KB-2625

02 — Dry-Run Scope & Exact SQL (pure read-only variant; inline Seam-A over 3-collection subset; live v_object_owner_gap logic reproduced verbatim; 2026-06-02)

6 min read Revision 1
one-roof-governancephase1coverage-dry-runf1-readonlyread-onlyseam-agap-logicsql2026-06-02

02 — Dry-Run Scope & Exact SQL

The exact read-only scope and the verbatim SQL executed. Every statement is a single SELECT through the AST-validated read-only query_pg role. No DDL, no transaction, no COMMIT.

2.1 Scope (smallest useful — doc 03)

Parameter Value
Source collection_registry (168 rows)
Filter governance_role='governed' AND coverage_status='BIRTH_REQUIRED' (35 rows)
Subset lexically first 3: agents, approval_requests, apr_action_types
Grain collection grain (object/birth_registry grain excluded)
Variant pure read-only (doc 03 §3.6) — Seam-A expression evaluated inline, not as a view; no BEGIN..ROLLBACK
Owner source live v_object_effective_owner (0 rows)
Gap logic the live v_object_owner_gap definition, reproduced exactly with the inline inventory substituted

2.2 Why pure read-only (not rollback-only)

Doc 03 §3.6 names the pure read-only pass as the recommended first step — "zero DDL and zero transaction — the safest possible first step." The mission mandates READ-ONLY ONLY, so the F-2 rollback-only variant (which wires the seams inside BEGIN..ROLLBACK) is deliberately not run here. F-2 remains a future, separately-authorized step (doc 07 §7.2).

2.3 The live gap logic being reproduced

pg_get_viewdef('v_object_owner_gap') (live, 2026-06-02):

SELECT inv.object_type, inv.object_ref, s.scope_code AS scope
FROM v_governance_object_inventory inv
CROSS JOIN governance_responsibility_scope s
LEFT JOIN v_object_effective_owner eo
  ON eo.object_type = inv.object_type
 AND eo.object_ref  = inv.object_ref
 AND eo.scope       = s.scope_code
 AND eo.owner_kind  = 'accountable'
WHERE s.status = 'active'
  AND inv.requires_owner = true
  AND inv.born = true
  AND eo.owner_gov_code IS NULL;

Grain = (object × active responsibility scope). Because v_governance_object_inventory is the inert seam (WHERE false), the live view returns 0. The dry-run substitutes the inline Seam-A expression for inv to see what the path would produce over 3 collections.

2.4 Seam-A inventory expression (doc 02 §2.5 of the readiness pkg, collection grain)

SELECT 'collection'::text AS object_type,
       cr.collection_name  AS object_ref,
       (cr.governance_role IN ('governed','locked')) AS requires_owner,
       (cr.coverage_status = 'BIRTH_REQUIRED')        AS born
FROM collection_registry cr
-- restricted in the dry-run to the 3-collection subset

The column shape (object_type, object_ref, requires_owner, born) was verified live to match the inert v_governance_object_inventory view definition exactly — so the inline substitution is faithful.

2.5 Statements executed (verbatim, read-only)

S1 — subset/scope confirm:

SELECT collection_name, governance_role, coverage_status
FROM collection_registry
WHERE governance_role='governed' AND coverage_status='BIRTH_REQUIRED'
ORDER BY collection_name LIMIT 3;

S2 — inventory seam (inline Seam-A over the subset):

WITH subset AS (
  SELECT collection_name FROM collection_registry
  WHERE governance_role='governed' AND coverage_status='BIRTH_REQUIRED'
  ORDER BY collection_name LIMIT 3
)
SELECT 'collection'::text AS object_type, cr.collection_name AS object_ref,
       (cr.governance_role IN ('governed','locked')) AS requires_owner,
       (cr.coverage_status='BIRTH_REQUIRED') AS born
FROM collection_registry cr JOIN subset s ON s.collection_name = cr.collection_name
ORDER BY object_ref;

S3 — owner resolution (live view, 3 subset objects):

SELECT eo.object_ref, eo.scope, eo.owner_gov_code, eo.owner_kind, eo.resolution, eo.depth
FROM v_object_effective_owner eo
WHERE eo.object_ref IN ('agents','approval_requests','apr_action_types')
ORDER BY eo.object_ref, eo.scope;

S4 — gap reproduction (production logic, inline inventory):

WITH subset AS (
  SELECT collection_name FROM collection_registry
  WHERE governance_role='governed' AND coverage_status='BIRTH_REQUIRED'
  ORDER BY collection_name LIMIT 3
),
inv AS (
  SELECT 'collection'::text AS object_type, cr.collection_name AS object_ref,
         (cr.governance_role IN ('governed','locked')) AS requires_owner,
         (cr.coverage_status='BIRTH_REQUIRED') AS born
  FROM collection_registry cr JOIN subset s ON s.collection_name = cr.collection_name
)
SELECT inv.object_type, inv.object_ref, s.scope_code AS scope,
       'GAP'::text AS verdict, 'no_accountable_owner'::text AS reason
FROM inv
CROSS JOIN governance_responsibility_scope s
LEFT JOIN v_object_effective_owner eo
  ON eo.object_type=inv.object_type AND eo.object_ref=inv.object_ref
 AND eo.scope=s.scope_code AND eo.owner_kind='accountable'
WHERE s.status='active' AND inv.requires_owner=true AND inv.born=true
  AND eo.owner_gov_code IS NULL
ORDER BY inv.object_ref, s.scope_code;

Plus census batteries (doc 01 / doc 05) and the view-definition / column-introspection SELECTs. All read-only.

2.6 Scope verdict

MINIMAL AND FAITHFUL. 3 collections, collection grain, live gap logic reproduced verbatim with only the inert seam swapped for its specified real expression. Zero DDL, zero transaction, no path to row explosion.

Back to Knowledge Hub knowledge/dev/reports/architecture/one-roof-phase1-coverage-dry-run-f1-readonly-2026-06-02/02-dry-run-scope-and-sql.md