Skip to content

feat(mcp): expose repo label-policy audit via gittensory_get_label_audit - #1461

Merged
JSONbored merged 5 commits into
JSONbored:mainfrom
oktofeesh1:feat/label-audit-mcp
Jun 27, 2026
Merged

feat(mcp): expose repo label-policy audit via gittensory_get_label_audit#1461
JSONbored merged 5 commits into
JSONbored:mainfrom
oktofeesh1:feat/label-audit-mcp

Conversation

@oktofeesh1

@oktofeesh1 oktofeesh1 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #1602.

The deterministic label audit (buildLabelAudit, src/signals/engine.ts) reports whether a repo's configured (.gittensory.yml / dashboard) label set matches the live GitHub labels and is trustworthy for label-multiplier scoring — surfacing missing configured labels, suspicious status/source-style labels, and the overall trusted-label-pipeline readiness. It already powers the repo-intelligence response but had no MCP surface, so agents/CLI couldn't pull it (it is also absent from gittensory_get_repo_context, which exposes a different subset).

This adds gittensory_get_label_audit (maintainer-authenticated via the existing requireRepoAccess, advisory only), mirroring the merged gittensory_get_maintainer_noise (#1414) and gittensory_get_outcome_calibration (#1174): a thin load-or-compute service (src/services/label-audit.ts) that loads the repo's labels + cached signals and runs the existing builder, plus the MCP tool registration + output schema + method. Output flows through the existing redactSensitiveForMcp wrapper.

Tracked by #1602. Same shape and scope as the merged maintainer-noise (#1414) and outcome-calibration (#1174) tools: no new REST route, no migration, no auth-policy change.

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
  • npm run typecheck
  • npm run test:coveragecodecov/patch: every changed line and branch in src/services/label-audit.ts and the new src/mcp/server.ts lines is covered (verified via lcov, incl. both sides of the pipeline-readiness summary ternary).
  • 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 behavior has unit + integration tests: service unit test (test/unit/label-audit.test.ts, incl. both readiness summary branches + sanitizer boundary), the MCP call-test in test/unit/mcp-output-schemas.test.ts, and the tool-list assertion in test/integration/api.test.ts.

Safety

  • No secrets, wallets, hotkeys, raw trust scores, private rankings, or private maintainer evidence are exposed — the report is the same public-safe audit already served in the repo-intelligence response, routed through redactSensitiveForMcp; a test asserts no wallet/hotkey/payout/reward terms leak.
  • Public text stays sanitized and low-noise; no compensation/optimization implications.
  • No auth/cookie/CORS/session changes — the tool reuses the existing requireRepoAccess maintainer guard (no new auth surface).
  • MCP behavior is updated and tested (new tool + output schema + call-test).
  • No UI changes.
  • No docs/changelog changes needed.

Notes

Third tool in the maintainer-side MCP series after the merged gittensory_get_maintainer_noise (#1414) and the in-review gittensory_get_maintainer_lane (#1456); identical blessed pattern (service + tool + output schema + tests). MCP-tool-only — does not touch the deliberately-consolidated /v1/contributors/:login/* surface.

@oktofeesh1
oktofeesh1 requested a review from JSONbored as a code owner June 26, 2026 10:38
@dosubot dosubot Bot added the size:M label Jun 26, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.50%. Comparing base (06329d8) to head (79c7fbe).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1461   +/-   ##
=======================================
  Coverage   95.50%   95.50%           
=======================================
  Files         203      204    +1     
  Lines       22008    22018   +10     
  Branches     7956     7957    +1     
=======================================
+ Hits        21019    21029   +10     
  Misses        413      413           
  Partials      576      576           
Files with missing lines Coverage Δ
src/mcp/server.ts 95.71% <100.00%> (+0.04%) ⬆️
src/services/label-audit.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.

The deterministic label audit (`buildLabelAudit`, src/signals/engine.ts) reports
whether a repo's configured (.gittensory.yml / dashboard) label set matches the
live GitHub labels and is trustworthy for label-multiplier scoring — surfacing
missing configured labels, suspicious status/source-style labels, and the overall
trusted-label-pipeline readiness. It already powers the repo-intelligence response
but had no MCP surface, so agents/CLI couldn't pull it (it is also absent from
gittensory_get_repo_context, which exposes a different subset).

Add `gittensory_get_label_audit` (maintainer-authenticated via the existing
requireRepoAccess, advisory only), mirroring the merged maintainer-noise (JSONbored#1414)
and outcome-calibration (JSONbored#1174) serving: a thin load-or-compute service
(src/services/label-audit.ts) that loads the repo's labels + cached signals and
runs the existing builder, plus the MCP tool registration + output schema +
method. Output flows through the existing redactSensitiveForMcp wrapper.

No new REST route, no migration, no auth-policy change — purely additive to the
MCP surface.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@oktofeesh1
oktofeesh1 force-pushed the feat/label-audit-mcp branch from 4a72571 to 75cf7ef Compare June 26, 2026 21:24
@loopover-orb

loopover-orb Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Warning

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

⏸️ Gittensory review — held for maintainer review

5 files · 1 AI reviewers · no blockers · readiness 55/100 · CI green · clean

⏸️ Held for maintainer review — Touches a guarded path — held for manual review

Signal Result Evidence
Code review ✅ No blockers 1 reviewers, synthesized
Linked issue ✅ Linked #1602
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:M.
Validation evidence ❌ 5/25 Cached preflight status is hold.
Open PR queue ❌ 3/10 23 open PR(s), 11 likely reviewable, 12 unlinked.
Contributor context ✅ Confirmed Gittensor contributor oktofeesh1; Gittensor profile; 931 PR(s), 5 issue(s).
Gate result ⚠️ Not blocking Advisory; not blocking this PR.
Nits — 2 non-blocking
  • 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.
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

@loopover-orb loopover-orb Bot added gittensor gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. labels Jun 27, 2026
# Conflicts:
#	src/mcp/server.ts
#	test/integration/api.test.ts
#	test/unit/mcp-output-schemas.test.ts
@dosubot dosubot Bot added the lgtm label Jun 27, 2026
@JSONbored
JSONbored merged commit 8644465 into JSONbored:main Jun 27, 2026
16 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in gittensory - v1 roadmap Jun 27, 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(mcp): expose the repo label-policy audit via gittensory_get_label_audit

2 participants