fix(review): hash a JSON payload for the impact-map query cache key to prevent collisions - #6144
Conversation
…o prevent collisions
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6144 +/- ##
=======================================
Coverage 95.33% 95.33%
=======================================
Files 599 599
Lines 47186 47186
Branches 15032 15032
=======================================
Hits 44983 44983
Misses 1477 1477
Partials 726 726
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Caution 🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥 🛑 LoopOver review result - reject/close recommendedReview updated: 2026-07-15 17:38:22 UTC
🛑 Suggested Action - Reject/Close Review summary Nits — 3 non-blocking
Why this is blocked
📋 Copy for AI agents — paste into your coding agent
Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://gittensory.aethereal.dev/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
|
LoopOver is closing this pull request on the maintainer's behalf (No linked issue detected; Maintainer requires a linked issue). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed. |
Problem
impactMapQueryFingerprint(src/review/impact-map.ts) built the impact-map query cache key by joining its fields with"|"and theexcludePathswith",", then hashing the string:queryTextis free-form text and anexcludePathis a file path — either can legitimately contain the"|"or","delimiter, which shifts a field boundary and lets two genuinely different inputs serialize to the same string, colliding on one fingerprint. Concretely, both of these produce"a|b|c|5|0.4|bm25":{ queryText: "a|b", excludePaths: ["c"], … }{ queryText: "a", excludePaths: ["b|c"], … }A collision returns one query's cached impact-map result for a genuinely different query (
getCachedImpactMapQuerylooks the row up purely by this fingerprint).Fix
Hash a
JSON.stringifypayload instead of a delimiter-joined string, so every field is escaped and distinct inputs always produce distinct fingerprints. This mirrors the exact discipline of the sibling cache-key builderslinked-issue-satisfaction-cache-input.ts(#5976) andai-slop-cache-input.ts.excludePathsstays sorted so argument order never causes a spurious cache miss. The function is exported so the fingerprint can be unit-tested directly (same as the sibling).Tests
test/unit/impact-map.test.tsadds coverage that:"|"/","delimiters (fails before the fix),excludePathsorder,queryText/topK/minScore/reranker) changes.npm run typecheckclean;test/unit/impact-map.test.tsgreen (27 tests).