fix(review): prioritize manifest/config files in RAG indexing before the chunk cap - #3438
Conversation
indexRepo sorted the tree by filePriority (code=0, doc=1) before applying MAX_CHUNKS_PER_REPO, so on a large repo package.json/tsconfig.json/etc. tied every other source file and lost the alphabetical tiebreaker, starving them out of the index entirely once the cap hit. Add a manifestPriority sort key that puts dependency-manifest and config files (reusing the existing isDependencyManifestFile/isConfigFile classifiers) ahead of the code/doc split, and recognize go.mod/go.work as indexable (they were previously skipped as extensionless).
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Tip 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 ✅ Gittensory review result - approve/merge recommendedReview updated: 2026-07-05 07:11:10 UTC
✅ Suggested Action - Approve/Merge
Review summary Nits — 4 non-blocking
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.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3438 +/- ##
=======================================
Coverage 93.47% 93.47%
=======================================
Files 292 292
Lines 30797 30798 +1
Branches 11225 11226 +1
=======================================
+ Hits 28786 28787 +1
Misses 1355 1355
Partials 656 656
🚀 New features to boost your workflow:
|
Summary
repoDocGeneration(a self-hosted repo-doc generation feature) reported "Package manager: not detected / Build: none detected / Test: none detected / Lint: none detected" forJSONbored/gittensoryin its generatedAGENTS.md, while a sibling repo with the same npm setup detected correctly. Root cause traced to a missingpackage.jsonrow inrepo_chunks(confirmed via direct DB query) — gittensory's RAG index hit the hardMAX_CHUNKS_PER_REPO = 1500cap exactly, andpackage.jsonnever made it in.indexRepo's pre-cap sort (src/review/rag-index.ts) only usedfilePriority(code=0 vs doc=1) — every source file, includingpackage.json, ties at priority 0 and falls to an alphabetical tiebreaker, so on a repo over the cap, alphabetically-late root manifests lose to the sheer volume ofsrc/**/test/**files. This isn't just a repo-doc-generation bug — it means RAG-grounded AI review context for the same large repo is also missing its own manifest/config files.manifestPrioritysort key that puts small, high-value manifest/config files (package.json,tsconfig*.json,wrangler.*,pnpm-workspace.yaml,go.mod,Cargo.toml,pyproject.toml,requirements*.txt, etc.) ahead of the existing code/doc split — reusing the sameisDependencyManifestFile/isConfigFileclassifierssrc/signals/path-matchers.tsalready exports for slop classification, rather than inventing a second filename vocabulary. This only reorders indexing priority; it doesn't change what's eligible (these are already indexable — JSON/TOML/YAML matchCODE_EXT_RE).go.mod/go.work(extensionless, likeDockerfile/Makefile) were missing fromALLOW_EXTLESS_REand were unconditionally skipped regardless of repo size or cap — added them (their lockfile siblingsgo.sum/go.work.sumremain excluded via the existing lockfile skip rule, which runs first).Scope
type(scope): short summaryConventional Commit format, for examplefix(api): restore profile access checks.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Validation
git diff --checknpm run typecheck(clean)npx vitest run test/unit/rag-index.test.ts test/unit/rag.test.ts test/unit/path-matchers.test.ts— 157/157 passingnpm run test:workers/npm run build:mcp/npm run test:mcp-pack/npm run ui:openapi:check/npm run ui:build— not run individually this PR; no worker/MCP/OpenAPI/UI surface touched.MAX_CHUNKS_PER_REPOstill gets every manifest file (8 distinct manifest/config filenames tested) indexed under the cap; an under-cap repo shows byte-identical existing behavior when the cap never matters;go.mod/go.work(including nested paths) classify as indexable code whilego.sumstill correctly skips (precedence check).Safety
UI Evidencesection below. — N/A, no visible UI change.Notes
safeCodeSpanTypeError, codex hang-detection, and Sentry release-validation strict-mode fixes.