KB-6D49
18000x · 06 — Bulk Instance Generation (3 from v2, all digest-match) + Bulk Text-as-Code Export (7/0/0)
5 min read Revision 1
iu-corev0.618000xbulk-instancetext-as-coderoundtripphase-f-invariant
18000x · 06 — Bulk Instance Generation + Text-as-Code Export
Bulk instance generation (durable)
ops/.../iu_core_18000x_bulk_instances.sql — single TX with composer gate flipped on inside the TX, generates 3 instances from tpl:wf:onboarding/v2, records lineage, closes gate before COMMIT.
Mechanism
- Query
iu_piece_membershipfor v2 template pieces inpiece_order. - Build a single
pieces_jsonreusing all 5iu_ids (no minting). - For i in 1..3:
- call
fn_iu_composewithcollection_key='tpl-inst:wf:onboarding/2026-05-25-bulk-i' - call
fn_iu_collection_record_template_instancefor lineage
- call
- Actor-tagged
iu-core-18000x-bulkfor bounded future cleanup.
Live result
NOTICE: compose instance 1: id=2b845fa6-a29f-4c39-a769-b66c5c517af1 minted=0 attached=5
NOTICE: compose instance 2: id=b4449507-9009-4c97-b672-ce1c946c183d minted=0 attached=5
NOTICE: compose instance 3: id=4c5b8781-9d5c-45b5-9d38-2d1083d9bb36 minted=0 attached=5
instance_collection_key | template_collection_key | instantiated_by | digest_matches_template
------------------------------------------+-------------------------+---------------------+-------------------------
tpl-inst:wf:onboarding/2026-05-25-bulk-1 | tpl:wf:onboarding/v2 | iu-core-18000x-bulk | t
tpl-inst:wf:onboarding/2026-05-25-bulk-2 | tpl:wf:onboarding/v2 | iu-core-18000x-bulk | t
tpl-inst:wf:onboarding/2026-05-25-bulk-3 | tpl:wf:onboarding/v2 | iu-core-18000x-bulk | t
3/3 digest-match — Phase F invariant holds at bulk scale (12000x proved 1, 15000x proved 1, 18000x proves N).
Observability after bulk
collection_key | version | instance_count | digest_matching_instances | digest_diverged_instances
----------------------+---------+----------------+---------------------------+---------------------------
tpl:wf:onboarding/v1 | v1 | 1 | 1 | 0
tpl:wf:onboarding/v2 | v2 | 3 | 3 | 0
Bulk text-as-code export
Driver: cutter_agent/iu_core/bulk_template_export_18000x.py — wraps cutter_agent.iu_core.text_as_code (12000x). One CollectionManifest per template + instance.
Export run
SELECT json_agg(...) FROM template+instance collections
=> 7 collections (2 v1+v2 templates + 1 file template + 4 instances)
python3 (text_as_code roundtrip):
exported_count = 7
roundtrip_failures = 0
digest_mismatch = 0
out_dir = /tmp/iu_core_18000x_export
Directory layout:
/tmp/iu_core_18000x_export/iu-tree/_collections/
file/
tpl_file_status-report_v1.md
workflow/
tpl-inst_wf_onboarding_2026-05-25-bulk-1.md
tpl-inst_wf_onboarding_2026-05-25-bulk-2.md
tpl-inst_wf_onboarding_2026-05-25-bulk-3.md
tpl-inst_wf_onboarding_2026-05-25-demo.md
tpl_wf_onboarding_v1.md
tpl_wf_onboarding_v2.md
Manifest example (tpl_wf_onboarding_v2.md)
---
collection_key: tpl:wf:onboarding/v2
collection_kind: workflow
title: Engineer onboarding workflow v2
source_axis_kind: composed
manifest_digest: 3e5047aaaba85151715f93c7ff2669be
piece_count: 5
---
# Engineer onboarding workflow v2
0000. [body] iu_core/template/15000x/wf-onboarding-v1/step-0-d0-account (ad22a9b5-…)
0001. [body] iu_core/template/15000x/wf-onboarding-v1/step-1-d1-repo (61944814-…)
0002. [body] iu_core/template/15000x/wf-onboarding-v1/step-2-d2-walkthrough (67892f6b-…)
0003. [body] iu_core/template/15000x/wf-onboarding-v1/step-3-d3-first-pr (0845e88c-…)
0004. [body] iu_core/template/18000x/wf-onboarding-v2/step-5-d10-30-day-checkin (5cd08c5d-…)
The 4 reused-from-v1 pieces are visible by their iu_core/template/15000x/... canonical address; the 1 new piece by its iu_core/template/18000x/... address.
Rollback note (bulk durables)
Bulk instances are intentionally durable (productization step). To reverse:
-- list rollback targets
SELECT id, collection_key FROM iu_piece_collection
WHERE created_by='iu-core-18000x-bulk';
-- delete bulk lineage (does not affect template lineage)
DELETE FROM iu_collection_template_instance_lineage
WHERE instantiated_by='iu-core-18000x-bulk';
-- (collection rows themselves use ON DELETE RESTRICT on every FK;
-- use the soft-delete / retire path instead of DROP)