Repository navigation
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueComment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why
Expensify/App#102126(headsplit/lhn-search-preview-parity-stack@9ef80392b52) fails exactly one functional gate: Compare knip issues against main (workflowKnip check, run35972536658, job107545343764). Every other gate on that head is green (typecheck, Jest Unit Tests jobs 1-8, ESLint, Oxfmt, Bun tests, React Compiler, Reassure perf tests).CI output from that job:
Root cause
Commit
9ef80392b52("S4: cache resolved Search previews per report; add perf harness") added a new public exportclearAlternateTextCachetosrc/libs/OptionsListUtils/index.ts. Knip reports it as an unused export:{"file": "src/libs/OptionsListUtils/index.ts", "exports": [{"namespace": "OptionsListUtils", "name": "clearAlternateTextCache", "line": 3407, "col": 5}]}The only file that imports it is
tests/perf-test/OptionsListChatPreview.perf-test.ts, andknip.jsonliststests/perf-test/**underignore, so that importer is not counted as a consumer. The export therefore has zero counted usage and the delta gate fails. This is not a mock-spread or re-export artifact.Fix
Give the export a counted consumer in an existing knip entry:
tests/unit/OptionsListUtilsTest.tsxnow importsclearAlternateTextCacheand calls it in the top-levelbeforeEach, next to theclearFilteredOptionListCache()call that already lives there.This is not a knip silencer. That test file clears the module-level filtered-option-list cache in
beforeEachprecisely to keep cases order-independent, and the resolved chat-preview cache added by9ef80392b52is the same kind of module-level state: its guarded inputs can surviveOnyx.clear(), so a case that resolves a preview text first can otherwise leak into the next case. Resetting it alongsideclearFilteredOptionListCache()is the same invariant the file already enforces. The diff is 5 lines (1 import, 1 call, 2 comment lines, 1 blank).Verification
All commands run in a clean worktree of
split/lhn-search-preview-parity-stack@9ef80392b52, plus this one commit. Knip version 6.34.0, same as CI.Knip, using CI's exact invocations (
KNIP=true npx knip --reporter json --no-exit-codefor each ref, then the repo comparator):Reproduces the CI failure byte-for-byte before the change, and clears it after, with no other finding added or resolved.
Type-check (CI's
npm run typecheck, which drivesbun scripts/typecheck.tsover every referenced project includingtsconfig.jest.json, the project that ownstests/):Jest on the touched suite (
clearAlternateTextCache()inbeforeEachmust not make any case order-dependent or change an assertion):Lint / format on the touched file:
Commit is GPG-signed with the same key as the rest of the stack, matching the "Verify signed commits" gate convention on this branch.
Notes
tests/unit/SearchRouterTest.test.tsx; that file does not exist on9ef80392b52, onExpensify/Appmain, or anywhere in this repo's history.tests/unit/OptionsListUtilsTest.tsxis the file that owns theclearFilteredOptionListCache()beforeEachanchor the brief describes, and it is a knip entry, so it is where the counted consumer belongs.npm run typecheckneedsbunonPATH; it ships innode_modules/.bin, so this run usedPATH="$PWD/node_modules/.bin:$PATH".Reassure Performance Testsand the sharded fullJest Unit Testsrun (out of scope for a 5-line test-file change, and both already pass on the base head). The Knip check itself will re-run on the stack branch once this merges.