KB-53A3

18000x · 04 — v2 template creation + version chain live (tpl:wf:onboarding v1 superseded → v2 current; digest_drift=t)

5 min read Revision 1
iu-corev0.618000xv2-templateversion-chainauto-supersededigest-drift

18000x · 04 — v2 template creation + version chain (live)

What ran

ops/.../iu_core_18000x_apply_v2_template.sql — single TX with the composer gate flipped on inside the TX (gate-toggle reversibility pattern per [[feedback-in-tx-gate-toggle-reversibility]]), composes v2, marks it, registers v1 and v2 into the chain, closes the gate before COMMIT.

v2 composition

fn_iu_compose(
    collection_key  = 'tpl:wf:onboarding/v2',
    collection_kind = 'workflow',
    title           = 'Engineer onboarding workflow v2',
    pieces          = jsonb_array(
        {role:body, iu_id:ad22a9b5-…-9761-549f65494a0a}  -- v1 step 0 reused
        {role:body, iu_id:61944814-…-a4aa-f292a9ecac65}  -- v1 step 1 reused
        {role:body, iu_id:67892f6b-…-bcdd-7efc462a203b}  -- v1 step 2 reused
        {role:body, iu_id:0845e88c-…-8e60-8e30e117da2c}  -- v1 step 3 reused
        {role:body, new_piece:{                          -- NEW D10 step minted
            canonical_address:'iu_core/template/18000x/wf-onboarding-v2/step-5-d10-30-day-checkin',
            title:'D10 — 30-day check-in',
            body:'At day 10 the new engineer and their tech lead jointly review the onboarding outcome…',
            unit_kind:'design_doc_section',
            section_type:'process'
        }}
    ),
    actor = 'iu-core-18000x')
=>
{
  ok: true,
  collection_id:  '1cd4f881-0e7f-4f7a-9133-07ce7e726d8d',
  collection_key: 'tpl:wf:onboarding/v2',
  pieces_minted:  1,
  pieces_attached:5,
  minted_unit_ids:['5cd08c5d-955f-4e20-8115-1617fdf466ae']
}

Birth-gate PILOT warnings (carry-forward from 15000x, non-blocking):

WARNING:  Birth gate L1 PILOT-ONLY: P-pub1 missing — production sẽ BLOCK
WARNING:  Birth gate L1 PILOT-ONLY: P-pub2 missing — production sẽ BLOCK

v2 marked as template

fn_iu_collection_mark_as_template(
    '1cd4f881-0e7f-4f7a-9133-07ce7e726d8d',
    'Engineer onboarding workflow v2',
    'Versioned successor to v1 with a new D10 check-in step — productized in 18000x.',
    'iu-core-18000x')
=> {status:ok, is_template:true, was_template_before:false}

Version chain registration

-- register v1 as the ROOT of family 'tpl:wf:onboarding'
fn_iu_collection_register_template_version(
    '62c032aa-8a58-44aa-b490-b236b28a7997',
    'tpl:wf:onboarding', 'v1', 1, NULL,
    'iu-core-18000x')
=> {status:ok, version_seq:1, version_status:current, family_chain_length:1}

-- register v2 with predecessor=v1 (auto-supersedes v1)
fn_iu_collection_register_template_version(
    '1cd4f881-0e7f-4f7a-9133-07ce7e726d8d',
    'tpl:wf:onboarding', 'v2', 2,
    '62c032aa-8a58-44aa-b490-b236b28a7997',
    'iu-core-18000x')
=> {status:ok, version_seq:2, version_status:current, family_chain_length:2,
    previous_collection_id:'62c032aa-…'}

Read-back from v_iu_template_version_chain

    collection_key    | version_label | version_seq | version_status | is_root | is_current | digest_drift
----------------------+---------------+-------------+----------------+---------+------------+-------------
 tpl:wf:onboarding/v1 | v1            |           1 | superseded     | t       | f          | f
 tpl:wf:onboarding/v2 | v2            |           2 | current        | f       | t          | t

digest_drift_from_previous = true for v2 — proves versioning supports genuine content evolution (the new D10 step changed the piece-graph manifest).

Read-back from v_iu_template_observability

    collection_key    | template_family   | version | status     | instances | digest_match | digest_diverged | active_pieces | template_without_version | version_without_template_marker
----------------------+-------------------+---------+------------+-----------+--------------+-----------------+---------------+--------------------------+--------------------------------
 tpl:wf:onboarding/v1 | tpl:wf:onboarding | v1      | superseded |         1 |            1 |               0 |             5 | f                        | f
 tpl:wf:onboarding/v2 | tpl:wf:onboarding | v2      | current    |         0 |            0 |               0 |             5 | f                        | f
 tpl:file:status-report/v1 | NULL         | NULL    | NULL       |         0 |            0 |               0 |             5 | t                        | f

The third row flags the unversioned tpl:file:status-report/v1 template (intentional carry-forward — operator opts it into the chain when v2 ships, by calling dot_iu_register_template_version).

v2 manifest digest

v1 manifest_digest = 2d3d37b60fd32963ddd7a6eef81aaad6
v2 manifest_digest = 3e5047aaaba85151715f93c7ff2669be

Different digest = different piece graph (4 reused + 1 new), as designed.

Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/v0.6-iu-core-18000x-template-versioning-bulk-scaleout-event-ops-open-goal/04-v2-template-creation-and-version-chain.md