Skip to content

feat(review): extract a codebase-grounded repo profile from RAG + signals - #3039

Merged
JSONbored merged 1 commit into
mainfrom
feat/repo-profile-extraction
Jul 4, 2026
Merged

feat(review): extract a codebase-grounded repo profile from RAG + signals#3039
JSONbored merged 1 commit into
mainfrom
feat/repo-profile-extraction

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

  • Adds extractRepoProfile(env, repoFullName) (src/review/repo-profile.ts), a single, versioned repo-profile-extraction primitive that turns a repo's existing RAG index (repo_chunks) and existing settings/manifest signals into a structured profile: architecture/module map, naming and test-file conventions, build/test/lint commands, and contribution-workflow facts (gate presence, linked-issue policy, CI workflow files).
  • Deliberately deterministic (no embedding/vector-query calls, no AI): reads indexed file paths and package.json content directly out of the repo_chunks store RAG ingestion already populates, so it introduces no second indexing pipeline and stays fully fixture-testable.
  • Returns an explicit present: false insufficient-data result (never a partial guess) when the repo has no RAG index populated yet, per the roadmap's fail-closed design principle.
  • Exports rag-index.ts's existing listStoredChunkPaths so this module reuses it instead of re-deriving "what files does this repo have indexed" logic.

Part of #2993 (repo-doc generation roadmap). Closes #2999.

Scope

  • The PR title follows type(scope): short summary Conventional Commit format, for example fix(api): restore profile access checks.
  • This PR is focused and does not mix unrelated backend, UI, MCP, docs, dependency, and deploy changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked an issue, or this is small enough that the summary explains why an issue is not needed.

Validation

  • git diff --check
  • npm run actionlint (not run — no workflow files touched)
  • npm run typecheck
  • npm run test:coverage — scoped to the changed file (src/review/repo-profile.ts): 100% statements/branches/functions/lines. Full unsharded test:coverage left to CI per this repo's own "don't duplicate CI locally" convention; ran the affected suites directly instead (test/unit/repo-profile.test.ts, test/unit/rag-index.test.ts, test/unit/rag-wiring.test.ts, test/unit/review-adapters.test.ts — 105/105 passing).
  • npm run test:workers (not run — no Cloudflare-Workers-pool-specific code touched)
  • npm run build:mcp / npm run test:mcp-pack (not run — no MCP package changes)
  • npm run ui:openapi:check / npm run ui:lint / npm run ui:typecheck / npm run ui:build (not run — no apps/gittensory-ui changes, no API/OpenAPI surface changed)
  • npm audit --audit-level=moderate (not run locally — no dependency changes; CI's dependency-review job covers this)
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries

If any required check was skipped, explain why:

  • Skipped checks above are for UI/MCP/Workers surfaces this PR does not touch (a new backend module + one existing-function export). CI's validate job runs them as a backstop.

Safety

  • No secrets, wallet details, hotkeys, coldkeys, user PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed.
  • Public GitHub text stays sanitized, low-noise, and does not imply compensation guarantees or optimization tactics.
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests. (N/A — no auth/session/CORS changes.)
  • API/OpenAPI/MCP behavior is updated and tested where needed. (N/A — no API/OpenAPI/MCP surface changed; this is an internal extraction primitive, not exposed.)
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks. (N/A — no UI changes.)
  • Visible UI changes include a UI Evidence section below with screenshots. (N/A — no visible UI changes.)
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs. (N/A.)

Notes

…nals

Adds extractRepoProfile(env, repoFullName), a single, versioned
repo-profile-extraction primitive that turns a repo's existing RAG
index (repo_chunks) and existing settings/manifest signals into a
structured profile: architecture/module map, naming and test-file
conventions, build/test/lint commands, and contribution-workflow
facts (gate presence, linked-issue policy, CI workflow files).

Deliberately deterministic (no embedding/vector-query calls, no AI):
reads indexed file paths and package.json content directly out of the
repo_chunks store RAG ingestion already populates, so it introduces no
second indexing pipeline and stays fully fixture-testable. Returns an
explicit insufficient-data result (never a partial guess) when the
repo has no RAG index populated yet.

Exports rag-index.ts's existing listStoredChunkPaths so this module
can reuse it instead of re-deriving "what files does this repo have
indexed" logic.

Part of #2993. Closes #2999.
@codecov

codecov Bot commented Jul 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.09%. Comparing base (a690257) to head (b5d824e).
⚠️ Report is 3 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3039      +/-   ##
==========================================
+ Coverage   96.08%   96.09%   +0.01%     
==========================================
  Files         260      261       +1     
  Lines       28774    28859      +85     
  Branches    10475    10504      +29     
==========================================
+ Hits        27647    27732      +85     
  Misses        492      492              
  Partials      635      635              
Files with missing lines Coverage Δ
src/review/rag-index.ts 90.66% <ø> (ø)
src/review/repo-profile.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@loopover-orb loopover-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 4, 2026
@loopover-orb

loopover-orb Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Warning

🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-04 09:59:05 UTC

3 files · 1 AI reviewer · 1 blocker · readiness 100/100 · CI green · clean

⏸️ Suggested Action - Manual Review

  • AI reviewers agree on a likely critical defect: src/review/repo-profile.ts:258 misreports `contributionWorkflow.gatePublishesCheck` because current settings resolution drives check publication through `reviewCheckMode` (`gate.checkMode` in `.gittensory.yml`), so a repo with `reviewCheckMode: "disabled"` and legacy `gateCheckMode: "enabled"` is reported as publishing a check
  • change it to derive from `settings.reviewCheckMode !== "disabled"` or explain why this extractor intentionally ignores the existing review-check-mode resolver path. — Resolve the flagged defect, or override if the AI reviewers are mistaken, then re-run the gate.

Review summary
This adds a deterministic repo-profile extractor on top of the existing RAG chunk store and settings/manifest signals, with good fixture coverage for the new helper behavior and the empty-index branch. The architecture/path extraction is scoped and reuses the existing path query, but the contribution workflow signal is wired to the wrong effective settings field for check publication, so repos configured through the current review-check mode path get a false profile.

Blockers

  • src/review/repo-profile.ts:258 misreports `contributionWorkflow.gatePublishesCheck` because current settings resolution drives check publication through `reviewCheckMode` (`gate.checkMode` in `.gittensory.yml`), so a repo with `reviewCheckMode: "disabled"` and legacy `gateCheckMode: "enabled"` is reported as publishing a check; change it to derive from `settings.reviewCheckMode !== "disabled"` or explain why this extractor intentionally ignores the existing review-check-mode resolver path.
Nits — 6 non-blocking
  • nit: src/review/repo-profile.ts:191 treats any object-shaped `scripts` value as a script map, so an array-valued malformed `scripts` field can still be walked; use `!Array.isArray(record.scripts)` for the defensive branch.
  • nit: test/unit/repo-profile.test.ts:259 covers the old `checkRunMode` path but does not cover the current `reviewCheckMode`/`gate.checkMode` path that the settings resolver already exposes.
  • src/review/repo-profile.ts:258 should follow the same effective field used by settings resolution: `gatePublishesCheck: settings.reviewCheckMode !== "disabled"`.
  • test/unit/repo-profile.test.ts should add cases for `reviewCheckMode: "disabled"` and `reviewCheckMode: "required"` so the profile stays aligned with `.gittensory.yml gate.checkMode` overlays.
  • src/review/repo-profile.ts:191 can harden malformed package metadata with `const scripts = record.scripts && typeof record.scripts === "object" && !Array.isArray(record.scripts) ? (record.scripts as Record<string, unknown>) : {};`.
  • PR author also opened the linked issue — Link an issue that was opened by a different contributor, or provide a rationale for why this self-authored issue represents genuine discovery work.

Concerns raised — review before merging

  • src/review/repo-profile.ts:258 misreports `contributionWorkflow.gatePublishesCheck` because current settings resolution drives check publication through `reviewCheckMode` (`gate.checkMode` in `.gittensory.yml`), so a repo with `reviewCheckMode: "disabled"` and legacy `gateCheckMode: "enabled"` is reported as publishing a check; change it to derive from `settings.reviewCheckMode !== "disabled"` or explain why this extractor intentionally ignores the existing review-check-mode resolver path.
Signal Result Evidence
Code review ❌ 1 blocker 1 reviewer
Linked issue ✅ Linked #2999
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 60 registered-repo PR(s), 51 merged, 421 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 60 PR(s), 421 issue(s).
Gate result ❌ Blocking Repo-configured hard blocker found.
Review context
  • Author: JSONbored
  • Role context: owner (maintainer lane)
  • Public audience mode: oss maintainer
  • Lane context: Repository registration is not available in the local Gittensory cache.
  • Public profile languages: not available
  • Official Gittensor activity: 60 PR(s), 421 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Treat this as maintainer-lane context rather than normal contributor-lane activity.
  • No action.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.

🟩 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.

  • Re-run Gittensory review

@JSONbored
JSONbored merged commit 3bf6de7 into main Jul 4, 2026
11 checks passed
@JSONbored
JSONbored deleted the feat/repo-profile-extraction branch July 4, 2026 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Development

Successfully merging this pull request may close these issues.

feat(review): extract a codebase-grounded repo profile from RAG + signals

1 participant