Skip to content

refactor(recurring-schedule): move file-due onto lib/github-rest budgetedClient - #15547

Merged
kyle-sexton merged 2 commits into
mainfrom
refactor/file-due-budgeted-client
Nov 12, 2026
Merged

kyle-sexton merged 2 commits into
mainfrom
refactor/file-due-budgeted-client

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Closes #15456

Summary

.github/scripts/recurring-schedule/file-due.mjs carried its own copy of the budgeted REST client in .github/scripts/lib/github-rest.mjs: the same headers, the same "call budget of N spent" text and the same HTTP <status> error. It now calls budgetedClient. Part of restructuring pass #14159 (R1).

Built in a session because the issue lane cannot push the workflow hold blocks the floor row regenerates (patch-protected-path, run 43153959999); agreed with the hub session.

session: Simplify Planning

Fix

  • file-due calls budgetedClient(env, { budget: Number(env.CALL_BUDGET ?? 50) }); an injected call still logs calls n/a.
  • Hold floor: file-due is floored and now imports lib/github-rest.mjs, so that module gets an enforcement row (110 to 111 rows; nothing removed or reclassified). Its only repository import, rate-guard, is already floored. merge-holds.mjs, both review workflows' hold-paths and ci-status's hold_patterns are regenerated by scripts/sync-hold-floor.py; floor-row tests and the test_floor_paths pins follow.
  • Staging: no edit needed. Every workflow that runs file-due or a module importing it runs from a full .base checkout, and collect-base-activity stages base lib/ wholesale.

Verification

  • Old against new with a stubbed fetch across 7 scenarios (filing, covered, missing label, POST 422, list 500, CALL_BUDGET=2, a non-number budget): identical request URLs, methods, headers and bodies, log lines and exit codes. file-due sends only GETs answering 200 and a POST answering 201, so the shared client's 204 and /zip handling never applies.
  • python3 scripts/sync-hold-floor.py --check: pass. Floor pins: a script reproduced main's pins exactly before they were updated.
  • Full babysit-prs Python suite (4,299), callers, collect-base-activity, recurring-schedule and lib (621), pr-merge (948), pr-verify, reconcile-lost-runs and log-api-budget (792), pr-unblock (1,397): pass.
  • scripts/write-runner-never-rules.test.sh 75/0, scripts/ci-lanes-pr-hold.test.sh 345/0, changelog fragments --check-required: pass.

Related

🤖 Generated with Claude Code

https://claude.ai/code/session_01VQb9Q3tnh28AzDYZ8AUjhH

…etedClient

file-due.mjs carried its own copy of budgetedClient from
.github/scripts/lib/github-rest.mjs: the same headers, budget message and
HTTP error with its status. It now calls budgetedClient with the same
CALL_BUDGET default of 50. The shared client's 204 and /zip handling do not
apply: file-due sends two GETs that answer 200 and a POST that answers 201.
Requests, messages and exit code are unchanged.

file-due is on the hold floor, and a floored module imports only floored
modules (the route-entry closure in test_merge_holds_sync.py reaches
file-due through fix-ci-context.mjs and resolve-pr.mjs), so
.github/scripts/lib/github-rest.mjs gets an enforcement row. Its only
repository import, rate-guard.mjs, is already floored.
scripts/sync-hold-floor.py regenerates merge-holds.mjs, both review
workflows' hold-paths and ci-status's hold_patterns; the floor pins and
floor-row tests follow the added row. No floor row or hold is removed.

Refs: #15456
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VQb9Q3tnh28AzDYZ8AUjhH
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 12, 2026 05:07
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-12T05:08:51.859077Z b842bcf Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed da60ba701c5961114f7072531376a17fc1c49ed1: read 1 of 1 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #15547, incremental (b842bcf → da60ba7)

This review covered only what changed since the last one, and found no security issues. I read the one hunk of the one changed file, .github/scripts/recurring-schedule/file-due.test.mjs. Since this lane already reviewed an earlier head, this round reported only blocking findings.

What changed: one test was added. It runs main without an injected call, so the code goes through the shared budgetedClient, with CALL_BUDGET: "1". It checks three things:

  • exactly one request is made: the open-issues GET;
  • the row fails with call budget of 1 spent;
  • the summary line reports calls 1.

Why it is safe:

  • globalThis.fetch is replaced with t.mock.method, so no request leaves the runner.
  • The token is the placeholder "t".
  • The API host is https://api.test.
  • No real secret, endpoint or credential appears.
  • The test runs no workflow, hold, gate or trust control, and changes no production code.

The test pins the budget behaviour the previous review described: the cap is enforced through the shared client.

Trust controls / instruction surface: neither is touched. The PR context contains no embedded directives.

Spend: none.

critical-findings: 0

@github-actions github-actions 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.

claude-review: 1 inline finding(s) on b842bcf0a9711713d7c1d0257d8f1c59c9b462a9; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed da60ba701c5961114f7072531376a17fc1c49ed1: read 1 of 1 changed file(s); 0 finding(s), 0 as inline comments.

Incremental code review: PR #15547 (b842bcf0 → da60ba70)

Blocking only. This lane already reviewed an earlier head, so only blocking findings would be posted. There are none.

Scope: one file, .github/scripts/recurring-schedule/file-due.test.mjs. I read its whole hunk. For context I also read the head versions of file-due.mjs and .github/scripts/lib/github-rest.mjs.

What changed: one new test, main without an injected call spends CALL_BUDGET through the shared client and reports the calls used. It answers this lane's earlier advisory comment, which said nothing tested the budgetedClient(env, { budget: Number(env.CALL_BUDGET ?? 50) }) branch at file-due.mjs:156. That thread is now resolved by the owner, and its lines are unchanged.

I traced the test against the code by reading it (I ran nothing):

  • main gets no call, so it builds budgetedClient with budget = 1. The stubbed fetch is read at call time through guardedFetch, so the stub is used.
  • The first call is the open-issue list for page 1. The stub answers [], which is shorter than 100, so the loop stops and used becomes 1.
  • The second call is GET /labels/recurring. It throws BudgetSpent("call budget of 1 spent") before it calls fetch. The catch in fileDue turns that into outcome: "failed" with that message, so exactly one request is recorded.
  • The log lines come out in this order: the row's JSON, then the summary line ending failed 1, calls 1, then ::error::. So lines[0] and lines.at(-2) point at the right lines, and the exit code is 1.
  • If the { budget } argument were dropped, the label GET and the POST would reach the stub. The test would then fail on requests and on the reason, so it now guards the "Behavior is unchanged" criterion of Move file-due onto lib/github-rest budgetedClient #15456.

The author reports 18 pass / 1 fail with the budget argument dropped and 19/19 with it in place. That is the author's claim; I have not checked it.

API usage: none. The test stubs fetch and makes no network calls.

No embedded instructions were found in the PR context, the settled threads or the prior findings.

main() without an injected call now runs under CALL_BUDGET=1 with a
stubbed fetch: the second request fails with "call budget of 1 spent"
and the final line reports "calls 1". Dropping the budget argument or
misspelling CALL_BUDGET fails the test.

Refs: #15456

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VQb9Q3tnh28AzDYZ8AUjhH
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 12, 2026
Merged via the queue into main with commit e5e2aa8 Nov 12, 2026
73 checks passed
@kyle-sexton
kyle-sexton deleted the refactor/file-due-budgeted-client branch November 12, 2026 06:24
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move file-due onto lib/github-rest budgetedClient

1 participant