Skip to content

feat(review): surface the test-evidence classifier in the AI review prompt#2635

Merged
JSONbored merged 2 commits into
mainfrom
feat/ai-review-test-evidence-context
Jul 2, 2026
Merged

feat(review): surface the test-evidence classifier in the AI review prompt#2635
JSONbored merged 2 commits into
mainfrom
feat/ai-review-test-evidence-context

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

  • src/services/ai-review.ts's buildUserPrompt/REVIEW_SYSTEM_PROMPT never referenced the engine's own deterministic test-evidence classification (src/signals/test-evidence.ts), even though src/signals/slop.ts already reuses it for the missingTestEvidence finding. The AI reviewer judged test adequacy purely by eyeballing the raw diff.
  • Adds buildTestEvidencePromptSection (exported, pure) to ai-review.ts, reusing the existing isCodeFile/isTestPath classifiers — no new signal. Splices a concise "changed code files with zero test-path evidence" section into the user prompt when applicable; additional context only, never a new blocker/nit rule.
  • Wires changedFiles (the PR's already-loaded file list) through GittensoryAiReviewInput from the one real call site in src/queue/processors.ts.
  • Absent when changedFiles isn't supplied, or when the PR has any test-path changes, so the prompt is byte-identical to today for the common case (a PR that already has tests, or any caller not yet passing changedFiles).

Closes #2558.

Scope

  • The PR title follows type(scope): short summary Conventional Commit format.
  • 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 (via npm run test:ci)
  • npm run typecheck
  • npm run test:coverage locally — 100% coverage on the new buildTestEvidencePromptSection function and its wiring; a unit-test suite plus an integration test asserting the section is actually spliced into the real prompt sent to the model.
  • npm run test:workers (via npm run test:ci)
  • npm run build:mcp (via npm run test:ci)
  • npm run test:mcp-pack (via npm run test:ci)
  • npm run ui:openapi:check (via npm run test:ci) — no OpenAPI-visible change
  • npm run ui:lint (via npm run test:ci)
  • npm run ui:typecheck (via npm run test:ci)
  • npm run ui:build (via npm run test:ci)
  • npm audit --audit-level=moderate
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries

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 surface touched.
  • API/OpenAPI/MCP behavior is updated and tested where needed. — N/A, no API-visible change (internal prompt construction only).
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks. — N/A, no UI change.
  • Visible UI changes include a UI Evidence section below with screenshots. — N/A, no UI change.
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs. — N/A.

Notes

  • First of a batch of independent maintainer-only roadmap items being worked one PR at a time.

…rompt

buildUserPrompt never referenced the engine's own deterministic
test-evidence classification (src/signals/test-evidence.ts), even though
slop.ts already uses it for the missingTestEvidence finding. The AI
reviewer judged test adequacy purely by eyeballing the raw diff.

Splice a concise "changed code files with zero test-path evidence" section
into the user prompt, reusing the existing isCodeFile/isTestPath
classifiers — no new signal, additional context only, never a new
blocker/nit rule. Absent when changedFiles isn't supplied, or when the PR
has any test-path changes, so the prompt stays byte-identical for the
common case.

Closes #2558.
@dosubot dosubot Bot added the size:M label Jul 2, 2026
@loopover-orb

loopover-orb Bot commented Jul 2, 2026

Copy link
Copy Markdown

Warning

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

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-02 22:03:38 UTC

3 files · 1 AI reviewer · no blockers · readiness 80/100 · CI green · clean

⏸️ Suggested Action - Manual Review

  • Touches a guarded path — held for manual review

Review summary
This change cleanly wires the already-loaded PR file list into the AI review prompt and reuses the existing code/test path classifiers to add test-evidence context only when a code-changing PR has no test-path changes. The behavior is narrowly scoped, covered by direct helper tests and prompt-level tests, and avoids changing callers that do not pass changedFiles. The most notable tradeoff is that raw file paths are now repeated in a trusted-looking classifier section, which is worth hardening even though the raw diff already exposes filenames.

Nits — 6 non-blocking
  • nit: src/services/ai-review.ts:514 should quote or JSON-encode each path before joining so unusual filenames containing commas, quotes, or newlines cannot make the classifier sentence ambiguous.
  • nit: test/unit/ai-review.test.ts:1785 repeats the run/env/user-prompt extraction setup across three cases; a small helper would keep these prompt-splice tests easier to extend.
  • src/services/ai-review.ts:514: consider formatting paths with JSON.stringify(path) or a small quotePath helper before joining them in the prompt.
  • test/unit/ai-review.test.ts:1785: extract the shared runGittensoryAiReview prompt-capture setup into a helper and keep each test focused on the changedFiles input and expected prompt substring.
  • 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.
  • Touches a guarded path — held for manual review — A maintainer must review and merge this change.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #2558
Related work ⚠️ 3 scoped overlaps Top overlaps are listed below; lower-confidence bulk is hidden.
Change scope ❌ 8/20 High review scope from cached public metadata (size label size:M; 1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 64 registered-repo PR(s), 55 merged, 522 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 64 PR(s), 522 issue(s).
Gate result ⚠️ Not blocking Advisory; not blocking this PR.
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: 64 PR(s), 522 issue(s).
  • Related work: Titles/paths share 10 meaningful terms. (issue #2277, issue #2278)
  • Related work: Titles/paths share 9 meaningful terms. (issue #2277, issue #2291)
  • Related work: Titles/paths share 10 meaningful terms. (issue #2277, issue #2280)
  • Additional title-only matches omitted; title-only overlap does not block.
Contributor next steps
  • Treat this as maintainer-lane context rather than normal contributor-lane activity.
  • Review top overlaps.
  • Add a concise scope and risk note.
  • No action.
  • Check active issues and PRs before submitting.
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

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

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.05%. Comparing base (9c8fc0e) to head (a9d1fc7).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2635   +/-   ##
=======================================
  Coverage   96.05%   96.05%           
=======================================
  Files         234      234           
  Lines       26280    26286    +6     
  Branches     9531     9534    +3     
=======================================
+ Hits        25244    25250    +6     
  Misses        425      425           
  Partials      611      611           
Files with missing lines Coverage Δ
src/queue/processors.ts 92.28% <ø> (ø)
src/services/ai-review.ts 95.25% <100.00%> (+0.08%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…mpt section

Gate review nit: a repeated file entry in the changed-files list could
make the test-evidence prompt section noisier than the actual changed-file
set. De-dupe via Set before joining.
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): surface the deterministic test-evidence classifier in the AI review prompt

1 participant