Files
PaperClipAI/doc/plans
Dotta c6a0cf4bce test(server): retire duplicated resolveShell darwin fallback row (#16639)
<!-- Write all pull request text in Simplified Technical English
(ASD-STE100): short sentences, one instruction per sentence, simple
approved vocabulary, and the active voice. -->

## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - The server prepares task workspaces in `workspace-runtime.ts`. One
helper, `resolveShell()`, picks the shell that workspace commands use.
> - `resolveShell()` computes its fallback with one two-arm ternary:
`"sh"` for win32, else `"/bin/sh"`. There is no separate darwin arm.
> - The tests for this helper had three unset-SHELL fallback rows:
linux, win32, and darwin. The darwin row repeated the linux row. It
observed the same ternary arm and asserted the same value through the
same code.
> - This pull request removes the duplicated darwin row. The linux row
keeps the non-win32 arm pinned.
> - The benefit is one less repeated registration per suite run and a
smaller platform matrix to maintain. No wall-time saving is claimed.

## Linked Issues or Issue Description

- No public GitHub issue exists for this cleanup. The underlying
problem: the `resolveShell` fallback tests registered two cases that
could not fail separately. Any change to the non-win32 fallback arm
breaks both rows at the same assertion. One row is enough to protect
that arm. The audit receipt in
`doc/plans/2026-10-17-workspace-runtime-resolveshell-test-audit.md`
records the full decision table, the deferred candidate, and the
retained rows.

## What Changed

- Deleted `falls back to /bin/sh on darwin when SHELL is unset` from the
`resolveShell (shell fallback)` describe in
`server/src/__tests__/workspace-runtime.test.ts` (6 test lines).
- Kept the win32 row (the only observation of the `"sh"` arm), the linux
row (the only needed observation of the `"/bin/sh"` arm), the
empty-string and whitespace-only rows (missing versus invalid input;
whitespace-only also pins the trim-before-check order), and the
missing-absolute-path row (the only observation of the `existsSync`
guard).
- Added the audit receipt
`doc/plans/2026-10-17-workspace-runtime-resolveshell-test-audit.md` with
evidence, commands, and the deferred candidate.
- Corrected the receipt's mutation-control record (head d99284b): the
`/bin/bash` control fails three retained rows, not one. See
Verification.
- Changed zero production lines, zero lockfile lines, and zero workflow
lines.

## Verification

- Focused owner run: `pnpm --filter @paperclipai/server exec vitest run
-t "shell fallback" src/__tests__/workspace-runtime.test.ts` (vitest
5.0.3, Node 25.9.0).
- Baseline before the edit: 9/9 passed.
- Candidate after the edit: 8/8 passed.
- Control (re-verified on head d99284b): the production fallback arm was
temporarily changed to `"/bin/bash"`. Exactly three retained rows then
failed with the same assertion (`expected '/bin/bash' to be '/bin/sh'`):
the linux unset row (the deleted darwin row's keeper), the empty-`SHELL`
row, and the missing-absolute-path row. The win32 rows and the
set-`SHELL` rows still passed (3 failed, 5 passed). This proves the
retained row carries the deleted row's failure sensitivity, and the
shared fallback value keeps two more independent guards. Production was
restored byte-exact (sha256
`335fd5332b4242ab0ff2a565323e27db48a69ddfb7bbd8d913e5148f79ff961b`
before and after), and the focused run passed 8/8 again.
- The full `workspace-runtime.test.ts` suite and the repo-wide
typecheck/test/build were not run locally; the isolated container cannot
finish the git-fixture cases inside their 15-second budgets (three
unrelated reconciliation cases time out at 15,000 ms on this host both
before and after the change). PR CI runs those lanes.
- PR CI on head d99284b: all 57 checks green (workflow run 39022073948;
the only non-success conclusions are conditional skips).

## Risks

- Low risk. The change is a six-line deletion inside one describe block,
plus a receipt correction. The only theoretical loss is a
darwin-specific fallback change, which does not exist today: darwin and
linux share the single non-win32 ternary arm. If a darwin-specific arm
is added later, that arm needs its own row and its own contract
decision.
- Open PRs #12658, #11753, and #16213 also touch
`server/src/__tests__/workspace-runtime.test.ts`, in different regions
(pnpm provisioning case, restart scoping, and worktree lock work). This
change edits only the `resolveShell` describe, so the hunks do not
collide.

> For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and
discuss it in `#dev` before opening the PR. Feature PRs that overlap
with planned core work may be redirected — check the roadmap first. See
[`CONTRIBUTING.md`](CONTRIBUTING.md).

## Model Used

- GLM, a large language model from Z.ai. Exact model ID: `z-ai/glm-5.3`
served through OpenRouter (`openrouter/z-ai/glm-5.3`). Context window:
the session that produced this change. Capabilities used: repository
file search and read, shell command execution, vitest runs, and a
production mutation control. No model context-window size beyond the
session is asserted because it was not disclosed to the agent.

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` /
`Closes: #` / `Refs #` OR (b) described the issue in-PR following the
relevant issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [ ] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [x] All Paperclip CI gates are green
- [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge
2026-10-19 07:28:35 -05:00
..