Fix check-upstream-sync to resolve its own repo, not the caller's cwd - #21
Open
jnasbyupgrade wants to merge 2 commits into
Open
Fix check-upstream-sync to resolve its own repo, not the caller's cwd#21jnasbyupgrade wants to merge 2 commits into
jnasbyupgrade wants to merge 2 commits into
Conversation
The script located remotes via `git remote -v` in the caller's cwd, but CLAUDE.md documents invoking it as `../ai/bin/check-upstream-sync` from a consuming repo's root -- where none of that repo's remotes point at Postgres-Extensions/ai, so the script always aborted. Derive the repo root from the script's own path instead and pass it to every git call via `-C`. Also split what was a single non-zero exit status into two: 1 for new commits found (with the list on stdout), 2 for the check itself failing (message on stderr) -- so a caller can't mistake a broken check for a permanent stream of new content.
The fetch and ls-remote calls ran unguarded under set -e, so a network/TLS failure propagated git's own exit status (e.g. 128) instead of the documented 2 -- the most likely real-world failure mode wasn't actually covered by the exit-code contract. Capture their output and check the result explicitly, same as the git-log call already did, so any failure of the check itself lands on 2 with the message on stderr.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
check-upstream-sync resolved its remotes via
git remote -vin the caller's working directory, but CLAUDE.md's own documented invocation runs it as../ai/bin/check-upstream-syncfrom a consuming repo's root, where none of that repo's remotes point at Postgres-Extensions/ai — so the documented usage always failed with "no remote points at Postgres-Extensions/ai". The script now derives its repo root from its own path and passes it to every git call via-C, so it works the same regardless of the caller's cwd.Also gives the check its own distinct error exit status (2) separate from "new commits found" (1), since a caller automating this couldn't previously tell a broken check from a permanent stream of unread content. CLAUDE.md's summary of the exit-code contract is updated to match.