You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
work-unit: checkpoint storage — segment hardening and invariants #1548
tl;dr: Outcome A — ready for implementation. The remaining checkpoint segment work is mechanical: harden segment.rs error classification/write limits, add regression tests for each failure mode from #1211, and add explicit segment-recovery invariant coverage wiring for #1109.
Recommendation
Proceed with a single focused PR against crates/logfwd-io/src/segment.rs (+ tests + verification contract update). The current implementation already fixes some #1211 items, but still has concrete silent-failure paths and missing invariant coverage seams.
Findings (evidence)
OS/permission errors are still collapsed into NotASegment and then ignored in recovery
crates/logfwd-io/src/segment.rs:209, :219, :244 map errors to SegmentStatus::NotASegment(...).
crates/logfwd-io/src/segment.rs:735-740 only warns and ignores NotASegment entries.
Result: unreadable/corruptly-accessed .lchk files can be silently skipped during recovery.
SegmentWriter::create still accepts arbitrary header values
open() enforces version compatibility at parse time; this API still allows writing headers future open-path may reject.
Read/write size limit mismatch remains
Read cap exists: MAX_READ_DATA_SIZE at crates/logfwd-io/src/segment.rs:315 and checked in read_batches() (:318-327).
SegmentWriter::append (:463-489) does not pre-check cumulative segment payload against this same cap.
Unsupported header versions are still treated as NotASegment
Header parse failures flow to NotASegment at crates/logfwd-io/src/segment.rs:242-245.
During recovery this gets ignored (:735-740) instead of an explicit corrupt/unsupported segment error classification.
Invariant seam coverage for segment recovery is not explicitly tracked in Kani boundary contract
dev-docs/verification/kani-boundary-contract.toml has required/recommended seams, but no entry for crates/logfwd-io/src/segment.rs.
Open PR in adjacent integration surface
#1550 (fix(stats): preserve structured input accounting) touches input/framed/pipeline paths; low direct overlap with segment.rs, but rebase/conflict risk exists if this work also modifies pipeline wiring.
Verification
I ran:
cargo test -p logfwd-io segment -- --nocapture
Observed:
segment unit tests passed (15 passed, 0 failed), including:
corrupt_data_size_prevented_from_oom
truncated_segment_returns_invalid_data
recovery_deletes_incomplete
This confirms baseline behavior is stable before applying the remaining hardening changes.
Add pre-write size guard so cumulative data_size + ipc_buf.len() never exceeds read-side cap; fail write early with explicit InvalidData/InvalidInput error text.
crates/logfwd-io/src/segment.rs
recover_segments (:686+)
Treat new IoError as hard recovery error (return Err(...)), and classify unsupported-version header parse as corrupt/unsupported-segment (not silent ignore).
crates/logfwd-io/src/segment.rs tests (:789+)
Existing unit test module
Add regression tests listed below.
dev-docs/verification/kani-boundary-contract.toml
seam list
Add crates/logfwd-io/src/segment.rs seam status (recommended initially if no immediate pure extraction, or required if reducer/proofs are added in same PR).
2) Tests to write (same file unless noted)
recovery_permission_error_is_hard_failure
Pattern: existing recover_segments tests.
Assert: unreadable .lchk returns Err, not silent skip.
create_rejects_unsupported_header_version
Assert: SegmentWriter::create with bad version fails with InvalidInput.
create_rejects_unknown_flags
Assert: unsupported flags rejected at create-time.
Assert: writer refuses append once cumulative payload crosses cap.
unsupported_segment_version_classified_non_silent
Craft .lchk with valid magic but unsupported version.
Assert recovery does not route through silent NotASegment path.
3) Invariant coverage follow-through for #1109
If done in same PR: extract a small pure recovery-decision helper (classification + next-id computation) from recover_segments and add bounded Kani proofs for:
next_segment_id == max_seen_id + 1 for non-empty sets
next_segment_id == 1 when none
no replay of incomplete/corrupt classes
If not done in same PR: keep code changes above + add explicit follow-up issue linked from this work-unit.
4) Verification command set
cargo test -p logfwd-io segment -- --nocapture
python3 scripts/verify_kani_boundary_contract.py
just kani-boundary
just ci
Integrity filtering activated and filtered the following items during workflow execution.
This happens when a tool call accesses a resource that does not meet the required integrity or secrecy level of the workflow.
resource:search_pull_requests (search_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)
Activity
github-actions commentedon Apr 7, 2026
tl;dr: Outcome A — ready for implementation. The remaining checkpoint segment work is mechanical: harden
segment.rserror classification/write limits, add regression tests for each failure mode from#1211, and add explicit segment-recovery invariant coverage wiring for#1109.Recommendation
Proceed with a single focused PR against
crates/logfwd-io/src/segment.rs(+ tests + verification contract update). The current implementation already fixes some#1211items, but still has concrete silent-failure paths and missing invariant coverage seams.Findings (evidence)
OS/permission errors are still collapsed into
NotASegmentand then ignored in recoverycrates/logfwd-io/src/segment.rs:209,:219,:244map errors toSegmentStatus::NotASegment(...).crates/logfwd-io/src/segment.rs:735-740only warns and ignoresNotASegmententries..lchkfiles can be silently skipped during recovery.SegmentWriter::createstill accepts arbitrary header valuescrates/logfwd-io/src/segment.rs:431—pub fn create(dir: &Path, header: SegmentHeader) -> io::Result(Self).open()enforces version compatibility at parse time; this API still allows writing headers future open-path may reject.Read/write size limit mismatch remains
MAX_READ_DATA_SIZEatcrates/logfwd-io/src/segment.rs:315and checked inread_batches()(:318-327).SegmentWriter::append(:463-489) does not pre-check cumulative segment payload against this same cap.Unsupported header versions are still treated as
NotASegmentNotASegmentatcrates/logfwd-io/src/segment.rs:242-245.:735-740) instead of an explicit corrupt/unsupported segment error classification.Invariant seam coverage for segment recovery is not explicitly tracked in Kani boundary contract
dev-docs/verification/kani-boundary-contract.tomlhas required/recommended seams, but no entry forcrates/logfwd-io/src/segment.rs.Open PR in adjacent integration surface
#1550(fix(stats): preserve structured input accounting) touchesinput/framed/pipelinepaths; low direct overlap withsegment.rs, but rebase/conflict risk exists if this work also modifies pipeline wiring.Verification
I ran:
cargo test -p logfwd-io segment -- --nocaptureObserved:
segmentunit tests passed (15 passed, 0 failed), including:corrupt_data_size_prevented_from_oomtruncated_segment_returns_invalid_datarecovery_deletes_incompleteDetailed Action Plan (mechanical spec)
1) Files to modify
crates/logfwd-io/src/segment.rsenum SegmentStatus(~175+),SegmentFile::open(:206+)IoError { path, error }) and route metadata/open/read failures there; keep true non-segment magic inNotASegment.crates/logfwd-io/src/segment.rsSegmentWriter::create(:431)version == SEGMENT_VERSION, allowed flags mask). Returnio::ErrorKind::InvalidInputon invalid header values.crates/logfwd-io/src/segment.rsSegmentWriter::append(:463) +MAX_READ_DATA_SIZE(:315)data_size + ipc_buf.len()never exceeds read-side cap; fail write early with explicitInvalidData/InvalidInputerror text.crates/logfwd-io/src/segment.rsrecover_segments(:686+)IoErroras hard recovery error (return Err(...)), and classify unsupported-version header parse as corrupt/unsupported-segment (not silent ignore).crates/logfwd-io/src/segment.rstests (:789+)dev-docs/verification/kani-boundary-contract.tomlcrates/logfwd-io/src/segment.rsseam status (recommendedinitially if no immediate pure extraction, orrequiredif reducer/proofs are added in same PR).2) Tests to write (same file unless noted)
recovery_permission_error_is_hard_failurerecover_segmentstests..lchkreturnsErr, not silent skip.create_rejects_unsupported_header_versionSegmentWriter::createwith badversionfails withInvalidInput.create_rejects_unknown_flagsflagsrejected at create-time.append_rejects_payload_exceeding_max_read_data_sizeunsupported_segment_version_classified_non_silent.lchkwith valid magic but unsupported version.NotASegmentpath.3) Invariant coverage follow-through for
#1109If done in same PR: extract a small pure recovery-decision helper (classification + next-id computation) from
recover_segmentsand add bounded Kani proofs for:next_segment_id == max_seen_id + 1for non-empty setsnext_segment_id == 1when noneIf not done in same PR: keep code changes above + add explicit follow-up issue linked from this work-unit.
4) Verification command set
cargo test -p logfwd-io segment -- --nocapture python3 scripts/verify_kani_boundary_contract.py just kani-boundary just ciRelated Items
crates/logfwd-io/src/segment.rsdev-docs/verification/kani-boundary-contract.tomlNote
🔒 Integrity filtering filtered 7 items
Integrity filtering activated and filtered the following items during workflow execution.
This happens when a tool call accesses a resource that does not meet the required integrity or secrecy level of the workflow.
issue_read: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)issue_read: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)issue_read: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)issue_read: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)pull_request_read: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)search_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)pull_request_read: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)What is this? | From workflow: Issue Triage
Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.
strawgate commentedon Apr 7, 2026
Execution Owner: Codex
Objective
Complete #1548 by fixing checkpoint segment safety bugs (#1211) and encoding checkpoint invariants (#1109).
Scope lock
Implementation steps (in order)
AGENTS.md,DEVELOPING.md,dev-docs/VERIFICATION.md, issue bodies fix(checkpoint): segment storage has panic paths, OOM vector, and silent error masking #1211 and arch: property-based tests for checkpoint state machine at-least-once invariant #1109.Required verification
cargo test -p logfwd-iocargo test -p logfwdjust testjust cijust lint-allPR requirements
fix(checkpoint): segment safety hardening + invariants coverage (#1548)Fixes #1211,Fixes #1109,Refs #1548.Done checklist
strawgate commentedon Apr 7, 2026
Cloud task launched (Codex queue): task_e_69d57804fd94832e8998f2a1b784c00f (3 attempts).\nhttps://chatgpt.com/codex/tasks/task_e_69d57804fd94832e8998f2a1b784c00f
fix(core): harden checkpoint segment parsing invariants (#1548)
fix(core): harden checkpoint segment parsing invariants (#1548) (#1569)
strawgate commentedon Apr 8, 2026
Resolved by PR #1569 with linked leaf concerns addressed (#1211, #1109). Checkpoint segment hardening and invariants landed.