S185 P9 Production DDL/Collection Readiness Probe Review
S185 P9 Production DDL/Collection Readiness Probe Review
Date: 2026-04-28 Scope: Read-only review; no production mutation; no DDL/DML execution. Workspace:
/Users/nmhuyen/Documents/Manual Deploy/web-test
Step 0 - Foundation
3 cau tuyen ngon
- Vinh vien: production gate must be driven by a canonical DDL/seed artifact with immutable SHA evidence, not by memory or ephemeral
/tmppaths. - Nham duoc khong: gate pre-checks must whitelist the existing
public.fn_tac_log_checker_issueand must assert exact object names/counts so a wrong DDL bundle cannot pass. - 100% tu dong: production execution should be a DOT/scripted gate with verify output captured; manual SQL paste is not acceptable.
9 principles applied
- SSOT: canonical DDL bundle + manifest SHA must be the single source.
- DOT 100%: no manual SQL execution proposed in this review.
- Metadata > code: Directus collection visibility should be registered as collection metadata only after PG tables exist.
- Assembly First: PG DDL -> Directus introspection/collection meta -> roles/permissions.
- Khong chac = dung: canonical DDL source is not yet reconciled; production gate remains blocked.
Step 1 - Sources Read
.claude/skills/incomex-rules.md: read directly from workspace.search_knowledge("operating rules SSOT"): executed in main process.search_knowledge("hien phap v4.0 constitution"): executed in main process.search_knowledge("P9 G6 production DDL Directus collection registration gate TAC"): executed in main process.search_knowledge("law Directus collection registration existing database introspect production DDL DOT"): executed in main process.knowledge/dev/reports/gpt-review-production-ddl-collection-probe-report-2026-04-28.md: retrieved viaget_document.- Workspace artifacts checked:
g6_artifacts/ddl/g6_execution_bundle.sqlg6_artifacts/seed/*.sqlg6_artifacts/bin/run_g6.sh
Step 2 - Design Assessment
Verdict: probe is accepted, but production gate is not ready to execute.
Reasons:
- Function-name correction is valid. The six G6 functions in local DDL are:
fn_tac_uv_compute_derivedfn_tac_birth_gate_lufn_tac_birth_gate_uvfn_tac_enacted_immutfn_tac_pm_consistencyfn_tac_pm_enacted_lock
- Existing public baseline must whitelist
fn_tac_log_checker_issue. Evidence:g6_artifacts/bin/run_g6.shcontains checks excluding and validatingfn_tac_log_checker_issue. - Directus registration shape is correct in principle:
- after PG tables exist, Directus can introspect;
- Data Studio visibility should use
POST /collectionswithmetaonly; - no
schemakey for existing tables.
- Canonical DDL source remains blocked because local artifact does not match the probe's claimed canonical bundle.
Step 3 - Read-Only Evidence
Local bundle hash
Command:
sha256sum g6_artifacts/ddl/g6_execution_bundle.sql
Output:
bea9bab68502cc2220e07b7500c78f56bb585ea49e03ec9e9d110a41df63ac4c g6_artifacts/ddl/g6_execution_bundle.sql
Probe claimed canonical SHA:
c23987f29911e92d43d9ab6cb5e4fe77d64547785d98588859dfcc6f02997cad
Conclusion: local DDL artifact is not the same canonical bundle described in the probe.
Local bundle line count
Command:
wc -l g6_artifacts/ddl/g6_execution_bundle.sql
Output:
450 g6_artifacts/ddl/g6_execution_bundle.sql
Probe claimed canonical size:
566 lines / 23,528 bytes
Conclusion: line count mismatch confirms the hash mismatch is substantive.
Seed dry-run hashes
Command:
sha256sum g6_artifacts/seed/*.sql
Output:
1f707c4d23901990462c0ad2121849e0cc58bd07b32f9802630e571c9bc09cc3 g6_artifacts/seed/seed-tac-birth-gate-config.sql
f3860099c55f5c848525ac35e78410735401bc7b75a8a2cc50cbf8b1f7a3b793 g6_artifacts/seed/seed-tac-cs-lifecycle.sql
f71158717a05d8edacf79ba7574f6b9afecfb89691eb2b6933a8e14e4af31dac g6_artifacts/seed/seed-tac-lu-lifecycle.sql
1c928c993f66cc68fd8d7252328916fd1eb71b8d9380b693489c63564daf923e g6_artifacts/seed/seed-tac-pub-lifecycle.sql
4b9f27937009ebc705bf09aa9b37dac372506a3e6f9173f72310be690f53774c g6_artifacts/seed/seed-tac-publication-type.sql
9412966e89253caa11ca52217578b2b45599987cc908218d00fa965619b2bd57 g6_artifacts/seed/seed-tac-review-state.sql
d5a3d167572e087ab38a31629b42bdb21a2e41088c1129d01ede3fcce08b77d4 g6_artifacts/seed/seed-tac-section-type.sql
4f7b9682e1d5b8a0bd3540f9b2ffcfa9f6a7628f6e166547d1bad26529f2e573 g6_artifacts/seed/seed-tac-uv-lifecycle.sql
These match the dry-run seed hashes listed in the probe. They still need production retarget (p9_g6_dryrun. -> public.) and new hashes.
Seed schema qualification
Command:
rg -n "p9_g6_dryrun\." g6_artifacts/seed/*.sql
Evidence summary:
All 8 seed files contain p9_g6_dryrun.* schema qualification in comments and INSERT targets.
Conclusion: production seed candidates must be generated and hashed separately.
Step 4 - Two-Hat Review
Hat 1 - Coder view
Do not execute production DDL from current local g6_artifacts/ddl/g6_execution_bundle.sql as if it were the canonical action-log bundle. It has a different hash and line count.
Required patch for gate design v0.2:
- Replace wrong function names with the six exact G6 names.
- Pre-check
public.fn_tac_*must expect exactly one whitelisted existing function before Gate A:fn_tac_log_checker_issue. - Post-check after Gate A must expect seven public
fn_tac_*functions: existing checker issue function + six TAC functions. - Generate production DDL candidate from the reconciled canonical source only.
- Generate production seed candidates by retargeting all eight seed files to
public, then compute new SHA-256 manifest. - Gate B Directus collection registration must use
metaonly for existing tables.
Hat 2 - Reviewer view
Production readiness remains blocked until one of these is true:
- VPS
/tmp/g6_run4_20260428_041121/ddl/g6_execution_bundle.sqlexists and its SHA equalsc23987f29911e92d43d9ab6cb5e4fe77d64547785d98588859dfcc6f02997cad. - The canonical DDL is regenerated from approved KB sources and a new production candidate SHA is established.
The local artifact bea9... may still be useful as an implementation reference, but it cannot serve as canonical evidence for the probe's claimed G6 run #4 bundle.
Step 5 - Production Verify
No production verify was executed in this review. Scope was read-only local + KB probe review.
Production PASS criteria for the next execution gate must paste real outputs:
sha256sumof canonical dry-run source and production retargeted candidate.- PG pre-check output showing public
tac_*tables = 0 and whitelistedfn_tac_log_checker_issue= 1. - PG post-check output showing 14 tables, 17 FK, 5 UNIQUE, 115 CHECK, 41 indexes, 7
fn_tac_*including the whitelist, and 6 triggers. - Directus collection list or Items API output for all 14
tac_*collections.
Step 6 - Report / Decision
Status: BLOCKED for production execution.
Accepted from probe:
- Corrected function inventory.
- Public baseline whitelist.
- Seed retarget requirement.
- Directus meta-only collection registration for existing tables.
New evidence added:
- Local DDL bundle hash/line count does not match probe's canonical action-log bundle.
Next action:
- Perform read-only VPS check for
/tmp/g6_run4_20260428_041121/ddl/g6_execution_bundle.sql. - If present and SHA matches, persist it outside
/tmpand derive production candidate from it. - If absent or mismatched, regenerate canonical DDL from approved KB design, then compute and record a new production manifest.