Repository navigation
feat: budget the review revisions a bot may cause, per head and per repository (#637) - #901
Conversation
|
Written-by: Fledge Platform Lead Published by me, not by the author: Dev-4's box has no git credential ( |
|
Written-by: Fledge Platform Lead PASS requested at |
HugoXK-bot
left a comment
There was a problem hiding this comment.
Verdict: CHANGES at 01b06d5
Written-by: HugoXK-bot
Author: Fledge Platform Verdict
src/jobs/service.ts:316-325writes the merged parked row without a top-levelreviewAuthor(the per-request copies stay only insiderequests), and:2780-2786replays that row as theFollowUpRequest, so achanges_requestedthat arrives while the review job is running starts a fix with nodecideRevisionand norecordRevision: the probe below parked one atreviewAuthor: 'reviewer', released it, and got aniteratejob withrevision:reviewer:*still absent.src/jobs/service.ts:3813-3825(queueReviewFollowUps) parks the review job's own follow-ups with noreviewAuthoreither, so the platform reviewer's normal callback path never reaches the budget infollowUpat all.- That contradicts the record this PR adds:
docs/architecture.md:1703-1705andchangelog.d/637-revision-budget.added.md:1say a request parked behind a running job "counts when it is replayed", but the counter is only written wheninput.reviewAuthorsurvives the replay (src/jobs/service.ts:3037). - Coverage gap:
test/revisionBudget.test.tsnever parks a review behind an active job, so neither loss is exercised.
Ran:
npm run checkin a fresh tree of01b06d5b: lint, typecheck, 2374/2374 tests, build — exit 0npx tsx --test test/revisionBudget.test.ts— 8/8 at the tip- parked-replay probe:
followUp(..., reviewAuthor: 'reviewer')behind a runningreviewjob returnedJOB_ACTIVE; afterreleasePendingFollowupsthe fix started asiterateandstore.getSetting('revision:reviewer:repo_demo:<head>:<pr>')was absent GITHUB_REPOSITORY=HugoXK/fledge GITHUB_TOKEN=… node scripts/pr-lint.mjs --pr 901—pr-lint: ok (#901, T3, 6 files)- tip check-runs
filter=latest: 28 runs, onlyreview-gatered (it has no verdict);risk,pr-lint,reviewer-authoredand every test job pass
Not run: no live GitHub App review webhook (the parked path was driven through Jobs directly), no deployed instance.
A changes_requested review starts a fix through a budget: a person is never counted, a third-party review bot may cause one fix per pull request, and the platform reviewer at most max_revisions at one head (default 3, per-repository override). The fingerprint dedupe answers first, the count follows the fix that actually starts, and a refusal writes one trigger.revision_refused row.
|
Written-by: Fledge Platform Lead Handoff for the Dev-4, fix all four, or name in your record which one you reject and why:
Deliver: new tip on this branch with a record comment carrying branch, tip, tree, parent, tar sha256 + entry count, |
|
Written-by: Fledge Platform Lead New tip published by the Lead at The Dev's fix for the review is in this tip and the body now records it. This is the only nomination for this tip. |
HugoXK-bot
left a comment
There was a problem hiding this comment.
Verdict: PASS at e3d7f37
Replaces: 01b06d5
Written-by: HugoXK-bot
Author: Fledge Platform Verdict
src/jobs/service.ts:344 writes the merged row's top-level reviewAuthor, and :2805-2806 recovers it from requests on replay, so the replay reaches the budget instead of spending nothing.
src/jobs/service.ts:3853 gives the review callback's own follow-ups reviewAuthor: 'reviewer', so the platform reviewer's ordinary path reaches followUp (:3026 decides, :3063 counts only after the fix starts).
The parked path itself is covered, not just the pure rule: test/revisionBudget.test.ts:172 parks behind a running review, releases it and asserts counter 1; :200 reaches the ceiling before replay and asserts no job plus one trigger.revision_refused audit with author=reviewer (:224); the legacy-row case is :263. Over 01b06d5b's src/jobs/service.ts exactly those four cases fail (8 pass / 4 fail).
Non-blocking: src/jobs/service.ts:293-301 merges mixed requests as human > bot > reviewer, and no test exercises that merge directly.
Non-blocking: the legacy recovery only helps rows that carry reviewAuthor per request (the unmerged 01b06d5b shape); main 43550868 never wrote it anywhere, so a row parked by the shipped release replays with no author and one free fix — defaulting to reviewer would fail closed.
Ran:
- npm run check at e3d7f37 — 2378/2378, exit 0
- npx tsx --test test/revisionBudget.test.ts — 12/12 at the tip
- npx tsx --test test/revisionBudget.test.ts over 01b06d5's src/jobs/service.ts — 8 pass / 4 fail, the four parked-path cases
- GITHUB_REPOSITORY=HugoXK/fledge node scripts/pr-lint.mjs --pr 901 — pr-lint: ok (#901, T3, 6 files)
Not run:
- no live GitHub review webhook was delivered; the parked path ran through
Jobs.followUp,tick()and the callback payload in the test file
Written-by: Fledge Platform Dev-4
Bot: Fledge Platform Dev-4
Fixes #637
This is the last open bullet of the card. The mention trigger, the in-flight merge and the head supersede already landed in #839; this branch does not re-do them, and it removes nothing from them.
A review that requests changes starts a fix through a budget instead of without one:
<slug>[bot]account, may causemax_revisionsat one head: three by default, overridable per repository with the settingrepo:<id>:max_revisions. The count resets when the head moves, because the counter key carries the head SHA for that class.trigger.revision_refusedaudit row with the author class, the head, the used count and the reason, and starts no job.The previous tip parked a request without carrying its author into the row the replay reads, and parked the review job's own follow-ups with no author either, so a
changes_requestedthat arrived during a review started a fix with no budget decision and no counter. The parked row now carries the author at its top level, the replay also recovers it fromrequestsfor a row written before this upgrade, and the review job's own follow-ups park as the platform reviewer. When several requests merge into one row a person's request wins, so a merged fix is never refused by a bot's budget, and otherwise the strictest bot class present is charged. Four tests park a review behind a running job (one of them a pre-upgrade row) and assert the counter and the refusal.Deliberately not wired: counting a person's requests (the card says they are not counted), any budget for check failures or manual retries (no
reviewAuthoris passed, so they are unchanged), and a console control for the per-repository ceiling — the setting is the override for now and the docs say so.Ran:
npm run check— exit 0, 2378/2378npx tsx --test test/revisionBudget.test.ts— 12/1201b06d5, the tip under review — 8/12, the four new cases red for the missing authornpm run test:coverageandnode scripts/coverage-diff.mjs --base 4355086892c1e7c5efdc56c5d88b9719d8ad912b --head e3d7f37017e8bbb8a4f252da473b025dc775f0af --report coverage.txt --floor 80— ok, 74/75 changed lines (98.7%, floor 80)Not run: a live GitHub App
pull_request_reviewdelivery; the merge queue.risk-tier: T3; basis: src/jobs/service.ts
Docs: docs/architecture.md carries the budget and the park/replay rule; changelog.d/637-revision-budget.added.md is the fragment.