Description
Agent Brief
Type: Task
Summary: Have scripts/sync-hold-floor.py write the two inline copies of api-budget.bash in the required-checks workflow between BEGIN/END comment lines, so its existing --check replaces the hand pasting (part of restructuring pass #15695; owner answer to R2's Q1, option (b)).
Current behavior:
Line numbers are at 26786304bb. .github/actions/log-api-budget/api-budget.bash (676 lines) is pasted by hand, verbatim, into two block scalars in the required-checks workflow (pr-require-checks.yml:250, :4254), because neither job has a checkout of that file:
- the "Mark the lanes in flight" step env of job
mark-lanes: the key linepr-require-checks.yml:250, content:251-926, at a 10-space key indent; the comment above it is:248-249; - the
ci-statusjob env: the key linepr-require-checks.yml:4254, content:4255-4930, at a 6-space key indent; the comment above it is:4245-4251.
.github/actions/log-api-budget/log-api-budget.test.mjs:1512-1523 fails when either copy differs from the file. That catches drift but does not remove the work: the file changed in 18 commits since 2026-08-13 (git log --since=2026-08-13), and each change had to be pasted into both blocks.
scripts/sync-hold-floor.py already writes generated text into this workflow and four other files, each block between BEGIN hold-floor <name> and END hold-floor <name> comment lines (pr-require-checks.yml:7242, :7246):
BLOCKSmaps each file to its block names and render functions (scripts/sync-hold-floor.py:147-153);marker()finds exactly one BEGIN and one END line (:156-162);generate()replaces the lines between them with the render output at the BEGIN line's indent (:165-174);--checkprints the diff and exits 1 when a copy is stale (:177-209).
plugins/source-control/skills/babysit-prs/scripts/tests/test_merge_holds_sync.py:525-531 runs --check. Its test-scope header lists the generator, every file under the actions directory and every workflow file (test_merge_holds_sync.py:1). The affected-suite selector matches with a * that crosses / (scripts/affected-tests.sh:1257, :1283-1284), so a pull request that changes the generator, api-budget.bash or the workflow selects that suite.
Desired behavior:
- Extend
scripts/sync-hold-floor.py; add no second generator script, suite or CI step.- Generalize the marker label so that each
BLOCKSentry carries its full label. The existing labels stay byte-for-byte as they are (hold-floor GATE_WORKFLOWS,hold-floor COST_PATHS,hold-floor HOLD_PATH_CLASSES,hold-floor hold-paths,hold-floor hold_patterns), so no existing BEGIN or END line changes. - Add two labels for the workflow:
api-budget mark-lanesandapi-budget ci-status. Both use one render function that emitsAPI_BUDGET_SH: |at the BEGIN line's indent, then each line ofapi-budget.bashindented two more spaces. An empty line stays empty, with no trailing spaces, and the file's final newline is dropped. - Keep the
generate(path, text)signature and the script name. - Add one docstring line naming the new blocks.
- Generalize the marker label so that each
- In the required-checks workflow, add four comment lines, each at the indent of the
API_BUDGET_SH: |key it brackets:# BEGIN api-budget mark-lanes: generated by scripts/sync-hold-floor.pydirectly above:250, and# END api-budget mark-lanesdirectly after:926;# BEGIN api-budget ci-status: generated by scripts/sync-hold-floor.pydirectly above:4254, and# END api-budget ci-statusdirectly after:4930.
- The markers sit outside the block scalar as YAML comments, never inside it as shell comments. A
#line indented to the block's content is part of the value, so it would change what the step runs and break both readers below. - Reword the comments at
pr-require-checks.yml:248-249and:4245-4246to say the block is generated (run the script after editingapi-budget.bash). These comments sit outside the block. - The script's first run after the markers are added rewrites nothing: both workflow blocks stay byte-identical in effect to today. Run it, then
--check, and confirm that the diff against main has only the marker and comment lines in the workflow. permissions,if:, env keys and their order, step names and job ids stay unchanged.- The equality test at
log-api-budget.test.mjs:1512-1523stays as it is. It still passes with the markers in place, andapi-budget.bash:114-116names it.
Files:
scripts/sync-hold-floor.py- the comment and marker lines around
pr-require-checks.yml:248-250,:926,:4245-4254and:4930 plugins/source-control/skills/babysit-prs/scripts/tests/test_merge_holds_sync.py(the docstring bullet at:13-16only, to name the api-budget blocks)
Key interfaces:
- Readers of the block that must keep working unchanged. Each was checked against the file with these four marker lines inserted:
log-api-budget.test.mjs:1513: its regex stops at the first line not indented two spaces past the key. It still finds pads[10, 6], and both bodies equal the file.scripts/lib/ci-gh-read.sh:22-25: its awk starts at the 6-space key line and stops at the first non-blank line not indented 8 spaces, so the END comment ends it. The output matchedapi-budget.bashbyte for byte (cmp).- The
markLanesharness atlog-api-budget.test.mjs:1528-1529reads the step'srun: |body, and that body is unchanged. scripts/ci-rerun-ci-status.test.sh:294sets its ownAPI_BUDGET_SHand does not read these blocks.
- YAML value: js-yaml parsed the marked file and the current file into deep-equal documents, and both
API_BUDGET_SHvalues equal the file. That shows the trailing comments at the key indent end the scalar without changing it. marker()requires exactly one match per label, hence the two distinct names. Neither label contains the textAPI_BUDGET_SH.test_babysit_risk.py:2239callssync.generate(sync.PIPELINE, tampered), so that call keeps working.- Hold floor:
scripts/sync-hold-floor.pyis atrustfloor row (docs/conventions/pr-pipeline.yaml:1824),api-budget.bashis agaterow (:1774), and the workflow is a gate workflow. This item adds, removes and reclassifies no floor row. The pins inplugins/source-control/skills/babysit-prs/scripts/tests/test_floor_paths.pychange only if a floor row changes, which this item does not do. The pull request holds for review because it edits a gate workflow; that is expected.
Acceptance criteria:
-
python3 -I scripts/sync-hold-floor.py --checkexits 0, and so doestest_merge_holds_sync.py'stest_every_copy_is_what_the_generator_writes. - Running
python3 -I scripts/sync-hold-floor.pyon the branch rewrites no file. - Against main, the required-checks workflow gains exactly the four marker lines and changes only the comment lines named above. No line inside either
API_BUDGET_SHblock changes. - Every existing
hold-floorBEGIN and END line is unchanged in all five generated files. - Editing a line of
api-budget.bashin a scratch copy, then running the script, updates both blocks, and--checkfails before the run. Show this in the PR body; do not commit the edit. -
log-api-budget.test.mjs,scripts/ci-gh-read.test.sh,test_merge_holds_sync.py,test_floor_paths.pyandtest_babysit_risk.pypass. - Every job id, trigger, permission,
if:and workflow file name is unchanged. - The pull request stays within 400 changed lines and 15 hand-edited files.
- ci-status is green.
Out of scope:
- Removing either copy or moving
API_BUDGET_SHto a workflow-levelenv:(rejected in R2's scope: every job would inherit it, andscripts/ci-rerun-ci-status.test.sh:294reads an inherited value as a path). - Editing
api-budget.bash, renamingscripts/sync-hold-floor.py, any floor row, the hold-floor blocks' content, other duplication, eval cases, fixtures, and skill and agent text.
Metadata
Metadata
Assignees
Labels
Type
Fields
Work status
Priority
Activity