Conversation
…rupts them Three file streams were closed by hand after their read or write, so any exception raised in between skipped the close and leaked the handle. On Windows a leaked handle keeps the file locked, and the pack folder the transfer was building could then neither be finished nor removed. - CipherUtils.addBootFileV2: the `ri` input and `bt` output streams - RawStoryTellerAsyncDriver.dumpSector: the sector dump output stream - UnofficialMetadataAdvice: the thumbnail cache output stream All three now use try-with-resources. No change on the happy path. The failure path cannot be reached from outside without a seam the production code does not need (a missing `ri` fails before the handle exists, a short one is ciphered without error), so this is a correctness fix by inspection. BootFileStreamLifecycleTest pins the nominal contract of addBootFileV2, which had no test: the shape of `bt`, its dependence on the device UUID, idempotence, and that both files are released on return. Closes #10 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
4 tasks
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.
What
Three file streams in
driverandagentwere opened and closed by hand. Any exception raised between the open and the.close()skipped the close and leaked the handle. On Windows a leaked handle keeps the file locked, so the very pack folder a transfer was building could then neither be finished nor removed.CipherUtils.addBootFileV2riinput +btoutputRawStoryTellerAsyncDriver.dumpSectorUnofficialMetadataAdviceAll three now use try-with-resources. No behaviour change on the happy path.
Why no failure-path test
There is no input that makes these methods fail between opening a stream and closing it: a missing/unreadable
rifails in theFileInputStreamconstructor before any handle exists, a shortriis ciphered without error, and a 64-byte write has no reachable failure short of a full disk. Reaching the leak would need a seam the production code does not need, so this is a correctness fix by inspection — the same status the repo already gives thegetFolderSizeclosing (seeFilesWalkResourceLeakTest#measuringFolderSizeReleasesTheTree).Tests
addBootFileV2had no test at all.BootFileStreamLifecycleTest(5 tests) pins its nominal contract so the rewrite cannot have altered it:btis the 64-byte ciphered prefix ofri, it depends on the device UUID, a second run overwrites rather than appends, a shortriyields a shortbt, and both files are deletable on return (the Windows-observable consequence of a closed handle).Locally:
mvn -B -Dskip.installnodeyarn=true -Dskip.yarn=true test→ 322 run, 0 failures, 0 errors, 39 skipped (the FAT32 opt-in classes).git diff --exit-codeclean after the build. Frontend untouched.Tracked in lgnap#10.
🤖 Generated with Claude Code