KB-3807

GPT Confirm — Gate B PASS and Opus Next Directive Gate C

6 min read Revision 1
s186gpt-confirmgate-bpassgate-cseeddieu38p9opus-directive

GPT Confirm — Gate B PASS and Opus Next Directive Gate C

Date: 2026-04-28

Reviewed inputs

  • Opus summary: Gate B Execution Results — GPT Confirm.
  • Agent execution log: knowledge/dev/laws/dieu38-trien-khai/reports/p9-gate-b-directus-collection-registration-log-2026-04-28-run2.md.
  • Gate design reference: knowledge/dev/laws/dieu38-trien-khai/P9-production-ddl-collection-gate-design.md.
  • Seed reference: knowledge/dev/laws/dieu38-trien-khai/seed-manifest-g6-expected.json and seed-g6/seed-tac-*.sql.

Verdict

CONFIRMED PASS.

Gate B is complete. 14/14 public.tac_* tables are surfaced as Directus collections meta-only.

Evidence accepted

  • Exact target set = 14, no unknown tac_*.
  • All 14 collections PATCHed/registered meta-only with HTTP 200.
  • All 14 verified by Directus API GET.
  • Field introspection works: 6–20 fields per collection.
  • Directus metadata rows after: 14 directus_collections rows with expected icons/notes.
  • directus_fields_tac_count=0 is acceptable because fields are introspected by API, not materialized rows.
  • All 14 public.tac_* tables remain at exact row count 0.
  • Gate A object counts unchanged: tables=14, functions=7, triggers=6.
  • Secret scan clean.
  • Scope hygiene: no Gate C, seed, roles/permissions, trigger guard, registry writes, DDL.

Law / constitutional check

No blocker found.

  • Hiến pháp / User-gated production: execution was within previously approved Gate B and stopped after log.
  • Điều 38 / LSL-01: aligned. The PG information-unit schema is now visible through Directus as gateway.
  • Điều 33: aligned. PostgreSQL remains SSOT; Directus metadata is a surface, not source of truth.
  • Gate separation: aligned. Gate B did not run Gate C seed or G8B roles.
  • Registry/Birth/Catalog: correctly left out of Gate B and should remain a follow-up/gate if needed.

Decision

Gate B obstacle cleared. Proceed to Gate C prompt drafting/review, not immediate execution.

Directive to Opus 4.6

Draft Gate C — TAC Seed 61 Rows Execution Prompt v0.1 for GPT review.

Correct framing

Gate C is part of Điều 38 Text-as-Code production rollout. It seeds the controlled vocab/config foundation for PG-governed information units. It is not broad corpus migration and not agent permission work.

Scope

Gate C only: insert the canonical 61 seed rows into 8 public.tac_* vocab/config tables using the existing canonical seed files under:

knowledge/dev/laws/dieu38-trien-khai/seed-g6/seed-tac-*.sql

Source files were originally dry-run targeted to p9_g6_dryrun; Gate C must retarget to public safely.

Target seed tables

Use deterministic 8-table target set from the manifest/seed files:

  1. tac_lu_lifecycle_vocab
  2. tac_uv_lifecycle_vocab
  3. tac_review_state_vocab
  4. tac_pub_lifecycle_vocab
  5. tac_cs_lifecycle_vocab
  6. tac_section_type_vocab
  7. tac_publication_type_vocab
  8. tac_birth_gate_config

Expected total: 61 rows, per manifest.

Hard exclusions

  • No DDL.
  • No changes to table/function/trigger structure.
  • No seed into core/member tables: tac_logical_unit, tac_unit_version, tac_publication, tac_change_set, tac_publication_member, tac_change_set_member.
  • No Directus collection metadata changes.
  • No roles, policies, permissions, tokens, or G8B.
  • No registry/birth/catalog/DOT writes.
  • No Gate B rework.
  • No G11.
  • No broad migration/corpus import.

Required prompt design elements

  1. Pre-checks

    • Confirm Gate A counts: tables=14, functions=7, triggers=6.
    • Confirm Gate B collections: exact target set 14 and API-readable.
    • Confirm 8 target seed tables are empty with exact count(*) = 0.
    • Confirm 6 non-seed tac_* tables are empty.
    • Confirm seed manifest is loaded and expected total/per-table counts are known.
    • Snapshot constraints/indexes enough to catch accidental schema drift.
  2. Canonicalization / retargeting

    • Read 8 canonical seed files.
    • Retarget schema references from p9_g6_dryrun to public.
    • Persist or log generated production seed candidate and SHA256.
    • Confirm no non-target schema references remain.
    • Confirm only INSERTs into 8 allowed seed tables are present.
  3. Execution safety

    • Run on VPS via SSH contabo.
    • Use docker exec -i postgres psql -U directus -d directus -v ON_ERROR_STOP=1 -X unless prompt justifies a different existing execution role.
    • Wrap seed in transaction.
    • Capture exit code/output.
    • Secret hygiene scan before upload.
  4. Post-verification

    • Exact row counts per 8 seed tables equal manifest; total = 61.
    • 6 non-seed tables still count 0.
    • Gate A counts unchanged: tables=14, functions=7, triggers=6.
    • Gate B collections still exact 14 and API-readable.
    • Optional: sample key rows from each seed table to prove content landed.
  5. Failure handling

    • If pre-check tables are not empty: STOP; do not delete existing data.
    • If seed transaction fails before COMMIT: rollback and report.
    • If partial committed state occurs unexpectedly: STOP; report exact per-table counts; no blind cleanup unless all rows can be proven created by this run and rollback policy is explicit.
  6. Action log

    • Path: knowledge/dev/laws/dieu38-trien-khai/reports/p9-gate-c-seed-log-YYYY-MM-DD.md with no-overwrite suffix.
    • Include pre-checks, seed candidate SHA, execution output, post-counts, sample rows, scope hygiene, secret scan, PASS/FAIL.

User GO rule

Opus should produce prompt v0.1 only. GPT reviews. Agent execution requires explicit User GO.

Current state after this decision

  • Gate A Production DDL: PASS.
  • Trigger Guard DROP Repair: PASS.
  • Gate B Directus Collections: PASS confirmed.
  • Gate C: ready for prompt drafting/review only.
  • G8B/G11/Nuxt/Migration/KG sync: not authorized yet.