Skip to content

feat(grafana): add additive maintainer review event panels - #6138

Merged
JSONbored merged 1 commit into
JSONbored:mainfrom
james3773:feat/issue-3717-audit-panels
Jul 15, 2026
Merged

feat(grafana): add additive maintainer review event panels#6138
JSONbored merged 1 commit into
JSONbored:mainfrom
james3773:feat/issue-3717-audit-panels

Conversation

@james3773

Copy link
Copy Markdown
Contributor

Summary

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:

  • ./node_modules/.bin/vitest run test/unit/selfhost-grafana-dashboard.test.ts test/unit/selfhost-grafana-reporting.test.ts
    passed for the dashboard suite; the reporting suite is currently sqlite3-gated in this container and was skipped by Vitest here.
  • npm run test:ci advanced through actionlint, migration/schema checks, env-reference checks, and selfhost:validate-observability, then stopped at npm run cf-typegen:check because local wrangler types consistently fails with write EPIPE in this environment before the later template-listed commands can run.
  • This is a draft PR so CI can confirm the remaining validation path in GitHub Actions.

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

Pending self-host Grafana screenshots; this draft changes dashboard JSON only and I do not have a running Grafana capture path in this container.

Notes

  • Issue comment context: part 1 already landed in #4134; this PR implements only the remaining part 2 additive-event-count work the follow-up comments called out on 2026-07-08 and 2026-07-14.
  • Written finding: the existing Manual review / Approved (pending merge) / Ignored (no gate decision yet) tiles are latest-state snapshots because scripts/export-grafana-reporting-db.sh derives review_targets from pull_requests plus the latest native review_audit gate_decision row. Before this change, the maintainer dashboard had no audit_events query path at all, so it could not show true additive event flow.
  • Additive panels intentionally use the audit ledger (agent.action.hold, agent.action.approve, github_app.pr_visibility_skipped) and keep the snapshot tiles unchanged so maintainers can compare flow vs. current backlog/state.

@JSONbored
JSONbored marked this pull request as ready for review July 15, 2026 12:42
@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 15, 2026
@JSONbored
JSONbored self-requested a review as a code owner July 15, 2026 12:42
@superagent-security superagent-security Bot added the contributor:flagged Contributor flagged for review by trust analysis. label Jul 15, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

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

@loopover-orb

loopover-orb Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Warning

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

⏸️ LoopOver review result - manual review recommended

Review updated: 2026-07-15 19:58:37 UTC

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

⏸️ Suggested Action - Manual Review

Review summary
This PR adds a new audit_events table to the self-host Grafana reporting exporter (both pg-source and sqlite-source paths, plus append-only fingerprinting for the fast-path skip), and wires three new additive stat panels (held-for-review, approvals, visibility-skipped) into the maintainer dashboard without touching the existing snapshot tiles. The target_key parsing (repo/pull_number split on '#'), the bot/outcome filtering pushed to query time rather than export time, and the LEFT JOIN-vs-no-pull_requests-table fallback are all handled consistently between the sqlite and postgres code paths, and the new tests exercise both the exporter's row-shaping and the dashboard's per-panel SQL against a real sqlite CLI. I don't see a correctness defect in the visible diff — this looks like a clean, well-targeted additive change tied to an open issue.

Nits — 5 non-blocking
  • scripts/export-grafana-reporting-db.sh: the two near-identical sqlite INSERT blocks (with vs without a pull_requests join) duplicate a large multi-line SQL string; consider factoring the shared SELECT/WHERE clause or driving submitter via a `LEFT JOIN` guarded by a `CASE` on table existence instead.
  • scripts/export-grafana-reporting-db.sh: the exported event_type allowlist includes `agent.action.close`, `agent.action.merge`, and `github_app.pr_public_surface_published`, none of which any new dashboard panel queries yet — worth a comment noting they're pre-staged for future panels, or trim them until a panel consumes them.
  • grafana/dashboards/maintainer-reviews.json: panel descriptions for the three new stat tiles are quite long inline JSON strings; fine functionally but consider whether that verbosity belongs in panel docs vs a dashboard README.
  • Add a one-line comment in export-grafana-reporting-db.sh near the audit_events event_type IN (...) list explaining which are currently dashboard-consumed vs reserved for future panels.
  • Consider extracting the shared SELECT column list/WHERE clause between the pull_requests-join and no-join sqlite INSERT statements into a shell variable to cut duplication.
Flagged checks (non-blocking)
  • Contributor trust — Contributor flagged for review
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #3717
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: 886 registered-repo PR(s), 624 merged, 83 issue(s).
Contributor context ✅ Confirmed Gittensor contributor james3773; Gittensor profile; 886 PR(s), 83 issue(s).
Gate result ✅ Passing No configured blocker found.
Improvement ℹ️ Insufficient signal risk: clean · value: insufficient-signal · LLM: moderate
Linked issue satisfaction

Partially addressed
The PR ships a solid version of requirement 2 (new additive event-count panels sourced from audit_events, exporter plumbing, and tests) but does not appear to add the required part 1 deliverable — updated descriptions/tooltips on the three existing 'Manual review', 'Commented (advisory)', and 'Ignored' panels clarifying their current-state semantics; the diff shows those panels' definitions untouc

Review context
  • Author: james3773
  • 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, MDX, Clojure, Cuda, Dart
  • Official Gittensor activity: 886 PR(s), 83 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.
🧪 Chat with LoopOver

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

  • @loopover ask <question> answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat <question> answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover 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/loopover-commands

🧪 Experimental — new and may change.

🟩 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.

@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.33%. Comparing base (e94ba61) to head (4e0113d).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6138   +/-   ##
=======================================
  Coverage   95.33%   95.33%           
=======================================
  Files         598      598           
  Lines       47178    47178           
  Branches    15026    15026           
=======================================
  Hits        44975    44975           
  Misses       1477     1477           
  Partials      726      726           
Flag Coverage Δ
shard-1 43.94% <ø> (ø)
shard-2 36.66% <ø> (ø)
shard-3 32.16% <ø> (ø)
shard-4 34.14% <ø> (ø)
shard-5 32.21% <ø> (ø)
shard-6 44.90% <ø> (ø)

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

@JSONbored
JSONbored merged commit 6d03648 into JSONbored:main Jul 15, 2026
15 of 16 checks passed
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:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(observability): clarify manual/commented/ignored panel semantics on the Reviews & PRs dashboard

2 participants