stop nan values in params showing as a problem instead invalid params#1237
stop nan values in params showing as a problem instead invalid params#1237pooleycodes wants to merge 3 commits into
Conversation
WalkthroughPage-number validation now parses query strings with an explicit base-10 radix and enforces numeric integer values with a minimum of 1 across issue-details, results, dataset-failed-expectation, and dataview request paths. ChangesPagination validation
Estimated code review effort: 2 (Simple) | ~5 minutes Possibly related PRs
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/controllers/issueDetailsController.js`:
- Line 14: Replace the parseInt-first page-number validation with strict
complete decimal-integer validation before conversion, rejecting NaN, decimals,
and trailing text while preserving the minimum value of 1 and default of 1.
Apply the same schema change at issue-details pagination, results pagination,
expectation pagination, dataview pagination, and entry issue-details pagination:
src/controllers/issueDetailsController.js#L14-L14,
src/controllers/resultsController.js#L558-L558,
src/middleware/dataset-failed-expectation-entry.middleware.js#L44-L44,
src/middleware/dataview.middleware.js#L35-L35, and
src/middleware/entryIssueDetails.middleware.js#L12-L12. Add coverage for NaN,
decimal, and trailing-text inputs.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 84760ac4-deff-4bec-af8d-aad7eca616fd
📒 Files selected for processing (5)
src/controllers/issueDetailsController.jssrc/controllers/resultsController.jssrc/middleware/dataset-failed-expectation-entry.middleware.jssrc/middleware/dataview.middleware.jssrc/middleware/entryIssueDetails.middleware.js
What type of PR is this? (check all applicable)
Description
A valibot parsing on page number values meant that letters values would be converted to NaN, which would then fail at the v.minValue() stage in the pipeline(), v.number() stops these NaN values getting through.
This resolves the attached Sentry Issue
Related Tickets & Documents
QA Instructions, Screenshots, Recordings
Please replace this line with instructions on how to test your changes, a note
on the devices and browsers this has been tested on, as well as any relevant
images for UI changes.
For URL such as /organisations/local-authority:BUC/conservation-area/data/avc used to get:
Will now get:
Added/updated tests?
We encourage you to keep the code coverage percentage at 80% and above. Please refer to the Digital Land Testing Guidance for more information.
have not been included
[optional] Are there any post deployment tasks we need to perform?
No
[optional] Are there any dependencies on other PRs or Work?
No
Summary by CodeRabbit