fix: defer getWorkingTreeState call and clean up process exit handling#415
Open
fix2015 wants to merge 1 commit into
Open
fix: defer getWorkingTreeState call and clean up process exit handling#415fix2015 wants to merge 1 commit into
fix2015 wants to merge 1 commit into
Conversation
- moved getWorkingTreeState() below the early return checks in resolveReviewTarget() — it was running 3 git commands that got thrown away whenever --base or --scope was specified - replaced process.exit(1) with process.exitCode = 1 in the session lifecycle hook so stderr output actually has time to flush - deduplicated nowIso() — was defined identically in both state.mjs and tracked-jobs.mjs, now state.mjs imports it from tracked-jobs
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.
A few things I noticed while reading through the code:
resolveReviewTarget()was callinggetWorkingTreeState(cwd)right at the top, which runs 3 git commands — but if--baseis provided, it returns immediately without ever using the result. moved the call down to just before it's actually needed, so those git commands don't run for nothingprocess.exit(1)in its catch handler, which kills the process before stderr has time to flush. the main companion script already usesprocess.exitCode = 1correctly, so matched the hook to the same patternnowIso()was defined identically in bothstate.mjsandtracked-jobs.mjs— consolidated to a single import from tracked-jobs