A — Cut / Reconstruct Evidence (2026-05-29)
A — Cut / Reconstruct Evidence
Capability: source document → IU pieces → reconstructed original order, with hash/diff/ordering evidence.
Verdict: PASS for automatic, deterministic reconstruction. Cut automation gap documented (see §A.5).
Channel: read-only (query_pg). Mutation: none.
A.1 Command & function
public.fn_iu_reconstruct_source(p_doc_code text) RETURNS TABLE(source_position, sort_order, section_type, section_code, canonical_address, depth, gap_before, iu_id)— STABLE.- Content hash per piece:
unit_version.content_hash(sha256 hex of body viafn_content_hash).
A.2 Inputs
Two pre-existing cut corpora chosen as proven datasets:
DIEU-37→fn_iu_reconstruct_source('knowledge/dev/laws/dieu37-governance-organization-law.md')DIEU-35→fn_iu_reconstruct_source('DIEU-35')
(Discovered cut corpora, information_unit.doc_code grouped: DIEU-35=36, DIEU-28=27, DIEU-32=23, dieu37=17, dieu39=16, dieu38=8.)
A.3 Ordering integrity (raw output)
| doc | pieces | min_pos | max_pos | positions_contiguous | positions_unique | sort_strictly_increasing | gap_before_count |
|---|---|---|---|---|---|---|---|
| DIEU-35 | 36 | 1 | 36 | true | true | true | 0 |
| DIEU-37 | 17 | 1 | 17 | true | true | true | 0 |
Interpretation: every source position 1..N is present exactly once, sort_order is strictly monotonic, and there are zero gaps — the original document order is fully reconstructable.
A.4 Deterministic reconstruction digest (hash/diff evidence)
md5(string_agg(canonical_address || ':' || content_hash, '|' ORDER BY source_position)):
| doc | pieces | pieces_with_hash | reconstruction_digest |
|---|---|---|---|
| DIEU-37 | 17 | 17 | 33e5a1a309833e94e251e829dc5644c5 |
| DIEU-35 | 36 | 36 | b079d61527d3aef34adeaa4cf4d4dee1 |
Every piece has a content hash; the digest is recomputable by any reviewer and will change if any piece body or the ordering changes — i.e. it is a tamper-evident reconstruction fingerprint.
Per-piece evidence — DIEU-37 (17 pieces, all version_seq=1)
| pos | section_code | canonical_address | v | body_len | content_hash[:16] |
|---|---|---|---|---|---|
| 1 | title | DIEU-37-v3.3#title | 1 | 513 | 3eccc6ee7d7f0d3c |
| 2 | ops-note | DIEU-37-v3.3#ops-note | 1 | 546 | 6b0fd7860a4d6257 |
| 3 | goal | DIEU-37-v3.3#goal | 1 | 1234 | 04d6cb0f01d086d1 |
| 4 | missions | DIEU-37-v3.3#missions | 1 | 1348 | d6d2377e1c053b64 |
| 5 | terms | DIEU-37-v3.3#terms | 1 | 1140 | 9a31770b2e39b197 |
| 6 | core | DIEU-37-v3.3#core | 1 | 746 | f0fa69ce22e20bdb |
| 7 | scope | DIEU-37-v3.3#scope | 1 | 1271 | 04187f0457235d4f |
| 8 | principles | DIEU-37-v3.3#principles | 1 | 3929 | c04a03be90679ac1 |
| 9 | schema | DIEU-37-v3.3#schema | 1 | 4619 | 2d9dfa668a93fdcb |
| 10 | dot | DIEU-37-v3.3#dot | 1 | 858 | fc6c4697e0cc089d |
| 11 | matrix | DIEU-37-v3.3#matrix | 1 | 517 | 21561d3011f75029 |
| 12 | pg-catalog | DIEU-37-v3.3#pg-catalog | 1 | 190 | dc5bb0981c10cc11 |
| 13 | law-links | DIEU-37-v3.3#law-links | 1 | 188 | ea0007a778ca91bf |
| 14 | seed | DIEU-37-v3.3#seed | 1 | 193 | 2ebeaf95d546d9d5 |
| 15 | debt | DIEU-37-v3.3#debt | 1 | 966 | fb519737f2e39f2c |
| 16 | triggers | DIEU-37-v3.3#triggers | 1 | 1119 | f8fafacd398844a5 |
| 17 | changelog | DIEU-37-v3.3#changelog | 1 | 1090 | 8423f5e4ebceff7d |
Depth tree: title at depth 0 (document root), all 16 body sections at depth 1.
A.5 Cut automation — what exists and the exact gap
Automatic reconstruction: fully automatic and deterministic (above) — one function call rebuilds the ordered document from its IU pieces.
Automatic cut: exists only through the approved-manifest pipeline — dot_iu_cut_from_manifest → fn_iu_cut_from_manifest (G1–G7 guards, single atomic txn) → loops fn_iu_create to birth each piece. It consumes an already-approved cut manifest (a Điều 32 governance artifact).
Exact gap: there is no standalone "feed a raw document → auto-segment → auto-cut" command. Segmentation of a raw source into the manifest (the decision of where the section boundaries are) is an upstream/curated step; the DB-side cut is the governed materialisation of that manifest. So:
- Raw-text → section manifest: manual/upstream (gap).
- Approved manifest → IU pieces: automatic (
fn_iu_cut_from_manifest). - IU pieces → reconstructed source: automatic + deterministic (
fn_iu_reconstruct_source, proven above).
This run used prior cut data (DIEU-37 / DIEU-35) and did not re-cut, per the safe-default instruction.
A.6 What a human can look at
Run SELECT * FROM fn_iu_reconstruct_source('knowledge/dev/laws/dieu37-governance-organization-law.md') ORDER BY source_position; — the 17 rows come back in original document order. Recompute the digest with the query in §A.4 and confirm it equals 33e5a1a3….
A.7 Safety
Read-only. No rows created/updated/deleted. No gate touched.