Skip to content

feat(enrichment): doc-comment vs signature drift analyzer (#1519)#1622

Closed
dale053 wants to merge 7 commits into
JSONbored:mainfrom
dale053:feat/enrichment-doc-comment-signature-drift
Closed

feat(enrichment): doc-comment vs signature drift analyzer (#1519)#1622
dale053 wants to merge 7 commits into
JSONbored:mainfrom
dale053:feat/enrichment-doc-comment-signature-drift

Conversation

@dale053

@dale053 dale053 commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a doc-comment drift analyzer to the enrichment brief. It flags JSDoc @param tags that don't
match the adjacent function signature when the PR touches those lines — specifically:

  • stale-param: a @param foo in the JSDoc where foo is no longer a parameter of the function
  • missing-param: a parameter in the function signature with no corresponding @param in the JSDoc

The analyzer is pure compute (no network calls). It reconstructs the new-file view from unified diff
patches, slides a window over JSDoc-to-function pairs, and only flags when at least one line in that
window is a PR-added line — so pre-existing drift in untouched code is never reported. Destructured
top-level params are skipped to avoid false positives from wrapper-name conventions (e.g. @param options
vs { host, port }: Options). Caps at 20 findings per PR.

Scope: JS/TS/JSX/TSX/MJS/CJS. Handles bare @param, {Type} prefix, [optional] bracket notation,
@param [name=default], rest params (...name), and the TS this pseudo-param.

Closes #1519.

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
  • npm run typecheck — fails on pre-existing missing optional self-host deps (pg, ioredis, @sentry/node, @cloudflare/puppeteer, pixelmatch, pngjs) that are absent in the dev environment but present in CI via npm ci. No new type errors introduced.
  • npm run test:coverage locally — 71/71 enrichment package tests pass; 3,837/3,837 main-suite assertions pass; pre-existing failures are all optional-dep import errors unrelated to this change.
  • 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
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries

If any required check was skipped, explain why:

  • npm run typecheck, npm run test:workers, npm run test:mcp-pack, npm run ui:* — dev environment is missing optional selfhost packages (pg, ioredis, etc.) and UI tooling. The enrichment package itself builds and tests clean (npm run build + all 71 tests pass). CI runs npm ci which installs all deps and will exercise these steps.

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 changes)
  • API/OpenAPI/MCP behavior is updated and tested where needed. (N/A — pure enrichment analyzer; no API surface change)
  • 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 JPG/JPEG or PNG screenshots arranged as organized, captioned, clickable thumbnails. (N/A — no visible UI changes)
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs.

UI Evidence

N/A — no visible UI changes.

Notes

Files changed:

File Change
review-enrichment/src/types.ts DocCommentFinding interface + docComment? key in BriefFindings
review-enrichment/src/analyzers/doc-comment.ts New analyzer (280 lines, pure compute)
review-enrichment/src/brief.ts Import + register scanDocComment in ANALYZERS registry
review-enrichment/src/render.ts Render docComment findings as a markdown brief section
review-enrichment/test/enrichment.test.ts 27 new tests covering extractJsDocParams, extractFunctionParams, reconstructLines, scanPatchForDocDrift (stale-param, missing-param, no-touch guard, destructured skip, JSDoc-not-followed-by-fn, single-line JSDoc, class methods, arrow fns, rest params, unbalanced parens, MAX_FINDINGS cap), scanDocComment (file filter, multi-file cap), renderBrief, and buildBrief integration

…1519)

Adds a REES analyzer that flags JSDoc @param tags that don't match the
adjacent function signature when the PR touches those lines — stale tags
referencing removed params and missing tags for newly added params.

Pure compute, no network calls. Operates on unified diff patches only:
reconstructs the new-file view from hunk lines, slides a window over
JSDoc-to-function pairs, and checks for drift only when at least one
line in the window is a PR-added line (so pre-existing drift is not
flagged). Destructured top-level params are skipped to avoid false
positives from wrapper-name conventions. Caps at 20 findings per PR.

Supports JS/TS/JSX/TSX/MJS/CJS. Handles bare @param, {Type} @param,
[optional] bracket notation, rest params, and the TS `this` pseudo-param.

Closes JSONbored#1519.
@dale053 dale053 requested a review from JSONbored as a code owner June 27, 2026 22:24
@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jun 27, 2026
@gittensory-orb

gittensory-orb Bot commented Jun 28, 2026

Copy link
Copy Markdown

Warning

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

⏸️ Gittensory review — held for maintainer review

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

⏸️ Held for maintainer review — Large change — held for manual review

Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #1519
Related work ⚠️ 3 scoped overlaps Top overlaps are listed below; lower-confidence bulk is hidden.
Review load ❌ 8/20 Readiness component derived from cached public PR metadata and labels; size label size:L.
Validation evidence ❌ 5/25 Cached preflight status is hold.
Open PR queue ❌ 3/10 21 open PR(s), 14 likely reviewable, 7 unlinked.
Contributor context ✅ Confirmed Gittensor contributor dale053; Gittensor profile; 43 PR(s), 20 issue(s).
Gate result ⚠️ Not blocking Advisory; not blocking this PR.
Nits — 2 non-blocking
  • Readiness score is below the configured threshold — Use the readiness panel as advisory maintainer context; the score does not block this PR.
  • Large change — held for manual review — Split this into smaller, focused PRs, or a maintainer reviews and merges it manually.
Review context
Contributor next steps
  • Review top overlaps.
  • Add scope summary.
  • Fix blocker.
  • Expect slower review.
  • 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.
  • Review load = cached public PR metadata such as size labels, changed paths, and preflight status.
  • Open PR queue = repo-wide review pressure; it is not a PR 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

@gittensory-orb gittensory-orb Bot added gittensor Gittensor contributor context gittensor:feature Gittensor-scored feature linked to a feature issue - worth 1.25x multiplier. labels Jun 28, 2026

@JSONbored JSONbored left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merge conflicts, please fix and resubmit.

This branch has conflicts that must be resolved
Use the web editor or the command line to resolve conflicts before continuing.

  • review-enrichment/src/brief.ts
  • review-enrichment/src/render.ts
  • review-enrichment/src/types.ts

@JSONbored JSONbored closed this Jun 29, 2026
@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 - worth 1.25x multiplier. gittensor Gittensor contributor context size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

feat(enrichment): Doc-comment-vs-signature drift

2 participants