sadpandajoe opened a new pull request, #40980:
URL: https://github.com/apache/superset/pull/40980
### SUMMARY
Two small correctness fixes in the Alerts & Reports feature, plus regression
tests.
**1. Escape `LIKE` wildcards in the reports text filter.** The text search
filter on
the alerts/reports list passed user input directly into `ILIKE`, so `%` and
`_` were
interpreted as wildcards rather than literal characters. A search for `a_b`
would
match `axb`, etc. The fix adds a local `_escape_like()` helper (mirroring
the existing
`daos/datasource.py` precedent) and passes `escape="\"` to each filter
clause so the
characters match literally.
**2. Preserve a typed `0` in the ReportModal custom screenshot-width
input.** The input
used `|| null` for the submitted value and `|| ''` for the display value,
which silently
coerced a typed `0` into "no custom width". The fix uses `?? ''` for display
and an
explicit `Number.isNaN()` check on change. A typed `0` is now submitted and
surfaced by
the server's min-width validation instead of being dropped on the client;
clearing the
field still yields an empty value (parsed `NaN` → null).
**Regression tests.** Adds backend unit tests pinning the report DAO's
`autoescape`
behavior and the update command's `extra.dashboard.activeTabs` validation
(both already
correct in code), and frontend RTL tests for the width-input behavior above.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A — behavior fixes, no visual change to the layout.
### TESTING INSTRUCTIONS
Backend:
```bash
pytest tests/unit_tests/reports/filters_test.py \
tests/unit_tests/reports/dao_test.py \
tests/unit_tests/commands/report/update_test.py
```
Frontend:
```bash
cd superset-frontend
npm run test -- src/features/reports/ReportModal/ReportModal.test.tsx
```
Manual: in the Alerts & Reports list, search the name filter for a term
containing `%`
or `_` and confirm it matches literally. In the report/alert modal for a
non-dashboard
chart, type `0` into the custom screenshot width and confirm the value is
preserved
(and rejected by validation) rather than silently cleared.
### ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [ ] Required feature flags:
- [x] Changes UI
- [ ] Includes DB Migration (follow approval process in
[SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
--
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]