Repository navigation
Conversation
The shell-script tests replace the environment wholesale, so a bare `bash` resolved through the PATH they set for their fake binaries and reached macOS's /bin/bash 3.2. compute-token-usage.sh uses `mapfile`, a bash 4 builtin, so six tests exited 127 locally while passing on the ubuntu runners. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
tend-agent
left a comment
There was a problem hiding this comment.
The bash swap itself looks right — shutil.which resolves against the pytest process's PATH before any test replaces it, and nothing in the suite writes a fake bash that this would shadow.
One gap left against the macOS goal, though: _usage is the only helper in test_shared_steps.py that hardcodes its PATH instead of resolving the tool it needs, and compute-token-usage.sh shells out to jq. macOS ships no jq, and on Apple Silicon Homebrew installs to /opt/homebrew/bin, which /usr/bin:/bin:/usr/local/bin doesn't cover — /usr/local/bin is the Intel prefix, which is probably why the suite goes green on your machine. So on an arm64 Mac the token-usage tests still fail, one step later than mapfile did rather than not at all.
Suggestions inline. Happy to push them as a commit instead if you'd rather not hand-apply.
The reviewer's point: `_usage` was the one helper with a hardcoded PATH, and compute-token-usage.sh shells out to jq — so a machine whose jq sits outside /usr/bin fails one step past where mapfile did. Also assert BASH, matching the jq lookups' idiom. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Both suggestions are in on 7dda2c2, and your The red Both snapshots are new files added by #847, recorded against a base that has since moved twice. The
EvidenceReproduced on a detached worktree at Prompt-string provenance, run against main's history:
|
… stale snapshots jq 1.8 removed `_nwise`, so the outage-reconcile fake failed to page and the two reconcile tests saw nothing to delete. Slice by index instead; an empty list still pages as `[[]]`, the shape real `gh` returns. The local-setup regtests arrived recorded against a base that predated the #904 revert and #849, so their snapshots carried the prose prompt and the older mention comments. Re-recorded from the current render. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
The snapshots landed with #847, whose branch recorded them while #902's prose prompt was on Verified f02bd6f against current |
tend-agent
left a comment
There was a problem hiding this comment.
The _nwise replacement is faithful — I checked it against _nwise(100) on 0/5/100/200/250-element inputs and the page shapes match, including the empty case that both render as [[]]. Snapshots re-record clean here and the suite is green.
One gap left against the PR's own title, though: three fixtures still pin PATH to f"{bindir}:/usr/bin:/bin" while the script under test shells out to real jq, so the "off the CI image (jq)" half lands for _usage only. Correcting my earlier framing — I said _usage was the only helper asserting where a tool lives rather than asking. It was the only one hardcoding the whole PATH; three others assert jq's location just as firmly, they just prepend a bindir first.
gh_env→mark-notification-read.sh, which runsjq -r '.issue.number' "$GITHUB_EVENT_PATH"gate_env→review-gate.sh, which runsSTATE=$(echo "$PR_INFO" | jq -re '.state')on the happy pathtest_notifications_precheck_tolerates_transient_non_jsonintest_integration.py→notifications-check.sh, which runsecho "$NOTIFS" | jq -e .
The third is the clearest tell: notifications_env in test_shared_steps.py drives that same script and already resolves jq, under the comment # Both the fake gh and the script itself shell out to jq. So one suite covers notifications-check.sh both ways.
Verified rather than inferred this time — running mark-notification-read.sh under a PATH with the fake gh and coreutils but no jq gives mark-notification-read.sh: line 29: jq: command not found, exit 127. Same shape mapfile produced, one tool over.
The fix is the idiom already at the three fixtures below them:
jq = shutil.which("jq")
assert jq, "jq is required for these tests"
...
"PATH": f"{bindir}:{Path(jq).parent}:/usr/bin:/bin",test_integration.py needs import shutil added; test_shared_steps.py already has both imports. None of the three lines falls inside this diff's hunks, so there's nothing to hand you as an inline suggestion — happy to push it as a commit here if you'd rather it land with the rest of the portability work than as a follow-up.
…of six
The reviewer's point: gh_env, gate_env and the integration pre-check
test pinned PATH to {bindir}:/usr/bin:/bin while the scripts they drive
shell out to jq, so a box carrying jq outside /usr/bin fails one tool
past where mapfile did.
Rather than a fourth copy of the lookup, tests.tool_path(*fakes) builds
the PATH once and all six call sites use it. Resolved per call, so a
suite needing no jq doesn't require one.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Taken, and generalized rather than copied:
|
|
One leftover: the |
tend-agent
left a comment
There was a problem hiding this comment.
tool_path closes the gap generically — all six call sites route through it, and report_failure_env["PATH"].split(":")[0] in test_run_issue_reconcile_refuses_a_call_with_no_row still lands on bindir because fakes stay first. Suites are green here (test_shared_steps.py + test_integration.py, 90 passed).
Two comments the refactor left behind, both inline: # Both the fake gh and the script itself shell out to jq. in rate_limit_env and notifications_env annotated the shutil.which("jq") block that moved into tool_path's docstring. They now sit above the event/notifications file setup, which has nothing to do with jq.
They annotated the jq lookup that moved into tool_path's docstring, and were left sitting above unrelated fixture setup. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Both comments dropped — you're right that they were annotating the lookup, not the file setup they ended up above.
|
wt testfailed six tests on macOS: the shell-script tests replace the environment wholesale, so a barebashresolved through the PATH they set for their fake binaries and reached/bin/bash3.2.compute-token-usage.shusesmapfile, a bash 4 builtin, so those tests exited 127 locally while passing on the ubuntu runners.BASH = shutil.which("bash")joinsACTION_VERSIONingenerator/tests/__init__.pyand every shell invocation in the suite uses it,test_integration.py's generated-snippet run included — so the tests exercise the scripts under the bash version CI does._usagewas the one helper still hardcoding its PATH; it now resolvesjqthe way the three fixtures below it do, so the token-usage tests don't depend onjqsitting in/usr/bin.Merging main surfaced two more suites of the same kind, both fixed here:
jq1.8 removed_nwise, which the outage-reconcile fake used to page comments, so it returned nothing to reconcile andtest_report_failure_reconciles_a_racing_leg/…_past_the_first_pagefailed on any box with jq ≥ 1.8 (ubuntu ships 1.7.1). It now slices by index; an empty list still pages as[[]], the shape realghreturns.test_workflow_with_local_setup_regtest[review]and[mention]were red on main, not just locally: #847 recorded their snapshots against a base that predated the #904 revert and #849, so they carried the prose prompt and the older mention comments. Re-recorded from the current render.429 tests pass on macOS.