fix(rag): scope chunk reads by repository - #4651
Conversation
|
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 #4651 +/- ##
=======================================
Coverage 94.22% 94.22%
=======================================
Files 441 441
Lines 38741 38741
Branches 14117 14117
=======================================
Hits 36504 36504
Misses 1577 1577
Partials 660 660
🚀 New features to boost your workflow:
|
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-11 00:22:42 UTC
⏸️ Suggested Action - Manual Review
Review summary Nits — 5 non-blocking
Concerns raised — review before merging
Review context
Contributor next steps
Signal definitions
🟩 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 Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
ab457e5 to
ae4d002
Compare
Motivation
Description
projectandreposo vector matches can only hydrate text when the storedrepo_chunksrow belongs to the authorized repository by changingretrieveContextWithMetricsto callreadChunkTexts(storage, project, repo, ids).readChunkTextsto acceptproject+repoand includeWHERE project = ? AND repo = ? AND id IN (...)so D1 reads cannot return victim repo rows for a different requested repo.cf-typegencheck reported drift.Testing
npx vitest run test/unit/rag.test.ts, which passed the modified and new tests forretrieveContextWithMetricsandreadChunkTexts.git diff --checkandnpm run cf-typegen, both of which succeeded and produced the updatedworker-configuration.d.tsartifact.npm run test:ci, which failed to complete due to existing timeout failures in unrelatedtest/unit/queue.test.tssweep tests during the coverage run; the local coverage run was stopped after those timeouts and is not addressed by this change.npm audit --audit-level=moderate, which failed due to the npm registry audit endpoint returning403 Forbidden(environmental/registry issue, not caused by this change).Codex Task