Skip to content

feat(audit): add persistent AuditLog storage foundation - #458

Merged
jscott3201 merged 2 commits into
devfrom
codex/pr-0108a-audit-log-persistence
Aug 30, 2026
Merged

feat(audit): add persistent AuditLog storage foundation#458
jscott3201 merged 2 commits into
devfrom
codex/pr-0108a-audit-log-persistence

Conversation

@jscott3201

Copy link
Copy Markdown
Owner

Summary

  • move dependency-neutral Audit notification/query/record models into bacnet-types and reusable constructed codecs into bacnet-encoding, while preserving the existing bacnet_services::audit paths and wire behavior
  • add an object-owned AuditLogPersistence port plus a concrete two-slot, versioned, checksummed file backend
  • persist retained typed records, sequence identities, capacity, Enable, and Total_Record_Count as one coherent snapshot
  • commit and synchronize prospective state before replacing observable memory; fall back only from recoverable corruption and fail closed on I/O, incompatible schema/identity, or divergent same-generation slots
  • enforce BACnet Audit Log count/wrap/status rules, keep Record_Count read-only, and require explicit Rust/Python per-object storage configuration

Standard and scope

This is the persistence-first foundation required by ANSI/ASHRAE 135-2020 §3.1 and §12.64. It establishes restart-safe object state and the dependency boundary needed by the later query slice.

It deliberately does not add AuditLogQuery dispatch, notification ingestion, authorization, replay, automatic migration/repair, multi-process locking, or public conformance claims. Portable power-loss behavior is not claimed beyond successful slot-file synchronization.

Compatibility

  • AuditLogObject::new now requires an injected persistence backend.
  • Python add_audit_log now requires an explicit storage_path.
  • the legacy description-only Audit record is replaced by the typed BACnet Audit record model.

Validation

Final-head checks:

  • cargo test -p bacnet-objects audit --locked — 14 passed
  • cargo fmt --all -- --check
  • cargo check -p bacnet-objects --tests --target x86_64-pc-windows-gnu --locked
  • git diff --check

Implementation-pass checks (the subsequent bounded repair touched only Audit object/persistence code and reran its focused suite):

  • cargo test -p bacnet-types audit --locked
  • cargo test -p bacnet-encoding audit --locked
  • cargo test -p bacnet-services audit --locked
  • cargo test -p bacnet-server wpm_rollback_contract --locked
  • cargo check -p rusty-bacnet --tests --locked
  • cargo clippy --workspace --exclude rusty-bacnet --all-targets --locked
  • cargo test --workspace --exclude rusty-bacnet --locked
  • conformance-doc, file-size, and no-secret checks

Hosted Windows runtime qualification remains required because this slice adds a concrete filesystem backend.

Refs #345

@jscott3201

Copy link
Copy Markdown
Owner Author

Final gate record for head 5f9ff36: holistic and dataflow immutable reviews PASS; lean dev CI PASS; supplemental draft PR #459 PASS on Windows, macOS, Ubuntu, MSRV, Clippy, Rustfmt, Cargo Deny, file-size, and no-secret checks. Supplemental Cargo Audit found pre-existing RUSTSEC-2026-0258 in unchanged h2 0.4.15; owner authorized merge of this dependency-neutral PR with an immediate dedicated h2 0.4.16 follow-up. PR #459 was closed without merge.

@jscott3201
jscott3201 merged commit dc64790 into dev Aug 30, 2026
32 of 33 checks passed
@jscott3201
jscott3201 deleted the codex/pr-0108a-audit-log-persistence branch August 30, 2026 02:06
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.

1 participant