Skip to content

fix(review): count manual work carried on non-deciding verdicts in the automation rate - #10089

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
shin-core:fix/automation-rate-human-verdicts-10013
Jul 31, 2026
Merged

fix(review): count manual work carried on non-deciding verdicts in the automation rate#10089
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
shin-core:fix/automation-rate-human-verdicts-10013

Conversation

@shin-core

Copy link
Copy Markdown
Contributor

What & why

The published automation-rate series answers "how much of this is decided with no human in the path?" from the decision_records ledger. Its read, queryAutomationRows, restricted rows to the deciding actions:

WHERE created_at >= ?
  AND action IN (merge, close, hold)

But a human signal — reevaluation_actor, or reevaluation_reason = 'maintainer_request' (#9742) — can ride a non-deciding verdict: a re-labelled PR, or a maintainer-triggered re-run recorded as a label / update_branch row. That action IN (...) filter dropped exactly those rows before buildAutomationRateSeries ever saw them. A PR's only surviving row was then its clean merge, so a pull request a person actually touched was published as automated — inflating the very rate the series exists to report honestly.

The fix

Select every decision_records row in the window and let the fold classify:

FROM decision_records
WHERE created_at >= ?

buildAutomationRateSeries already ORs verdictShowsHumanAction across a PR's rows, so once the human-signal row reaches it, the PR folds to manual correctly. The published definitions are unchangeddecided still requires an enacted-or-held verdict, automated still requires enacted && !human, the week is still the PR's first verdict, and verdictShowsHumanAction keeps its three conditions. Only which verdicts the fold gets to see changes. AUTOMATION_COUNTED_ACTIONS stays the published deciding-set the fold keys decided on; it just no longer gates the read.

Tests (test/unit/automation-rate.test.ts)

  • Regression (orb(metrics): the automation-rate query filters out the very verdicts that carry the human-action signal #10013): a PR whose deciding merge verdict is clean but whose non-deciding label verdict carries reevaluationActor now folds to manual (automated: 0, manual: 1) — and the same for a maintainer_request reason riding an update_branch row. On main the query never delivered those rows, so the PR read as automated.
  • Query assertion updated: the real read must not contain action IN ( and must bind exactly one placeholder (the created_at >= ? window bound) — fails on main, which still emits the action list.
  • The existing definition-pins (undecided-PR excluded, held-then-merged is manual, bot label before merge stays automated) are unchanged and still pass.

Validation

  • npm run typecheck clean for these files (the only local errors are a pre-existing missing-release-please-dep phantom in unrelated release tooling, present on bare main).
  • npm run engine-parity:drift-check passes; npm run ui:openapi:check clean (the response shape is unchanged — only which rows the internal query selects).
  • Diff coverage on src/review/automation-rate.ts is 100% line and branch.
  • git diff --check clean; single-file source change + its test.

Closes #10013

…e automation rate

queryAutomationRows restricted rows by action IN (merge, close, hold), so a
human signal recorded on a non-deciding verdict -- a reevaluation_actor or a
reevaluation_reason of maintainer_request riding a label or update_branch row --
never reached buildAutomationRateSeries. The PR's only surviving row was its
clean merge, so a pull request a person actually touched was published as
automated, inflating the rate.

Select every decision_records row in the window and let the fold classify: it
already ORs verdictShowsHumanAction across a PR's rows, so seeing the
human-signal row is all it needs. The published decided/automated/manual
definitions are unchanged -- only which verdicts the fold gets to see.

Closes JSONbored#10013
@shin-core
shin-core requested a review from JSONbored as a code owner July 31, 2026 06:41
@superagent-security

Copy link
Copy Markdown
Contributor

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

@loopover-orb

loopover-orb Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-31 06:53:14 UTC

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

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This PR correctly identifies and fixes a real bug: the `queryAutomationRows` `WHERE action IN (...)` filter dropped rows carrying human-action signals (reevaluation_actor/reason) when those signals rode a non-deciding verdict like `label` or `update_branch`, causing manually-touched PRs to be misclassified as automated. The fix removes the action filter from the SQL read and lets `buildAutomationRateSeries`'s existing fold-and-OR logic classify correctly, which is the right layer for the fix since the published `decided`/`automated` definitions are unchanged. Tests were updated appropriately: new regression cases cover the human-signal-on-non-deciding-verdict scenario, and the query-shape assertion was updated to check for exactly one placeholder/bind instead of the old action-list.

Nits — 3 non-blocking
  • src/review/automation-rate.ts:44,54 — the `orb(metrics): the automation-rate query filters out the very verdicts that carry the human-action signal #10013` issue-number references in comments are fine as-is but the external brief's suggestion to extract them into a named constant is unnecessary churn for an inline reference.
  • Removing the `action IN (...)` filter means `queryAutomationRows` now selects every decision_records row in the window regardless of action, which is correct per the fix but slightly widens the result set size — worth a quick sanity check that this table isn't large enough for the unfiltered scan to matter at current data volumes, though nothing in the diff suggests a real regression.
  • Consider adding a brief note in the PR description validating that no other caller of `AUTOMATION_COUNTED_ACTIONS` still assumes it gates the read (grep shows the fold in buildAutomationRateSeries is the only remaining consumer, which the diff correctly preserves).

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #10013
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: 65 registered-repo PR(s), 50 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor shin-core; Gittensor profile; 65 PR(s), 0 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Partially addressed
The PR correctly removes the action-based SQL filter, updates the AUTOMATION_COUNTED_ACTIONS doc comment, and adds tests confirming a human signal on a non-deciding verdict flips the PR to manual, matching most requirements. However, the issue explicitly requires a test asserting that a PR whose earliest row is a non-deciding verdict is attributed to that row's own week (the 'week of its FIRST ver

Review context
  • Author: shin-core
  • 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: 65 PR(s), 0 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://loopover.ai/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

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 31, 2026
@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.59%. Comparing base (d301523) to head (bdc4df9).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10089      +/-   ##
==========================================
+ Coverage   79.57%   79.59%   +0.01%     
==========================================
  Files         282      283       +1     
  Lines       58664    58721      +57     
  Branches     6842     6859      +17     
==========================================
+ Hits        46682    46739      +57     
  Misses      11694    11694              
  Partials      288      288              
Flag Coverage Δ
backend 100.00% <ø> (?)

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

Files with missing lines Coverage Δ
src/review/automation-rate.ts 100.00% <ø> (ø)

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LoopOver approves — the gate is satisfied and CI is green.

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

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

orb(metrics): the automation-rate query filters out the very verdicts that carry the human-action signal

1 participant