KB-4AF4

GPT Review — B3-F1 Soft Gate Design — BLOCKED, Revision Required — 2026-05-12

5 min read Revision 1
p3dbirth-systemb3f1soft-gategpt-reviewblockedrevision-required2026-05-12

GPT Review — B3-F1 Soft Gate Design — BLOCKED, Revision Required — 2026-05-12

Scope reviewed

Reviewed Opus artifacts:

  • knowledge/dev/laws/dieu44-trien-khai/design/p3d-birth-system-b3f1-soft-gate-design.md
  • knowledge/dev/laws/dieu44-trien-khai/prompts/p3d-birth-system-b3f1-soft-gate-implementation-prompt-DRAFT.md
  • knowledge/dev/laws/dieu44-trien-khai/reports/p3d-birth-system-b3f1-soft-gate-design-report.md

Related governing review:

  • knowledge/dev/laws/dieu44-trien-khai/reviews/gpt-review-b3f0-rerun-after-b3f0a-pass-2026-05-12.md

Verdict

Status: BLOCKED_REVISION_REQUIRED

Opus selected the right high-level strategy (SHAPE_PROBE_FIRST → HYBRID), but the current implementation prompt is not approved because it asks Agent to derive PL/pgSQL and create the function/trigger in one execution.

Blocking issue 1 — violates PG function two-pass rule

The prompt currently allows:

Agent creates PL/pgSQL function ... Agent derives actual PL/pgSQL from resolved concepts.
CREATE FUNCTION fn_collection_onboarding_soft_gate()
CREATE TRIGGER trg_collection_onboarding_soft_gate ...

This violates the required two-pass rule for PG functions:

  1. Agent generates compiled SQL artifact only.
  2. GPT reviews compiled SQL.
  3. User/Agent executes reviewed SQL only after approval.

B3-F1 creates a new gate function with policy logic. This is high-risk and must not be generated and executed in the same Agent run.

Blocking issue 2 — trigger event coverage too narrow

Current trigger fires only on:

AFTER INSERT OR UPDATE OF governance_role, coverage_status

But gate logic depends on additional policy columns, at minimum:

  • coverage_scope_status
  • coverage_exemption_reason
  • coverage_review_owner

If these change without governance_role/coverage_status, the soft gate can miss relevant state transitions. Opus must re-evaluate trigger event columns or justify another PG-native mechanism.

Blocking issue 3 — issue table shape and idempotency need proof before DDL

The design assumes system_issues can store category/severity/entity_ref/description/status. This must be verified in a read-only shape probe and reported before any function is generated for execution.

The design also needs a dedup key strategy that does not rely on fragile free-text matching if suitable columns exist. If the table lacks a durable dedup column, Opus must design a safe fallback.

Blocking issue 4 — soft gate should not be installed before SQL artifact review

Even if shape probe passes, the next approved Agent task should be compile-only, not install:

  • generate function body SQL;
  • generate trigger SQL;
  • generate rollback SQL;
  • generate companion full-scan query;
  • write all artifacts to KB;
  • no DDL execution.

Required revision direction

Opus must revise B3-F1 into at least two steps:

B3-F1a — Soft Gate Shape Probe + SQL Artifact Draft

Mode: READ-ONLY / COMPILE-ONLY.

Allowed:

  • Inspect system_issues, collection_registry, dot_config, species_collection_map, pg_proc, pg_trigger.
  • Decide exact column mappings.
  • Produce compiled SQL artifacts for function/trigger/rollback/full-scan query.
  • Write report and SQL artifacts to KB.

Forbidden:

  • No CREATE FUNCTION.
  • No CREATE TRIGGER.
  • No DDL.
  • No DML except KB report upload.

B3-F1b — Soft Gate Execution

Only after GPT reviews B3-F1a compiled SQL and user approves.

Requirements for revised B3-F1a

  1. Keep SHAPE_PROBE_FIRST → HYBRID strategy.
  2. Prove system_issues shape live.
  3. Prove whether system_health_checks is needed or not.
  4. Resolve all required collection_registry policy columns live.
  5. Read sibling policy from dot_config; no embedded sibling list.
  6. Resolve function OIDs live by proname.
  7. Derive collection sets live; no snapshot counts as gates.
  8. Include event coverage decision for all relevant columns, not only governance_role and coverage_status.
  9. Include idempotent issue dedup strategy.
  10. Produce compiled SQL artifacts but do not execute them.
  11. Produce rollback SQL.
  12. Produce companion full-scan query.
  13. Write report to KB.

Governance status

b3f1_design_review_status=BLOCKED_REVISION_REQUIRED
b3f1_execution_allowed=false
b3f1a_shape_probe_compile_allowed=false_until_revised_prompt_review
hard_gate_allowed=false
phase5c2_migration_allowed=false
next_recommended_action=OPUS_REVISE_B3F1_INTO_B3F1A_COMPILE_ONLY_AND_B3F1B_EXECUTION
Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/reviews/gpt-review-b3f1-soft-gate-design-blocked-revision-required-2026-05-12.md