Repository navigation
Keep the mode, refuse a short download, and stop claiming disk we do not use - #55
Merged
Merged
Conversation
…not use Three findings from an external conformance suite that states what a cloud file must answer and checks it through a real mount. Five of its eight invariants already passed, including the two hardest — the atomic save and the delete-during-upload races fixed in #52 and #51 both held up under a test that was not written by whoever fixed them. **`chmod +x` returned success and changed nothing.** setattr accepted a mode change and dropped it on the floor, and every attribute answer used a hardcoded 0o644. OneDrive has nowhere to store a mode, so it has to live here or not at all — and the exec bit is the one that matters, because losing it turns a working script into one that will not run with nothing to point at. Modes now live in their own table, the same way local-only symlinks already do, and are held in memory because every stat reads them and a stat must not become a query. The second half of that was worse and only showed up under the suite. The mode is keyed by item ID, and a created file's ID changes when the upload adopts the real OneDrive one. A `chmod +x` made before the upload landed was orphaned under a `_local_*` key nothing would ever ask about again, so it applied right up until the file finished uploading and then quietly stopped. The cache file already moves across adoption; the mode moves with it now. **A download that ended early was served as a short file.** The size of a placeholder comes from the delta pass. If the object changes on OneDrive before anyone reads it, the stream ends at a different length — and we took a completed download to mean a correct one. The reader had asked about a 4096-byte file and got 2048, with no error, and because getattr answers from the cache file the wrong size then became what stat reported from then on. A hydration now either brings what the row promised or it brings nothing: the partial copy is discarded, the row stays a placeholder so the next open tries again, and the reader gets EIO instead of a file that is quietly not what it asked for. **A placeholder claimed disk it was not using.** blocks was computed from size, so a cloud-only file reported a full allocation. That makes `du -sh ~/OneDrive` report the whole drive, which means on-demand cannot be seen to be working even when it is — and the cache-size policy reads those numbers. blocks now comes from the cached copy, and is zero when there is not one. Tests: two mount round trips, one for the mode across an adoption and one for the short download, which also asserts the placeholder's blocks. Both confirmed to fail before the corresponding fix. The five existing round trips and the rest of the suite are unchanged.
franzjeger
force-pushed
the
fix/conformance-5-3-5-7-5-8
branch
from
August 8, 2026 19:44
ea39b06 to
f400a0e
Compare
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.
Three findings from an external conformance suite that states what a cloud file
must answer and checks it through a real mount, a real sync engine and a real
database.
Worth saying first: five of its eight invariants already passed, including
the two hardest. The atomic-save and delete-during-upload races fixed in #52 and
#51 both held up under a test that was not written by whoever fixed them.
chmod +xreturned success and changed nothingsetattraccepted a mode change and dropped it, and every attribute answer useda hardcoded
0o644. OneDrive has nowhere to store a mode, so it lives here ornot at all — and the exec bit is the one that matters, because losing it turns a
working script into one that will not run, with nothing to point at.
Modes now live in their own table, the way local-only symlinks already do, and
are held in memory because every
statreads them and astatmust not becomea query.
The second half only showed up under the suite, and was worse. The mode is keyed
by item ID, and a created file's ID changes when the upload adopts the real
OneDrive one. A
chmod +xmade before the upload landed was orphaned under a_local_*key nothing would ever ask about again — so it applied right up untilthe file finished uploading, and then quietly stopped. The cache file already
moves across adoption; the mode moves with it now.
A download that ended early was served as a short file
A placeholder's size comes from the delta pass. If the object changes on
OneDrive before anyone reads it, the stream ends at a different length — and a
completed download was taken to mean a correct one. The reader asked about a
4096-byte file and got 2048, with no error, and because
getattranswers fromthe cache file the wrong size then became what
statreported from then on.A hydration now either brings what the row promised or nothing: the partial copy
is discarded, the row stays a placeholder so the next
opentries again, andthe reader gets
EIOrather than a file that is quietly not what it asked for.A placeholder claimed disk it was not using
blockswas computed fromsize, so a cloud-only file reported a fullallocation. That makes
du -sh ~/OneDrivereport the whole drive — on-demandcannot be seen to be working even when it is — and the cache-size policy reads
those numbers.
blocksnow comes from the cached copy, and is zero when thereis not one.
Tests
Two mount round trips: one for the mode across an ID adoption, one for the short
download, which also asserts the placeholder's blocks. Both confirmed to fail
before the corresponding fix (
git stashthe two source files, run, watch themgo red). The five existing round trips and the rest of the suite are unchanged —
137 tests green.
Where the suite lives
https://github.com/franzjeger/HydrationAPI — the invariants are written against
a trait that knows nothing about any implementation, so they outlive the
architecture.
cargo test -p adapter-onedrive-referenceruns them against thisclient. Against this branch: 8 passed, 0 failed.
🤖 Generated with Claude Code