Skip to content

feat(export): one complete installation export an agency can leave with - #130

Merged
TusanHomichi merged 9 commits into
mainfrom
claude/98-installation-export
Oct 15, 2026
Merged

TusanHomichi merged 9 commits into
mainfrom
claude/98-installation-export

Conversation

@TusanHomichi

Copy link
Copy Markdown
Member

Primary Issue

Closes #98

Problem And Outcome

Milestone 5's exit is that "a center can leave with all of its data". Neither existing export carried all of it. The record export holds finalized versions only. The trainee packet holds one enrollment. Of the 47 stored tables, 19 were read by no export at all: drafts and their review history, training sessions, retention policies and holds, notices, and the audit trail.

After merge, an export_records holder can download one archive from the home page. It carries everything the installation holds except credentials. consolebook-server export verify checks it from the file alone. Nothing is silently omitted: the archive's own ledger names every carried table and every exclusion, and tests fail if the schema gains a table or column the format has not decided on.

Changes

  • Decision and format: ADR 0028 and docs/formats/installation-export.md. The archive is record-export units, byte for byte, plus one typed canonical-JSON document per stored table: 43 carried, with ids kept as references. The manifest ledger names the 5 credential exclusions. The column tables were generated from the migrated schema. The maintainer's four choices are recorded on export: one complete installation export an agency can leave with #98.
  • One owning specification (installation_export/spec): it defines each table's key and, for each column, its type, nullability, reference, program-version agreement, vocabulary, and text form, plus the exclusions. The producer, the verifier, a schema coverage guard, a format-document sync test, and a spec fingerprint all read it.
  • Producer:
    • Authorizes export_records in the service and audits installation_exported.
    • Reads the unit list and every table in one read snapshot.
    • Runs the verifier's own row check on every row. A stored value it does not understand is refused, never passed through.
    • Streams through the record export's container writer and its deliver path (GET /api/exports/installation).
  • Verifier: export verify dispatches on the format. It checks the ledger and every document's hash, canonical form, members, types, nullability, vocabularies, key order, counts, references, and agreements, plus evaluation_version against the units in both directions. Prints one line per unit and per table.
  • Closed vocabularies: the closed_vocabulary! macro now generates EventKind, SubjectKind, Capability, and NoticeKind, with their stored names, parsers, and ALL. Stored strings are unchanged.
  • Web: the home page's exports card, moved to web/src/lib/exports/ExportsCard.svelte, adds "Export the whole installation". It is offered even before any record is finalized, and the card says the archive is not encrypted.
  • Docs: the CHANGELOG Unreleased entry, the roadmap and README Milestone 5 status, the domain model, and the development task index.

Scope

Verification

  • Candidate revision: 17ea43d (based on main 82c0cb0).
  • Local full proof: scripts/proof.py passed all 7 gates in 490 s on 17ea43d59f9d55ed99df4fe7014e7fe75d0e212a (clean tree, unchanged during the run). The workspace ran 282 Rust tests: 0 failed, 3 ignored, and installation_export 26 passed with 1 ignored (the guarded golden regeneration). The browser suite ran 62 expected, 0 unexpected, 0 flaky, 0 skipped, on system Google Chrome 155.0.8059.79 (not a Playwright download). Receipt sha256 dac49aca374447ac3b6f84a5656c7b931656feb920818923f7237cdd76f52f2f, archived on the maintainer machine. Hosted results follow on this PR.
  • Tests:
    • Every carried table has rows through real services.
    • Counts are compared with the database, and credentials are proven absent with positive controls.
    • About 50 negative controls each assert the exact finding.
    • The coverage guard covers both directions, foreign-key shapes, exclusions, and CHECK spellings.
    • Doc sync covers columns, agreements, vocabularies, and exclusions.
    • Format v1 is pinned by a spec fingerprint, a vocabulary floor, and a committed golden v1 archive (tests/fixtures/installation-export-v1.zip, 47,083 bytes, invented data, sha256 a46cca12…). Every build must verify that archive, and regeneration is guarded.
    • A browser spec downloads the export, verifies it with the CLI, and refuses a trainer (403).
  • Listed the exact verification commands run below
  • Added or updated tests when behavior changed
  • Added or updated an ADR when a durable decision changed (ADR 0028)
  • All fixtures and examples are invented; no real agency data
- scripts/check-guidance-names.sh
- web/: npm ci, npm run check, npm run build
- cargo fmt --check
- cargo clippy --workspace --all-targets -- -D warnings
- cargo test --workspace
- cargo build -p consolebook-server
- web/: npm run e2e (system Google Chrome)

Review And Merge Notes

  • Review performed: three rounds of independent review by the reviewer role, read-only, on frozen worktrees.
    • Round 1 (d2ed3e9): 0 blocking, 7 should-fix, 7 nits.
    • Round 2 (e1b7e70): 0 blocking. All round-1 findings were confirmed fixed against the original probes. Decision R1/R2: vocabularies are additive within a format version, plus a golden archive, with the reasoning on export: one complete installation export an agency can leave with #98.
    • Round 3 (f453991): 0 blocking. Both pins were mutation-tested. The remaining wording fixes, the regeneration guard, and one missing control are applied in 17ea43d. That last delta was self-reviewed by the integrator.
    • The implementer and worker roles wrote the code from fixed briefs. The integrator reviewed every delegated result and re-ran the focused tests.
  • Correction rungs:
    • (1) One owning spec, one vocabulary macro, and one row check shared by producer and verifier.
    • (2) Coverage, doc-sync, fingerprint, vocabulary-floor, and golden-archive tests, each with negative controls.
    • What only review still guards is named in the format: tightenings the golden data satisfies, rules loosened without a control, and a fingerprint edited together with the spec.
  • Authority: the maintainer's standing permission to manage PRs end to end (2026-10-15).
  • User or operator impact: a new home-page action for administrators. The archive contains every person's data unencrypted, and the UI and format say so.

🤖 Generated with Claude Code

TusanHomichi and others added 8 commits October 15, 2026 10:32
ADR 0028 and docs/formats/installation-export.md define the archive the
maintainer chose on #98: record-export units for every finalized version plus
one typed canonical-JSON document per stored table, with a manifest ledger of
every carried table (43) and every credential exclusion (5), references and
program-version agreements the verifier checks, and a coverage guard that
fails when a migration adds a table or column the format does not account for.
Cross-references from the domain model, the task index, and the record-export
and trainee-packet formats point to it.

Refs #98

Co-Authored-By: Claude Opus 5.5 <[email protected]>
One table specification (installation_export/spec) owns the 43 carried
tables, their keys, column types, nullability, references, program-version
agreements, vocabularies, and the 5 credential exclusions; the producer, the
verifier, a schema coverage guard, and a format-document sync test all read
it. The producer authorizes export_records holders in the service, audits
installation_exported, reads the unit list and every table in one read
transaction, and streams through the record export's container writer and
delivery (GET /api/exports/installation). export verify dispatches on the
format and checks the ledger, every document's hash, canonical form, members,
types, vocabularies, key order, counts, references, agreements, and the
evaluation_version rows against the units.

Tests populate every carried table through real services, verify offline,
compare counts with the database, prove credentials absent, and pair each
check with a negative control; the coverage guard and doc sync each have
their own. The format now states determinism as a pure function of the rows
read (each export carries its own audit event) and qualifies the three draft
program_version_id references.

Refs #98

Co-Authored-By: Claude Opus 5.5 <[email protected]>
export_records holders get "Export the whole installation" beside the
records-only export, even before any record is finalized, with copy that
says it carries everything but credentials and is not encrypted. A browser
spec downloads it, verifies it with `export verify`, and proves a trainer
neither sees the action nor gets the archive (403 capability_required).

Refs #98

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…EADME

The roadmap and README no longer list a complete installation export among
the remaining Milestone 5 limits, and the changelog's Unreleased section
describes it.

Refs #98

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The coverage guard now keeps every foreign-key shape per column, checks that
dotted exclusions and unit columns exist and that nothing is both carried and
excluded, and reads CHECK lists however they are spelled. One
closed_vocabulary macro generates EventKind, SubjectKind, Capability, and
NoticeKind with their stored names, parsers, and ALL, so no value can exist
outside its vocabulary. The producer runs the verifier's own row check and
refuses a row the verifier would reject. A spec fingerprint pinned to
format_version 1 makes a changed specification require a new format
version. The unit/row agreement is now linear, the ledger hash finding names
its table, and every check the review proved untested has a negative control.
The format documents the audit-as-attempt rule and the amendment watermarks.

Refs #98

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The card holding the records-only and complete installation exports moves
unchanged to web/src/lib/exports/ExportsCard.svelte, sharing the page's busy
flag through a bindable prop, so +page.svelte stays under 1,000 lines
(1,001 -> 904) after #98 added the installation export.

Refs #98

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…en archive

Vocabularies grow within a format version, so the spec fingerprint no longer
covers their values; a floor test instead requires every version-1 value to
stay admitted. A committed golden version-1 archive (an invented,
fully populated installation) must verify in every build: it pins the
manifest shape and the verifier's rules, so a format change that skips a
version bump fails, and the first bump must decide how version-1 archives
keep verifying. The coverage guard reads quoted and parenthesised CHECK
columns, and the format and ADR 0028 state exactly what each pin covers and
the guard's remaining limits.

Refs #98

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ns cover

Regenerating a golden archive now needs CONSOLEBOOK_REGENERATE_GOLDEN=1,
names the file from the current format version, and refuses to overwrite one,
so `--include-ignored` cannot rewrite the version-1 fixture. A negative
control pins evaluation_version.content_hash's text form. The format and
ADR 0028 now say the golden archive pins the verifier's rules only as far as
its data exercises them, and name what review alone still guards:
tightenings the golden data satisfies, rules loosened without a control, and
a fingerprint edited together with the specification.

Refs #98

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T18:24:39.263969Z 0960c96 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 17ea43d59f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

read_document now asks the cancellation callback for every row, as the
record export's metadata pass asks it for every unit, so a client that
disconnects (or a preflight that expires) while a large table is being read
ends the export promptly instead of holding the read transaction and an
export slot until the table is finished. A test counts the calls (at least
one per stored row; previously about one per table) and proves a flip
inside a table ends the export before the response starts.

Refs #98

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@TusanHomichi
TusanHomichi merged commit 50be527 into main Oct 15, 2026
9 checks passed
@TusanHomichi
TusanHomichi deleted the claude/98-installation-export branch October 15, 2026 18:29
TusanHomichi added a commit that referenced this pull request Oct 15, 2026
…als (#145)

* test: one runtime test credential, and a guard against password literals

Integration tests no longer declare passwords: tests/support provides a
per-process password generated from OS randomness (plus wrong, fresh, and
too-short variants), the shared login and user helpers that 14 and 12 test
crates had each copied, and assertion messages that name no user. With no
literal there is nothing for CodeQL's hard-coded-credential and
cleartext-logging rules to flag in new test files (#126; recurred on #130
and #139).

tests/no_credential_literals.rs scans every test source and fails on a
password, passphrase, or secret literal in a binding, struct field, JSON key,
JSON-in-a-string, or a credential call, with its scan contract in the header,
an exact-path allowlist (upgrade_compat's argon2 0.5 fixture), and negative
controls for every shape it flags and every allowed shape it must not; against
the pre-change tests it reports 38 findings across 28 files.

Closes #126

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test: close the credential guard's review gaps

Independent review found no blockers. Follow-ups: upgrade_compat again
checks a one-character near miss of the fixture password, built at run time
(a verifier that ignored the last byte passed the previous version); a
sensitive binding is flagged for any non-empty literal in its initializer
(arrays, vec!, Some, match/if arms, closures), a ("password", "literal")
pair and macro/turbofish credential calls are caught, and sign-in helpers
are matched by more names; empty literals are exempt, so absence and
empty-password tests read naturally; the header lists every remaining miss
with its reason. The controls move to a 149-case corpus checked against the
header in both directions, the walk skips symbolic links, and an unreadable
file is named. Against the pre-change tests: 38 findings in 26 files.

Refs #126

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
This was referenced Oct 15, 2026
TusanHomichi added a commit that referenced this pull request Oct 15, 2026
A minor release under ADR 0022: the complete installation export (#130), the
web stack on SvelteKit 3 and Vite 8 (#140) with the browser floor it brings
(Chrome/Edge 111, Firefox 114, Safari 16.4), Rust 1.99 and SQLite 3.51
(#139), and doctor's migration verdict matching serve (#144, ADR 0029).
Upgrading from 0.2.0 runs no migration. Versions agree across Cargo and web
(tests/release_version.rs); the changelog, README, roadmap, and install guide
name 0.3.0.

Refs #146

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

export: one complete installation export an agency can leave with

2 participants