Conversation
Validates the FIRST API with a minimal crash-consistency test: - Append-only log with 2 writes + fsync - 3 explicit crash points - Prefix-consistency invariant check Closes #16
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 05a128cfde
ℹ️ 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".
| // INVARIANT: Records are prefix-consistent | ||
| // Either: [], ["RECORD1"], or ["RECORD1", "RECORD2"] | ||
| // Never: ["RECORD2"] alone (would violate append-only semantics) | ||
|
|
||
| match records.as_slice() { | ||
| [] => { /* Nothing persisted - fine */ } | ||
| ["RECORD1"] => { /* Partial - fine */ } | ||
| ["RECORD1", "RECORD2"] => { /* Complete - fine */ } |
There was a problem hiding this comment.
Enforce durability after fsync crash point
The invariant currently allows [] or "RECORD1" even when the crash happens at the explicit after_fsync point. At that point fsync() has returned, so the log should be fully durable under FIRST’s model; accepting empty/partial states will let durability regressions (e.g., missing/ignored fsync) pass undetected. Consider using crash_info.label (or point id) to require "RECORD1","RECORD2" when the crash is at after_fsync.
Useful? React with 👍 / 👎.
Use crash_info.label to differentiate expected states: - Before fsync: any prefix is acceptable - After fsync: both records MUST be present Addresses review feedback on #23
Use crash_info.label to differentiate expected states: - Before fsync: any prefix is acceptable - After fsync: both records MUST be present Addresses review feedback on #23
Summary
Adds the canonical example test to validate the FIRST API is clean and usable.
Changes
tests/canonical_append_log.rswith:Verification
cargo fmt -- --check✅cargo clippy -- -D warnings✅cargo test --test canonical_append_log✅ (1 test passes)Closes #16