Skip to content

test(web): exhaustive match classification truth table and mixed e2e - #41

Merged
iskhakovt merged 3 commits into
mainfrom
test/exhaustive-match-classification
Apr 13, 2026
Merged

iskhakovt merged 3 commits into
mainfrom
test/exhaustive-match-classification

Conversation

@iskhakovt

@iskhakovt iskhakovt commented Apr 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Add exhaustive 5×5 rating truth table (25 pairs, null timing) and timing matrix (36 combos for the yes/willing quadrant) to classifyMatch unit tests — documents every (ratingA, ratingB) → matchType cell as a 2D array
  • Rework the "mixed answers" e2e test: Alice and Bob now use different rating arrays so match, possible, both-maybe, and fantasy all appear on the same results page (previously both answered "maybe" → only both-maybe)
  • Add offset parameter to answerQuestionsCycling helper for shifting the starting index

Test plan

  • pnpm vitest run packages/web/src/lib/classify-match.test.ts — 100 tests pass (was 39)
  • pnpm test:e2e -- e2e/results.spec.ts — 4/4 e2e tests pass
  • Pre-commit hooks pass (biome, typecheck)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Enhanced test coverage for match classification with varied rating combinations to verify multiple match types are produced correctly.

Add a 5×5 rating truth table (25 pairs) and a timing matrix (36 combos)
to classify-match unit tests. Rework the "mixed answers" e2e test so
Alice and Bob use different rating arrays, producing match/possible/
both-maybe/fantasy on the same results page. Add offset param to
answerQuestionsCycling helper.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Apr 13, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 23346fdb-eb5c-49a2-bc4d-3aed716e5ebd

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The pull request adds an optional offset parameter to the answerQuestionsCycling helper function, refactors an e2e test to use deterministic per-screen rating sequences for varied match-type coverage, and introduces comprehensive exhaustive test coverage for the classifyMatch function via programmatically-generated null-timing and timing-matrix test blocks.

Changes

Cohort / File(s) Summary
Test Helper Enhancement
e2e/helpers.ts
Added optional offset parameter (default 0) to answerQuestionsCycling to allow control over the starting index of the rating-cycling sequence.
E2E Test Refactoring
e2e/results.spec.ts
Replaced uniform single-rating approach with deterministic per-screen rating arrays for Alice and Bob; updated assertions to verify all four match types (match, possible, both-maybe, fantasy) appear and green-light does not.
Classification Test Coverage
packages/web/src/lib/classify-match.test.ts
Added exhaustive programmatic test coverage: null-timing truth table for all ordered pairs of five rating values, and timing matrix for "yes/if-partner-wants" quadrant across all timing combinations.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Whiskers twitching with delight
With offset now, we hop through ratings right,
Exhaustive tables bloom in test-suite light,
Match types dance and classify true,
Coverage sprouting where seeds once grew! 🌱

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: adding exhaustive test coverage to match classification (truth table) and reworking the mixed e2e test.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

iskhakovt added a commit that referenced this pull request Apr 13, 2026
Test changes (exhaustive truth table, mixed e2e, offset param) were
accidentally bundled with this design-polish PR. Moved to dedicated
PR #41 (test/exhaustive-match-classification).

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
e2e/results.spec.ts (1)

69-76: Array spreading is unnecessary but harmless.

Since aliceRatings and bobRatings are already separate arrays with different values, the offset parameter isn't needed here. The spread syntax [...aliceRatings] converts the readonly tuple to a mutable array, which isn't required since answerQuestionsCycling doesn't mutate the input.

This works correctly as-is; just noting the spread could be removed for simplicity if desired.

♻️ Optional: Remove unnecessary spreads
-    await answerQuestionsCycling(alice, [...aliceRatings]);
+    await answerQuestionsCycling(alice, aliceRatings);
     await alice.getByRole("button", { name: "I'm done" }).click();
     await expect(alice.getByText("Waiting for everyone")).toBeVisible();

     await bob.goto(partnerLink);
     await goThroughIntro(bob);
     await narrowToCategory(bob, "Group & External");
-    await answerQuestionsCycling(bob, [...bobRatings]);
+    await answerQuestionsCycling(bob, bobRatings);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@e2e/results.spec.ts` around lines 69 - 76, The test unnecessarily spreads the
readonly tuples aliceRatings and bobRatings into new arrays before passing them
to answerQuestionsCycling; remove the spreads and pass aliceRatings and
bobRatings directly to answerQuestionsCycling (i.e., change
answerQuestionsCycling(alice, [...aliceRatings]) to
answerQuestionsCycling(alice, aliceRatings) and similarly for bob) since
answerQuestionsCycling does not mutate its input.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@e2e/results.spec.ts`:
- Around line 69-76: The test unnecessarily spreads the readonly tuples
aliceRatings and bobRatings into new arrays before passing them to
answerQuestionsCycling; remove the spreads and pass aliceRatings and bobRatings
directly to answerQuestionsCycling (i.e., change answerQuestionsCycling(alice,
[...aliceRatings]) to answerQuestionsCycling(alice, aliceRatings) and similarly
for bob) since answerQuestionsCycling does not mutate its input.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f27b65a0-9070-468b-b920-aaa8233c421f

📥 Commits

Reviewing files that changed from the base of the PR and between 159efe0 and e78823d.

📒 Files selected for processing (3)
  • e2e/helpers.ts
  • e2e/results.spec.ts
  • packages/web/src/lib/classify-match.test.ts

Accept `readonly Rating[]` in answerQuestionsCycling so callers can
pass `as const` tuples directly without spreading.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
iskhakovt added a commit that referenced this pull request Apr 13, 2026
* feat(web): refine design with tactile depth and editorial polish

Elevate the Peach & Sage palette with gradient buttons, warm layered
shadows, spring-curve animations, and consistent visual hierarchy
across all screens — while preserving the safe, ND-friendly character.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

* refactor(web): address CodeRabbit review feedback

- Extract gradient colors to CSS tokens (--color-accent-dark, etc.)
- Centralize easing curve as --ease-spring CSS variable
- Extract shared variantStyles to lib/variant-styles.ts
- Use animation: none in prefers-reduced-motion (not just duration)
- Use stable key={step} instead of key={i} in Intro.tsx

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

* refactor(web): extract shadow/progress CSS tokens, reduce className noise

- Add shadow theme tokens (--shadow-accent-sm, --shadow-accent-md,
  --shadow-accent-light-sm) to replace 10+ inline arbitrary values
- Add .shadow-accent-embossed for compound shadow + inset highlight
- Add .progress-track, .progress-fill, .progress-glow CSS utilities
  replacing 6 inline style props across QuestionCard and Summary
- Use cn() consistently for conditional classNames (not template literals)
- Document cn() convention in CLAUDE.md

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

* refactor(web): extract CopyLinkField component, enforce cn() everywhere

- Extract CopyLinkField component for the repeated link input + copy
  button + sr-only pattern (3 instances across GroupSetup and Invite)
- Convert all 14 template-literal classNames to cn() across 8 files
- Zero `className={\`...\`}` patterns remaining in codebase

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

* refactor(web): remove test changes — moved to #41

Test changes (exhaustive truth table, mixed e2e, offset param) were
accidentally bundled with this design-polish PR. Moved to dedicated
PR #41 (test/exhaustive-match-classification).

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

* test(web): regenerate visual regression baselines

All 60 screenshots updated to match the new design polish:
gradient buttons, warm shadows, spring animations, refined typography.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
The offset can't produce all match types with a single array (fantasy
only matches itself), so the mixed-answers test uses two explicit
arrays instead. Remove the speculative parameter.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@iskhakovt
iskhakovt enabled auto-merge (squash) April 13, 2026 12:03
@iskhakovt
iskhakovt merged commit c171b09 into main Apr 13, 2026
8 checks passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.8.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant