rusackas opened a new pull request, #42592:
URL: https://github.com/apache/superset/pull/42592

   ### SUMMARY
   This is a test-only PR, TDD-style validation of #42041.
   
   The issue reports that on the Roles/Permissions admin page, searching by a 
permission's real (underscore) name doesn't show the result, even when the 
backend has already matched it correctly.
   
   Tracing it down: `formatPermissionLabel` (in `features/roles/utils.ts`) 
replaces underscores with spaces for display, so a permission on `stg_silver` 
renders as "stg silver". The server-side search (`fetchPermissionOptions`) 
correctly matches the raw underscore name. But `AsyncSelect`'s `filterOption` 
defaults to `true` with `optionFilterProps: ['label', 'value']`, so after the 
server returns a legitimately matched option, `AsyncSelect` re-filters it 
client-side against the same relabeled `label`. Since the underscore search 
term never appears as a substring of the space-formatted label, the option gets 
discarded before it ever renders — even though the backend got it right.
   
   Added one regression test on `AsyncSelect` that reproduces this exact shape: 
a loader returns an option whose label has had underscores replaced with 
spaces, and asserts it's still visible after typing the underscore search term 
the loader matched on.
   
   **How to interpret CI on this PR:**
   - If CI is green, the described bug doesn't reproduce as I understand it, or 
something upstream already guards against it — worth a comment on #42041 either 
way.
   - If CI is red, the bug is real and confirmed, and this PR should turn into 
(or motivate) an actual fix rather than get merged as-is.
   
   One disclosure: local `pre-commit`'s `type-checking-frontend` hook can't 
complete in the git worktree I used — it needs a pre-built 
`lib/spec/index.d.ts` that no fresh worktree has, and building it from scratch 
hits unrelated pre-existing type errors traceable to this worktree's path 
depth, not to this change. Everything else (prettier, oxlint, custom rules, 
stylelint, mypy) passes locally. CI runs at normal checkout depth and is the 
real gate here.
   
   ### TESTING INSTRUCTIONS
   ```
   cd superset-frontend
   npx jest 
packages/superset-ui-core/src/components/Select/AsyncSelect.test.tsx -t 
"regression for #42041"
   ```
   
   ### ADDITIONAL INFORMATION
   - [x] Has associated issue: #42041
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   Closes #42041


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to