Skip to content

own-language budget step charges master's foreign lines to a PR whose base.sha is stale #7489

Open

Description

@gHashTag

The foreign-line budget step in .github/workflows/own-language.yml diffs github.event.pull_request.base.sha...github.event.pull_request.head.sha. GitHub does not move pull_request.base.sha when master moves; it stays at the base the PR last saw (here: the base at PR creation). When a PR then merges a newer master into its branch, the three-dot diff starts at the old base, and every foreign line master gained in between is charged to the PR.

Seen on #7425 (Part of #6063): run 37603940543 used BASE cfda070b2 for head dca980b6f, which already contains master up to ba161bba1. The step denied cli/t27b/src/codegen.rs, ir.rs and tests/differential.rs, all from #7398 (lane 3), not from the PR. Diffed against current master the same head is inside the budget (49 foreign lines). Locally, the same check_budget against the stale bases of #7418 and #7447 also denies, and against current master all four lane 5 PRs pass.

Workaround used: gh api -X PATCH repos/gHashTag/t27/pulls/N -f base=master refreshes base.sha to the current master tip; a label toggle then re-runs the workflow with the fresh payload.

Possible fix (the workflow is protected, so this needs the owner's label): after checkout, compute the base as git merge-base origin/master "$HEAD" (or fetch github.base_ref and diff origin/$BASE_REF...$HEAD) instead of trusting the event's base.sha. The path check in the same file reads $BASE:tools/policy/foreign-exceptions.txt and has the same staleness, so an exception block that landed on master after the PR opened is not seen either.

Part of #6063

Boundary

  • .github/workflows/own-language.yml
  • cli/t27b/src/codegen.rs
  • tests/differential.rs
  • tools/policy/foreign-exceptions.txt

User Scenarios

  • Given a pull request whose base.sha is stale because master has advanced since the PR was created, When the own-language.yml workflow runs its foreign-line budget step, Then the step must compute the diff base at runtime using the current merge-base with origin/master (or origin/$BASE_REF) instead of trusting the event's base.sha, so that only foreign lines introduced by the PR itself are counted.
  • Given a PR that merges a newer master into its branch, When the workflow reads tools/policy/foreign-exceptions.txt for the path check, Then it must read the file from the computed current base so that exception blocks added to master after the PR opened are honored.

Requirements

  • FR-001: The workflow .github/workflows/own-language.yml MUST replace the three-dot diff github.event.pull_request.base.sha...github.event.pull_request.head.sha with a diff computed from git merge-base origin/master "$HEAD" (or origin/${{ github.base_ref }}...$HEAD) so the base reflects the current tip of the target branch.
  • FR-002: The foreign-exceptions file read in the same workflow ($BASE:tools/policy/foreign-exceptions.txt) MUST use the computed current base instead of the stale event base.sha.

Success Criteria

  • grep -q 'merge-base origin/master' .github/workflows/own-language.yml exits 0.
  • grep -q 'merge-base origin/\${{ github.base_ref }}' .github/workflows/own-language.yml || grep -q 'origin/\${{ github.base_ref }}\.\.\.\$HEAD' .github/workflows/own-language.yml exits 0.
  • The workflow run on a PR with stale base.sha where master gained foreign lines since PR creation reports foreign-line count ≤ budget for a head that is within budget against current master (exit 0 on the budget step).
  • The path check for tools/policy/foreign-exceptions.txt in the workflow references the computed base variable (exit 0 on grep -q '\${COMPUTED_BASE:-.*}:tools/policy/foreign-exceptions.txt' .github/workflows/own-language.yml or equivalent).
  • All four lane-5 PRs (e.g., specs: layernorm, wrapup-auto and ternary_mac_synth test what they claim (Closes #7404) #7418, t27b: a test local named for a module var (Closes #7668) #7447) pass the budget step when re-run against current master (4 PRs pass).

Activity

  1. gHashTag commented on Oct 7, 2026

    @gHashTag
    OwnerAuthor

    It recurs on every master merge: after pushing the re-merges of #7418, #7425, #7447 and #7470 (master b94f486), all four PRs still carried base.sha d5cefde, from the previous PATCH. A diff from there would charge #7462's lower.rs and source.rs lines to them. Refreshed again with PATCH plus a label toggle.

  2. added
    needs-boundaryNo '## Boundary' section, so the Queen can reserve nothing for it and no bee can take it
    and removed
    needs-boundaryNo '## Boundary' section, so the Queen can reserve nothing for it and no bee can take it
    on Oct 7, 2026
  3. gHashTag commented on Oct 7, 2026

    @gHashTag
    OwnerAuthor

    Reopened 2026-10-07: the bulk close of issues without a ## Boundary section was reverted by the owner. Nothing to do here; this comment replaces the earlier close notice.

  4. added
    needs-shapeIssue lacks Boundary/Scenarios/Requirements/Success criteria
    on Oct 7, 2026
  5. removed
    needs-shapeIssue lacks Boundary/Scenarios/Requirements/Success criteria
    on Oct 7, 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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions