Remove unsafe assertions from SearchRouter parser substitutions - #100942
Draft
KJ21-ENG wants to merge 1 commit into
Draft
Remove unsafe assertions from SearchRouter parser substitutions#100942KJ21-ENG wants to merge 1 commit into
KJ21-ENG wants to merge 1 commit into
Conversation
Seatbelt-Operation: s08-a7f9ba43-4541881-sign-1
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.
Explanation of Change
Add separate raw generated-parser declaration/types and remove unsafe assertions from the SearchRouter substitution seam. Generated JavaScript is unchanged: the declaration truthfully preserves quoted/comma values, range positions, duplicate occurrence indexes, tax aliases, dynamic and mixed-case keys, explicit substitution precedence, the positive-account
mefallback, stale-map pruning, and null, full, or key-only autocomplete results.SearchRouterUtilsintentionally now returnsundefinedwhen a Report or ExpenseReport has absent, missing, or non-stringreportID; valid string IDs and existing overlay traversal are preserved.Changed files:
src/components/Search/SearchRouter/SearchRouterUtils.tssrc/components/Search/SearchRouter/buildSubstitutionsMap.tssrc/components/Search/SearchRouter/getAutocompleteSelectionSubstitutionKey.tssrc/components/Search/SearchRouter/getQueryWithSubstitutions.tssrc/components/Search/SearchRouter/getUpdatedSubstitutionsMap.tssrc/components/Search/types.tssrc/libs/SearchParser/autocompleteParser.d.tsFixed Issues
$ #94739
PROPOSAL: #94739 (comment)
Tests
Focused local checks passed lint, format, spelling, identity, hygiene, five existing Jest suites (39 tests), 171 parser assertions, and 35 production assertions. No new committed tests were added. Local TypeScript remains waived, not passed: the changed-root and no-
skipLibCheckAPI probes have no candidate/API-probe diagnostics, but 43 imported-App and 738 imported/dependency diagnostics prevent a complete local program guarantee.Fork CI run 34477141288, attempt 1 passed full typecheck, lint, format, React Compiler, Jest, and final collection for signed head
6e4840e1f3a7265b51759ace5d62a15f5e0adb47against4541881ce86bcac1185c2b8088e9fd4beb23be3c.Manual QA has not been performed; repeat the staging steps below.
Offline tests
Not performed and not applicable to this exact diff: it changes no offline behavior, network request, or offline fallback.
QA Steps
Manual QA required. QA before review. The defensive reportID guard changes a runtime contextual-search outcome. On staging, use Search to open SearchRouter over both Report and ExpenseReport, then exercise nested routes, an overlay route, and a non-report screen. Enter or select quoted/comma workspace or room names and duplicate values; submit the result and verify the expected report context and substitutions. For missing or non-string report IDs, verify no crash and no contextual report lookup. Check the JS console throughout.
PR Author Checklist
The issue is linked and repeatable QA is documented, but no manual, offline, console, High Traffic, all-platform, screenshot, or new-unit-test work was performed. Conditional CSS, asset, copy, layout, Storybook, deeplink, markdown-editing, and new-pattern claims are not applicable to this diff and remain unchecked.
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
No screenshots or video were produced.