Skip to content

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

Merged
JSONbored merged 4 commits into
JSONbored:mainfrom
andriypolanski:feat/slop-duplicate-trend-card-2202-v2
Jul 13, 2026
Merged

feat(ui): slop + duplicate trend card on maintainer dashboard (#2202)#5635
JSONbored merged 4 commits into
JSONbored:mainfrom
andriypolanski:feat/slop-duplicate-trend-card-2202-v2

Conversation

@andriypolanski

@andriypolanski andriypolanski commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds the missing #2202 maintainer-dashboard card: an 8-week trend-over-time view of slop-flag and duplicate-flag rates (dual TrendChart series, band labels only — never raw slop-risk or credibility numbers).

  • Extends buildQueueHealth / queue-health signal snapshots with slopFlaggedPullRequests and duplicateFlaggedPullRequests so historical snapshots carry countable flags.
  • Adds buildMaintainerSlopDuplicateTrend to roll up weekly rates from listSignalSnapshots("queue-health") plus the live shaped queue-health point; exposes qualityDashboard.slopDuplicateTrend on GET /v1/app/maintainer-dashboard.
  • New SlopDuplicateTrendCard wired into MaintainerPanel after QueueHealthCard, with generatedAt + stale pill, shared legend, and empty / one-series-empty / no-data branches.

Closes #2202. Part of #539.

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.

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage locally; codecov/patch requires ≥99% coverage of the lines AND branches you changed (aim for 100% on your diff so CI variance does not fail near the threshold). Global coverage is a non-blocking trend with a loose 90% backstop, not the gate.
  • 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:

Scoped tests run so far (not a substitute for full npm run test:ci):

  • npx vitest run test/unit/maintainer-slop-duplicate-trend.test.ts — both weekly series, legacy snapshots, one-series-empty, no-data, multi-repo aggregation, slopBandLabelFromRate branches, live buildQueueHealth integration
  • npx vitest run test/unit/maintainer-quality-dashboard.test.ts test/unit/predicted-gate-engine-branch-coverage.test.ts
  • npx vitest run test/integration/api.test.ts -t "counts cached open PRs across all in-scope"
  • npx vitest run test/unit/routes-gate-outcome-breakdown.test.ts
  • npm --workspace @loopover/ui run test -- --run slop-duplicate-trend-card.test.tsx
  • npx eslint on changed UI files (prettier clean)

Full gate still required before push: npm run test:ci + npm audit --audit-level=moderate on Node 22.

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 — maintainer dashboard without trend card image
After — loaded dual-series trend card image
After - loaded empty trend card image
Before - (Mobile: 375×812) image
After - (Mobile: 375×812) image

@andriypolanski
andriypolanski marked this pull request as draft July 13, 2026 17:30
@loopover-orb loopover-orb Bot added gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. gittensor:priority Maintainer-selected Gittensor priority — scores a 1.5x multiplier. labels Jul 13, 2026
@loopover-orb

loopover-orb Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Warning

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

⏸️ LoopOver review result - manual review recommended

Review updated: 2026-07-13 18:46:36 UTC

22 files · 1 AI reviewer · no blockers · readiness 82/100 · CI green · clean

⏸️ Suggested Action - Manual Review

  • Touches a guarded path — held for manual review: This PR changes guardrail-protected path(s): apps/gittensory-ui/src/components/site/app-panels/maintainer-panel.tsx (matched apps/gittensory-ui/**), apps/gittensory-ui/src/components/site/app-panels/slop-duplicate-trend-card-model.ts (matched apps/gittensory-ui/**), apps/gittensory-ui/src/components/site/app-panels/slop-duplicate-trend-card.test.tsx (matched apps/gittensory-ui/**), apps/gittensory-ui/src/components/site/app-panels/slop-duplicate-trend-card.tsx (matched apps/gittensory-ui/**), packages/gittensory-engine/src/signals/predicted-gate-engine.ts (matched packages/gittensory-engine/**), and 3 more.

Review summary
This PR adds the #2202 maintainer-dashboard trend card end-to-end: schema-free flag counts on QueueHealth.signals (mirrored in both `src/signals/engine.ts` and `packages/gittensory-engine/src/signals/predicted-gate-engine.ts`), a bulk per-target snapshot-history query, a pure `buildMaintainerSlopDuplicateTrend` rollup, and the React card + model with empty/one-series-empty/no-data branches. The legacy-snapshot backfill heuristic (`legacyDuplicateFlagged`) and the D1-safe `row_number() OVER()` windowed query are both handled correctly, and the test suite (unit + integration + UI) covers the real branches rather than fabricated ones. The one real inefficiency is that `src/api/routes.ts` recomputes `buildCollisionReport`/`buildQueueHealth` a second time per repo purely to feed the trend builder, duplicating work `buildMaintainerQualityDashboard` already does internally for the same `qualityRepoInputs`.

Nits — 6 non-blocking
  • src/api/routes.ts:~1416-1433 recomputes `buildCollisionReport`/`buildQueueHealth` per repo to build `currentQueueHealth` for the trend, duplicating the same computation `buildMaintainerQualityDashboard` already performs on the identical `qualityRepoInputs` — consider threading the already-built `QueueHealth` through instead of recomputing.
  • src/services/maintainer-slop-duplicate-trend.ts:9-10 `SLOP_DUPLICATE_TREND_SNAPSHOT_LIMIT = weeks*2` assumes queue-health snapshots run at most twice a week; if the snapshot job cadence is higher, older weeks in the 8-week window could silently starve for history — worth a comment cross-reference to the actual job interval or a slightly larger buffer.
  • apps/gittensory-ui/.../slop-duplicate-trend-card.tsx uses raw literals (`80` chart height, magic date-slice indices in `formatGeneratedAt`) — minor readability nit, not worth a constant given single use.
  • src/services/maintainer-slop-duplicate-trend.ts:129 nesting flagged by static analysis at depth 5 in `readQueueHealthSignals`/ternary fallback chain — consider extracting the legacy-fallback branch into its own small helper for readability.
  • Pass the already-computed `QueueHealth` per repo from `buildMaintainerQualityDashboard`'s internal loop (or hoist that loop) into `buildMaintainerSlopDuplicateTrend`'s `currentQueueHealth` input instead of rebuilding collisions/queue-health a second time in routes.ts.
  • 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 #2202
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 (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 163 registered-repo PR(s), 106 merged, 28 issue(s).
Contributor context ✅ Confirmed Gittensor contributor andriypolanski; Gittensor profile; 163 PR(s), 28 issue(s).
Gate result ⚠️ Not blocking Advisory; not blocking this PR.
Improvement ✅ Minor risk: clean · value: minor — Code changes are accompanied by test evidence.
Review context
  • Author: andriypolanski
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 163 PR(s), 28 issue(s).
  • Related work: Titles/paths share 3 meaningful terms. (issue #5213, issue #642)
  • 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.
[BETA] Chat with Gittensory

Ask Gittensory a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @gittensory ask <question> answers contribution-quality Q&A with source citations and freshness.
  • @gittensory chat <question> answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @gittensory mention with a real question is routed to the closest matching read-only command automatically -- no exact syntax required.

Full command reference: https://gittensory.aethereal.dev/docs/gittensory-commands

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 LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

@superagent-security

Copy link
Copy Markdown
Contributor

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

@andriypolanski
andriypolanski marked this pull request as ready for review July 13, 2026 17:34
@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.02%. Comparing base (b189eaf) to head (08b9425).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff            @@
##             main    #5635    +/-   ##
========================================
  Coverage   95.01%   95.02%            
========================================
  Files         575      576     +1     
  Lines       45738    45845   +107     
  Branches    14661    14692    +31     
========================================
+ Hits        43459    43565   +106     
  Misses       1528     1528            
- Partials      751      752     +1     
Flag Coverage Δ
shard-1 43.98% <77.27%> (+0.08%) ⬆️
shard-2 35.69% <19.09%> (-0.05%) ⬇️
shard-3 32.31% <19.09%> (-0.03%) ⬇️
shard-4 32.53% <12.72%> (-0.05%) ⬇️
shard-5 31.78% <31.81%> (+<0.01%) ⬆️
shard-6 44.13% <73.63%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ensory-engine/src/signals/predicted-gate-engine.ts 100.00% <100.00%> (ø)
src/api/routes.ts 94.32% <100.00%> (+0.02%) ⬆️
src/db/repositories.ts 96.71% <100.00%> (+0.02%) ⬆️
src/services/maintainer-quality-dashboard.ts 100.00% <ø> (ø)
src/services/maintainer-slop-duplicate-trend.ts 100.00% <100.00%> (ø)
src/signals/engine.ts 97.50% <100.00%> (+0.01%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JSONbored
JSONbored merged commit cdfc14b into JSONbored:main Jul 13, 2026
16 checks passed
@andriypolanski
andriypolanski deleted the feat/slop-duplicate-trend-card-2202-v2 branch July 16, 2026 15:10
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. gittensor:priority Maintainer-selected Gittensor priority — scores a 1.5x multiplier. manual-review Gittensor contributor context

Development

Successfully merging this pull request may close these issues.

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

3 participants