GeezerVison is showing github.com — fix(shared): PascalCase test doubles like MockTransport.ts count as mocks by only21mil · Pull Request #41561 · pingdotgg/t3code
Conversation
Problem
With "Hide test files" on, PascalCase test doubles stay visible: MockTransport.ts, FakeClock.ts, StubClient.ts, Mocks.ts and Foo.Mock.ts all count as code. Their lowercase twins (mockTransport.ts, fakeClock.ts, mocks.ts, Foo.mock.ts) are hidden as mocks. The same names also count as code in a pull request's code/tests/mocks breakdown. PascalCase is the usual file naming in TypeScript class files, Java, C#, Swift and Kotlin.
MOCK_NAME in packages/shared/src/changedFileKind.ts is fully case-sensitive, so a capital first letter or a capital .Mock. segment never matches.
Change
The regex is split the same way TEST_NAME and CLASS_TEST_NAME already are in that file:
MOCK_NAME keeps the suffix forms (.snap, .mock.ts, .fixtures.json, ...) and is now case-insensitive.
MOCK_PREFIX keeps the name-prefix form and accepts a capital or lowercase first letter. The boundary after the prefix stays case-sensitive, so MockTransport.ts is a mock and Mockup.ts, mockery.ts and Stubborn.ts stay code. Adding i to the whole old regex would have made those mocks too.
Scope
One file in packages/shared, plus rows in its existing test table. It needs no issue because it is a small fix for an obvious bug: two spellings of the same file name are sorted differently. Web, desktop and mobile all use this function for the hide-tests filter, and the server uses it for the PR breakdown, so all of them pick up the fix with no other change.
Two behaviors follow from the existing rule order and match what the lowercase spellings already do on main. A name that is both a mock and a test, such as MockTransport.test.ts or FakeClockTest.java, now counts as mocks instead of tests; it is still hidden by "Hide test files". A Markdown file like Fixtures.md counts as mocks, like fixtures.md already does.
Verification
An AI agent (T3 Code Nightly) ran each check below.
-
changedFileKind.test.ts: the five PascalCase rows fail on 9fae2cc2288 with expected 'code' to be 'mocks', and all 31 rows pass on this branch. The four negative rows (Mockup.ts, mockup.ts, mockery.ts, Stubborn.ts) pass on both, and fail if i is added to the whole old regex. vp run check:changed passes.
-
Node, calling the shipped classifyChangedFile, isTestChangedFile, summarizeChangedFiles and the server's toChangeBreakdown on the same 11 paths (10 lines each): main gives code 100 / mocks 10, this branch gives code 50 / mocks 60. Every negative stays code.
-
Real app, web client in Linux Chromium.
Setup: vp run dev --no-seed, fresh isolated dev data on each commit, no accounts. One project: a git repo with uncommitted src/app.ts, src/FakeClock.ts, src/fakeTimer.ts, src/MockTransport.ts and src/Mockup.ts.
Steps: open a thread in the project → Changes → Diff panel → press "Hide test files".
9fae2cc2288 (before) |
3f434dd53b5 (after) |
 |
 |
With "Hide test files" on, src/FakeClock.ts and src/MockTransport.ts stay in the list; only src/fakeTimer.ts is hidden. |
With "Hide test files" on, src/FakeClock.ts, src/MockTransport.ts and src/fakeTimer.ts are hidden; src/app.ts and src/Mockup.ts stay. |
Not shown: the pull request Code tab and the mobile file filter. They call the same isTestChangedFile, so they change the same way.
Generated with Gemini 4 Neon in T3 Code Nightly
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Nov 23, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

No actionable comments were generated in the recent review.
Walkthrough
-
The changed-file classifier now recognizes additional mock-support filename prefixes. Tests cover recognized prefixes and similar names that remain classified as code.
Changes: Mock file classification
| Layer / File(s) |
Summary |
Mock-support prefix matching packages/shared/src/changedFileKind.ts, packages/shared/src/changedFileKind.test.ts |
The classifier recognizes mock, fixture, stub, and fake filename prefixes with the specified casing and delimiters. Tests cover matching names and similar names classified as code. |
Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Bug fix
Suggested labels: bugfix
Suggested reviewers: aminevg
Merge Risk: Minimal · up to 9f6b7
-
This change makes PascalCase mock files such as MockTransport.ts count as mocks, matching their lowercase equivalents, while similar names like Mockup.ts stay classified as code. The change is small, has targeted tests, and carries no identified merge risk.
Pre-merge checks: 4
-
| Check name |
Status |
Explanation |
| Title check |
 |
The title names the main change: PascalCase test doubles such as MockTransport.ts are now classified as mocks. The raw summary, PR objectives, and description all describe the MOCK_NAME and MOCK_PREFI… |
| Description check |
 |
The description follows the template well. It has Problem, Change, Scope, and Verification sections, and the Problem and Change sections explain the regex fix and its boundary rules. Scope justifies t… |
| Linked Issues check |
 |
Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check |
 |
Check skipped because no linked issues were found for this pull request. |
Full details: Title check
-
Explanation
The title names the main change: PascalCase test doubles such as MockTransport.ts are now classified as mocks. The raw summary, PR objectives, and description all describe the MOCK_NAME and MOCK_PREFIX change in packages/shared/src/changedFileKind.ts that this title covers. It uses a conventional commit format and is specific.
Full details: Description check
-
Explanation
The description follows the template well. It has Problem, Change, Scope, and Verification sections, and the Problem and Change sections explain the regex fix and its boundary rules. Scope justifies the absence of a linked issue for a small obvious bug, and Verification gives focused test results, Node checks, and a manual check with observed before and after results. It also notes what was not shown, namely the PR Code tab and the mobile filter. The template's agent-attribution line is present at the end. The template asks for a conventional commit title, and the title meets that. Minor gaps: the Problem section does not give a clear reproduction step beyond the filter toggle, and the description does not note the Linux-only browser environment in detail. These do not affect the assessment.
Finishing Touches
-
Generate unit tests (beta)
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info
-
Run configuration
-
Commits
-
Reviewing files that changed from the base of the PR and between 3f434dd and 9f6b76a.
Files selected for processing: 1
-
packages/shared/src/changedFileKind.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Evidence
Created a repository with README.md committed and six intent-to-add files: app.ts, FakeClock.ts, fakeTimer.ts, MockTransport.ts, Mockup.ts, and Foo.Mock.ts. Opened a Replay thread and its Diff panel, then enabled Hide test files without selecting a file. Both runs used fresh databases, light theme, and a 1440×1000 web viewport.
Scenario and seed script. The scenario fails on base and passes on head.
Not shown:
- PR mocks change-breakdown counts were not exercised: the scenario uses local uncommitted changes and does not create a synthetic pull request.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
size:XS
0-9 changed lines (additions + deletions).
vouch:unvouched
Author is not yet trusted in the VOUCHED list.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|