Skip to content

perf(pr-pipeline): keep the workflow file name in api-routes - #17531

Merged
kyle-sexton merged 5 commits into
mainfrom
perf/17460-route-workflow-file
Nov 19, 2026
Merged

kyle-sexton merged 5 commits into
mainfrom
perf/17460-route-workflow-file

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Refs: #17460

Summary

The api-routes job-end notice now keeps the workflow file name after workflows/, so the ~4,400 calls a day pr-merge.yml spends on repos/{repo}/actions/workflows/{x}/runs can be split by workflow before any cut is aimed at one call site. These are file names in this public repository, so the notice exposes nothing new.

Fix

  • A segment directly after workflows/ matching ^[a-z0-9][a-z0-9_-]*\.ya?ml$ is kept; a numeric workflow id stays {n}; every other variable segment is sanitized as before. A route that would pass 80 characters keeps {x} there rather than becoming other.
  • Changed together: rate-guard.mjs routeOf/routeOk, api-budget.bash API_BUDGET_ROUTE (pr-require-checks.yml's generated copies via scripts/sync-hold-floor.py), babysit_gh.py api_route. rate-guard.vectors.json, which all three are tested against, gains the new cases.
  • The rule comments above routeOf/routeOk, api_route and API_BUDGET_ROUTE stated the old rule, so they are deleted; rate-guard.vectors.json holds the rule.

Verification

  • node --test over log-api-budget.test.mjs and rate-guard.test.mjs: 250 pass. count-requests.test.mjs's "fix-ci-context's main counts each request its client sends" needs ajv, which a fresh worktree lacks, and fails the same way on main.
  • python3 -m unittest over test_babysit_gh_*.py: 148 pass.
  • scripts/sync-hold-floor.py --check clean; scripts/run-ruff.sh check passes; comment lint passes.

Remaining

  • Per-workflow before/after for pr-merge's listings, from the hub's job-calls log, once this is merged.
  • Pacing (hub-side), reconcile hourly (separate PR), Wait For Refine (left as is).

Related

🤖 Generated with Claude Code

https://claude.ai/code/session_01KeBVgaQE4QB75SPD3ky1jd

kyle-sexton and others added 2 commits November 19, 2026 15:15
pr-merge.yml's jobs spent about 4,400 calls a day on
repos/{repo}/actions/workflows/{x}/runs, and the {x} hid which workflow
each listing read, so no cut could be aimed at one call site. The route
now keeps the file name after workflows/, which is a file name in this
public repository, so the job notice exposes nothing new.

- Kept only when it matches ^[a-z0-9][a-z0-9_-]*\.ya?ml$ and directly
  follows workflows/; a numeric workflow id stays {n}, every other
  variable segment is sanitized as before, and a route that would pass
  80 characters keeps {x} there instead of turning into other.
- rate-guard.mjs routeOf and routeOk, api-budget.bash API_BUDGET_ROUTE
  (pr-require-checks.yml copies regenerated by sync-hold-floor.py) and
  babysit_gh.py api_route change together; rate-guard.vectors.json, which
  all of them test against, gains the new cases.

Refs: #17460

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KeBVgaQE4QB75SPD3ky1jd
…ge made wrong

The comments above routeOf and routeOk (rate-guard.mjs), api_route
(babysit_gh.py) and API_BUDGET_ROUTE (api-budget.bash) said the segment
after workflows/ becomes {x} and that a route holds only REST path words
and placeholders. rate-guard.vectors.json, which every templater is
tested against, holds the rule.

Refs: #17460

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KeBVgaQE4QB75SPD3ky1jd
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 19, 2026 21:15
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 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-19T21:17:31.709413Z 92f90d3 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 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 92f90d356945469e5f7acdb81eb31f44960534fb; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

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

Code review (96045c9)

I reported blocking findings only. This lane already reviewed earlier heads of this pull request (blocking only: yes), so advisory findings are left out.

Scope. I read all 8 changed files in .claude-lane/pr.diff in full: two changelog fragments, api-budget.bash, rate-guard.mjs, rate-guard.vectors.json, pr-merge/workflow.test.mjs, the two generated awk copies in pr-require-checks.yml, and babysit_gh.py. Since the last review this head adds only a merge from main; the route logic is the same as at f368899.

What I checked (by reading the code, I ran nothing).

  • The three implementations agree. routeOf in rate-guard.mjs (L252-L297), api_route in babysit_gh.py (L1362-L1421) and the awk api_route work the same way:
    • A file name is kept only when the segment before it is workflows and that segment was a name marker, not inside a path tail.
    • All three use the same lowercase .ya?ml pattern.
    • All three put the file back to {x} only when the whole route would pass 80 characters, then fall back to other.
  • Edge cases hold. Python's segments[index - 1] would read the wrong segment at index 0, but name is always false there, so the check stops before it.
  • The checks match. routeOk and awk api_route_ok both accept the file segment only after workflows.
  • The long-name vector is right. release-generate-dependabot-changelog-fragments.yml/dispatches gives a 93-character route, so it correctly becomes {x}.
  • Other readers of REST_PATH_WORDS. lane-run-report/post.mjs (L58-L70) still masks anything that isn't a path word as *. A kept workflow file name is therefore redacted in that comment, which is the safe direction.
  • Author's test results. The PR says 250 node tests and 148 Python tests pass and that the sync-hold-floor --check is clean. That is the author's claim; I did not verify it.

Settled and prior. The earlier advisory thread (dangling docstring reference and the stale REST_PATH_WORDS comment) was fixed in f368899 and resolved, and its lines are unchanged, so I am not raising it again.

Closing issue. The PR only says Refs: #17460 and closes no issue, so there are no acceptance criteria to check.

Loosened checks. The prompt has no loosened_check_verdict:, loosened_check_patterns: or loosened_check_decision_record: lines. I therefore used fail with no consumer entries and did not check the citation requirement. Nothing in the diff loosens a check.

Loosened-check verdict: fail (default, no settings lines); patterns: 0

Security findings belong to the separate security lane that runs on this repository.

No blocking findings.

Verifier dropped 0 of 0 candidates.

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

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

Security review: PR #17531

I found no security issues. This lane already reviewed an earlier head (f3688999), so this pass reported only CRITICAL and IMPORTANT findings.

What changed. The route sanitizer that feeds the job-end api-routes notice now keeps a workflow file name that follows workflows/. Before this change that segment became {x}. The same change is made in all four copies: rate-guard.mjs (routeOf/routeOk), api-budget.bash (API_BUDGET_ROUTE), the two generated awk copies in pr-require-checks.yml, and babysit_gh.py (api_route). The vectors and one workflow test are updated to match. Three rule comments are removed.

What I checked. I read all eight files on the full-diff list, and gave the trusted-path files (api-budget.bash, rate-guard.mjs, pr-require-checks.yml, babysit_gh.py) the extra scrutiny the lane asks for.

  • What a kept segment can hold. A segment is kept only when it fully matches ^[a-z0-9][a-z0-9_-]*\.ya?ml$ and directly follows workflows. That allows lowercase letters, digits, _, - and a .yml/.yaml suffix, with no uppercase, %, :, /, space or newline. So a kept segment cannot break out of a ::notice line or inject a workflow command. It also cannot carry GitHub token formats, which mix upper and lower case, or a URL-encoded value (the Secret%20Name.yml vector stays {x}). These are file names in a public repository, so the notice exposes nothing new.
  • routeOk and planted routes. routeOk now also accepts such a segment after workflows (rate-guard.mjs L117, awk api_route_ok). A planted route can therefore show only a name in that same narrow character set. It cannot widen what untrusted text reaches anything.
  • The length cap. A route over 80 characters still falls back, first to {x} for the file segment and then to other. The cap is kept in all copies.
  • Edge cases. In babysit_gh.py, segments[index - 1] is read only while name is set, so it never runs at index 0. In the awk copies, s[i - 1] is the raw previous segment, which matches the JS and Python copies.
  • Trust controls and merge holds. None is touched. The pr-require-checks.yml hunks are only the generated API_BUDGET_ROUTE copies, not the ci-status hold logic. Nothing on a trusted-trigger, token-scope, kill-switch or broker path changes.
  • Removed comments. They described code and were not standing instructions, so the instruction-surface lens does not apply.
  • Manifests and cost. No plugin manifest changes, and nothing here can cause a charge.

The settled thread on babysit_gh.py, about stale and dangling route-rule comments, has unchanged lines and is not raised again. The PR context contains no embedded instructions.

critical-findings: 0

kyle-sexton and others added 3 commits November 19, 2026 16:38
…se word-list comment

Review of #17531: api_route's docstring still said "the rules above",
which the previous commit deleted; it now names its twins (rate-guard.mjs
routeOf, api-budget.bash API_BUDGET_ROUTE), says to change them together,
and points at rate-guard.vectors.json and the test that checks it. The
comment above REST_PATH_WORDS said any segment outside the list could be
a name, a path or planted text, which a kept workflow file name now
contradicts; it is deleted. log-api-budget.test.mjs still checks that
api-budget.bash carries the same word list.

Refs: #17460

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KeBVgaQE4QB75SPD3ky1jd
…'s cover-read route

pr-merge's workflow.test.mjs pinned the cover read's reading to
repos/{repo}/actions/workflows/{x}/runs; with the workflow file name now
kept, the reading is .../workflows/pr-require-checks.yml/runs. The
dispatch POST keeps the {x}/dispatches route its step passes by hand.

Refs: #17460

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KeBVgaQE4QB75SPD3ky1jd
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit af9d2e8 Nov 19, 2026
66 checks passed
@kyle-sexton
kyle-sexton deleted the perf/17460-route-workflow-file branch November 19, 2026 22:38
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 19, 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.

1 participant