BE-DP-31 · Before the merge: Stock Opname's tables, tests and generated files
ID BE-DP-31 · Level L0 · Pack Row 0g · Stock Opname in the schema · Run order row 0g, before the Stock Opname pull request is merged · Issue #322
On the Stock Opname branch, every pgTAP test passes on your Mac's local stack, and the generated files match the new schema (D33). The branch adds:
- two tables to
public,stock_opname_sessionsandstock_opname_expected, with their two enums and policies (R-OPN-01 to R-OPN-06, R-OPN-09, R-OPN-10); - two codes,
opname:readandopname:write, and their role grants (R-ACC-86 to R-ACC-89).
So pnpm db:types and pnpm docs:reference will change files this time. The Backend Engineer's workspace can't start the stack, so these commands are yours to run. No generated file is written by hand (D22); reference/roles.md is written from the seed, and block 2 proves it or replaces it.
Before
Section titled “Before”- The pull request for #321 and #322 is open on the branch
docs/321-stock-opname, with DOC's rules and BE's commits. - No other schema pull request has merged since the branch last took main; if one has, say so on the pull request first.
- You are at the root of your clone, the local stack is running, and
git status --shortprints nothing.
1 · The branch, rebuilt from nothing, and every test
Section titled “1 · The branch, rebuilt from nothing, and every test”git fetch origin docs/321-stock-opnamegit switch docs/321-stock-opnamepnpm supabase db resetpnpm supabase test db2 · The types and the reference pages from this schema
Section titled “2 · The types and the reference pages from this schema”pnpm db:typespnpm docs:referencegit status --short3 · Commit what block 2 changed
Section titled “3 · Commit what block 2 changed”git add packages/db-types apps/docs/src/content/docs/referencegit commit -m "build(db-types): regenerate for stock opname (D33, #322)"git pushExpect
Section titled “Expect”- Block 1: "Finished supabase db reset", then
All tests successful.andResult: PASS. The new tests are the 12 in53_stock_opname.test.sql(R-OPN-01 to R-OPN-06, R-OPN-09, R-OPN-10), two in22_seed_system.test.sql(R-ACC-88, R-ACC-89), and one in51_migration_access.test.sql: a v1 deny ofopname:writeis a deny ofopname:write(R-ACC-89). - Block 2:
packages/db-types/src/database.ts,reference/tables.mdandreference/policies.md.reference/roles.mdonly if the hand-written one differs. - Block 3: one commit, pushed.
gh pr checks docs/321-stock-opnameEvery check passes.
If it fails
Section titled “If it fails”- A test fails in block 1: paste the
not okline and the lines under it that start with#into #322. Don't edit the test, and don't merge. - Block 2 changes a file outside
packages/db-typesandreference/: say which on the pull request; the Backend Engineer checks why.
git switch main and pnpm supabase db reset. Nothing here touches staging or production.
Log each run as a comment on #322: date · who · result, with block 1's last lines and block 2's file list.