Repository navigation
fix(sim-cli): take over a stale source lock whose owner file was left empty or cut short - #10300
Merged
Merged
Conversation
… empty or cut short isStaleLock read owner.json with .then(JSON.parse, () => null), whose rejection handler never sees a throw from JSON.parse. A command that died between writeFile creating owner.json and filling it left a lock every later command crashed on with a raw SyntaxError, never reaching the age rule; a command reading the file mid-write crashed the same way instead of being refused as busy. A malformed owner now counts as unrecorded, so the 60-second age rule decides.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
[Medium impact] The PR appears safe to merge. SummaryMakes
Reviews (1) · Last reviewed commit: "fix(sim-cli): take over a stale source l..." · Reviewed by Greptile |
This branch was previously deployed
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.
Summary
isStaleLockread the source directory lock'sowner.jsonwith.then((text) => JSON.parse(text), () => null). A rejection handler in the same.thennever sees an error thrown by the success callback, so a malformed owner file threw a rawSyntaxError:writeFilecreatingowner.jsonand filling it, every later source command in that directory crashed. None of them reached the 60-second rule for a lock with no recorded owner, and the "remove .sim/command.lock" hint never showed.SOURCE_DIR_BUSY, exit 10).A malformed owner now counts as unrecorded, so the age rule decides. A stale lock is taken over; a fresh one is busy.
This came up as a Greptile finding on #10299.
Testing
SyntaxError.tsc, biome,check:comment-hygieneandcheck:test-patternspass.