KB-F736

GPT Review — DOT-119 P1 Report and P2 Directive

5 min read Revision 1
gpt-reviewdot-119p1p2no-hardcodemetadata-drivenapproved

GPT Review — DOT-119 P1 Report and P2 Directive

Date: 2026-05-05 Reviewer: GPT-5.5 Thinking / Incomex Hội đồng AI Reviewed: knowledge/dev/laws/dieu44-trien-khai/reports/dot119-repair-p1-metadata-ddl-seed-report.md rev4

Verdict

P1 PASS.

Agent executed the mutation run correctly and honored scope boundaries.

Verified outcomes

  • 3 new metadata fields created in PG + Directus:
    • birth_code_strategy
    • birth_code_column
    • birth_identity_source
  • Metadata distribution exactly matches expected:
    • column = 25
    • disabled = 63
    • legacy_id_single_colon = 3
    • subordinate = 1
    • synthetic_id = 1
    • unclassified = 73
    • total = 166
  • NULL cleanup completed:
    • birth_code_strategy IS NULL = 0
    • birth_identity_source IS NULL = 0
  • PG enforcement installed:
    • 2 CHECK constraints
    • NOT NULL + DEFAULT on strategy/source
    • birth_code_column remains nullable
  • Core invariants preserved:
    • fn_birth_registry_auto hash unchanged: 1f729b3571a74963089bb3ef388217f3
    • birth trigger count unchanged: 30
    • no birth drift inside mutation transactions
  • Boundaries honored:
    • no DOT-119 execution
    • no DOT-119 script rewrite
    • no function edit
    • no IU trigger
    • no IU rows
    • no Pack 2B

Notes

The first seed transaction rolled back due to a verification query error, then retried cleanly. This is acceptable: no partial state, invariants held, final transaction committed successfully.

The live birth_registry drift from 75,469 to 75,472 across the full run is normal background activity and was handled correctly under the anti-hardcode run-local baseline model.

No-hardcode directive for P2

P2 is the phase where the actual DOT-119 script is rewritten. This is the highest-risk phase for the anti-hardcode principle.

DOT-119 v2 must be metadata-driven. It must not embed collection-specific lists such as:

  • information_unit
  • unit_version
  • law_catalog
  • workflows
  • hardcoded code / process_code / law_code mappings

The only acceptable logic is:

  1. read collection_registry for the requested --collection;
  2. read birth_code_strategy, birth_code_column, birth_identity_source;
  3. validate according to strategy;
  4. generate trigger SQL from metadata;
  5. never replace fn_birth_registry_auto.

Next directive to Opus

Proceed to P2 design/prompt drafting, not runtime execution yet.

Opus should create:

knowledge/dev/laws/dieu44-trien-khai/prompts/18b-p2-dot119-script-rewrite-prompt.md

But before finalizing the prompt, Opus must inspect current DOT-119 source and produce exact full v2 script content. Claude Code must not be asked to invent code from pseudocode.

P2 prompt must include:

  1. Read controlling docs:

    • 18a rev4
    • 18b rev3
    • P1 report
    • this GPT review
  2. Preflight:

    • confirm P1 fields/constraints exist;
    • confirm distribution remains valid or at least no NULL/constraint drift;
    • capture fn_birth_registry_auto hash and require it remains 1f729b3571a74963089bb3ef388217f3;
    • trigger count baseline = 30;
    • no IU rows created;
    • inspect current DOT-119 script and backup exact file path.
  3. Exact v2 script:

    • P2 runtime prompt must include the full script content.
    • No pseudocode.
    • No hardcoded collection mappings.
    • No CREATE OR REPLACE FUNCTION fn_birth_registry_auto.
    • Explicit CLI modes: --dry-run, --execute, --verify, optional admin --drop, --json.
    • Exit codes aligned with 18a rev4.
    • JSON output for agents.
    • No implicit execute.
  4. Installation:

    • backup current script to exact path;
    • write temp file;
    • bash -n syntax check;
    • grep no function replacement;
    • chmod;
    • atomic mv;
    • verify installed hash/path.
  5. Smoke tests:

    • no-args/help;
    • dry-run existing column strategy collection;
    • dry-run non-code column collection;
    • dry-run information_unit synthetic strategy;
    • dry-run one unclassified collection should exit 10 + JSON finding;
    • verify existing trigger collection should exit 0 if matching;
    • disabled/subordinate collection should skip/no-op correctly;
    • function hash unchanged;
    • trigger count unchanged;
    • birth_registry count run-local baseline handled without hardcoded stale number.
  6. Report:

    • path: knowledge/dev/laws/dieu44-trien-khai/reports/dot119-repair-p2-script-rewrite-report.md
    • include exact script md5, backup path, smoke outputs, function hash trail, trigger count trail, no-hardcode self-check result.
  7. Hard boundaries:

    • no fn_birth_registry_auto edit;
    • no IU trigger install (18c only);
    • no IU rows;
    • no Pack 2B;
    • no seed/DDL changes.

Current state

P1 is accepted. The next deliverable is a P2 prompt with exact DOT-119 v2 script content for GPT/User review before dispatch.

Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/reviews/gpt-review-dot119-p1-report-and-p2-directive-2026-05-05.md