Repository navigation
test(bob-plugin): fold the shell-change checks into the #968 test - #1015
Conversation
setup removes our block from the old startup file only after the last step that can fail (on main since #968). Nothing tested that order. A re-run under a new shell that fails later must leave the old file routing Bob; with the cleanup mid-setup, the rollback left Bob routed nowhere while it said rolled_back=true. The test fails on that order. Found in the round-3 review of #973. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Vitaly Zabershinsky <[email protected]>
Signed-off-by: Vitaly Zabershinsky <[email protected]>
vz-ibm
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 2 (claude, user of @vz-ibm) | Claude Code 2.1.316 | offload-review skill, @vz-ibm's session | fresh | 2 of 2 | 1 of 2 | f513107f43ba |
blocking |
Verdict: blocking
The new test is correct and passes by reading. But a test on main already pins the same order. The PR's main reason ("No test covered the order") is wrong.
Findings
- bob-plugin/context-guru/scripts/test_bob_plugin.py:648 — the new test duplicates
test_a_failed_shell_change_keeps_the_old_rc_block(line 603), which is already onmain- What fails: the PR adds a second test for one concept, and its description says that no test covered the order. That claim is false, so the stated reason for the PR does not hold.
- Proof:
- The base (
407d9d1a) hastest_a_failed_shell_change_keeps_the_old_rc_blockat line 603. It came in with #968 (10329879). - That test does the same steps: setup under bash, then setup under
SHELL=/bin/zshwithPLUGIN.bob_hooks.installpatched to raiseOSError. - It asserts
code == 1,result=setup_failed, andROUTE.is_routed(self.rc). The last assertion is the one that catches the old mid-setup cleanup. If_remove_old_rc_blockran beforebob_hooks.install(bob_plugin.py:654),.bash_profilewould lose its block and line 616 would fail. - So the PR's "It fails on the old order" check proves nothing new: the old test fails on the old order too.
- The new test adds only three checks:
rolled_back=true, noold_rc_block=removed, and a pre-existing.zshrcthat stays byte-identical. The.zshrccase is a small real addition (it coversrc_created=Falsefor the new file, so the rollback must remove the block and keep the user's content).
- The base (
- Fix: add the three new assertions and the pre-existing
.zshrcto the test at line 603, and delete the new test. Correct the PR body: say the order was already pinned, and that this PR makes that test stricter. Or close the PR if the extra checks are not worth a change.
Non-blocking
- The old test at line 603 patches
bob_route.probe. Setup never reaches the probe there, becausebob_hooks.installfails first. The new test correctly leaves the patch out. If you merge the tests, you can drop that patch. - The merge commit
f513107fbrings no change to the PR diff. Onlytest_bob_plugin.pychanges (+19 lines).
What I checked
- The full diff
407d9d1a..f513107f(one file, 19 added lines), and both commits. _setup_changesinbob_plugin.py:602-672:_remove_old_rc_blockruns last, afterwrite_record(record)at line 663, inside thetry. A failure inbob_hooks.installgoes toundo.run()before the cleanup runs.Undo.run/_undo: the undo steps areconfig,service,rc,hooks.servicerewrites the old plist and waits until it is healthy (theFakeProxyis still running).hooksis a no-op becausehad["hooks"]is true.rccallsbob_route.remove(.zshrc, created=False). Sorolled_back=trueholds.bob_route.install/remove: install appendsblock(port), and remove takes out the same bytes, so.zshrcgoes back toalias ll='ls -l'\nbyte for byte.rc_candidates: under zsh the target is~/.zshrc. The test needs no macOS home and runs on the Linux CI runner.bobplugin_test.goruns the Python suite throughgo test ./bob-plugin/, so CI picks up the new test.- The PR has no behavior change and no data dependence. That is correct: the PR changes only a test.
- I did not run the tests (live tests are not approved).
vz-ibm
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 1 (claude, user of @vz-ibm) | Claude Code 2.1.316 | offload-review skill, @vz-ibm's session | fresh | 1 of 2 | 1 of 2 | f513107f43ba |
approve |
Verdict: approve
Findings
None.
Non-blocking
- The PR says "No test covered the order". That is not correct.
mainalready has
test_a_failed_shell_change_keeps_the_old_rc_block(bob-plugin/context-guru/scripts/test_bob_plugin.py:603on base,
added in #968). It runs the same scenario: bash setup, a zsh re-run,bob_hooks.installfails, and it asserts
ROUTE.is_routed(self.rc). That assertion also fails if the cleanup moves back to mid-setup. - The new test adds 3 real checks that the old test does not have:
- the user's own
.zshrcexists before the re-run and is byte-identical after the rollback; rolled_back=trueis in the output;old_rc_block=removedis not in the output.
- the user's own
- Proposal: correct the PR text ("an existing test covers the route; this one adds the user's
.zshrc
and the rollback report"). Or fold the 3 new checks into the existing test, so one scenario has one test.
Either is fine.
What I checked
- The full diff: one file, 19 added lines,
test_bob_plugin.py:648-665. The merge commitf513107fbrings in onlymain. _setup_changesinbob_plugin.py:602-696:_remove_old_rc_blockruns after the finalwrite_record, as the PR says.
Theexceptblock callsundo.run()and printsrolled_back.- The trace of the new test:
- The
.zshrcexists before the re-run. Sorc_createdis False, andhad["rc"]is False. bob_route.installappends our block to the.zshrc. Thenbob_hooks.installraisesOSError.Undo._undo("rc")callsbob_route.remove(.zshrc, created=False). That removes only our block, so the bytes
match the start again (bob_route.py:232-269).- The undo of "service" puts the old plist back.
wait_healthyreaches the FakeProxy, sookis True and the
output hasrolled_back=true. The exit code is 1. ~/.bash_profileis not touched, sois_routed(self.rc)is True.
- The
- The test does not patch
bob_route.probe. That is correct: the failure comes before the probe, and the first
setup runs under bash like other tests in the suite. - The Go test
bob-plugin/bobplugin_test.goruns this suite throughpython3 -m unittest, so CI picks the test up. - Data dependence: none. Behavior change: none (test only).
- I did not run the tests. Live tests are not approved for this review.
The test from #968 already pins the order: setup removes the old block only after the last step that can fail. The new test ran the same steps. Move its 3 extra checks into the #968 test and delete the new test: - the rollback reports rolled_back=true; - setup does not report old_rc_block=removed; - the user's own .zshrc is byte-identical after the rollback. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Vitaly Zabershinsky <[email protected]>
|
Reply to round 1 (reviewer 1 and reviewer 2). Reviewer 2, finding 1 (the new test duplicates the #968 test): fixed in 2f02885.
Reviewer 1, non-blocking (the PR text is wrong): fixed. The PR title and body now say that #968 already pins the order, and that this PR makes that test stricter. Reviewer 2, non-blocking (the |
vz-ibm
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 2 (claude, user of @vz-ibm) | Claude Code 2.1.316 | offload-review skill, @vz-ibm's session | resumed | 2 of 2 | 2 of 2 | 2f028859e39e |
approve |
Verdict: approve
My round-1 finding is fixed. The PR now changes one test, and it adds 6 lines. I found nothing new.
Findings
None.
Status of earlier findings
- Reviewer 2, finding 1 (the new test duplicates the #968 test): fixed in
2f028859.- The new test is deleted.
grepfinds notest_a_failed_rerun_after_a_shell_changeinbob-plugin/. test_a_failed_shell_change_keeps_the_old_rc_block(test_bob_plugin.py:603) now has the 3 extra checks:rolled_back=true, noold_rc_block=removed, and a byte-identical.zshrc.- The test writes
.zshrcafter the bash setup and before the zsh re-run. Sorc_createdis False for.zshrc, and the rollback must keep the user's content. My round-1 trace still holds:bob_route.remove(.zshrc, created=False)takes out only our block. - The PR body is corrected. It now says that #968 already pins the order, and that this PR makes that test stricter.
- The new test is deleted.
- Reviewer 1, non-blocking (the PR text is wrong): fixed. The title and body are correct now.
- Reviewer 2, non-blocking (the
bob_route.probepatch is not needed): not changed, by the author's choice. The reason is right: the patch was in the #968 test before this PR, and removing it is out of scope. It does no harm.
Non-blocking
- None.
What I checked
- Last review: round 1,
f513107f43ba3503186234fb82074ead6b47f39d, 2026-11-10T12:46:37Z - New commits read: 1 —
2f028859test(bob-plugin): fold the shell-change checks into the #968 test - Read in full: 2 reviews, 1 comment, 0 inline comments (from the three files)
- New items since my last review:
- Reviewer 1's round-1 review (12:46:40Z, approve, one non-blocking point on the PR text). I checked that the PR text is now corrected.
- The author's reply comment (12:56:36Z). I checked each of its 3 points against the commit and the PR body (see "Status of earlier findings").
- Commit
2f028859. I read the full diff and the whole changed test (test_bob_plugin.py:603-622).
- The net diff
407d9d1a..2f028859: one file,test_bob_plugin.py, 6 added lines, all in one test. No code changes. - The commit has a DCO sign-off and an
Assisted-By:line. - Behavior change: none. Data dependence: none. Both are correct for a test-only PR.
- I did not run the tests (live tests are not approved).
vz-ibm
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 1 (claude, user of @vz-ibm) | Claude Code 2.1.316 | offload-review skill, @vz-ibm's session | resumed | 1 of 2 | 2 of 2 | 2f028859e39e |
approve |
Verdict: approve
Findings
None.
Earlier findings
- Reviewer 2, finding 1 (the new test duplicates the #968 test): fixed.
2f028859deletes the new test.
It moves its 3 checks intotest_a_failed_shell_change_keeps_the_old_rc_block(test_bob_plugin.py:603-622).
The file now has notest_a_failed_rerun_after_a_shell_change...(grep count 0). - Reviewer 1, non-blocking (the PR text is wrong): fixed. The PR body now says that #968 already pins the order,
and that this PR makes that test stricter. - Reviewer 2, non-blocking (the
bob_route.probepatch is not needed): not changed, by the author's choice.
The reason is correct: the patch was there before this PR and does no harm. I accept it.
Non-blocking
- None.
What I checked
- Last review: round 1,
f513107f43ba3503186234fb82074ead6b47f39d, 2026-11-10T12:46:40Z - New commits read: 1 —
2f028859test(bob-plugin): fold the shell-change checks into the #968 test - Read in full: 2 reviews, 1 comment, 0 inline comments (from the three files)
- New items since my last review:
- Commit
2f028859: I read the full diff and the whole changed test. See below. - Author's comment at 2026-11-10T12:56:36Z (reply to round 1): I checked each of its 3 points. See "Earlier findings".
- The changed PR body: I read it in full. It is now correct.
- Commit
- The full diff
407d9d1a..HEADis now 6 added lines in one test. No product code changes. - The trace of the stricter test:
- The user's
.zshrcexists before the zsh re-run. Sorc_createdis False, andbob_route.check(.zshrc)passes. bob_route.installappends our block. Thenbob_hooks.installraisesOSError("disk full").- The undo of "rc" calls
bob_route.remove(.zshrc, created=False). It removes only our block, so the file is
alias ll='ls -l'\nagain, byte for byte. - The undo of "service" puts the old plist back. The FakeProxy still answers, so the output has
rolled_back=true. _remove_old_rc_blockdoes not run, so the output has noold_rc_block=line, and~/.bash_profilestill routes Bob.
- The user's
- On the old order (cleanup before
bob_hooks.install),_remove_old_rc_blockprintsold_rc_block=removedand
removes the bash block. So 2 assertions fail, as the author says. - Data dependence: none. Behavior change: none (test only).
- I did not run the tests. Live tests are not approved for this review.
Summary
This PR makes the test for a failed re-run after a change of login shell stricter. It adds 3 checks to the existing test from #968.
What we found
rolled_back=true.main(andv0.7.1) already has the right order. The cleanup runs last, afterwrite_record.test_a_failed_shell_change_keeps_the_old_rc_block, from feat(bob-plugin): add the IBM Bob plugin and its status bar #968. It checks that~/.bash_profilestill routes Bob..zshrc.What changed
test_bob_plugin.py, intest_a_failed_shell_change_keeps_the_old_rc_block:~/.zshrcbefore the zsh re-run.rolled_back=true;old_rc_block=removed;.zshrcis byte-identical after the rollback.How it was tested
bob_hooks.install, it fails onold_rc_block=removed.go test -count=1 ./bob-plugin/: OK.Data dependence
None.
🤖 Generated with Claude Code