Skip to content

Generate the two inline api-budget.bash copies in the required-checks workflow #15967

Description

@kyle-sexton

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 line pr-require-checks.yml:250, content :251-926, at a 10-space key indent; the comment above it is :248-249;
  • the ci-status job env: the key line pr-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):

  • BLOCKS maps 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);
  • --check prints 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 BLOCKS entry 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-lanes and api-budget ci-status. Both use one render function that emits API_BUDGET_SH: | at the BEGIN line's indent, then each line of api-budget.bash indented 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.
  • 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.py directly above :250, and # END api-budget mark-lanes directly after :926;
    • # BEGIN api-budget ci-status: generated by scripts/sync-hold-floor.py directly above :4254, and # END api-budget ci-status directly 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-249 and :4245-4246 to say the block is generated (run the script after editing api-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-1523 stays as it is. It still passes with the markers in place, and api-budget.bash:114-116 names it.

Files:

  • scripts/sync-hold-floor.py
  • the comment and marker lines around pr-require-checks.yml:248-250, :926, :4245-4254 and :4930
  • plugins/source-control/skills/babysit-prs/scripts/tests/test_merge_holds_sync.py (the docstring bullet at :13-16 only, 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 matched api-budget.bash byte for byte (cmp).
    • The markLanes harness at log-api-budget.test.mjs:1528-1529 reads the step's run: | body, and that body is unchanged.
    • scripts/ci-rerun-ci-status.test.sh:294 sets its own API_BUDGET_SH and 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_SH values 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 text API_BUDGET_SH.
  • test_babysit_risk.py:2239 calls sync.generate(sync.PIPELINE, tampered), so that call keeps working.
  • Hold floor: scripts/sync-hold-floor.py is a trust floor row (docs/conventions/pr-pipeline.yaml:1824), api-budget.bash is a gate row (:1774), and the workflow is a gate workflow. This item adds, removes and reclassifies no floor row. The pins in plugins/source-control/skills/babysit-prs/scripts/tests/test_floor_paths.py change 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 --check exits 0, and so does test_merge_holds_sync.py's test_every_copy_is_what_the_generator_writes.
  • Running python3 -I scripts/sync-hold-floor.py on 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_SH block changes.
  • Every existing hold-floor BEGIN and END line is unchanged in all five generated files.
  • Editing a line of api-budget.bash in a scratch copy, then running the script, updates both blocks, and --check fails 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.py and test_babysit_risk.py pass.
  • 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_SH to a workflow-level env: (rejected in R2's scope: every job would inherit it, and scripts/ci-rerun-ci-status.test.sh:294 reads an inherited value as a path).
  • Editing api-budget.bash, renaming scripts/sync-hold-floor.py, any floor row, the hold-floor blocks' content, other duplication, eval cases, fixtures, and skill and agent text.

Activity

  1. added
    status: ready
    host-run
    on Nov 13, 2026
  2. added theissue type on Nov 13, 2026
  3. removed
    status: ready
    on Nov 13, 2026
  4. removed
    host-run
    on Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    Work status

    ready

    Priority

    low

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions