Repository navigation
feat(audit): the audit log as a striped db-core table with its own retention - #323
Merged
Merged
Conversation
…tention (#309) The audit is the table `audit` (ADR-024 point 3): `at`, `by`, `action`, `participant`, `user`, `token` and the rest as JSON, sorted by `at`, in `data/audit` or under `<FRANK_STORE>/audit`. FRANK_AUDIT_RETENTION_DAYS (400) drops whole days at the hourly compaction, apart from the sightings'. - The server is the one writer; a command that finds the table locked appends to `data/audit.spool`, which the server drains each tick and at shutdown. `frank serve` refuses a table another process holds. - `/v1/admin/audit` is one query with the admin's scope in the WHERE; the response is as before. - The JSONL days (files, or `audit/YYYY-MM-DD/` objects) are imported once, kept in `audit.jsonl/`; an import cut short goes on without duplicates. - `mcp_call` leaves the audit; the access line carries `tool` (point 6). - `frank token revoke` audits the token's 12 digits, not the prefix given. - rust-version 1.89 (File::lock); `make s3-column TABLE=audit`; specs 010, 011, 015, 020, README, deploy settings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… gate serve::maintain and audit::import_store were CCN 18 (gate 15). The audit's per-tick work moves to maintain_audit, the read-cache warm-up to warm_cache, and the store import to move_day_objects and store_text. No behaviour change; the MC/DC snapshot follows the moved lines. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
audit, sorted byat, indata/auditor under<FRANK_STORE>/audit(ADR-024 point 3). It has its own retention,FRANK_AUDIT_RETENTION_DAYS(default 400), apart from the sightings'. This supersedes ADR-019 point 3: one object per line in S3 is gone.frank user addthroughpodman exec) spools its line todata/audit.spool, and the server moves it in every minute and at shutdown. With the server stopped the command writes the table itself.frank serverefuses to start while another process holds the table./v1/admin/auditanswers from the table with the admin's scope in the SQLWHERE. MCP tool calls are reads: they leave the audit and the access log names the tool (tool).Changes
Added
crates/frank/src/audit.rs: the table, the spool, the scoped query and a one-time import of the JSONL days (files indata/audit/, oraudit/YYYY-MM-DD/objects in the store), kept inaudit.jsonl/and markedIMPORTED. An import cut short resumes without duplicates.FRANK_AUDIT_RETENTION_DAYS(CLI flag and env), in compose and the STACKIT module.make s3-column TABLE=auditreads the audit table (scripts/read-garage-column.sh).Changed
/v1/admin/auditis one query; the response is as before.mcp_callis no longer an audit line:frank::accessgets atoolfield (ADR-024 point 6).frank token revokeaudits the token's 12-digit prefix, not what was typed.rust-version1.85 → 1.89 (File::lockfor the spool).frank-core'sunhexusesis_multiple_of, which its MC/DC tests now name by the new snapshot id.docs/mcp.md,docs/sightings-storage.md.Fixed
Changelog
FRANK_AUDIT_RETENTION_DAYS, 400 days). Commands run beside the server no longer write the audit file directly. The existing JSONL audit days are imported once on start.Testing
cargo test --workspace --locked --features frank/tls: 376 passed, 0 failedmake test-mcdc: 48/48 decisions covered;make check-mcdc-freshcurrentcargo clippy --workspace --all-targets --features frank/tls -D warnings,cargo clippy -p frank-wasm --target wasm32-unknown-unknown,cargo fmt --check,make check-mvl-limit,make check-assurance(0 dead links)admins_manage_their_own_organisation_only)frank serveholds the table (a_command_next_to_the_server_spools_its_audit_line); a second server refused (serve_refuses_an_audit_table_held_by_another_process)s3-columntable selection checked with a stubcolumn-rs(URL and error paths)make s3-column TABLE=auditagainst a running Garage: not run (needsmake up); the table's read through column-rs is unverifiedRelated Issues
Related to #309
The open item is the live read above. Once it is run, the body can say
Closes #309.🤖 Generated with Claude Code