fix(graph-vfs): decode graph VFS paths safely so a malformed % never throws - #323
fix(graph-vfs): decode graph VFS paths safely so a malformed % never throws#323Diwak4r wants to merge 5 commits into
Conversation
…throws handleGraphVfs documents that it "never throws" and its VFS caller (resolveGraph) has no try/catch, but parsePath ran the remainder through decodeURIComponent, which raises URIError on a lone/short % escape (e.g. a `find/100%` pattern). Wrap the decode in a safeDecode helper that falls back to the raw string, honoring the never-throws contract.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
ChangesGraph path safety
Test stability
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 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 |
|
Heads-up on the CI failures — all three failing jobs (Quality gate Node 22.x, Quality gate Node 24.x, Windows smoke) fail on the exact same, unrelated test: This test is about
Neither file touches the log store, I've left the log-store test alone to avoid scope creep on an unrelated module — happy to help fix/quarantine it separately if the maintainers want, but it shouldn't block this graph-vfs fix. Requesting review/merge on the isolated change. |
…e-prune of test records The AC-1, AC-6, and db-file-existence tests open a `baseDir`-backed store without a clock, so the startup prune uses the real system clock. As the test records carry hardcoded timestamps from 2026-06-20 and the default retention age cap is 30 days, these rows get pruned on re-open once real time exceeds that window — causing `AC-1` to fail with `expected [] to have a length of 3 but got +0` on all three CI legs. Fix: pass `clock: testClock` (frozen at 2026-06-20T00:00:00.000Z) to both the write and read stores in those three tests, matching the pattern the existing age-sweep AC-5 test already uses. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Clock-injection commit d377750 already pushed but CI did not auto-trigger on the fork push. Empty commit to force it. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
|
Closing this to clear out a backlog I let build up rather than leave it sitting in your queue. It was never picked up and at this age it isn't going to be. If it's still wanted, say so and I'll reopen it against current main. |
Problem
handleGraphVfs(src/daemon/runtime/codebase/query.ts) documents that an unknown/odd path "returns a short usage listing (never throws)", and its VFS callerresolveGraph(src/daemon-client/vfs/read.ts) wraps it in no try/catch — its own docblock repeats "The renderer itself never throws".But
parsePathruns the path remainder throughdecodeURIComponent, which raisesURIError: URI malformedon a lone or short%escape. So a perfectly ordinary caller-supplied VFS path likegraph/find/100%(orgraph/show/a%zz,graph/neighborhood/src/x%.ts) throws out ofhandleGraphVfsinstead of rendering — breaking the documented contract and propagating out of an un-guarded caller.Fix
Route the remainder through a small
safeDecodehelper that returns the raw string whendecodeURIComponentthrows, so an undecodable remainder is passed through verbatim rather than blowing up the whole render. One-line call-site change plus the helper.How verified
tests/daemon/runtime/codebase/query.test.tscoveringfind/100%,show/a%zz, andneighborhood/src/x%.ts.npx vitest run tests/daemon/runtime/codebase/query.test.ts→ 26 passed.useIterableCallbackReturnwarning in this file is unrelated and present onmain).Summary by CodeRabbit
Bug Fixes
Tests