KB-7205
dot-iu-cutter v0.5 WS-Q5 — Production Apply Command Package (scaffold-stripped; DO NOT EXECUTE)
16 min read Revision 1
dot-iu-cutterv0.5ws-q5registry-substrateproduction-applycommand-packagescaffold-strippednot-executeddieu442026-05-18
dot-iu-cutter v0.5 WS-Q5 Registry Substrate — Production Apply Command Package
Phase:
v0_5_WS_Q5_registry_substrate_production_preflight_and_command_package· Date: 2026-05-18 Pairs with: preflight-result, rollback-command-package, verification-command-package, command-review-report.⚠️ GATING BANNER — DO NOT EXECUTE
phase: production_command_package_authoring sql_executed: none # QG4 — authored for sovereign review, NOT run begin_commit_run: false # no production transaction opened tables_created: 0 dml_seed: none grant_role_change: none index_executed: none directus_mutation: none execution_authorized: false self_advance: PROHIBITED decision_authority: GPT / User ONLYThe SQL below is the exact production artifact for sovereign command-review. It is byte-derived from the GPT-PASSed DDL draft
…WS-Q5-registry-substrate-DDL-draft-2026-05-18.sql.md, with the dry-run scaffold line removed (QG2). It MUST NOT be run in this phase.
0. Scaffold-strip attestation (QG2)
removed_line: "CREATE SCHEMA IF NOT EXISTS cutter_governance;"
reason: preflight confirmed cutter_governance ALREADY EXISTS in production
(12 existing tables). Creating/altering the schema is out of scope and
forbidden for the production artifact (GPT review: scaffold
allowed_in_production_artifact = false).
contains_create_schema: NO # grep-assertable: 0 occurrences of "CREATE SCHEMA"
ddl_body_unchanged: yes — the 12 CREATE TABLE statements + COMMENTs are
byte-identical to the GPT-PASSed draft (only the prepended scaffold
line is absent; no other edit).
transaction_boundary: explicit BEGIN; ... COMMIT; wrapper added so apply is
all-or-nothing (any error -> ROLLBACK, zero partial objects).
1. Pre-apply safety preconditions (verify at apply command-review, NOT here)
P-1 Re-run the read-only preflight immediately before apply; cutter_governance
must still exist and the 12 WS-Q5 names must still be ABSENT (0 collision).
P-2 Production system_identifier must equal 7611578671664259111 at apply time.
P-3 Capture a fresh production backup (pg_dump, read-only) BEFORE apply;
record sha. (Backup execution = part of the approved apply phase, not this
authoring phase.)
P-4 Apply MUST run with psql -v ON_ERROR_STOP=1 so any error aborts the
single transaction (no partial create; implicit ROLLBACK).
P-5 No other migration/DDL/DML/GRANT/Directus/CUT/VERIFY interleaved.
P-6 This package authorizes NOTHING — apply requires a separate GPT/User
sovereign approval (see command-review-report).
2. Production apply SQL — transaction-wrapped (DO NOT EXECUTE)
-- ============================================================================
-- dot-iu-cutter v0.5 WS-Q5 Registry Substrate — PRODUCTION APPLY
-- Target: cutter_governance schema (ALREADY EXISTS — NOT created here)
-- Additive-only · No CASCADE · No DML · No DEFAULT · No CHECK · No trigger
-- 12 CREATE TABLE (cutter_governance 12 -> 24). Run with: psql -v ON_ERROR_STOP=1
-- DO NOT EXECUTE until separate GPT/User sovereign approval.
-- ============================================================================
BEGIN;
-- 1. matcher_config_registry -- @authority WS-2 D3 (matcher_kind/matcher_ref = config row, NOT inline regex)
CREATE TABLE cutter_governance.matcher_config_registry (
matcher_ref text NOT NULL,
matcher_kind text NOT NULL,
matcher_definition jsonb NOT NULL,
description text,
lifecycle text NOT NULL,
registered_by text NOT NULL,
registered_at timestamptz NOT NULL,
CONSTRAINT pk_matcher_config_registry PRIMARY KEY (matcher_ref)
);
COMMENT ON TABLE cutter_governance.matcher_config_registry IS
'WS-2 D3: grammar matcher configuration as data rows (anti-hardcode). v0.5 WS-Q5.';
-- 2. address_template_registry -- @authority WS-2 D6 + BR-A1 LOCKED scheme
CREATE TABLE cutter_governance.address_template_registry (
address_template_ref text NOT NULL,
template_pattern text NOT NULL,
docprefix_separator text NOT NULL,
level_separator text NOT NULL,
encodes_status boolean NOT NULL,
description text,
lifecycle text NOT NULL,
registered_by text NOT NULL,
registered_at timestamptz NOT NULL,
CONSTRAINT pk_address_template_registry PRIMARY KEY (address_template_ref)
);
COMMENT ON TABLE cutter_governance.address_template_registry IS
'WS-2 D6 + BR-A1 LOCKED separator scheme. Policy enforced via verification + governed seed (no CHECK by BATCH-1 precedent).';
-- 3. grammar_profile -- @authority WS-2 D3 / canon §2 model (NOT redesigned)
CREATE TABLE cutter_governance.grammar_profile (
grammar_profile_ref text NOT NULL,
display text,
address_template_ref text NOT NULL,
lifecycle text NOT NULL,
registered_by text NOT NULL,
registered_at timestamptz NOT NULL,
CONSTRAINT pk_grammar_profile PRIMARY KEY (grammar_profile_ref),
CONSTRAINT fk_grammar_profile_address_template_ref
FOREIGN KEY (address_template_ref)
REFERENCES cutter_governance.address_template_registry (address_template_ref)
);
COMMENT ON TABLE cutter_governance.grammar_profile IS
'WS-2 D3 / canon §2: grammar profile header. Levels/markers in child tables. v0.5 WS-Q5.';
-- 4. grammar_profile_level -- @authority WS-2 D3 level_definitions[]
CREATE TABLE cutter_governance.grammar_profile_level (
grammar_profile_ref text NOT NULL,
level_seq integer NOT NULL,
level text NOT NULL,
matcher_kind text NOT NULL,
matcher_ref text NOT NULL,
numbering_scheme text NOT NULL,
is_leaf_candidate boolean NOT NULL,
CONSTRAINT pk_grammar_profile_level PRIMARY KEY (grammar_profile_ref, level_seq),
CONSTRAINT uq_grammar_profile_level_name UNIQUE (grammar_profile_ref, level),
CONSTRAINT fk_grammar_profile_level_profile
FOREIGN KEY (grammar_profile_ref)
REFERENCES cutter_governance.grammar_profile (grammar_profile_ref),
CONSTRAINT fk_grammar_profile_level_matcher
FOREIGN KEY (matcher_ref)
REFERENCES cutter_governance.matcher_config_registry (matcher_ref)
);
COMMENT ON TABLE cutter_governance.grammar_profile_level IS
'WS-2 D3 level_definitions[] as rows. v0.5 WS-Q5.';
-- 5. grammar_profile_status_marker -- @authority WS-2 D3 status_marker_rules
CREATE TABLE cutter_governance.grammar_profile_status_marker (
grammar_profile_ref text NOT NULL,
marker text NOT NULL,
maps_to text NOT NULL,
CONSTRAINT pk_grammar_profile_status_marker PRIMARY KEY (grammar_profile_ref, marker),
CONSTRAINT fk_gpsm_profile
FOREIGN KEY (grammar_profile_ref)
REFERENCES cutter_governance.grammar_profile (grammar_profile_ref)
);
COMMENT ON TABLE cutter_governance.grammar_profile_status_marker IS
'WS-2 D3 status_marker_rules as rows; status stays metadata, NOT in canonical address (BR-A1).';
-- 6. source_family_registry -- @authority WS-2 D2 §1
CREATE TABLE cutter_governance.source_family_registry (
source_family text NOT NULL,
display_vi text,
display_en text,
authority_semantics_default text NOT NULL,
grammar_profile_ref text NOT NULL,
version_policy text NOT NULL,
status_policy text NOT NULL,
default_parser_profile_ref text,
lifecycle text NOT NULL,
registered_by text NOT NULL,
registered_at timestamptz NOT NULL,
CONSTRAINT pk_source_family_registry PRIMARY KEY (source_family),
CONSTRAINT fk_source_family_registry_grammar_profile
FOREIGN KEY (grammar_profile_ref)
REFERENCES cutter_governance.grammar_profile (grammar_profile_ref)
);
COMMENT ON TABLE cutter_governance.source_family_registry IS
'WS-2 D2: source family classification + authority_semantics default + grammar binding. v0.5 WS-Q5.';
-- 7. source_document_registry -- @authority OD-SEQ1 Step 0 + WS-2 D6 (address_docprefix) + handoff §4.2
CREATE TABLE cutter_governance.source_document_registry (
source_document_ref text NOT NULL,
address_docprefix text NOT NULL,
source_url text,
source_family text NOT NULL,
authority_class text NOT NULL,
display_vi text,
display_en text,
lifecycle text NOT NULL,
registered_by text NOT NULL,
registered_at timestamptz NOT NULL,
CONSTRAINT pk_source_document_registry PRIMARY KEY (source_document_ref),
CONSTRAINT uq_source_document_registry_docprefix UNIQUE (address_docprefix),
CONSTRAINT fk_source_document_registry_family
FOREIGN KEY (source_family)
REFERENCES cutter_governance.source_family_registry (source_family)
);
COMMENT ON COLUMN cutter_governance.source_document_registry.address_docprefix IS
'WS-2 D6: UNIQUE 1 doc -> 1 prefix; BR-A1 path = <DOCPREFIX>/<L1>-...; never a code literal.';
-- 8. source_document_version_registry -- @authority canon §4/§5 (content_checksum, document_version_id)
CREATE TABLE cutter_governance.source_document_version_registry (
document_version_id text NOT NULL,
source_document_ref text NOT NULL,
content_checksum text NOT NULL,
retrieval_timestamp timestamptz NOT NULL,
source_format text,
authoritative_version text,
version_status text,
provenance jsonb,
registered_by text NOT NULL,
registered_at timestamptz NOT NULL,
CONSTRAINT pk_source_document_version_registry PRIMARY KEY (document_version_id),
CONSTRAINT uq_sdvr_doc_checksum UNIQUE (source_document_ref, content_checksum),
CONSTRAINT fk_sdvr_source_document
FOREIGN KEY (source_document_ref)
REFERENCES cutter_governance.source_document_registry (source_document_ref)
);
COMMENT ON TABLE cutter_governance.source_document_version_registry IS
'Canon §4/§5: re-ingest same content_checksum -> same version (idempotent addresses). v0.5 WS-Q5 Step 0.';
-- 9. entity_kind_registry -- @authority WS-2 D5
CREATE TABLE cutter_governance.entity_kind_registry (
entity_kind text NOT NULL,
display text,
description text,
default_source_system_hint text,
lifecycle text NOT NULL,
registered_by text NOT NULL,
registered_at timestamptz NOT NULL,
CONSTRAINT pk_entity_kind_registry PRIMARY KEY (entity_kind)
);
COMMENT ON TABLE cutter_governance.entity_kind_registry IS
'WS-2 D5: entity_kind vocab as rows (anti-hardcode). v0.5 WS-Q5.';
-- 10. entity_reference_registry -- @authority WS-2 D5 + OD-FA5 APPROVE_CORE_MINIMAL
CREATE TABLE cutter_governance.entity_reference_registry (
entity_ref_id text NOT NULL,
entity_kind text NOT NULL,
source_system text NOT NULL,
natural_key text NOT NULL,
authority_note text,
permission_policy_ref text,
snapshot_policy_ref text,
lifecycle text NOT NULL,
registered_by text NOT NULL,
registered_at timestamptz NOT NULL,
CONSTRAINT pk_entity_reference_registry PRIMARY KEY (entity_ref_id),
CONSTRAINT uq_entity_reference_registry_natural
UNIQUE (entity_kind, source_system, natural_key),
CONSTRAINT fk_entity_reference_registry_kind
FOREIGN KEY (entity_kind)
REFERENCES cutter_governance.entity_kind_registry (entity_kind)
);
COMMENT ON TABLE cutter_governance.entity_reference_registry IS
'WS-2 D5 core-minimal (OD-FA5). IU<->raw_entity binding TARGET; IU never copies data (read live at assembly).';
-- 11. authority_override -- @authority WS-2 D4 §3
CREATE TABLE cutter_governance.authority_override (
override_id text NOT NULL,
scope text NOT NULL,
iu_id text,
span_ref text,
authority_role text NOT NULL,
reason text,
set_by text NOT NULL,
set_at timestamptz NOT NULL,
provenance jsonb,
CONSTRAINT pk_authority_override PRIMARY KEY (override_id)
);
COMMENT ON TABLE cutter_governance.authority_override IS
'WS-2 D4: unit/span authority-role override (the only sanctioned deviation from source_family default). Span mechanism detail deferred to real mixed-authority pilot.';
-- 12. metadata_key_registry -- @authority WS-2 D1 §1
CREATE TABLE cutter_governance.metadata_key_registry (
metadata_key text NOT NULL,
key_namespace text NOT NULL,
key_type text NOT NULL,
allowed_values_policy text,
cardinality_policy text NOT NULL,
mutability_policy text NOT NULL,
index_policy text NOT NULL,
hot_threshold_hint text,
lifecycle text NOT NULL,
owner_role text NOT NULL,
created_by text NOT NULL,
created_at timestamptz NOT NULL,
CONSTRAINT pk_metadata_key_registry PRIMARY KEY (metadata_key)
);
COMMENT ON TABLE cutter_governance.metadata_key_registry IS
'WS-2 D1: metadata key governance (anti-hardcode). Hot-key promotion = separate sovereign DDL cycle. v0.5 WS-Q5.';
COMMIT;
-- END WS-Q5 PRODUCTION APPLY
-- 12 tables · 12 PK · 8 FK · 4 UNIQUE · 0 CASCADE · 0 CHECK · 0 trigger
-- · 0 DEFAULT · 0 enum · 0 DML · 0 GRANT · 0 index (constraint-backed only)
-- · NO CREATE SCHEMA (QG2)
3. Object inventory (authoritative — for verification cross-check)
tables: 12 (all cutter_governance.* ; preflight-confirmed disjoint from existing 12)
primary_keys: 12 pk_<table>
foreign_keys: 8
fk_grammar_profile_address_template_ref -> address_template_registry
fk_grammar_profile_level_profile -> grammar_profile
fk_grammar_profile_level_matcher -> matcher_config_registry
fk_gpsm_profile -> grammar_profile
fk_source_family_registry_grammar_profile -> grammar_profile
fk_source_document_registry_family -> source_family_registry
fk_sdvr_source_document -> source_document_registry
fk_entity_reference_registry_kind -> entity_kind_registry
unique_constraints: 4
uq_grammar_profile_level_name (grammar_profile_ref, level)
uq_source_document_registry_docprefix (address_docprefix)
uq_sdvr_doc_checksum (source_document_ref, content_checksum)
uq_entity_reference_registry_natural (entity_kind, source_system, natural_key)
check: 0 trigger: 0 default: 0 enum: 0 cascade: 0 dml: 0 grant: 0
note: AD-4 corrected counts (8 FK / 4 UNIQUE) — matches the dry-run live catalog.
4. Statements
- QG2: production artifact contains NO
CREATE SCHEMA(scaffold stripped; grep-assertable). QG4: nothing executed; explicitBEGIN; … COMMIT;boundary present but NOT run. QG7: no secrets. - No DML seed, no GRANT/role change, no index, no evidenced_by vocab amend, no Cap-4 checker change, no Directus mutation, no CUT/VERIFY, no deploy/restart, no git commit.
- Self-advance PROHIBITED — doc 2 of 5; production apply NOT executed and still requires GPT/User sovereign approval. STOP → route GPT/User.
Companion files: preflight-result, rollback-command-package, verification-command-package, command-review-report.