KB-5899

Phase 3 — Điều 37 MARK + VERIFY MARK result

6 min read Revision 1
dieu45phase3markverify-markdieu37fn-iu-op-mark-filefn-iu-op-verify-mark2026-05-26

Phase 3 — Điều 37 MARK + VERIFY MARK

1. MARK invocation

SELECT fn_iu_op_mark_file(
  p_source_text     => :source_text,        -- 23,387 UTF-8 bytes of Điều 37 v3.3
  p_source_ref      => 'knowledge/dev/laws/dieu37-governance-organization-law.md',
  p_pieces          => :pieces_json::jsonb,  -- 17 pieces
  p_actor           => 'dieu45-phase3-pilot-2026-05-26',
  p_source_kind     => 'user',
  p_idempotency_key => 'dieu45-phase3-pilot-dieu37-20260526-write-channel',
  p_mark_report_md  => 'dieu45 phase3 pilot 2026-05-26 — write channel rerun',
  p_workflow_ref    => 'operational-cut-workflow'
);

Output: staging_record_id = 258c715c-6f49-4e12-b62a-a64a6907f435.

Job 2 ack:

{"state":"succeeded","job_id":"338339bd-…","refused":false,
 "summary":"mark ok staging_record_id=258c715c-6f49-4e12-b62a-a64a6907f435",
 "finished_at":"2026-05-26T15:13:49.495209+00:00"}

2. Staging row created

staging_record_id : 258c715c-6f49-4e12-b62a-a64a6907f435
source_ref        : knowledge/dev/laws/dieu37-governance-organization-law.md
lifecycle_status  : approved → consumed (post-cut)
owner_actor       : dieu45-phase3-pilot-2026-05-26
idempotency_key   : dieu45-phase3-pilot-dieu37-20260526-write-channel
part_count        : 3                  -- iu_staging_payload rows
byte_len          : 28,777             -- approx. UTF-8 of source + frame
content_hash      : a87295655da43d54d4176860358f58eb
vector_excluded   : t                  -- NVSZ zone
approved_at       : 2026-05-26 15:13:49.501679+00
approved_by       : dieu45-phase3-pilot-2026-05-26
consumed_at       : 2026-05-26 15:17:38.784037+00
consumed_by_run_id: a64340fe-96ea-428a-a860-32e8b471b496

iu_staging_payload rows for this staging:

part_index | part_name      | payload_kind | text bytes
-----------+----------------+--------------+-----------
         1 | cut_manifest   | json         |  -
         2 | mark_report    | text         | 52
         3 | coverage_proof | json         |  -

Note: the manifest pieces live in iu_staging_payload[1].payload_json->'pieces', not in the iu_staging_record.metadata.pieces copy. (This is the recovery point of §3 in 00-summary.md.)

3. 17 pieces (post-patch — final state)

idx local_piece_id piece_role section_type section_code canonical_address
0 p1 title heading title DIEU-37-v3.3#title
1 p2 intro paragraph ops-note DIEU-37-v3.3#ops-note
2 p3 body paragraph goal DIEU-37-v3.3#goal
3 p4 body paragraph missions DIEU-37-v3.3#missions
4 p5 body definition terms DIEU-37-v3.3#terms
5 p6 body principle core DIEU-37-v3.3#core
6 p7 body paragraph scope DIEU-37-v3.3#scope
7 p8 body principle principles DIEU-37-v3.3#principles
8 p9 body technical_spec schema DIEU-37-v3.3#schema
9 p10 body governance_process dot DIEU-37-v3.3#dot
10 p11 body technical_spec ⚠ matrix DIEU-37-v3.3#matrix
11 p12 body instruction_block pg-catalog DIEU-37-v3.3#pg-catalog
12 p13 reference section ⚠ law-links DIEU-37-v3.3#law-links
13 p14 body process seed DIEU-37-v3.3#seed
14 p15 body section ⚠ debt DIEU-37-v3.3#debt
15 p16 body technical_spec triggers DIEU-37-v3.3#triggers
16 p17 appendix changelog changelog DIEU-37-v3.3#changelog

⚠ — three entries were patched in iu_staging_payload.payload_json->'pieces' from the original codes the manifest builder had picked from tac_section_type_vocab:

idx original (vocab-valid) patched (fn_iu_create-valid)
10 (p11) matrix technical_spec
12 (p13) reference_mapping section
14 (p15) open_decision_list section

The original codes are present in tac_section_type_vocab (17 items, lifecycle_status='active') but not in the hard-coded 13-item list that fn_iu_create enforces. See 00-summary.md §6 for the lesson.

4. VERIFY MARK + approval

SELECT fn_iu_op_verify_mark(
  p_staging_record_id => '258c715c-…'::uuid,
  p_approve           => true,
  p_approval_doc_id   => 'dieu45-phase3-pilot-approval-2026-05-26',
  p_approver          => 'dieu45-phase3-pilot-2026-05-26',
  p_actor             => 'dieu45-phase3-pilot-2026-05-26'
);

Output:

{
  "alias": "fn_iu_op_verify_mark",
  "approve": true,
  "verdict": "approved",
  "inner_result": {"ok": true, "verdict": "approved",
                   "axis_a_ok": true, "axis_b_ok": true, "axis_c_ok": true},
  "staging_record_id": "258c715c-6f49-4e12-b62a-a64a6907f435"
}

All three axes (A: sort_order, B: section_type, C: parent_or_container_ref / no-vector) returned true at MARK time. The approval is now durable; cut.verify_mark was acked.

5. Coverage assertion

Source text length (UTF-8): 23,387 B; piece content total (slice-by-anchor): 20,467 chars (the ~16-char gap is whitespace between sections). All 17 pieces have non-empty content_text.

Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/v0.6-dieu45-phase-3-mark-cut-queue-pilot-dieu37-write-channel/04-dieu37-mark-verify-result.md