Repository navigation
fix: drop previous .old before logger rotation rename (Windows-safe) - #555
Merged
Merged
Conversation
Contributor
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-555Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr555.tgz
npm install -g packageThis comment is automatically updated on each push. |
This was referenced Sep 5, 2026
Merged
Merged
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.
Split out of PR#277 per maintainer decision: only the one production-impacting fix from #276 is kept; the debug-dump GC and launcher tmplog sweep are dropped (debug-only concern / tmpdir hygiene).
Problem (#276, item ③):
openStreamrotatesbili.log→bili.log.oldwithrenameSyncwithout removing an existing.oldfirst. On POSIXrenameoverwrites, so rotation works and at most one generation survives. On WindowsrenameSynccannot overwrite an existing target — it throws, the surroundingcatchswallows it, and rotation silently never happens:bili.loggrows unbounded for the life of the install.Fix:
try { unlinkSync(file + ".old") } catch {}immediately before the rename. Windows-safe (target can't pre-exist), and on POSIX it makes the ≤1-generation guarantee explicit instead of relying on overwrite semantics.Test:
tests/logger-rotate.test.ts— writes two generations past MAX_BYTES through the real logger and asserts exactly one.oldexists and the fresh log is post-rotation.Pre-flight: typecheck ✓ · logger tests 18/18 ✓ · build ✓.