feat(parquet): add a durable audit sink over the §3.7 Parquet stream - #111
Conversation
`ParquetAuditSink` implements `ourios_core::audit::AuditSink` by writing each event to the RFC 0005 §3.7 audit Parquet stream: derive the event's audit partition (tenant + UTC day) and write a single-event file under `audit/tenant_id=…/year=…/month=…/day=…/`. `emit` is infallible per the trait, so a write failure increments a `write_failures` counter rather than propagating (surfaced there until the logging/metrics bootstrap can report it). Single-event files are fine for the low-volume compaction audit stream (≤ one event per compacted partition per sweep); batching and the §6.4 crash-ordering barrier arrive with the WAL-backed sink (RFC 0005 §3.7 / RFC 0008), which supersedes this best-effort pre-WAL persistence — the barrier is moot for compaction anyway (it commits before its audit event). Test: emit a compaction event, then read it back byte-for-byte from its derived audit partition via `AuditReader`. Verification: cargo fmt --all --check, clippy --all-targets --all-features -D warnings, cargo test -p ourios-parquet --all-features — all green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR adds ChangesAudit Event Persistence to Parquet
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
What
A durable
ParquetAuditSink(AuditSink) that persists audit events to the RFC 0005 §3.7 audit Parquet stream — the concrete sink theourios-serverbinary will hand the compactor (chosen over a NoOp placeholder so compaction audit events actually land on disk).Design
emit(event)derives the event's audit partition (tenant + UTC day, RFC 0005 §3.4) and writes a single-event file (audit/tenant_id=…/year=…/month=…/day=…/<uuid>.parquet) viaAuditWriter.emit(theAuditSinkcontract) → write failures bump awrite_failurescounter rather than propagating, surfaced there until the logging/metrics bootstrap (CLAUDE.md §6.3).RFC note
RFC 0005 §3.7 routes durable+ordered audit through the WAL (post-MVP). This sink provides best-effort persistence using the already-specified §3.7 format in the meantime — strictly better than the "in-memory until the WAL" status quo, without changing the format the WAL path will also write.
Test
Emit a compaction event → read it back byte-for-byte from its derived audit partition via
AuditReader.Verification
cargo fmt --all --check,cargo clippy --all-targets --all-features -D warnings,cargo test -p ourios-parquet --all-features— all green.🤖 Generated with Claude Code
Summary by CodeRabbit