KB-6D99

08 — Next step: CUT approval and execution

4 min read Revision 1
dieu44dieu39next-stepcut-approval

08 — Next step: CUT approval and execution

The Điều 39 cut_request 146f1520-aaa2-4bda-af2c-06a8f76cd36a is now at status='marked' with a valid cut_manifest_piece_schema_v1 manifest:

  • staging record 9fa4685e-d35a-45d4-aee7-aa2836785ca5
  • manifest_digest aded6af91fb9643fb2ea99ff024a1ede
  • 16/16 pieces complete on all required fields
  • VERIFY_MARK preview verdict = approved (axis A/B/C all PASS)

Operator approval (required to advance)

SELECT public.fn_cut_verify_mark(
  p_cut_request_id := '146f1520-aaa2-4bda-af2c-06a8f76cd36a'::uuid,
  p_approve        := true,
  p_approval_doc_id := '<KB path or ticket reference>',
  p_approver       := '<approver identity, e.g. nmhuyen>',
  p_actor          := '<operator identity>'
);

This will:

  1. Call fn_iu_op_verify_mark(p_approve=true, …)fn_iu_verify_mark(p_apply=true, …) which sets iu_staging_record.lifecycle_status='approved' and records the approval doc id.
  2. Transition cut_request.status: marked → mark_verified.
  3. Emit signal cut.verify_mark with verdict=approved.

CUT execution

Once at mark_verified, call:

SELECT public.fn_cut_apply(
  p_cut_request_id := '146f1520-aaa2-4bda-af2c-06a8f76cd36a'::uuid,
  p_actor          := '<operator>'
);

This advances cut_request.status: mark_verified → cut_in_progress → cut_done, creates cut_run_id, and emits 16 IUs anchored to knowledge/dev/laws/dieu39-knowledge-graph-law.md under canonical addresses DIEU-39-v2.3#….

CUT verification

SELECT public.fn_cut_verify_cut(
  p_cut_request_id := '146f1520-aaa2-4bda-af2c-06a8f76cd36a'::uuid,
  p_actor          := '<operator>'
);

Expected: axis_a/b/c_ok=true, no_vector_ok=true, pieces_count=16, verdict='verified'.

Completion

SELECT public.fn_cut_request_transition(
  '146f1520-aaa2-4bda-af2c-06a8f76cd36a'::uuid,
  'completed',
  '<operator>',
  '{}'::jsonb
);

Then completed → cleanup_scheduled after 15-day TTL window (CF-1 from runtime-hardening pack — cleanup executor still pending).

What's intentionally NOT done in this pack

  • CUT not run (strict non-goal).
  • mark_verified transition not applied (requires operator-supplied approval_doc_id and approver — caller decision, not the fix author's).
  • Orphaned staging record 3d9d0388-… left at lifecycle_status=rejected for audit; cleanup executor (CF-2 in [[project-iu-cut-operational-pipeline-copy-mark-verify-cut-pass-2026-05-26]]) will reap.

Caller guidance for future MARK invocations

Every future caller of fn_cut_mark_staged_file MUST emit pieces matching cut_manifest_piece_schema_v1 (see 03-cut-manifest-piece-schema-v1.md):

[
  {
    "local_piece_id": "P1",
    "source_position": 1,
    "piece_role": "section_body",
    "section_type": "section",
    "content_text": "...",
    "canonical_address": "...",
    "parent_local_id": null
  },
  ...
]

If the caller produces invalid pieces, MARK raises an indexed error (piece[N].<field> is required (cut_manifest_piece_schema_v1)) and the cut_request stays at copied (or mark_rejected) — no silent advance to marked.

Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/v0.6-iu-cut-dieu39-verify-mark-root-cause-and-contract-fix/08-next-step-cut-approval.md