KB-7F50

GPT Review — Pack 21 Hardcode Objection and Rev3 Directive

6 min read Revision 1
gpt-reviewpack-21anti-hardcodebirth-pipelinerev3-required

GPT Review — Pack 21 Hardcode Objection and Rev3 Directive

Date: 2026-05-05 Reviewer: GPT-5.5 Thinking / Incomex Hội đồng AI Reviewed:

  • knowledge/dev/laws/dieu44-trien-khai/design/21-birth-runtime-truth-doc-fix-pack.md rev2
  • knowledge/dev/laws/dieu44-trien-khai/prompts/21-birth-runtime-truth-doc-fix-execution-prompt.md rev1

Verdict

User objection is correct. Pack 21 rev2 still contains hardcode thinking. Rev3 required before dispatch.

Replacing stale constants (31, 18) with newer constants (162, 19) does not solve the root problem. It only postpones the next stale-doc incident.

Correct principle:

Runtime docs should point to live query paths / views / inventory reports, not encode changing counts as permanent facts.

Required change in philosophy

Docs should distinguish:

  1. Stable rule / invariant — long-lived truth.

    • Example: birth triggers are stored in pg_trigger.
    • Example: birth_registry schema truth is PostgreSQL information_schema / catalog.
    • Example: QT-002 is the canonical process; implementation status is discoverable.
  2. Dynamic runtime count — must be queried.

    • Example: total birth triggers.
    • Example: trigger pattern split.
    • Example: birth_registry column count.
  3. Snapshot evidence — a dated observation.

    • Example: P2B-INV on 2026-05-05 observed 162 trigger instances and 19 columns.

Do not write dynamic runtime counts as timeless statements.

Required Pack 21 rev3 patches

Patch design pack and execution prompt before dispatch.

P1 — Replace hardcoded count wording with query-path wording

Instead of:

Runtime as of 2026-05-05 has 162 birth trigger instances total: 31 ... and 131 ...

Use:

Birth trigger coverage is dynamic. To inspect current runtime coverage, query pg_trigger for birth trigger patterns. P2B-INV (2026-05-05) observed 162 instances: 31 trg_birth_* and 131 legacy birth_trigger_*.

Include query:

SELECT
  CASE
    WHEN tgname LIKE 'trg_birth_%' THEN 'dot119_v2_trg_birth'
    WHEN tgname LIKE 'birth_trigger_%' THEN 'legacy_birth_trigger'
    ELSE 'other_birth'
  END AS trigger_pattern,
  count(*) AS trigger_count
FROM pg_trigger
WHERE NOT tgisinternal
  AND (tgname LIKE 'trg_birth_%' OR tgname LIKE 'birth_trigger_%')
GROUP BY 1
ORDER BY 1;

P2 — Replace schema column count wording with schema-query wording

Instead of:

birth_registry runtime = 19 columns.

Use:

birth_registry schema is dynamic and must be inspected from PostgreSQL catalog. P2B-INV (2026-05-05) observed status present and 19 columns.

Include query:

SELECT column_name, data_type, is_nullable, column_default
FROM information_schema.columns
WHERE table_schema='public'
  AND table_name='birth_registry'
ORDER BY ordinal_position;

Docs may mention status as observed in P2B-INV, but should not require future readers to manually update a count.

P3 — QT-002 wording should avoid implementation freeze

Do not write:

QT-002 has no dedicated wrapper binary.

as a timeless fact.

Use:

QT-002 is the canonical process name. As of P2B-INV (2026-05-05), no dedicated QT-002 wrapper binary was found; runtime enforcement was provided by PG triggers/gates. Re-verify tool availability via dot_tools and filesystem when needed.

Include query/search path:

SELECT code, name, status, operation, file_path
FROM dot_tools
WHERE code ILIKE '%BIRTH%'
   OR name ILIKE '%birth%'
   OR operation ILIKE '%birth%'
   OR file_path ILIKE '%birth%'
ORDER BY code;

P4 — Backfill wording should be query/path-based

Do not freeze manual/no cron as permanent.

Use:

P2B-INV observed dot-birth-backfill available and no cron found. Re-verify cron/tool state before making decisions.

Include check:

crontab -l 2>/dev/null | grep -Ei 'birth|backfill|registry' || true
grep -RInE 'dot-birth-backfill|birth.*backfill' /etc/cron* /opt/incomex 2>/dev/null | head -100

P5 — Historical report notes should be snapshot notes, not replacement truth

Append to S145 as:

This report is historical and scoped to S145. For current runtime counts, query PostgreSQL using the Pack 21 birth-trigger coverage query. P2B-INV (2026-05-05) snapshot observed ...

P6 — CAT-023 should not maintain field counts manually

If CAT-023 is a schema catalog, it can list fields, but it should include:

  • source of truth = PostgreSQL catalog / meta_catalog sync process;
  • observed snapshot date if updated;
  • avoid “total N fields” unless generated automatically.

P7 — Add future runtime view proposal as TD, not execution

Add TD:

Create v_birth_pipeline_runtime_stats or equivalent view/report generator to centralize dynamic birth runtime facts.

This would return current counts/schema/status from PG. It is runtime mutation and must be a separate design/execution pack, not Pack 21.

P8 — Execution prompt must patch docs to query-path language

Modify execution prompt so Agent appends/patches text with:

  • queries;
  • snapshot evidence;
  • “re-verify current runtime” language;
  • no timeless numeric constants except inside dated snapshot notes.

Immediate directive to Opus

Do not dispatch Pack 21 execution prompt rev1.

Patch Pack 21 to rev3 and execution prompt to rev2 with the anti-hardcode language above.

After patch, return for GPT/User review.

Hard boundaries remain

  • no runtime mutation;
  • no DOT patch;
  • no trigger/function/schema patch;
  • no Pack 2C dispatch;
  • no new birth process design.

Rationale

The goal is not to replace wrong numbers with right numbers. The goal is to make the documentation point to the current source of truth so that changing runtime counts do not require another manual doc fix.

Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/reviews/gpt-review-pack21-hardcode-objection-and-rev3-directive-2026-05-05.md