Skip to content

feat(ui): gate-outcome breakdown card (#2203)#5098

Merged
JSONbored merged 6 commits into
JSONbored:mainfrom
andriypolanski:feat/ui-gate-outcome-card-2203
Jul 12, 2026
Merged

feat(ui): gate-outcome breakdown card (#2203)#5098
JSONbored merged 6 commits into
JSONbored:mainfrom
andriypolanski:feat/ui-gate-outcome-card-2203

Conversation

@andriypolanski

Copy link
Copy Markdown
Contributor

Closes #2203

Summary

Adds a read-only Gate outcomes card to the maintainer dashboard summarizing auto-merged, auto-closed, and held/manual terminal dispositions from repo-scoped agent.action.{merge,close,hold} audit events. Three stat tiles plus a stacked proportion bar; scoped to the maintainer's repos.

Part of #539.

Changes

Area Change
src/services/gate-outcome-breakdown.ts Pure buildGateOutcomeBreakdown + audit bucket classifier
src/db/repositories.ts listGateOutcomeAuditEventRollups (repo-scoped SQL rollups)
src/api/routes.ts Attach gateOutcomeBreakdown to qualityDashboard on GET /v1/app/maintainer-dashboard
apps/gittensory-ui/.../gate-outcome-card-model.ts UI types, rate formatting, stacked-bar segments
apps/gittensory-ui/.../gate-outcome-card.tsx Three Stat tiles + stacked proportion bar
apps/gittensory-ui/.../maintainer-panel.tsx Wire GateOutcomeCard into maintainer console
Tests gate-outcome-breakdown.test.ts, gate-outcome-audit-rollups.test.ts, gate-outcome-card.test.tsx, integration API assertion

UI Evidence

Required before opening the PR — upload screenshots via GitHub drag-and-drop (do not commit images):

Page / Feature Before After
Maintainer dashboard (/app maintainer panel) image image

Test plan

  • buildGateOutcomeBreakdown — all buckets present
  • buildGateOutcomeBreakdown — zero in one bucket
  • buildGateOutcomeBreakdown — empty rollups (null rates)
  • classifyGateOutcomeAuditBucket — ignores dry-run/denied/non-outcome events
  • listGateOutcomeAuditEventRollups — repo scope + empty scope
  • GateOutcomeCard — all outcomes, zero bucket, empty state
  • npm run ui:test -- gate-outcome-card.test.tsx
  • npm run test:unit -- test/unit/gate-outcome-breakdown.test.ts test/unit/gate-outcome-audit-rollups.test.ts
  • Manual: sign in as maintainer, open maintainer panel, confirm card renders with seeded audit rows
  • Before/after screenshots uploaded to PR (required — issue is visual)

Notes

  • Issue is labeled visual + gittensor:feature. Confirm contributor eligibility before opening.
  • Breakdown uses a 30-day window (GATE_OUTCOME_BREAKDOWN_WINDOW_DAYS) over all scoped repos (not the 12-repo quality cap).
  • Public-safe: counts and rates only — no reward/wallet/score fields in payload or UI.

@andriypolanski andriypolanski marked this pull request as draft July 11, 2026 14:54
@superagent-security

Copy link
Copy Markdown
Contributor

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

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

gittensory-orb Bot commented Jul 11, 2026

Copy link
Copy Markdown

Warning

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

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-12 04:18:55 UTC

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

⏸️ Suggested Action - Manual Review

  • Touches a guarded path — held for manual review: This PR changes guardrail-protected path(s): src/services/gate-outcome-breakdown.ts (matched src/services/**).

Review summary
This PR adds a self-contained, read-only "Gate outcomes" card to the maintainer dashboard, aggregating repo-scoped agent.action.{merge,close,hold} audit rows into auto-merged/auto-closed/held counts and rates, wired end-to-end (repository rollup query → pure service aggregation → route attachment → UI card) with matching test coverage at each layer. The repo-scoping filter in listGateOutcomeAuditEventRollups (src/db/repositories.ts) reuses the same lower(targetKey) prefix-range pattern as the existing listPrVisibilitySkipAuditEvents, and the additive qualityDashboard.gateOutcomeBreakdown field is non-breaking for existing consumers (UI type and two existing panel tests were updated to match). The change closes the linked issue #2203 and stays narrowly scoped to that feature.

Nits — 6 non-blocking
  • The route wiring in src/api/routes.ts computes gateOutcomeSinceIso with raw `24 * 60 * 60 * 1000` inline instead of a named constant (e.g. `ONE_DAY_MS`), per the external brief's magic-number flag.
  • GateOutcomeCard (apps/gittensory-ui/.../gate-outcome-card.tsx) is a single ~88-line component; consider splitting the stat-tile row and the stacked-bar/legend into small helper components for readability.
  • Couldn't fully verify from the truncated diff that the `repositories` array passed into `listGateOutcomeAuditEventRollups` in src/api/routes.ts is the same maintainer-scoped set used elsewhere in the handler (vs. all installations) — the integration test only exercises a single-repo owner session, so double-check multi-repo/multi-tenant scoping isn't accidentally broader than intended.
  • Confirm the `repositories` variable feeding `repoFullNames` in the new routes.ts block is drawn from the same scoped list as `qualityRepoInputs`/`qualityRepoNames` used just above it, to avoid leaking counts from repos outside the maintainer's scope.
  • Consider extracting the day-in-ms conversion in routes.ts into a small shared constant if similar window calculations recur elsewhere in the file.
  • 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 #2203
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low 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: 150 registered-repo PR(s), 100 merged, 29 issue(s).
Contributor context ✅ Confirmed Gittensor contributor andriypolanski; Gittensor profile; 150 PR(s), 29 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: Python, TypeScript, JavaScript, Rust, Cuda, Kotlin, MDX, Scala
  • Official Gittensor activity: 150 PR(s), 29 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
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 Gittensory, a quiet PR intelligence layer for OSS maintainers.

  • Re-run Gittensory review

@codecov

codecov Bot commented Jul 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.20%. Comparing base (74afe7d) to head (7ff3006).
⚠️ Report is 14 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5098   +/-   ##
=======================================
  Coverage   94.20%   94.20%           
=======================================
  Files         470      471    +1     
  Lines       39705    39736   +31     
  Branches    14489    14498    +9     
=======================================
+ Hits        37404    37435   +31     
  Misses       1645     1645           
  Partials      656      656           
Flag Coverage Δ
shard-1 46.13% <58.06%> (-0.28%) ⬇️
shard-2 33.84% <6.45%> (+0.27%) ⬆️
shard-3 31.56% <6.45%> (+0.23%) ⬆️
shard-4 32.62% <6.45%> (-0.16%) ⬇️
shard-5 33.49% <35.48%> (-0.08%) ⬇️
shard-6 45.15% <96.77%> (+0.23%) ⬆️

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

Files with missing lines Coverage Δ
src/api/routes.ts 94.30% <100.00%> (+0.01%) ⬆️
src/db/repositories.ts 96.75% <100.00%> (+0.01%) ⬆️
src/services/gate-outcome-breakdown.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.

@andriypolanski andriypolanski marked this pull request as ready for review July 11, 2026 15:38
@gittensory-orb gittensory-orb Bot added the manual-review Gittensor contributor context label Jul 11, 2026
@gittensory-orb

Copy link
Copy Markdown

An AI reviewer flagged a likely defect, but its confidence was below this repository's configured close-confidence floor, so this is held for a maintainer to confirm instead of closing automatically. Resolve the flagged defect (see the review notes), or ask a maintainer to override.

@JSONbored JSONbored merged commit 19fbd93 into JSONbored:main Jul 12, 2026
17 checks passed
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. manual-review Gittensor contributor context

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(ui): gate-outcome breakdown card (auto-merge / auto-close / hold)

2 participants