Walk a share in the order the resume position is read in (#189) - #199
Merged
icebergai-review-bot[bot] merged 1 commit intoAug 19, 2026
Merged
Conversation
A reclaimed file-share task could skip files and report the scope clean. `fetch` resumes by dropping every entry whose key sorts at or before the stored position, which is only sound if the walk hands files over in that same order. It did not. `_walk` yielded a directory's own files as it scanned the listing and merely *pushed* subdirectories, so every file in a directory went out ahead of everything beneath a subdirectory sorting before them — and within the directory they went out in reverse, since the loop iterated the reversed batch that the stack was to pop in order. With `a/x.txt`, `b.txt`, `m.txt`, the walk delivered `m.txt`, `b.txt`, `a/x.txt`. An attempt reclaimed after `b.txt` re-delivered `m.txt` and skipped `a/x.txt` — which held an AWS key — with coverage counting the root complete. Silent coverage loss is the worst way this scanner can be wrong. Files are now stacked alongside directories, so both take one order: a subdirectory's subtree is walked before the siblings that sort after it. And the position is compared segment by segment rather than as a joined string, because `/` (0x2F) sorts after `.` (0x2E) — `"a/b" > "a.txt"` as strings while the walk yields `a/b` first, so comparing whole keys would have dropped `a.txt` on resume, reintroducing the same class of bug in a different shape. Checkpoint version 1 -> 2: a stored `1` position names a place in an order this engine does not walk, so it is discarded and the root re-read. Re-reading costs a pass; misreading costs coverage. Verified across 300 randomly generated trees over adversarial names (`a`, `a.txt`, `a.b`, `a-b`, `a_`, `a~`), resuming from every cut point of every tree: no non-ascending order and no resume that skipped or repeated. The conformance kit's `assert_checkpoint_resume` — built for exactly this and never invoked here, though Confluence and Jira both call it — now runs against a nested fixture, and reports the old behaviour as "2 unit(s) skipped, 1 re-yielded". Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sohE85sRDt6t2w3936rGJ
There was a problem hiding this comment.
Verdict
APPROVE
Completed bounded review across 1 immutable scope(s). No actionable findings in the supplied change.
Scope health
Convergence: healthy. Review mode: initial.
Recommended action: CONTINUE_INCREMENTAL.
- No escalation signals.
Prior findings
| Finding | Status |
|---|---|
| — | No prior finding state |
New findings
No new findings.
Fix-induced regressions
- None evidenced.
Uncertainty
- No material uncertainty recorded.
Validation
- Reviewed the exact supplied diff and exact-head connector context.
- Verified the revised depth-first traversal order matches segment-wise checkpoint comparison and that v1 checkpoints restart safely.
Residual risks
- None identified.
icebergai-review-bot
Bot
deleted the
claude/codebase-review-cleanup-ovlli4
branch
August 19, 2026 22:23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #189.
A reclaimed file-share task could skip files and report the scope clean — silent coverage loss, the worst way this scanner can be wrong.
The defect
fetchresumes by dropping every entry whose key sorts at or before the stored position. That is only sound if the walk hands files over in that same order, and it did not:_walkyielded a directory's own files while scanning the listing and merely pushed subdirectories, so every file in a directory went out ahead of everything beneath a subdirectory sorting before them — and within the directory they went out in reverse, since the loop iterated the reversed batch the stack was meant to pop in order.Reproduced against merged
main, witha/x.txt(holding an AWS key),b.txt,m.txt:The fix
/(0x2F) sorts after.(0x2E), so"a/b" > "a.txt"as strings while the walk yieldsa/bfirst — comparing whole keys would have droppeda.txton resume, reintroducing the same class of bug in a different shape. There is a test for exactly these names.1→2. A stored1position names a place in an order this engine does not walk, so it is discarded and the root re-read. Re-reading costs a pass; misreading costs coverage.Validation
/-vs-.ordering trap, and the discarding of a1checkpoint.assert_checkpoint_resumeexists for precisely this defect and was never invoked here, though Confluence and Jira both call it — Fileshare checkpoint resume can silently skip files: walk order does not match the resume comparison #189 called that out as the reason the suite missed the bug. It now runs against a nested fixture, and against the old code it reports: "resuming from a published checkpoint did not continue where it left off (2 unit(s) skipped, 1 re-yielded)".a,a.txt,a.b,a-b,a_,a~), resuming from every cut point of every tree: zero non-ascending orders, zero resumes that skipped or repeated.ruff/ruff format/mypy/make docs-checkclean; full suite 1944 passed, 2 skipped (the two permission-bit tests, correctly skipped as root here; CI runs them).Docs
docs/connectors.mdsaid the walk was "sorted at every level" — true of each individual listing, and yet the order was still wrong, which is roughly the ambiguity the bug hid behind. It now states the actual guarantee (one order across the root), the segment-wise comparison and why, and the version bump. CHANGELOG gains a Fixed entry.Operator note
No action required. In-flight
1checkpoints are discarded automatically, costing one re-read of the affected root. Findings already stored are unaffected — this changes only the order files are handed over in, not their identity.🤖 Generated with Claude Code
https://claude.ai/code/session_012sohE85sRDt6t2w3936rGJ
Generated by Claude Code