chore(greenhouse): makes route search validation Zod v4–ready (filter by prefix before parse) #1446
+148
−66
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.
Summary
Route search validation no longer relies on Zod’s
ctx.pathinz.preprocess(removed in Zod v4). A small helper filters URL search params by known keys and allowed prefixes before parsing with Zod, so the same behavior works with Zod v3 and v4.Changes Made
filterSearchParamsByPrefix(raw, knownKeys, allowedPrefixes)helper in heureka (utils.ts), supernova (lib/validateSearch.ts), and doop (lib/validateSearch.ts)./servicesand/vulnerabilitiesroutes to validate search via the helper + schema (no preprocess usingctx.path)./alertsroute to use the helper withACTIVE_FILTERS_PREFIXandPAUSED_FILTERS_PREFIX./violationsroute to use the helper withACTIVE_FILTERS_PREFIX.getFiltersForUrlasRecord<string, string | string[]>and adjusted implementation so search param types align with the route schema.Related Issues
Screenshots (if applicable)
none
Testing Instructions
pnpm ipnpm TASKChecklist
PR Manifesto
Review the PR Manifesto for best practises.