Skip to content

fix(heureka): coerce numeric searchTerm URL param to string in search box - #1893

Open
hodanoori wants to merge 6 commits into
mainfrom
hoda-single-digit-search-bug
Open

fix(heureka): coerce numeric searchTerm URL param to string in search box#1893
hodanoori wants to merge 6 commits into
mainfrom
hoda-single-digit-search-bug

Conversation

@hodanoori

@hodanoori hodanoori commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes a crash in Heureka (Services), Doop, and Supernova when typing a single digit in the search box. TanStack Router parses ?searchTerm=3 as a number from the URL, and z.string().optional() rejects numbers, causing a Zod parse error that breaks the app. Applies the same coercion pattern already present in the Heureka Vulnerabilities route (which was not affected) to the three routes that were missing it.

The fix uses a shared optionalStringSchema helper defined in each app's own utils/helpers file, which coerces any non-string primitive (number, boolean) to string while passing undefined/null through unchanged.

Changes Made

  • Add optionalStringSchema helper to apps/heureka/src/utils.ts, apps/doop/src/lib/helpers.ts, and apps/supernova/src/lib/utils.ts
  • Use optionalStringSchema for searchTerm in apps/heureka/src/routes/services/index.tsx (replacing inline z.string().optional())
  • Use optionalStringSchema for searchTerm in apps/heureka/src/routes/vulnerabilities/index.tsx (replacing previous inline z.preprocess)
  • Use optionalStringSchema for searchTerm in apps/doop/src/routes/violations.tsx
  • Use optionalStringSchema for searchTerm in apps/supernova/src/routes/alerts.tsx

Related Issues

Screenshots (if applicable)

Testing Instructions

  1. pnpm i
  2. pnpm TASK

Checklist

  • I have performed a self-review of my code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have made corresponding changes to the documentation (if applicable).
  • My changes generate no new warnings or errors.
  • I have created a changeset for my changes.

PR Manifesto

Review the PR Manifesto for best practises.

…tring

When a user types a single digit in the search box, TanStack Router parses
it as a number from the URL. z.string().optional() rejects numbers, causing
a parse error and breaking the app. Add z.preprocess to coerce numbers to
strings before validation, matching the fix already in the vulnerabilities
route.

Signed-off-by: Hoda Noori <hoda.noori@sap.com>
@hodanoori
hodanoori requested a review from a team as a code owner August 17, 2026 08:16
Copilot AI lite review requested due to automatic review settings August 17, 2026 08:16
@changeset-bot

changeset-bot Bot commented Aug 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d6709fc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@cloudoperators/juno-app-doop Patch
@cloudoperators/juno-app-heureka Patch
@cloudoperators/juno-app-supernova Patch
@cloudoperators/juno-app-greenhouse Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR updates multiple route search schemas to accept numeric searchTerm inputs by preprocessing them into strings before Zod validation.

Changes:

  • Added a Zod preprocess step to coerce numeric searchTerm values to strings in alerts, services, and violations routes.
  • Kept the rest of the query schema structure unchanged.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
apps/supernova/src/routes/alerts.tsx Coerces numeric searchTerm to string during search query parsing.
apps/heureka/src/routes/services/index.tsx Coerces numeric searchTerm to string during services search query parsing.
apps/doop/src/routes/violations.tsx Coerces numeric searchTerm to string during violations search query parsing.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread apps/supernova/src/routes/alerts.tsx Outdated
Comment thread apps/heureka/src/routes/services/index.tsx Outdated
@hodanoori hodanoori changed the title fix(heureka,doop,supernova): coerce numeric searchTerm URL param to s… fix(heureka): correct numeric searchTerm URL param to string in search box Aug 17, 2026
hodanoori and others added 3 commits August 17, 2026 10:25
… and broaden coercion

- Add optionalStringSchema to each app's utils/helpers file to avoid
  duplicating the preprocess logic across routes
- Broaden coercion from number-only to any primitive (number | boolean)
  with explicit type cast to satisfy no-base-to-string lint rule
- Use the shared schema in all affected routes

Signed-off-by: Hoda Noori <hoda.noori@sap.com>
Signed-off-by: Hoda Noori <hoda.noori@sap.com>
@hodanoori hodanoori self-assigned this Aug 17, 2026
@hodanoori hodanoori changed the title fix(heureka): correct numeric searchTerm URL param to string in search box fix(heureka): coerce numeric searchTerm URL param to string in search box Aug 17, 2026
@hodanoori hodanoori added the greenhouse-pr-build Set this label to create a preview image which will automatically set the `greenhouse-pr-preview` label Aug 17, 2026
@github-actions github-actions Bot added the greenhouse-pr-preview THIS LABEL IS SET AUTOMATICALLY. label Aug 17, 2026
Signed-off-by: Hoda <107242553+hodanoori@users.noreply.github.com>
@github-actions github-actions Bot added greenhouse-pr-preview THIS LABEL IS SET AUTOMATICALLY. and removed greenhouse-pr-preview THIS LABEL IS SET AUTOMATICALLY. labels Aug 17, 2026
@github-actions github-actions Bot added greenhouse-pr-preview THIS LABEL IS SET AUTOMATICALLY. and removed greenhouse-pr-preview THIS LABEL IS SET AUTOMATICALLY. labels Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

greenhouse-pr-build Set this label to create a preview image which will automatically set the `greenhouse-pr-preview` greenhouse-pr-preview THIS LABEL IS SET AUTOMATICALLY.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug](juno): Entering a single digit breaks search in Heureka, Doop & Supernova

3 participants