Skip to content

export: one complete installation export an agency can leave with #98

Closed

Description

@TusanHomichi

Existing issue check

Problem or outcome

The Milestone 5 exit is "a center can leave with all of its data". The installation archive currently omits drafts, acknowledgments, amendments, signoff history, and exporter identity (docs/formats/record-export.md, "not included"). Trainee packets gather some of this per trainee, but no single export carries everything an agency would need to move to another system or to answer a records request after leaving.

Scope

In scope:

  • Define, as a format and decision under Milestone 5 design: exports and recovery #44, what a complete installation export contains. Implement it with the same file-verifiable guarantees as the existing exports (export verify).

Out of scope:

  • Import into another product.
  • PDF rendering, which is tracked under Milestone 5 separately.

Acceptance criteria

  • The format document lists every record class and whether and how each one is exported. Nothing is silently omitted.
  • Integration tests export a populated invented installation, verify it offline, and compare its counts against the database.

Expected proof

  • cargo test --workspace, including the new export tests and a negative control for a tampered archive.

Decisions (maintainer, 2026-10-15)

Asked in the #44 pattern before any code; the maintainer chose the recommended option for each:

  1. Shape: one typed document per stored table. Finalized versions travel as record-export units, byte for byte. Every other carried table is one canonical-JSON document whose rows keep their ids as references. The verifier checks each document's types and closed vocabularies, that every reference resolves inside the archive, and that row counts match the manifest. A guard test fails when a migration adds a table or column the export does not account for.
  2. Contents: everything except credentials. Drafts carry their review, contributor, and snapshot history. Also carried: sessions, assignments, programs, people, retention policies and holds, notices, and the audit trail. Password hashes, login sessions, reset codes, and setup codes are excluded. The manifest names each exclusion with a reason.
  3. Delivery: web download. It sits on the home page (/), beside the installation record export, for export_records holders, is audited as installation_exported, and is verified with export verify. There is no offline CLI export in this outcome.
  4. Shipping: one PR. It carries the ADR, format document, producer, verifier, coverage guard, web download, and tests, and gets an independent review before push.

Execution record

ID Outcome Depends on Role Acceptance State
D1 ADR 0028 and docs/formats/installation-export.md: every stored table and column carried or excluded, with a reason — integrator Every table in the final schema is named exactly once; docs gates pass verified: 9baf098 (43 carried + 5 excluded = all 47 tables; column tables generated from the migrated schema)
I1 Spec-driven producer, export verify dispatch, GET /api/exports/installation, installation_exported audit event, coverage guard D1 implementer Focused tests including negative controls; fmt/clippy verified: 17ea43d (G1 receipt dac49aca…)
T1 Integration tests: a populated invented installation is exported, verified offline, and its counts compared against the database; tampered, dangling-reference, count-mismatch, and unmapped-table controls fail I1 implementer cargo test --workspace verified: 17ea43d
W1 Home-page (/) download beside the installation record export for export_records holders, with a browser test I1 implementer npm run check, e2e spec verified: 17ea43d (62/62 browser tests)
R1 Independent review of the exact candidate SHA I1, T1, W1 reviewer Findings resolved or filed verified: three rounds, 0 blocking; all findings fixed or recorded (#129 filed); final delta self-reviewed
G1 Full local gates (scripts/proof.py) on the frozen candidate R1 verifier Receipt verified: 17ea43d, 7/7 gates, receipt dac49aca… (comment)
P1 Push, PR, hosted pr-gate, automated review threads resolved G1 integrator Green hosted run active: #130 open, hosted checks running

Next action: when #130's required checks are green and every review thread is resolved, squash-merge it (standing permission), verify the merged main revision, and archive the graph.

Related roadmap, decisions, or issues

Activity

  1. TusanHomichi commented on Oct 15, 2026

    @TusanHomichi
    MemberAuthor

    Authority update (2026-10-15): the maintainer granted standing permission to manage PRs end to end: "you have standing permission to manage PRs end to end and that includes merging and cleaning up old branches". The integrator merges once required checks are green on the current head and every review thread is resolved (squash only; no admin bypass of a failing check), then verifies the merged revision and removes the branch and worktree. Deployments and releases are not covered.

  2. TusanHomichi commented on Oct 15, 2026

    @TusanHomichi
    MemberAuthor

    R1: independent review of d2ed3e9 (reviewer role, read-only, on a frozen detached worktree, 2026-10-15)

    Verdict: nothing blocking. Producer, verifier, single read snapshot, authorization, and audit are correct for the schema at migration 0016. All 22 verifier probes were detected. In the review worktree, cargo test -p consolebook-server --test installation_export --test record_export --test trainee_packet gave 13 + 6 + 13 passed, and cargo clippy -p consolebook-server --all-targets -D warnings was clean.

    Should-fix: each was reproduced by a probe, and all are gaps in the guards that keep the format honest as the schema changes:

    • S1: a second FK on a column, such as a new composite, is invisible to the coverage guard.
    • S2: the vocabulary ALL arrays are hand-maintained. A new audit kind missing from them would make every export fail.
    • S3: a dotted exclusion or unit column that disappears from the schema goes unnoticed, and carried ∩ excluded is unchecked.
    • S4: nothing forces a format_version bump when the spec changes.
    • S5: producer and verifier row rules differ. An audit row with a half-set subject exports "complete", then fails verification.
    • S6: the unit↔row agreement check is quadratic (40k units ≈ 23 s in a debug build).
    • S7: about 25 checks work but have no pinned negative control.

    Nits N1–N7:

    • CHECK list tokenizer spelling robustness;
    • doc-sync of the exclusion list and counts;
    • derive the credential-absence set from EXCLUSIONS;
    • a stale doc comment;
    • audit-as-attempt wording;
    • amendment watermark columns documented;
    • ledger hash finding should name its table.

    Disposition: all S1–S7 and N1–N7 are in scope for #98 and were sent back to the implementer as one fix brief (S2 at rung 1 via a single vocabulary macro, S5 at rung 1 via one shared row check). R1 re-reviews the delta before G1.

  3. TusanHomichi commented on Oct 15, 2026

    @TusanHomichi
    MemberAuthor

    R1 round 2: re-review of 8d0d7b3..e1b7e70 (reviewer role, frozen worktree at e1b7e70)

    Verdict: nothing blocking. S1, S2, S3, S5, S6, and S7 are confirmed fixed against the original probes. Verifier time is now linear: 40k units take 3.76 s, against 23.3 s before. N2–N7 are fixed.

    • No false refusals: every rule the producer now enforces is either guaranteed by the schema or written only by audit::record and record_for_subject. So no legitimately held row is refused.
    • Web commit: correct, accessible, and reuses downloadExport. The e2e assertions match main.rs and would fail on a regression.
    • Clean runs: cargo test --test installation_export --lib (22 + 13 passed), clippy, and npm run check.

    Open after round 2:

    • R1: the fingerprint includes vocabulary values. Every new audit kind, notice kind, or capability would then force a format bump, and after a bump a newer build reports every v1 archive as UnsupportedFormat.
    • R2: the pin covers the spec-held rules but not the manifest shape or the verifier's hard-coded rules. Re-recording the v1 hash is caught only by review. The format and ADR overclaim, saying "enforces" and "impossible to skip".
    • R3: the remaining coverage-guard blind spots are undocumented: quoted or parenthesised identifiers in CHECK, trigger-only vocabularies, flags without a CHECK, and GLOB forms.
    • R5: +page.svelte reached 1,001 lines.
    • R6: a truncated download is reported as "the server could not be reached". This is pre-existing and shared with the record export.

    Decision on R1 and R2 (integrator; no decision advisor is in use; options and reasoning recorded here):

    • Option (a): vocabulary additions are compatible within a format version.
    • Option (b): strict versioning, with a verifier that dispatches every recorded version.

    Chosen: (a), plus a golden archive.

    1. Vocabularies grow within a format version. They are already append-only, and stored rows must keep reading. The fingerprint no longer covers vocabulary values. A test instead pins v1's values as a floor that must stay contained. A reader that meets an unknown value reports it, as this verifier does. A build always verifies its own and earlier archives' values.
    2. A committed golden v1 archive must verify in every build. It is made from the invented fixture. It pins the manifest shape and the verifier's rules, which the fingerprint cannot. A table or column change breaks it, which forces a new format_version. That first bump must then decide, in its ADR, how v1 archives keep verifying. The decision can't be skipped, because this test makes it.
    3. The format and ADR say exactly this. Spec-held structure is pinned by the fingerprint, and the manifest and verifier rules are pinned by the golden archive. Loosening a verifier rule is caught by its negative control, not by either pin.

    Why: an agency leaves with an archive, and that archive must keep verifying with the builds it is likely to hold. Strict per-kind versioning would end v1 verification at the first disposition kind, for no reader's benefit. The golden archive turns a review-only rule into a test (rung 2) and costs one small fixture.

    Other items:

    • R3: quoted and parenthesised identifiers are handled where the tokenizer can do so simply. Trigger-only vocabularies, flags without a CHECK, and GLOB forms are named in the format as limits of the guard. In those cases it under-verifies; it never leaks.
    • R5: the exports card moves into its own component, which keeps the page under 1,000 lines.
    • R6: filed separately, since it is pre-existing and shared with the record export.
  4. TusanHomichi commented on Oct 15, 2026

    @TusanHomichi
    MemberAuthor

    G1: local full proof (verifier role) on 17ea43d59f9d55ed99df4fe7014e7fe75d0e212a, tree 66fad771. The tree was clean and unchanged during the run, and no other builds ran concurrently. Run 2026-10-15T17:55:01Z, 490 s, scripts/proof.py exit 0, all 7 gates passed.

    • Rust tests: cargo test --workspace ran 282 tests, 0 failed, 3 ignored. Within that, installation_export passed 26 with 1 ignored, the guarded golden regeneration.
    • Browser suite: 62 expected, 0 unexpected, 0 flaky, 0 skipped, on system Google Chrome 155.0.8059.79.
    • Fingerprints: receipt sha256 dac49aca…; server binary de5bf40e…; web build manifest 94cc54e0….
    • Archive: /data/dev/home/.codex/tmp/consolebook-98-installation-export-20261015/, 14 files, read back against its manifest.

    R1 round 3 (f453991): 0 blocking. The remaining wording fixes, the regeneration guard (an env var, a versioned file name, and no overwrite), and the content_hash control are applied in 17ea43d. That final delta was self-reviewed by the integrator, who re-ran --test installation_export (26 passed).

    PR: #130.

  5. TusanHomichi commented on Oct 15, 2026

    @TusanHomichi
    MemberAuthor

    Done. Merged in #130 as 50be527bb667c89c25cde3674dea7ac8c27edd52, a squash with single parent 82c0cb0. The merged tree a54977dc is identical to PR head 0960c96.

    Evidence on that exact head:

    • Local full proof (verifier role): 7/7 gates; 283 Rust tests passed, 0 failed, 3 ignored; 62/62 browser tests on system Chrome 155. Receipt sha256 dfff1a3c….
    • Hosted: fmt-clippy-test, build-x86_64, build-aarch64, and CodeQL in all 4 languages passed.
    • Codex: reviewed both heads. Its one P2 (cancellation inside a table) was fixed in 0960c96 with a negative control, and the thread was resolved.
    • CodeQL: its three test-only alerts were dismissed as used in tests, with the class fix tracked in test: one shared invented credential so CodeQL stops re-flagging every test file #126.

    Acceptance:

    • The format lists all 47 stored tables, carried or excluded, and a test enforces that (coverage guard and doc sync).
    • Integration tests export a populated invented installation, verify it offline, and compare its counts with the database.
    • cargo test --workspace covers the new tests and negative controls, including tampered archives.

    Follow-ups filed: #126 (shared test credential), #129 (truncated-download message). The final graph snapshot and all receipts are archived at /data/dev/home/.codex/tmp/consolebook-98-installation-export-20261015. The branch and worktree are removed. Authority: the maintainer's standing PR permission (2026-10-15).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions