Drop the hard jq dependency from gstack-gbrain-source-wireup - #2369
Open
benjaminberes-bp wants to merge 1 commit into
Open
Drop the hard jq dependency from gstack-gbrain-source-wireup#2369benjaminberes-bp wants to merge 1 commit into
benjaminberes-bp wants to merge 1 commit into
Conversation
check_source_state() shelled out to jq and hard-failed without it:
jq required for source state detection. Install jq (brew install jq) and re-run.
WARNING: gbrain wireup failed; run .../gstack-gbrain-source-wireup manually
Two separate problems.
The dependency itself was unnecessary. Its stated justification in the comment
-- "jq is documented as a dependency of gstack-gbrain-detect (transitive)" --
is stale: gstack-gbrain-detect is TypeScript and no longer shells out to jq, as
its own comments about "the bash version's jq" record. jq had become a hard
dependency of this one code path. Meanwhile bun already is a hard dependency of
gstack, several bins carrying a `#!/usr/bin/env bun` shebang, so parsing the two
identical `.sources[] | select(.id==$id) | .local_path` extractions with bun
removes a dependency instead of documenting one.
The advice was not actionable. `brew install jq` does not apply on
Windows/git-bash, where jq is absent by default. The practical effect there:
the gbrain wireup is skipped on every run, as a warning that the run continues
past. brain-restore carrying on is the right behaviour, but the breakage
becomes routine and therefore stops being read.
The loud-failure property that adversarial review asked for is kept -- without
a JSON parser we still cannot tell "absent" from "missing-tool" and would
falsely re-add an existing source, so check_source_state still probes and still
dies. Only the tool it probes for changed, to one that is already required.
Verified on Windows 11 / git-bash / bun 1.3.14: `--probe` returns identical
output with jq present and with jq removed from PATH, where it previously died.
The bun extraction was checked against jq on real `gbrain sources list --json`
output, plus the absent-id and invalid-JSON cases, which both yield "".
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
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_source_state()shells out tojqand hard-fails without it:Two separate problems.
The dependency is unnecessary
The comment justifying it is stale:
# jq is documented as a dependency of gstack-gbrain-detect (transitive)gstack-gbrain-detectis TypeScript and no longer shells out tojq— its owncomments refer to "the bash version's
jq -n" in the past tense. Sojqhadbecome a hard dependency of this one code path, for exactly two identical
extractions:
bunis already a hard dependency of gstack — several bins carry a#!/usr/bin/env bunshebang. Parsing the JSON with it removes a dependencyrather than documenting one.
The advice is not actionable
brew install jqdoes not apply on Windows/git-bash, wherejqis absent bydefault. The practical effect there is that the gbrain wireup is skipped on
every run, as a warning the run continues past.
brain-restorecarrying onis the right call, but the breakage becomes routine and stops being read.
What is preserved
The loud-failure property adversarial review asked for. Without a JSON parser
we still cannot distinguish absent from missing-tool, and would falsely
re-add an existing source — so
check_source_statestill probes and stilldies. Only the tool it probes for changed, to one that is already required.
Verification
On Windows 11 / git-bash / bun 1.3.14:
--probereturns byte-identical output withjqpresent and withjqremoved from
PATH, where it previously died.jqon realgbrain sources list --jsonoutput, plus the absent-id and invalid-JSONcases, which both yield
""as before.Happy to keep a
jqfast path if you would rather not add a bun call in a bashbin — but given bun is already required, this seemed like the smaller surface.