Skip to content

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_sessions and stock_opname_expected, with their two enums and policies (R-OPN-01 to R-OPN-06, R-OPN-09, R-OPN-10);
  • two codes, opname:read and opname: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.

  • 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 --short prints nothing.

1 · The branch, rebuilt from nothing, and every test

Section titled “1 · The branch, rebuilt from nothing, and every test”
Terminal window
git fetch origin docs/321-stock-opname
git switch docs/321-stock-opname
pnpm supabase db reset
pnpm supabase test db

2 · The types and the reference pages from this schema

Section titled “2 · The types and the reference pages from this schema”
Terminal window
pnpm db:types
pnpm docs:reference
git status --short
Terminal window
git add packages/db-types apps/docs/src/content/docs/reference
git commit -m "build(db-types): regenerate for stock opname (D33, #322)"
git push
  • Block 1: "Finished supabase db reset", then All tests successful. and Result: PASS. The new tests are the 12 in 53_stock_opname.test.sql (R-OPN-01 to R-OPN-06, R-OPN-09, R-OPN-10), two in 22_seed_system.test.sql (R-ACC-88, R-ACC-89), and one in 51_migration_access.test.sql: a v1 deny of opname:write is a deny of opname:write (R-ACC-89).
  • Block 2: packages/db-types/src/database.ts, reference/tables.md and reference/policies.md. reference/roles.md only if the hand-written one differs.
  • Block 3: one commit, pushed.
Terminal window
gh pr checks docs/321-stock-opname

Every check passes.

  • A test fails in block 1: paste the not ok line 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-types and reference/: 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.