Repository navigation
fix(app): percent-encode chart and dashboard URL state - #3842
brandon-pereira wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: 7f06a1f The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🔵 Tier 2 — Low RiskSmall, isolated change with no API route or data model modifications. Why this tier:
Review process: AI review + quick human skim (target: 5–15 min). Reviewer validates AI assessment and checks for domain-specific concerns. Stats
|
Duplicate code analysisNo new duplicate code introduced by this PR. jscpd compared this branch against |
PR Review
2 finding(s): 🔴 0 P0/P1 · 🟡 2 P2 · 🔵 0 P3 None could be anchored to changed lines; they are listed below. Findings outside the changed lines
Priority comes from a separate grading pass over the finished review. P3 is folded here instead of posted inline. No finding blocks merge automatically; a maintainer decides. |
Deep ReviewScope: Swaps nuqs' default The swap is sound and backward-compatible: ✅ No critical issues found. 🟡 P2 — recommended
🔵 P3 nitpicks (1)
Reviewers (10): correctness, security, testing, maintainability, kieran-typescript, julik-frontend-races, project-standards, agent-native, learnings-researcher, previous-comments. Testing gaps: Dashboard Notes: The two prior PR comments are from No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond |
E2E Test Results✅ All tests passed • 482 passed • 1 skipped • 1090s
Tests ran across 4 shards in parallel. |
Summary
Chart Explorer
?config=and temporary dashboard?dashboard=state used nuqs' default JSON serializer. It wrote raw JSON into the URL and encoded spaces as+, so links could break when pasted into chat clients or terminals. Both now use the existingparseAsJsonEncodedparser, which writes percent-encoded JSON while still reading legacy raw-JSON links.Also updates the dashboard unit-test mocks and adds coverage for a SQL config containing quotes, brackets,
%,+, and newlines, plus an E2E case that loads a legacy raw-JSON chart link and asserts the rewritten URL is percent-encoded.How to reproduce
Starting point: any HyperDX deployment with Chart Explorer available, such as the Vercel preview on this PR.
On
main:SELECT 1and run the query.configparameter contains raw JSON and+for spaces:/chart?config={%22configType%22:%22sql%22,%22connection%22:%22demo%22,%22source%22:%22demo%22,%22sqlTemplate%22:%22SELECT+1%22}+can be rewritten or stripped in transit, so the link may no longer restore the chart.On this branch:
configparameter is percent-encoded:/chart?config=%7B%22configType%22%3A%22sql%22%2C%22connection%22%3A%22demo%22%2C%22source%22%3A%22demo%22%2C%22sqlTemplate%22%3A%22SELECT%201%22%7DHow to test on Vercel preview
Preview routes: /chart
Steps:
/chartand switch to SQL mode.SELECT 1and run the query.configquery parameter starts with%7Band contains no raw{,", spaces, or+.Validation
yarn lint:fix,make ci-lint,cd packages/app && yarn ci:unitmake dev-e2e FILE=source-name-deeplink GREP="legacy raw-JSON"passed.Note
Low Risk
Small query-param serialization swap with backward-compatible parsing; low risk to chart explorer and temporary dashboard deep links.
Overview
Chart Explorer
?config=and unsaved dashboard?dashboard=URL state now serialize withparseAsJsonEncodedinstead of nuqs’ default raw JSON parser, so shared links use percent-encoded JSON (no literal{,", spaces, or+in the param) while still accepting older raw-JSON links.Unit tests mock
parseAsJsonEncodedinstead ofparseAsJson,queryParsersgains round-trip coverage for SQL configs with tricky characters, and a Playwright case loads a legacy raw-JSON chart link and asserts the URL is rewritten to the encoded form on load.Reviewed by Cursor Bugbot for commit 7f06a1f. Bugbot is set up for automated code reviews on this repo. Configure here.