feat(audit): emit Create audit row on mileage entry creation #284
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/pms-315-mileage-create-audit"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Adds the Create audit row to
create_mileage_entry, the one create path the PMS-318 sweep could not cover becausemileage_tracking(PMS-315, PR #277) merged to main only after the sweep branch was cut.create_mileage_entrynow takes theAuditCtx(threaded from its route handler) and, inside the existing transaction, snapshots the inserted row viato_jsonband callsaudit_write(action=Create, "mileage_entries", before=NULL, after=row)before commit. A rollback drops both the entry and its audit row; the change-history viewer surfaces the create event with no client change.Tests
create_mileage_entrydirectly now pass anAuditCtx.create_mileage_entry_writes_create_audit_row: asserts the create audit row is entity-scoped, has nobeforesnapshot, captures the row inafter, and records the ctx user as actor.Verification
cargo fmt --all --check,cargo clippy --all-targets -- -D warnings,cargo check --all-targets,cargo test --lib(168 passed) all green via the local toolchain. The Postgres-backed integration tests run in CI.Note
The broad sweep across the other 12 modules is in a separate PR (PMS-318). This PR is the mileage tail of the same effort.
#PMS-318