KB-2AB4

110000x · 06 — Short MARK Proof (Điều 37 via alias)

6 min read Revision 1
iu-core110000xmarkshort-formproofdieu-37no-vector-staging-zonebounded

110000x · 06 — Short MARK Proof (Điều 37 via alias)

Status: AUTHORED — ready for operator apply post-mig-042R. This Claude MCP session has no DDL/exec channel; the proof script below is parameterized for the operator to run as workflow_admin in BEGIN/ROLLBACK.

Goal

Prove that:

MARK file knowledge/dev/laws/dieu37-governance-organization-law.md theo quy trình operational-cut-workflow, lưu vào No-Vector Staging Zone

…executed via the short alias fn_iu_op_mark_file:

  1. Resolves the KB source automatically (no operator prompt for the link).
  2. Writes exactly 1 iu_staging_record row with lifecycle_status='pending_review'.
  3. Writes exactly 3 iu_staging_payload rows (cut_manifest, mark_report, coverage_proof).
  4. Records a 32-hex determinism_digest on iu_staging_record.metadata.
  5. Does NOT upload any pending payload to KB.
  6. Does NOT touch iu_vector_sync_point.

Pre-conditions (verified live in Phase A)

SELECT (SELECT count(*) FROM information_unit WHERE doc_code='DIEU-37') AS d37_pre,
       (SELECT count(*) FROM iu_vector_sync_point) AS vsp_pre,
       (SELECT count(*) FROM iu_core.iu_staging_record) AS stg_pre,
       (SELECT value FROM dot_config WHERE key='iu_core.composer_enabled') AS composer;
-- Expect: 0, 152, 3, 'false'

Proof script (BEGIN/ROLLBACK; operator runs)

Step A — Operator-side (Claude/Codex agent) prepares variables:

# In the operator session, agent fetches the source from KB:
SOURCE_TEXT="$(claude-kb get knowledge/dev/laws/dieu37-governance-organization-law.md)"
# Agent authors pieces per 80000x doctrine, saves to /tmp/dieu37-pieces.json

Step B — Operator runs SQL via psql, passing source_text and pieces as bind variables:

\set ON_ERROR_STOP on
BEGIN;

\set source_text `cat /tmp/dieu37-source.txt`
\set pieces      `cat /tmp/dieu37-pieces.json`

-- Short MARK via alias
WITH m AS (
  SELECT public.fn_iu_op_mark_file(
    p_source_text  := :'source_text',
    p_source_ref   := 'knowledge/dev/laws/dieu37-governance-organization-law.md',
    p_pieces       := :'pieces'::jsonb,
    p_actor        := 'operator-110000x-d37-mark',
    p_source_kind  := 'user'
  ) AS r
)
SELECT r->>'staging_record_id' AS sid,
       r->>'manifest_digest'   AS digest,
       r->>'source_hash'       AS shash,
       r->>'source_bytes'      AS sbytes,
       r->>'lifecycle_status'  AS lifecycle,
       r->>'destination'       AS destination,
       r->>'idempotency_key'   AS ikey
FROM m \gset

-- Assertions
SELECT
  :'sid'::uuid AS sid,
  (:'lifecycle' = 'pending_review')                                              AS check_lifecycle,
  (length(:'digest') = 32 AND :'digest' ~ '^[a-f0-9]{32}$')                      AS check_digest_32hex,
  (:'destination' LIKE '%No-Vector Staging Zone%')                               AS check_destination,
  ((SELECT count(*) FROM iu_core.iu_staging_payload
    WHERE staging_record_id = :'sid'::uuid) = 3)                                 AS check_three_payloads,
  ((SELECT count(*) FROM iu_core.iu_staging_payload
    WHERE staging_record_id = :'sid'::uuid AND part_name='cut_manifest') = 1)    AS check_cut_manifest_part,
  ((SELECT count(*) FROM iu_core.iu_staging_payload
    WHERE staging_record_id = :'sid'::uuid AND part_name='mark_report') = 1)     AS check_mark_report_part,
  ((SELECT count(*) FROM iu_core.iu_staging_payload
    WHERE staging_record_id = :'sid'::uuid AND part_name='coverage_proof') = 1)  AS check_coverage_proof_part,
  ((SELECT vector_excluded FROM iu_core.iu_staging_record
    WHERE staging_record_id = :'sid'::uuid) = true)                              AS check_vector_excluded,
  ((SELECT metadata->>'determinism_digest' FROM iu_core.iu_staging_record
    WHERE staging_record_id = :'sid'::uuid) = :'digest')                         AS check_determinism_digest_stored,
  ((SELECT count(*) FROM iu_vector_sync_point) = 152)                            AS check_vsp_untouched;

-- Pre-rollback inspection
SELECT staging_kind, lifecycle_status, source_ref, source_kind, part_count, byte_len, expires_at
FROM iu_core.iu_staging_record WHERE staging_record_id = :'sid'::uuid;

ROLLBACK;

-- Post-rollback assertion (state restored)
SELECT count(*) AS stg_post FROM iu_core.iu_staging_record;  -- Expect: 3 (back to pre)
SELECT count(*) AS pay_post FROM iu_core.iu_staging_payload;  -- Expect: 4 (back to pre)

Expected output

sid                  | <uuid>
check_lifecycle      | t   -- pending_review
check_digest_32hex   | t   -- 32-hex manifest_digest
check_destination    | t   -- written to NVSZ
check_three_payloads | t   -- exactly 3 payloads
check_cut_manifest_part | t
check_mark_report_part  | t
check_coverage_proof_part | t
check_vector_excluded     | t   -- vector_excluded=true
check_determinism_digest_stored | t   -- digest in metadata
check_vsp_untouched   | t   -- iu_vector_sync_point row count unchanged

Anti-claims (what this proof does NOT do)

  • Does not upload the MARK manifest or any payload to KB. (Anti-pattern explicitly forbidden in START-HERE.)
  • Does not vectorize any payload (structural impossibility per R6 in report 04).
  • Does not create any information_unit row (MARK ≠ CUT).
  • Does not touch production_documents (table absent).
  • Does not call Qdrant.
  • Does not open the composer gate (MARK does not need it; only CUT does).

Verdict template (post-apply, operator-run)

IU_CORE_110000X_SHORT_MARK_PROOF_DIEU37_PASS
- short-form MARK alias accepted the KB source: PASS
- 1 staging_record (pending_review): PASS
- 3 staging_payloads (cut_manifest/mark_report/coverage_proof): PASS
- 32-hex manifest_digest: PASS
- vector_excluded=true: PASS
- iu_vector_sync_point unchanged: PASS
- post-ROLLBACK state = pre exactly: PASS
- zero KB upload of MARK payloads: PASS
Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/v0.6-iu-core-110000x-operator-alias-surface-d30-d31-protection/06-short-mark-proof.md