KB-2A3C

IU Core 500x — 04 Piece/file/workflow proofs + text-as-code

3 min read Revision 1
dieu44iu-core-mvp500xcomposeworkflow-as-piecestext-as-coderoundtripv0.62026-05-22

04 — Piece / file / workflow proofs + text-as-code

1. Create-file-from-many-pieces

Proven twice. Non-durablesandbox/110 E2: fn_iu_compose of a 2-piece file emits collection_created=1 + piece_added=2, every piece minted through the birth gate. Durableruntime/270: collection iu_core.composer.scratch-file-001 committed, 2 pieces minted via fn_iu_composefn_iu_create, validated ok=true.

2. Create-workflow-from-steps

sandbox/110 E8 — fn_iu_compose of a workflow from 3 ordered step pieces: render returns 3 steps, fn_iu_collection_validate ok=true, piece_order contiguous [0,1,2]. A workflow is an ordered collection of step pieces, each step one IU. E9 — validation is fail-closed: a soft-deleted step is caught ("1 active piece(s) are soft-deleted").

3. Add / remove / reorder / validate / render

sandbox/110 E3 — add + reorder + remove each emit their event (5 mutation events total). sandbox/120 O6 — dot_iu_remove_piece leaves the piece alive. runtime/270fn_iu_collection_render returns the 2 ordered pieces; fn_iu_collection_validate clean.

4. Metadata axes refresh after composition

runtime/270 R270_pieces: axis_b_tag_total = 2fn_iu_compose calls fn_iu_metadata_refresh for every minted piece, so composed-from-scratch content enters the three-axis metadata model immediately. in_axis_c_tree = 0 is expected — composed pieces are flat, not reparented into the cut tree.

5. Text-as-code export / diff / validate — roundtrip proof

Proven byte-identical on the new composed collection. The production fn_iu_collection_manifest_refresh stored a manifest digest for iu_core.composer.scratch-file-001; the manifest rows were read via fn_iu_collection_render and fed to the offline Python contract composer.manifest_digest(...):

stored   = 79d66938f49fe54aea0643c9b3a81d39
computed = 79d66938f49fe54aea0643c9b3a81d39
ROUNDTRIP_BYTE_IDENTICAL = True

The SQL digest and the Python text-as-code contract agree exactly — a git diff of a composition manifest is meaningful. text_as_code.py (serialize_corpus, parse_collection_manifest, roundtrip_collection_manifest, propose_collection_import) is unchanged and still covered by the suite; the 480x durable iu-tree/ export remains intact. IMPORT_IS_DESTRUCTIVE stays Falsepropose_collection_import is fail-closed and non-destructive.

6. Durable inert test collection

runtime/270's iu_core.composer.scratch-file-001 (lifecycle draft, never delivered) is the durable inert composed-from-scratch collection the macro asks for — fully reversible via runtime/rollback/270.

Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/v0.6-iu-core-500x-dot-one-command-composer-production-closeout-open-goal/04-piece-file-workflow-textcode.md