KB-5C75

15000x · 05 — Instance generation proof (digest_matches_template=true @ prod; template+instance both 2d3d37b60fd32963…)

3 min read Revision 1
iu-corev0.615000xinstance-generationmanifest-digestphase-f-invariantlineageproduction-scale

15000x · 05 — Instance generation proof (digest matches template @ prod)

Goal

Confirm at production scale the 12000x Phase F invariant: instance pieces sharing iu_ids with template ⇒ instance.manifest_digest = template.manifest_digest.

SQL (excerpt)

WITH tpl_pieces AS (
    SELECT m.iu_id, m.piece_order, m.piece_role
      FROM iu_piece_collection c
      JOIN iu_piece_membership m ON m.collection_id = c.id
     WHERE c.collection_key='tpl:wf:onboarding/v1'
       AND m.membership_status='active'
     ORDER BY m.piece_order
)
SELECT public.fn_iu_compose(
    'tpl-inst:wf:onboarding/2026-05-25-demo', 'workflow',
    'Onboarding workflow — instance 2026-05-25 demo',
    'Instance generated from tpl:wf:onboarding/v1 by 15000x.',
    (SELECT jsonb_agg(jsonb_build_object('role',piece_role,'iu_id',iu_id) ORDER BY piece_order)
       FROM tpl_pieces),
    'iu-core-15000x'
);

fn_iu_compose result

{
  "ok": true,
  "collection_id": "8a63ee23-0dbb-4eea-b82a-8d5605e0e588",
  "pieces_minted": 0,
  "pieces_attached": 5,
  "collection_key": "tpl-inst:wf:onboarding/2026-05-25-demo",
  "minted_unit_ids": []
}

Zero new IUs minted. 5 template-piece iu_ids re-attached.

Lineage record via fn_iu_collection_record_template_instance

{
  "status": "ok",
  "instance_collection_id": "8a63ee23-0dbb-4eea-b82a-8d5605e0e588",
  "template_collection_id": "62c032aa-8a58-44aa-b490-b236b28a7997",
  "instance_manifest_digest": "2d3d37b60fd32963ddd7a6eef81aaad6",
  "template_manifest_digest": "2d3d37b60fd32963ddd7a6eef81aaad6",
  "digest_matches_template": true
}

digest_matches_template = true at production scale.

Persisted lineage view

 instance_collection_key                | template_collection_key | digest_matches_template
 tpl-inst:wf:onboarding/2026-05-25-demo | tpl:wf:onboarding/v1    | t

What this proves

Claim Evidence
fn_iu_compose iu_id branch is the legitimate instance-from-template mechanism pieces_minted=0, pieces_attached=5
Piece-graph identity determines manifest_digest both digests 2d3d37b6…
Lineage durably persisted view row post-COMMIT
Invariant scales to production data same outcome at iu_count=173 as at 163

Out of scope

  • Modifying a template piece body + propagation semantics — 16000x
  • Instance that diverges from template (subset of pieces) — works mechanically; digest_matches_template = false is then correctly surfaced
Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/v0.6-iu-core-15000x-productization-operator-ops-closeout-open-goal/05-instance-generation-proof.md