KB-9D19

70000x · 03 — Six-flow test runner package layout + behavior</title> <parameter name="tags">["iu-core","70000x","runner","package","six-flow"]

4 min read Revision 1

70000x · 03 — P2 Six-flow test runner package

Layout

ops/iu-core-six-flow-test-readiness/
├── README.md
├── SIX_FLOW_TEST_READINESS_MATRIX.md
├── USER_TEST_RUNBOOK.md
├── DOT_COMMAND_PLAN.md
├── run_six_flow_tests.sh                  (bash 3.2+ TSV-based runner)
├── test_01_autocut_reconstruct_source.sql (read-only)
├── test_02_axis_b_professional_filter.sql (read-only)
├── test_03_parent_child_subtree_filter.sql(read-only)
├── test_04_create_edit_piece_document.sql (BEGIN/ROLLBACK + in-TX gate-toggle)
├── test_05_piece_trigger_in_out.sql       (BEGIN/ROLLBACK + in-TX gate-toggle)
├── test_06_sql_bridge_piece_to_db.sql     (BEGIN/ROLLBACK)
├── _reports/<UTC_timestamp>/              (per-run logs, gitignored)
└── reports/                               (KB report bundle 00..10)

Runner contract

SSH_HOST=contabo ./run_six_flow_tests.sh [test_NN]
  1. Resolves psql exec channel via ${PSQL_CMD} or ${SSH_HOST} (defaults to docker exec -i postgres psql -U directus -d directus).
  2. Creates _reports/<UTC_timestamp>/ and a per-test log file.
  3. Pipes each SQL file into psql with ON_ERROR_STOP=1 -q.
  4. Classifies the result:
    • psql rc≠0 → FAIL_psql_rc_N
    • any verdict_pass | f row → FAIL_verdicts_N
    • else → PASS_N
  5. Writes summary.json and exits non-zero if any test FAILed.

Bash 3.2 handling

macOS ships bash 3.2 (no associative arrays). The runner uses TSV name<TAB>result per line which works in bash 3.2+. Runs natively on any modern bash.

In-TX gate-toggle pattern (T04, T05)

BEGIN;
UPDATE dot_config SET value='true' WHERE key='iu_core.composer_enabled';
-- run test
UPDATE dot_config SET value='false' WHERE key='iu_core.composer_enabled';  -- defensive
ROLLBACK;

ROLLBACK reverses both the gate flip AND the work atomically. Pre-ROLLBACK gate-flip-back is belt-and-suspenders. This is [[feedback-in-tx-gate-toggle-reversibility]], proven 12000x phases D-G, refreshed at 70000x T04+T05.

Six tests one-line per

T01 fn_iu_reconstruct_source('DIEU-35') → 36 pieces, monotonic, all resolvable
T02 iu_metadata_tag_registry axis-B = {legal_document, section_type, unit_kind}
T03 fn_iu_subtree(root) → root cb211ee6 has depth 2, children+grandchildren present, acyclic
T04 fn_iu_compose mints 3+attaches 3; add/reorder/remove OK; dry_run split/merge/supersede/retire all JSON-OK
T05 fn_iu_piece_emit_event in-TX emit emit_enabled=true + dry_run_only=true → +1 row, emit_mode='dry_run'; ZERO live piece routes
T06 INSERT iu_sql_link (link_role='represents') → validate=resolved, view-resolve, reverse-lookup

Live evidence — run 20260525T081115Z

{
  "ts": "20260525T081115Z",
  "results": {
    "test_01_autocut_reconstruct_source": "PASS_3",
    "test_02_axis_b_professional_filter": "PASS_3",
    "test_03_parent_child_subtree_filter": "PASS_3",
    "test_04_create_edit_piece_document": "PASS_5",
    "test_05_piece_trigger_in_out": "PASS_3",
    "test_06_sql_bridge_piece_to_db": "PASS_6"
  }
}

6 PASS / 0 FAIL.

Schema-discovery learnings (filed as 70000x lessons L2-L6)

  • information_unit.statuslifecycle_status
  • event_outbox.payloadsafe_payload
  • fn_iu_create unit_kind vocab → {design_doc_section, law_unit}
  • iu_sql_link.link_role CHECK vocab → 11 roles (use represents not reference)
  • fn_iu_sql_link_inbound_capture is a trigger function — not directly callable
Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/v0.6-iu-core-70000x-full-test-readiness-six-user-flows-open-goal/03-p2-six-flow-runner.md