KB-2AF5

P3D — B3-A2b birth_registry Exemption Policy Update — Agent Prompt

5 min read Revision 1
p3dbirth-systemb3a2bbirth-registryexemptionpolicy-updateprompt

P3D — B3-A2b birth_registry Exemption Policy Update — Agent Prompt

Date: 2026-05-12 Mode: PG WRITE — narrow policy UPDATE only Mainline: P3D_BIRTH_SYSTEM_COMPLETION_PACK

Mission

Execute B3-A2b birth_registry exemption policy update.

Mark birth_registry as exempt from B3-A birth trigger installation because it is the birth system table itself and naïve birth-trigger wiring would create self-birth recursion.

Governing decisions

  • B3-A2 design patched by GPT and confirmed by Opus.
  • B3-A2a variant function equivalence probe PASS_ACCEPTED_WITH_NOTE.
  • This task only updates policy metadata for collection_registry.collection_name='birth_registry'.

Approved target row

collection_name = birth_registry

Approved values

coverage_status = BIRTH_EXEMPT_SYSTEM_LOG_OR_AUDIT
coverage_scope_status = IN_SCOPE
coverage_exemption_reason = SYSTEM_MANAGED: self-referential birth system table — recursive trigger risk
coverage_review_owner = GPT_B3A2
coverage_decided_by = GPT_B3A2_REVIEW
coverage_decided_at = now()

Important: Do not write SYSTEM_MANAGED to coverage_scope_status. Current CHECK constraint allows only:

IN_SCOPE
USER_EXCLUDED
FUTURE_SCOPE
ORPHAN_REGISTRY

SYSTEM_MANAGED is semantics inside coverage_exemption_reason, not a scope-status literal.

Hard boundaries

  • UPDATE only public.collection_registry row where collection_name='birth_registry'.
  • No INSERT.
  • No DELETE.
  • No DDL.
  • No trigger creation/drop/alter.
  • No function creation/patch.
  • No species/entity_species/species_collection_map changes.
  • No birth_registry table mutation.
  • No B3-A3 trigger install.
  • No Phase 5C2.
  • No UI cutover.

Required gates inside one transaction

  1. Acquire advisory transaction lock: pg_advisory_xact_lock(hashtext('p3d_birth_b3a2b_birth_registry_exemption')).
  2. Verify public.collection_registry exists.
  3. Verify all 6 B3-P policy columns exist:
    • coverage_status
    • coverage_scope_status
    • coverage_exemption_reason
    • coverage_review_owner
    • coverage_decided_at
    • coverage_decided_by
  4. Verify CHECK constraint allowed values for coverage_status include BIRTH_EXEMPT_SYSTEM_LOG_OR_AUDIT.
  5. Verify CHECK constraint allowed values for coverage_scope_status include IN_SCOPE and do not require/expect SYSTEM_MANAGED.
  6. Verify exactly one row exists in collection_registry with collection_name='birth_registry'.
  7. Capture old values for exact rollback:
    • coverage_status
    • coverage_scope_status
    • coverage_exemption_reason
    • coverage_review_owner
    • coverage_decided_at
    • coverage_decided_by
  8. Verify current row is not already in a conflicting exemption state. If already exactly matches approved target values except timestamp/actor, report already_exempt=true; do not rewrite unless safe and justified.
  9. UPDATE only the approved target row.
  10. Post-update verification: row has approved values.
  11. Verify no fn_birth_registry_auto or fn_birth_registry_auto_id trigger was created on birth_registry by this task.
  12. Prepare exact rollback SQL restoring old values per captured row.

Execution requirements

  • Single transaction.
  • Advisory lock.
  • Compiled SQL logged before execution.
  • Rollback SQL logged.
  • Post-commit verification.
  • STOP on mismatch.

Required report path

knowledge/dev/laws/dieu44-trien-khai/reports/p3d-birth-system-b3a2b-birth-registry-exemption-policy-update-report.md

Required final response fields

b3a2b_birth_registry_exemption_status=PASS|PASS_ALREADY_EXEMPT|BLOCKED|FAILED
target_collection=birth_registry
rows_updated=<N>
already_exempt=true|false
transaction_committed=true|false
rollback_values_captured=true|false
coverage_status=BIRTH_EXEMPT_SYSTEM_LOG_OR_AUDIT
coverage_scope_status=IN_SCOPE
system_managed_semantics_in_exemption_reason=true|false
no_trigger_created=true
no_ddl=true
no_function_patch=true
no_birth_registry_table_mutation=true
no_species_mutation=true
no_5c2_migration=true
report_path=knowledge/dev/laws/dieu44-trien-khai/reports/p3d-birth-system-b3a2b-birth-registry-exemption-policy-update-report.md
next_recommended_action=GPT_REVIEW_B3A2B_THEN_B3A_READINESS_RERUN

If any gate fails:

  • STOP before mutation.
  • Write a BLOCKED report with exact failing gate and live evidence.
Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/prompts/p3d-birth-system-b3a2b-birth-registry-exemption-policy-update-prompt.md