fix(nc-review): stop set -e killing the step on exactly one nit - #1214
Conversation
The review job failed on nanocoder#1213 after producing a correct verdict. The
agent wrote the file, the workflow read it, and then the step exited 1 having
printed nothing at all.
Cause:
COUNTS="...${N_NIT} nit$([ "$N_NIT" -gt 1 ] && echo s)"
With exactly one nit the inner test returns 1, the command substitution inherits
that status, and under `set -e` an assignment fails with the status of its
substitution. The step died there. Nothing appeared in the log because every
echo after that point is redirected into comment.md, so the failure looked like
a step that did nothing.
It only ever fires on N_NIT == 1. Runs with zero nits short-circuit at the guard
before reaching the substitution, which is why this survived six earlier runs.
Replaced with plain if-blocks, and the same shape applied to the CLAIMED notice
above it, which had the identical hazard.
Verified across eight count combinations: 0/0/0, 1/0/0, 0/1/0, 0/0/1, 0/0/2,
1/1/1, 2/3/4, 0/2/1. All exit 0 and render the expected heading, including
correct nit/nits pluralisation.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PZY52ePXLjwG9TaQgq2cHT
No changeset foundThis PR does not add a changeset, so it will not appear in the changelog or trigger a release. If the change is user-facing, add one: pnpm changesetPick a bump (patch / minor / major) and write the changelog entry in our usual voice ("Added X... Thanks to @you. Closes #123."), then commit the generated If this PR is docs-only or a chore that needs no release note, you can ignore this - or run |
nc-review: nothing to raiseFixes a real 🔴 blocking · 🟠 a reviewer would ask for a change · ⚪ optional Automated code review — correctness, security, design, tests, plus duplicates and scope. A human still decides; this is not a substitute for review and is not exhaustive. The required status checks separately cover lint, formatting, types, unused dependencies, the test suite and the build. This bot never merges. Maintainers can rerun with |
The review job failed on #1213 after producing a correct verdict. The agent wrote the file, the workflow read it, then the step exited 1 having printed nothing at all.
Cause
COUNTS="...${N_NIT} nit$([ "$N_NIT" -gt 1 ] && echo s)"With exactly one nit, the inner
[ 1 -gt 1 ]returns 1, the command substitution inherits that status, and underset -ean assignment fails with the status of its substitution. The step died on that line.Nothing appeared in the log because every
echoafter that point is redirected intocomment.md— so a hard failure looked like a step that silently did nothing.It fires only when
N_NIT == 1. Zero nits short-circuits at the[ "$N_NIT" -gt 0 ]guard before reaching the substitution, which is why this survived six earlier runs and then broke on the first PR that produced a single nit.Fix
Plain
ifblocks, with explicitnit/nitsselection. TheCLAIMEDmismatch notice above it had the identical hazard ([ ... ] && echo) and got the same treatment.Verified
Extracted the real step from the workflow and ran it against eight combinations —
0/0/0,1/0/0,0/1/0,0/0/1,0/0/2,1/1/1,2/3/4,0/2/1. All exit 0 with the expected heading and correct pluralisation.