Skip to content

feat(ui): slop + duplicate trend card on maintainer dashboard (#2202)#4707

Closed
jimcody1995 wants to merge 8 commits into
JSONbored:mainfrom
jimcody1995:feat/slop-duplicate-trend-2202
Closed

feat(ui): slop + duplicate trend card on maintainer dashboard (#2202)#4707
jimcody1995 wants to merge 8 commits into
JSONbored:mainfrom
jimcody1995:feat/slop-duplicate-trend-2202

Conversation

@jimcody1995

Copy link
Copy Markdown
Contributor

Add weekly slop-flag and duplicate-flag rate trends from queue-health snapshots to the maintainer console, with band labels, freshness metadata, and Vitest coverage.

Summary

  • Extends buildQueueHealth / queue-health signal snapshots with slopFlaggedPullRequests and duplicateFlaggedPullRequests counts.
  • Adds buildMaintainerSlopDuplicateTrend to roll up an 8-week trend from historical snapshots plus the live queue-health point for the current week.
  • Exposes qualityDashboard.slopDuplicateTrend on GET /v1/app/maintainer-dashboard.
  • Adds SlopDuplicateTrendCard to the maintainer console: dual TrendChart series (slop flag rate, duplicate flag rate), shared legend, generatedAt, and stale/fresh pill.
  • Surfaces band labels only on the card — no raw slop-risk, trust, or credibility numbers.
  • Vitest coverage for service/UI branches (populated series, one-series-empty, no-data, legacy snapshots, duplicate clusters, maintainer panel wiring).
  • Guards buildQueueHealth when collision reports omit clusters.
  • Covers the keep-newer-snapshot branch in weekly aggregation for 100% codecov/patch on changed src/** lines.

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 a currently open issue this PR resolves (e.g. Closes #123) — a linked open issue is required for every contributor PR.

Closes #2202
Part of #539

Validation

  • git diff --check
  • npm run typecheck (UI workspace)
  • npm run test:coverage locally — patch coverage verified at 100% (92/92 changed executable lines, 69/69 changed branches in src/**)
  • 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:

  • MCP / worker / actionlint checks are unchanged by this PR; CI runs the full matrix on push.
  • Local runs completed during development:
    • npm run test:coverage (full suite, 94.93% lines global)
    • npm test -- --run test/unit/maintainer-slop-duplicate-trend.test.ts
    • npm --workspace @jsonbored/gittensory-ui test -- --run src/components/site/app-panels/slop-duplicate-trend-card.test.tsx
    • npm --workspace @jsonbored/gittensory-ui test -- --run src/components/site/app-panels/slop-duplicate-trend-card-model.test.ts
    • npm --workspace @jsonbored/gittensory-ui test -- --run src/components/site/app-panels/maintainer-panel.test.tsx

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.
  • API/OpenAPI/MCP behavior is updated and tested where needed.
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks.
  • Visible UI changes include a UI Evidence section below with JPG/JPEG or PNG screenshots arranged as organized, captioned, clickable thumbnails. SVG screenshots are not used as review evidence. Review-only screenshots or recordings are not committed to the repository.
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs.

UI Evidence

State / title JPG/PNG evidence
Before/app/maintainer loaded state (no trend card between StatCards and Install health) before
After/app/maintainer loaded state (new Slop + duplicate trend card with dual charts, legend, generatedAt, fresh pill) after

What changed: StatCards flow straight into Install health before; after, the new Slop + duplicate trend card sits between StatCards and Install health.

Notes

Made with Cursor

jimcody1995 and others added 8 commits July 10, 2026 14:23
…red#2202)

Add weekly slop-flag and duplicate-flag rate trends from queue-health snapshots to the maintainer console, with band labels, freshness metadata, and Vitest coverage.

Co-authored-by: Cursor <cursoragent@cursor.com>
Update maintainer and queue-health test fixtures for the new required
slopFlaggedPullRequests and duplicateFlaggedPullRequests counts, and drop
those fields from the engine-package predicted-gate coverage stub.

Co-authored-by: Cursor <cursoragent@cursor.com>
…e absent

buildQueueHealth now tolerates collision reports without a clusters array,
preventing contributor draft and other callers from crashing when only
summary counts are present.

Co-authored-by: Cursor <cursoragent@cursor.com>
…red#2202)

Format slop trend UI files for prettier, add model/panel coverage tests,
and exercise legacy snapshot, duplicate-cluster, and edge-case branches
in buildMaintainerSlopDuplicateTrend/buildQueueHealth.

Co-authored-by: Cursor <cursoragent@cursor.com>
)

Reorder same-week snapshot fixtures so an older point is skipped when a
newer repo snapshot is already aggregated, satisfying codecov/patch ≥99%.

Co-authored-by: Cursor <cursoragent@cursor.com>
@jimcody1995 jimcody1995 requested a review from JSONbored as a code owner July 10, 2026 15:59
@superagent-security superagent-security Bot added the contributor:flagged Contributor flagged for review by trust analysis. label Jul 10, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

🚨 Contributor flagged. Click here for more info: Superagent Dashboard

@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.15%. Comparing base (af90fa9) to head (c12a2ea).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4707      +/-   ##
==========================================
+ Coverage   94.14%   94.15%   +0.01%     
==========================================
  Files         437      438       +1     
  Lines       38551    38634      +83     
  Branches    14055    14081      +26     
==========================================
+ Hits        36294    36377      +83     
  Misses       1599     1599              
  Partials      658      658              
Files with missing lines Coverage Δ
src/api/routes.ts 94.28% <100.00%> (+0.01%) ⬆️
src/services/maintainer-quality-dashboard.ts 100.00% <ø> (ø)
src/services/maintainer-slop-duplicate-trend.ts 100.00% <100.00%> (ø)
src/signals/engine.ts 97.46% <100.00%> (+0.01%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

gittensory-orb Bot commented Jul 10, 2026

Copy link
Copy Markdown

Warning

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

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-10 16:16:00 UTC

19 files · 1 AI reviewer · no blockers · readiness 82/100 · CI green · unstable

⏸️ Suggested Action - Manual Review

  • Touches a guarded path — held for manual review: This PR changes guardrail-protected path(s): src/services/maintainer-quality-dashboard.ts (matched src/services/**), src/services/maintainer-slop-duplicate-trend.ts (matched src/services/**).

Review summary
This PR adds a public-safe weekly slop-flag/duplicate-flag rate trend to the maintainer dashboard: two new signal counts on `QueueHealth` (engine.ts), a rollup service (`maintainer-slop-duplicate-trend.ts`) that aggregates historical snapshots plus the live queue-health point per ISO week, wiring into the maintainer-dashboard route, and a new dual-series `TrendChart` card. The duplicate-flag logic correctly restricts to high-risk clusters with ≥2 PR items (not PR-issue collisions), the legacy-snapshot fallback and missing-`clusters` guard are exercised by tests, and band labels/rates are the only thing surfaced to the UI (no raw risk scores leak, verified by the `FORBIDDEN_PUBLIC_TERMS` test). I found no reachable correctness defect — the week-bucketing math is UTC/Monday-aligned and consistent, and the route wiring reuses the existing `qualityRepoInputs` shape.

Nits — 6 non-blocking
  • src/api/routes.ts: `buildCollisionReport`/`buildQueueHealth` are now computed twice per repo per request (once here for `slopDuplicateTrend`, and again inside `buildMaintainerQualityDashboard`'s existing repo loop) — for repos with large PR/issue lists this doubles the per-request signal computation; consider passing the already-computed `collisions`/`queueHealth` into both builders.
  • src/api/routes.ts: the new code zips `queueHealthHistories` to `qualityRepoInputs` by array index (`queueHealthHistories[index]`) — confirm `qualityRepos` and `qualityRepoInputs` are always built in the same order/length, since an index mismatch here would silently attach the wrong repo's snapshot history.
  • src/services/maintainer-slop-duplicate-trend.ts:114 `legacyDuplicateFlagged` is a heuristic (`collisionClusters * 2`) for pre-feat(ui): slop + duplicate trend-over-time card (maintainer dashboard) #2202 snapshots with no real flagged-PR count — worth a one-line note in the trend summary/UI that older weeks are approximated, since the rate isn't measured the same way as new weeks.
  • Magic numbers: slop band thresholds `25`/`60` in maintainer-slop-duplicate-trend.ts:91-92 and the `slice(5,22)` in slop-duplicate-trend-card-model.ts:62 would read clearer as named constants.
  • slop-duplicate-trend-card.tsx: `SlopDuplicateTrendCard`'s render body is fairly large (~81 lines) — consider hoisting the legend block into its own component the way `TrendPanel`/`LegendItem` already are.
  • Touches a guarded path — held for manual review — A maintainer must review and merge this change.
Flagged checks (non-blocking)
  • Contributor trust — Contributor flagged for review
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #2202
Related work ⚠️ 1 scoped overlap Top overlaps are listed below; lower-confidence bulk is hidden.
Change scope ❌ 8/20 High 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: 84 registered-repo PR(s), 31 merged, 1 issue(s).
Contributor context ✅ Confirmed Gittensor contributor jimcody1995; Gittensor profile; 84 PR(s), 1 issue(s).
Gate result ⚠️ Not blocking Advisory; not blocking this PR.
Linked issue satisfaction

Partially addressed
The PR implements all functional deliverables from the issue — a new SlopDuplicateTrendCard with dual TrendChart series, shared legend, band labels (not raw scores), generatedAt/stale surfacing, wiring into maintainer-panel.tsx, and Vitest coverage for both-series, one-series-empty, and no-data branches. However, the issue explicitly mandates a filled-in before/after screenshot table for this UI c

Review context
  • Author: jimcody1995
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: TypeScript, JavaScript
  • Official Gittensor activity: 84 PR(s), 1 issue(s).
  • Related work: Titles/paths share 3 meaningful terms. (issue #642, issue #2013)
Contributor next steps
  • Review top overlaps.
  • Add a concise scope and risk note.
  • 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.
Visual preview
Route Viewport Before (production) After (this PR's preview) Diff
/ desktop before / after /
/ mobile before / (mobile) after / (mobile)

Click any thumbnail to open the full-size screenshot. Before = production · After = this PR's preview deploy.

🟩 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

Copy link
Copy Markdown

This pull request changes UI/visual code but its description is missing a before/after screenshot table. Every changed page/feature needs a markdown table with a before column and an after column, each cell a clickable thumbnail (uploaded to the PR, not committed to the repo) with a caption below — for example:

Before After
before — caption after — caption

Please resubmit with the table filled in. This is an automated maintenance action.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor:flagged Contributor flagged for review by trust analysis. gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 1.25x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(ui): slop + duplicate trend-over-time card (maintainer dashboard)

1 participant