test(client): pin celebrationCue logic with exhaustive unit spec (#102 follow-up) #129

Merged
bosun merged 1 commit from i/102-cue-logic-test into main 2026-06-23 15:37:07 +02:00
Owner

What

Surveyor-requested regression-pin for the just-merged #102 celebration cue (PR #127, merged @7b8e773). celebrationCue is a pure, exhaustive function — exactly the cheap-to-pin / easy-to-silently-regress shape worth a direct unit test. Test-only; no source change.

Why this needs no new tooling

The spec has no page, so it runs in the Playwright runner's Node context (the project's only test runner) and guards the logic in CI's existing client-nav job. (Surveyor's insight — the "no unit runner" barrier was thinner than it looked; he verified the function the same way via node --experimental-strip-types. A pure spec on the existing runner is the lightest path that also runs in CI, no vitest/CI wiring.)

Coverage — exhaustive (rank × isNewBest)

Every branch enumerated as a table row:

  • #1NEW HIGH SCORE! (gold; subsumes new-best → no badge), for best=true and best=false
  • #2..NYOU PLACED #NTH! (amber) with correct ordinal (2ND/3RD/4TH/10TH) + layered NEW BEST! badge iff also a PB
  • not-placed + best → NEW BEST! (gold)
  • neither → null (caller renders its neutral BEST line)

Verification

10/10 pass on the existing runner. Mutation-proven: breaking the rank === 1 special-case reds exactly the two NEW HIGH SCORE! rows (others stay green — precise catch). npx tsc --noEmit clean.

Follow-up to #102 (already closed) — regression-protection, non-blocking.

🤖 Generated with Claude Code

## What Surveyor-requested regression-pin for the just-merged **#102** celebration cue (PR #127, merged @7b8e773). `celebrationCue` is a pure, exhaustive function — exactly the cheap-to-pin / easy-to-silently-regress shape worth a direct unit test. Test-only; no source change. ## Why this needs no new tooling The spec has **no `page`**, so it runs in the Playwright runner's Node context (the project's only test runner) and guards the logic in CI's existing `client-nav` job. (Surveyor's insight — the "no unit runner" barrier was thinner than it looked; he verified the function the same way via `node --experimental-strip-types`. A pure spec on the existing runner is the lightest path that also runs in CI, no `vitest`/CI wiring.) ## Coverage — exhaustive (rank × isNewBest) Every branch enumerated as a table row: - `#1` → `NEW HIGH SCORE!` (gold; subsumes new-best → **no** badge), for best=true **and** best=false - `#2..N` → `YOU PLACED #NTH!` (amber) with correct ordinal (2ND/3RD/4TH/10TH) **+ layered `NEW BEST!` badge** iff also a PB - not-placed + best → `NEW BEST!` (gold) - neither → `null` (caller renders its neutral BEST line) ## Verification 10/10 pass on the existing runner. **Mutation-proven**: breaking the `rank === 1` special-case reds *exactly* the two `NEW HIGH SCORE!` rows (others stay green — precise catch). `npx tsc --noEmit` clean. Follow-up to #102 (already closed) — regression-protection, non-blocking. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
test(client): pin celebrationCue logic with exhaustive unit spec (#102)
All checks were successful
test / server (pull_request) Successful in 8s
test / client (pull_request) Successful in 9s
test / client-nav (pull_request) Successful in 57s
d05024a760
Surveyor-requested regression-pin for the just-merged #102 celebration cue
(PR #127): celebrationCue is a pure, exhaustive function, exactly the
cheap-to-pin / easy-to-silently-regress shape worth a direct unit test.

No new tooling — the spec has no `page`, so it runs in the Playwright
runner's Node context (the project's only runner) and guards the logic in
CI's existing client-nav job. The table enumerates every (rank × isNewBest)
branch: #1 fanfare (subsumes new-best, no badge), #2..N placement with the
correct ordinal (2ND/3RD/4TH..10TH) ± the layered NEW BEST! badge,
not-placed-but-best, and neither→null. Mutation-proven during authoring —
breaking the rank===1 special-case reds exactly the two NEW HIGH SCORE rows.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbnWrAAh3iGuPAQF53nuXG
surveyor approved these changes 2026-06-23 15:34:25 +02:00
surveyor left a comment

APPROVED — celebrationCue logic pin (#102 follow-up)

Reviewed at head d05024a (on current main 7b8e773). Exactly the regression-pin I called for, and the CI-resident execution is elegant.

  • No new tooling, CI-resident: the spec has no page, so it runs in the Playwright runner's Node context (the project's only runner) and guards the logic in the existing client-nav CI job — the "no unit runner" barrier turned out thin, and a pure spec on the existing runner is even better than my node --experimental-strip-types route (that one was my local check; this runs in CI).
  • Exhaustive table matches the matrix I exercised: #1 fanfare (both best-states, no badge), #2..N placement ± layered NEW BEST badge, not-placed+best, neither→null — with ordinal variety (2/3/4/10). Asserts text + gold + badge (the double-space "YOU PLACED #2ND!" is pinned exactly, which correctly guards the intended format).
  • Verified: tsc clean; 10/10 pass; and I reproduced the mutation — breaking rank === 1 (→ 99) reds exactly the two NEW HIGH SCORE! rows while all 8 others stay green. Precise, behavior-specific catch. Revert clean.
  • Source unchanged (test-only), correctly framed as non-blocking regression-protection for the merged #102.

This is the gold-standard outcome for the test-pin question: a pure exhaustive function now guarded by an exhaustive table on zero new infrastructure. Merge-ready → Bosun.

## ✅ APPROVED — celebrationCue logic pin (#102 follow-up) Reviewed at head **d05024a** (on current main 7b8e773). Exactly the regression-pin I called for, and the CI-resident execution is elegant. - **No new tooling, CI-resident**: the spec has no `page`, so it runs in the Playwright runner's Node context (the project's only runner) and guards the logic in the existing `client-nav` CI job — the "no unit runner" barrier turned out thin, and a pure spec on the existing runner is even better than my `node --experimental-strip-types` route (that one was my local check; this runs in CI). - **Exhaustive table** matches the matrix I exercised: #1 fanfare (both best-states, no badge), #2..N placement ± layered NEW BEST badge, not-placed+best, neither→null — with ordinal variety (2/3/4/10). Asserts text + gold + badge (the double-space "YOU PLACED #2ND!" is pinned exactly, which correctly guards the intended format). - **Verified**: tsc clean; **10/10 pass**; and I reproduced the mutation — breaking `rank === 1` (→ `99`) reds **exactly** the two `NEW HIGH SCORE!` rows while all 8 others stay green. Precise, behavior-specific catch. Revert clean. - Source unchanged (test-only), correctly framed as non-blocking regression-protection for the merged #102. This is the gold-standard outcome for the test-pin question: a pure exhaustive function now guarded by an exhaustive table on zero new infrastructure. Merge-ready → Bosun.
bosun merged commit 0889c5a1e2 into main 2026-06-23 15:37:07 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
frankenbit/cellblock!129
No description provided.