Skip to content

feat(enrichment): history analyzer — author record, similar PRs, issue alignment (#1478) - #1771

Merged
JSONbored merged 7 commits into
JSONbored:mainfrom
dev-miro26:feat/enrichment-history-analyzer
Jun 29, 2026
Merged

feat(enrichment): history analyzer — author record, similar PRs, issue alignment (#1478)#1771
JSONbored merged 7 commits into
JSONbored:mainfrom
dev-miro26:feat/enrichment-history-analyzer

Conversation

@dev-miro26

Copy link
Copy Markdown
Contributor

Summary

Adds the history analyzer to the review-enrichment service (REES), resolving #1478. It surfaces public-safe historical context the no-checkout in-prompt reviewer is blind to and the engine deliberately does not compute:

  • Author track record in this repo — prior merged / closed PR counts (GitHub Search API), account age (Users API), and a firstTimeContributor flag.
  • Similar past PRs — past PRs that already changed the same files (commits-by-path → associated PRs), each tagged merged or reverted (a revert commit referencing a PR marks it reverted), with the overlapping paths — surfacing revert/regression history.
  • Linked-issue alignment — whether the diff covers the linked issue's stated requirement (full | partial | none), computed from the linkedIssue carried in the request envelope (no extra fetch).

It carries only public GitHub facts — never internal submitter reputation, trust, reward, or score (those stay private; this analyzer never reads or emits them).

Self-contained and fail-safe, matching the codeowners (#1515) / asset-weight (#1621) precedent: it reads the optional short-lived githubToken + author + linkedIssue from the request envelope and degrades gracefully when any is absent or a GitHub call rate-limits/errors — the block is returned with partial: true (or [] when there is nothing to report), and the rest of the brief still ships. No engine / src/** change; entirely within review-enrichment/ (its own node:test suite, outside the main tsc/vitest/Codecov scope).

Wired per the issue: HistoryFinding type + history key in types.ts, the linkedIssue envelope field, scanHistory registered in the brief.ts analyzer registry, and a public-safe block in render.ts. 17 node:test units cover author context, the first-timer flag, similar-PR detection + revert classification, current-PR exclusion, alignment full/partial/none, the no-token / rate-limit / thrown-fetch degrade paths, the SSRF repo guard, the pure helpers, and rendering.

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. (Closes feat(enrichment): history analyzer — author track record, similar past PRs, linked-issue alignment #1478)

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage — 5113 passed / 8 skipped. No src/** changed, so there is no codecov/patch obligation (the analyzer lives in review-enrichment/, which Codecov ignores).
  • npm run test:workers
  • npm run build:mcp
  • npm run test:mcp-pack
  • npm run ui:openapi:check
  • npm run ui:lint
  • npm run ui:typecheck
  • npm run ui:build
  • npm audit --audit-level=moderate — 0 vulnerabilities
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries — review-enrichment suite green (199 pass, 17 new), covering every branch / fallback / degrade path.

If any required check was skipped, explain why:

  • Whole npm run test:ci chain is green on this branch (rebased current with main); npm run rees:test (build + sourcemap validation + node:test) also run directly.

Safety

  • No secrets, wallet details, hotkeys, coldkeys, user PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed. Only public GitHub facts; internal reputation is explicitly excluded.
  • Public GitHub text stays sanitized, low-noise, and does not imply compensation guarantees or optimization tactics. The rendered block uses the existing safeCodeSpan / promptText escapers and is re-sanitized + defanged by the engine before it is spliced.
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests. — N/A: no auth/cookie/CORS/session change.
  • API/OpenAPI/MCP behavior is updated and tested where needed. The REES contract (EnrichRequest.linkedIssue, BriefFindings.history) is extended and unit-tested; no main-repo OpenAPI/MCP surface is touched.
  • 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. — N/A: backend-only (review-enrichment service); no visible UI / frontend / docs / extension change.
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs. No changelog edited.

UI Evidence

N/A — backend-only change to the review-enrichment service; no visible UI, frontend, docs, or extension surface.

Notes

@dev-miro26
dev-miro26 requested a review from JSONbored as a code owner June 29, 2026 22:09
@dosubot dosubot Bot added the size:L label Jun 29, 2026
@loopover-orb

loopover-orb Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Tip

🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩

✅ Gittensory review result - approve/merge recommended

Review updated: 2026-06-29 23:12:30 UTC

5 files · 1 AI reviewer · no blockers · readiness 55/100 · CI green · unknown

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
The change adds a self-contained history analyzer, wires it into the enrichment registry, and renders a public history block for author context, similar past PRs, and linked issue alignment. The main degraded-search path is implemented correctly in the provided head content: failed Search API counts remain null and do not produce a first-time classification. The visible diff is safe enough to proceed, with the main remaining concerns around precision of the heuristic matching rather than a reachable breakage.

Nits — 6 non-blocking
  • nit: review-enrichment/src/analyzers/history.ts:75 keeps numeric tokens such as issue numbers, dates, and versions, which can skew linked-issue coverage when the issue title/body contains boilerplate identifiers rather than requirements.
  • nit: review-enrichment/src/analyzers/history.ts:284 only recognizes revert references in the generated quoted-title form, so squash-merge or manually written revert messages may leave a reverted prior PR rendered as merged.
  • nit: review-enrichment/src/analyzers/history.ts:177 says failed counts fall back to 0, but the implementation now correctly preserves null, so the comment should be updated to match the contract.
  • review-enrichment/src/analyzers/history.ts:75: filter pure numeric tokens or issue-reference-shaped tokens from requirementTokens so linked-issue alignment is driven by requirement words.
  • review-enrichment/src/analyzers/history.ts:284: add a tested fallback for common revert body formats such as `This reverts commit ...` only if you can map that commit back to the associated PR without guessing.
  • Readiness score is below the configured threshold — Use the readiness panel as advisory maintainer context; the score does not block this PR.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #1478
Related work ⚠️ 2 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:L; 1 linked issue).
Validation posture ❌ 5/25 Preflight is holding this PR; address the blocker before review.
Contributor workload ✅ 10/10 Author activity: 4 registered-repo PR(s), 3 merged, 1 issue(s).
Contributor context ✅ Confirmed Gittensor contributor dev-miro26; Gittensor profile; 4 PR(s), 1 issue(s).
Gate result ✅ Passing No configured blocker found.
Review context
Contributor next steps
  • Review top overlaps.
  • Add a concise scope and risk note.
  • Fix the blocker.
  • Triage stale or unlinked PRs.
  • Refresh registry data or choose a registered active repo.
  • 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 Jun 29, 2026
@dev-miro26

Copy link
Copy Markdown
Contributor Author

Please don't close this PR
I will fix and update more current issue.

@JSONbored

Copy link
Copy Markdown
Owner

Please don't close this PR I will fix and update more current issue.

That's fine for now, but please note later today automated one-shot reviews should be fully activated, which will mean PRs will either be merged or closed upon first review. You'll have to ensure things are perfect locally before submitting, moving forward, otherwise you'll end up with a lot of closures.

@dosubot dosubot Bot added the lgtm label Jun 29, 2026
@JSONbored
JSONbored merged commit a000c3f into JSONbored:main Jun 29, 2026
13 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in gittensory - v1 roadmap Jun 29, 2026
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.

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

feat(enrichment): history analyzer — author track record, similar past PRs, linked-issue alignment

2 participants