Skip to content

fix(observability): confirm and repoint the maintainer dashboard's review_targets ledger (part 2 of #3717) #4166

Description

@JSONbored

Context

Follow-up to #3717 (part 2 of that issue's two-part ask), which was itself deliberately left
unshipped there: PR #4134 shipped part 1 (the panel description/tooltip clarification on panels
5/6/7) and explicitly deferred "a true additive event-count panel backed by audit_events" as
out of scope, pending investigation of where review_targets.status/.verdict actually gets set
to manual/commented/ignored for gittensory-native PRs.

This issue reports that investigation's result: it surfaced a bigger problem than "which
event_type to use."

Finding 1 — no existing audit_events event_type fits (confirms #3717's own suspicion)

Scanned every literal eventType: in src/queue/processors.ts: 78 distinct string literals plus
7 more resolved from named constants (REVIEW_EVASION_CLOSED_EVENT_TYPE,
REGATE_REPAIR_ATTEMPT_EVENT_TYPE, REGATE_REPAIR_EXHAUSTED_EVENT_TYPE,
CI_STUCK_FINALIZE_GUARD_EVENT_TYPE, REVIEW_NAG_PING_EVENT_TYPE,
MONITORED_MENTION_PING_EVENT_TYPE, COMMAND_RATE_LIMIT_EVENT_TYPE). None represent "PR
disposition became manual/commented/ignored" as a discrete event.

Finding 2 (new, more consequential) — review_targets appears to be an orphaned ledger for gittensory-native PRs, not a live one

Looked for the actual write path that sets review_targets.status/.verdict to
manual/commented/ignored — the call site a new emission point would need to sit next to.
No such write path exists anywhere in the current codebase:

  • grep across src/** for INSERT/UPDATE against review_targets (or a Drizzle write): zero
    hits. The table is deliberately raw-SQL-only, "NOT added to the Drizzle schema" per its own
    migration comment (migrations/0050_review_targets.sql).
  • No SQL trigger in migrations/*.sql populates it either.
  • Multiple, independent, contemporaneous code comments describe it as legacy/dead for the
    current (post-convergence-cutover) engine, not just historically:
    • src/review/public-stats.ts:9 — "The legacy review_targets ledger this used to read was
      orphaned by the convergence cutover — nothing writes it anymore."
    • src/review/public-stats.ts:165 — same claim, restated where the live replacement query
      (audit_events github_app.pr_public_surface_published joined to the pull_requests cache)
      is defined.
    • src/review/ops-wire.ts:5-8 — "ADAPTED TO GITTENSORY'S OWN OUTCOME DATA — NOT reviewbot's
      review_targets/review_audit (those tables are not populated here)... gittensory's
      review-outcome ledger is different."
    • src/review/stats.ts:19-21 — "decision/reversal/gate-action aggregates still read the legacy
      review_targets/review_audit ledgers... but the maintainer dashboard's complexity read comes
      from the ACTIVE audit_events ledger" — i.e. this dashboard has already been partially
      repointed away from review_targets for one metric.
    • src/review/submitter-reputation.ts:23 — the review_targets-dependent signal is marked
      "ADDITIVE + DORMANT."
  • The comment introducing the "orphaned" language was added 2026-06-23 in PR fix(public-stats): repoint proof-of-power counter to the live ledger #1114
    (fix(public-stats): repoint proof-of-power counter to the live ledger) — a deliberate,
    ~2-week-old repointing, not stale leftover text.
  • PR fix(selfhost): recognize review_audit in the exporter's no-source-tables guard #3546's own description treats pull_requests as the dominant/live table in the Grafana
    reporting-exporter's guard, consistent with this.

I could not confirm this against a live production/self-hosted instance — I only have a fresh
git worktree, no bound D1/SQLite. This is exactly the "confirm the hypothesis with real data"
deliverable #3717 itself asked for and that neither #3717's investigation nor PR #4134 fully did
either (both reasoned from reading the query/code, not a live query). That live confirmation is
the necessary first step here
— specifically: query the self-hosted maintainer instance's
review_targets table for MAX(updated_at) and see whether it is frozen at (or shortly after) the
2026-06-23 cutover, or whether something is still writing to it that this code-only search missed.

As a secondary, mechanical (not live-data) check, I confirmed the query-shape mechanism #3717
already described is real: replaying the panel 5/3 queryText verbatim against an in-memory DB
migrated with this repo's actual migrations/*.sql, a single row inserted as status='manual' and
later UPDATEd to status='merged' (both timestamps inside one window) counts once under "Manual
review" before the update and zero after — it moves to "Merged" instead of accumulating. That part
is solid; it just doesn't tell us whether real rows are still arriving at all.

Why this changes the shape of the ask

If review_targets truly receives no new rows for current gittensory-native activity, then:

  • All six top-row stat panels (PRs tracked/Merged/Closed/Manual review/Commented/
    Ignored) — not just the three fix(observability): clarify manual/commented/ignored panel semantics on the Reviews & PRs dashboard #3717 focused on — are reading an increasingly stale,
    non-growing ledger, and will trend toward showing near-zero activity in any window that starts
    after the cutover, regardless of real current volume.
  • Adding one new additive event-count panel next to the existing six (the shape fix(observability): clarify manual/commented/ignored panel semantics on the Reviews & PRs dashboard #3717 asked for)
    would not fix that — it would just be the one panel on the dashboard actually tracking live
    activity, sitting next to six that increasingly aren't.
  • The more durable fix likely follows the precedent already set for the public homepage counter
    (src/review/public-stats.ts): repoint the dashboard's source of truth to audit_events
    (github_app.pr_public_surface_published) joined to the pull_requests cache for terminal
    disposition. But that mapping is not mechanical — public-stats.ts's own model has no
    manual/ignored/error concept
    ("Reviewed PRs that never got a published surface... simply don't
    appear — there is no ignored/manual/error"), so representing "manual review" and "ignored" in a
    live-ledger world needs real design, not a copy-paste.

Requirements (for whoever picks this up)

  1. Confirm live: query a self-hosted maintainer instance's review_targets table directly
    (SELECT MAX(updated_at) FROM review_targets, and ideally a status breakdown) to settle whether
    it is genuinely frozen or still receiving some writes this code search missed.
  2. If frozen: decide, with the maintainer, whether to (a) repoint all six panels to a live source
    (bigger, more valuable, matches the public-stats.ts precedent) or (b) leave the existing six as
    a historical/legacy view and add a differently-labeled live panel set alongside (matches fix(observability): clarify manual/commented/ignored panel semantics on the Reviews & PRs dashboard #3717's
    original, narrower ask). Either is legitimate; the current state (six stale panels, mislabeled as
    live windows even after fix(observability): clarify manual/commented/ignored panel semantics #4134's tooltip fix, which explains the windowing semantics but not the
    staleness one) is not.
  3. If a genuinely new discrete "disposition became manual/commented/ignored" concept is needed for
    gittensory-native PRs (rather than reusing pr_public_surface_published + terminal state), design
    and add the emission point at whichever call site in src/github/app.ts /
    src/queue/processors.ts actually decides that disposition today, following the existing dotted
    event_type naming convention (e.g. github_app.gate_overridden).

Non-goals

Retroactively backfilling event history for the frozen review_targets era. Changing the
review_targets/review_audit schema. Anything beyond the maintainer Grafana dashboard.

References

Metadata

Metadata

Assignees

Labels

maintainer-onlyOwner-only work — yields no Gittensor points.orbGittensory Orb related - maintainer self-hosting analytics.

Projects

Status
Todo

Relationships

None yet

Development

No branches or pull requests

Issue actions