Skip to content

Cover the pin-shortcut run path and the job self-improvement footer - #962

Merged
selfcontained merged 1 commit into
mainfrom
agt_a23eceb47faa/job-test-enforcer-44afdc14
Aug 16, 2026
Merged

Cover the pin-shortcut run path and the job self-improvement footer#962
selfcontained merged 1 commit into
mainfrom
agt_a23eceb47faa/job-test-enforcer-44afdc14

Conversation

@selfcontained

Copy link
Copy Markdown
Owner

Recurring test-health run. Local suite was green on the first pass (28th consecutive), so the whole run went to the queued next_focus coverage gap.

Suite status

Lane Result
pnpm run check pass
pnpm run format pass on a warm tree (#942's .prettierignore fix still holding)
pnpm run test server 162 files / 2735 tests, web 912, ext 60, scripts 4
pnpm run test:e2e 180 passed / 12 skipped
pnpm run test:e2e:live 11 passed in 23.3s, zero leaked e2e-* tmux sessions (19th consecutive)
pnpm run finalize:web pass

CI scan (gh run list --limit 50): 49 success / 1 failure. The failure is the Release workflow's own origin/main advanced after smoke tests merge-race guard on v0.33.12 from 2026-08-13 — already triaged in a prior run, not a test failure and not a flake. No new flakes; the brain flake list stays empty (6th consecutive run).

Coverage added

Three zero-coverage surfaces, all reached through the queued focus area:

  • useRunPinShortcut (apps/web/src/hooks/use-pin-shortcuts.ts) had no unit coverage at all. It is a write into a live agent session — the server resolves the pin's prompt and types it into the terminal. The E2E suite proves the button reaches the endpoint once; the URL shape, the POST, and the label/error toast branches are only checkable at this level.
  • resolvePinShortcutIcon (apps/web/src/lib/pin-shortcut-icons.ts) was covered for its name allowlist by the existing server-side lockstep test, but not for resolution. The lookup is an own-property check specifically so inherited keys fall through to the fallback — without it, an agent passing "constructor" resolves to something that is not a component and throws during render.
  • buildSelfImprovementGuidance's job branch (apps/server/src/shared/self-improvement-prompt.ts) had no assertions anywhere. jobs/service.ts builds its prompt in a module-private function, so nothing else in the repo checks that a self-improving job is told to call update_job with its own name and directory. The template branch already reaches three suites through its caller and is deliberately not duplicated here.

No product code changed. No product bugs found, no Linear tickets filed.

Mutation battery

21 mutants, 19 killed. Two survivors, neither a test gap:

  • resolvePinShortcutIcon's name && truthiness guard is unobservable — Object.hasOwn already rejects undefined (coerced to the absent key "undefined") and "". Recorded as product cleanup, not missing coverage.
  • Splitting the update instruction across two lines changes guidance formatting rather than any contract. Protecting it meant pinning a 155-char prose string that the self-improvement flow is itself meant to be able to reword, so it was deliberately left unprotected.

Review round

One general review agent inspected this run's diff and returned five actionable items, all applied:

  1. Deleted a tautological loop asserting resolvePinShortcutIcon(k) === PIN_SHORTCUT_ICONS[k] for every own key — that restates the implementation, and the typeof companion was already guaranteed by the satisfies Record<string, LucideIcon> annotation.
  2. Dropped the prose-pinned one-line assertion (see the second surviving mutant above).
  3. Dropped the template-branch test — the review found it already covered by template-launch-prompt.test.ts, templates/service.test.ts, and mcp-handlers.test.ts. Re-running the battery confirmed nothing was lost: the templateId mutant is still killed by the existing suites.
  4. Dropped three assertions that certified react-query rather than the hook (toHaveBeenCalledTimes(1) after a single mutate, and the two "the other toast didn't fire" cross-checks).
  5. Fixed a misattributed comment — apps/web pins vitest 2.1.9, and restoreAllMocks has never reset module-factory vi.fn()s in either major, so the justification now names the actual reason rather than a version.

🤖 Generated with Claude Code

Three zero-coverage surfaces, all reached through the queued next_focus:

- useRunPinShortcut had no unit coverage at all. It is a write into a live
  agent session — the server resolves the pin's prompt and types it into the
  terminal — so the request it builds and the toast each outcome produces are
  worth pinning. The E2E suite proves the button reaches the endpoint once;
  the URL shape, the POST, and the label/error branches are only checkable
  here.

- resolvePinShortcutIcon was covered for its name allowlist (by the existing
  server-side lockstep test) but not for resolution. The lookup is an
  own-property check specifically so inherited keys fall through to the
  fallback; without it "constructor" resolves to something that is not a
  component and throws during render.

- buildSelfImprovementGuidance's job branch had no assertions anywhere.
  jobs/service.ts builds its prompt in a module-private function, so nothing
  else in the repo checks that a self-improving job is told to call update_job
  with its own name and directory. The template branch already reaches three
  suites through its caller and is not duplicated here.

Mutation battery: 21 mutants, 19 killed. Two recorded survivors, neither a
test gap — the `name &&` guard in resolvePinShortcutIcon is unobservable
(Object.hasOwn already rejects undefined and ""), and splitting the update
instruction across two lines changes guidance formatting rather than any
contract, which is not worth pinning the copy to protect.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@selfcontained
selfcontained merged commit 57d82b5 into main Aug 16, 2026
1 check passed
@selfcontained
selfcontained deleted the agt_a23eceb47faa/job-test-enforcer-44afdc14 branch August 16, 2026 02:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant