fix(build): the plan's "N files, N jobs, <flags>" line names the game's flags again #2217

Open
dazemc wants to merge 1 commit from dazemc/Longshot:fix/plan-line-flags into main
Contributor

Summary

A build's plan prints N files, N jobs, <flags> just before it compiles, and that line has been printing the wrong flags: the last job's, not the game's. On Linux it says the posix object's -O2 -D_GNU_SOURCE where the game's lifted chunks are at -O1; in #1906's builder log it is the bare -O2 that made the line look like the game had been built at the wrong level. The object keys: fingerprints printed above it are correct; this line is the one players paste when an update compiles everything.

How to see it on main: build with LONGSHOT_OBJ_STORE set (every player's build, and every build with a shared store). The line after object store …: N objects from it ends in the last job's flags. Without a store the loop that does it never runs, so a plain make_game.py build looks right.

Why: fl, the game's flags, is rebound by main()'s object-store loop — for _, src, obj, fl, deps in jobs: at nx2/build.py:2215 — because Python's loop variables outlive the loop. shown at :2294 reads fl afterwards and so reports whatever the smallest job carried. The loop's own keys are right: each object is keyed by its own job's flags, and this PR only renames the loop's variable (job_fl), leaving that behaviour and every object's key alone.

What changes: one loop variable's name in nx2/build.py, and tests/test_plan_line_flags.py (new, 3 checks: the loop does not rebind fl, it still keys each object by its job's flags, and the line still reads fl). Two of the three fail on main.

Split out of #2199 (the object store's misses), where it was found while making those misses visible; review asked for it as its own change. No object key, build output or game behaviour changes.

Read first: nx2/build.py's main() around the object-store loop and shown, then tests/test_plan_line_flags.py.

Testing

Tested: game-free only. In the game: N/A — build tooling only, no game code path changes; the evidence is the new check.

  • tests/test_plan_line_flags.py: 3 pass here; on main's build.py 2 fail (for _, src, obj, fl, deps in jobs: found in the loop, key_of(src, job_fl, deps) missing), which is the bug.
  • The full suite on this head 7b9f70da, same command, environment and scope as the baseline: 912 passed, 23 failed, 18 skipped in 402 s (--jobs 5, 12 GiB), the same 23 names as a2dc5385's baseline (diff empty, no new name).
  • tests/test_check_pr_description.py (26) passes.

Still to test:

  • Any PC with a shared object store: the next build's plan line, expecting it to end in the game's flags (-O1 -DA64_POLLING -DA64_WRITE_TRACK -DA64_MARK_BITMAP on Linux) rather than the last job's (-O2 -D_GNU_SOURCE), by hand.

Measurements

Nothing to measure: this changes which flags one log line prints; no object, object key, build time or game timing moves.

Risks

  • What could break: a log line. The loop's behaviour is unchanged (it still keys each object by its own job's flags, which the new check pins), so no build output changes.
  • Turning it off: a revert is enough; neither build nor game reads anything this PR touches.
  • Nothing a player notices except the corrected line in the log they paste.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says. (In the game: N/A — build tooling only, no game code path changes; the evidence is the new check.)
  • mise run test passes (any failure that also fails on main is named): 912 passed, 23 failed, 18 skipped on this head (7b9f70da, --jobs 5, 12 GiB, pinned headers); the 23 names are exactly a2dc5385's baseline set, no new name.
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here.
  • A check under tests/ that reads changed source is updated, not weakened. (The check that reads the changed loop is tests/test_plan_line_flags.py, new here; nothing existing was weakened.)
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.
## Summary A build's plan prints `N files, N jobs, <flags>` just before it compiles, and that line has been printing the wrong flags: the *last job's*, not the game's. On Linux it says the posix object's `-O2 -D_GNU_SOURCE` where the game's lifted chunks are at `-O1`; in #1906's builder log it is the bare `-O2` that made the line look like the game had been built at the wrong level. The `object keys:` fingerprints printed above it are correct; this line is the one players paste when an update compiles everything. **How to see it on main:** build with `LONGSHOT_OBJ_STORE` set (every player's build, and every build with a shared store). The line after `object store …: N objects from it` ends in the last job's flags. Without a store the loop that does it never runs, so a plain `make_game.py` build looks right. **Why:** `fl`, the game's flags, is rebound by `main()`'s object-store loop — `for _, src, obj, fl, deps in jobs:` at `nx2/build.py:2215` — because Python's loop variables outlive the loop. `shown` at `:2294` reads `fl` afterwards and so reports whatever the smallest job carried. The loop's own keys are right: each object is keyed by its own job's flags, and this PR only renames the loop's variable (`job_fl`), leaving that behaviour and every object's key alone. **What changes:** one loop variable's name in `nx2/build.py`, and `tests/test_plan_line_flags.py` (new, 3 checks: the loop does not rebind `fl`, it still keys each object by its job's flags, and the line still reads `fl`). Two of the three fail on main. Split out of #2199 (the object store's misses), where it was found while making those misses visible; review asked for it as its own change. No object key, build output or game behaviour changes. Read first: `nx2/build.py`'s `main()` around the object-store loop and `shown`, then `tests/test_plan_line_flags.py`. ## Testing **Tested:** game-free only. **In the game: N/A** — build tooling only, no game code path changes; the evidence is the new check. - `tests/test_plan_line_flags.py`: 3 pass here; on main's `build.py` 2 fail (`for _, src, obj, fl, deps in jobs:` found in the loop, `key_of(src, job_fl, deps)` missing), which is the bug. - The full suite on this head `7b9f70da`, same command, environment and scope as the baseline: **912 passed, 23 failed, 18 skipped** in 402 s (`--jobs 5`, 12 GiB), **the same 23 names** as `a2dc5385`'s baseline (diff empty, no new name). - `tests/test_check_pr_description.py` (26) passes. **Still to test:** - Any PC with a shared object store: the next build's plan line, expecting it to end in the game's flags (`-O1 -DA64_POLLING -DA64_WRITE_TRACK -DA64_MARK_BITMAP` on Linux) rather than the last job's (`-O2 -D_GNU_SOURCE`), by hand. ## Measurements Nothing to measure: this changes which flags one log line prints; no object, object key, build time or game timing moves. ## Risks - **What could break:** a log line. The loop's behaviour is unchanged (it still keys each object by its own job's flags, which the new check pins), so no build output changes. - **Turning it off:** a revert is enough; neither build nor game reads anything this PR touches. - Nothing a player notices except the corrected line in the log they paste. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. (In the game: N/A — build tooling only, no game code path changes; the evidence is the new check.) - [x] `mise run test` passes (any failure that also fails on `main` is named): **912 passed, 23 failed, 18 skipped** on this head (`7b9f70da`, `--jobs 5`, 12 GiB, pinned headers); the 23 names are exactly `a2dc5385`'s baseline set, no new name. - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. - [x] A check under `tests/` that reads changed source is updated, not weakened. (The check that reads the changed loop is `tests/test_plan_line_flags.py`, new here; nothing existing was weakened.) - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold.
fix(build): the plan's "N files, N jobs, <flags>" line names the game's flags again
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 6s
7b9f70da68
`fl`, the game's flags, was rebound by the object store's loop in `main()` (`for _, src, obj, fl, deps in jobs:`: Python's
loop variables outlive the loop). Every player's build has `LONGSHOT_OBJ_STORE` set, so that loop always ran, and the line
after it reported the last job's flags instead: on Linux the posix object's `-O2 -D_GNU_SOURCE`, and in #1906's log a bare
`-O2` where the game's lifted chunks are at `-O1`. The `object keys:` fingerprints above it are printed before the loop and
were never affected; this is the line players paste when an update compiles everything.

The loop keys each object by the job's own flags, as before: only the name it left behind changed.

tests/test_plan_line_flags.py checks that the loop leaves `fl` alone, still keys each object by its own job's flags, and that
the line still reads `fl` (two of its three checks fail on main).

Split out of #2199, where it was found while making the object store's misses visible; it changes no object's key.

Assisted-by: opencode (DeepSeek V4.1 Flash)
Author
Contributor

Tested in game: N/A — build tooling only; no game code path changes. Evidence: the new check (two of its three fail on main) and the suite it was part of on its original branch.

Tested in game: N/A — build tooling only; no game code path changes. Evidence: the new check (two of its three fail on main) and the suite it was part of on its original branch.
Author
Contributor

Body: the 'check under tests/ that reads changed source' box added, with the truth that the check is new here (tests/test_plan_line_flags.py) and nothing existing was weakened — that is the hint pr status showed. No code change.

Body: the 'check under tests/ that reads changed source' box added, with the truth that the check is new here (tests/test_plan_line_flags.py) and nothing existing was weakened — that is the hint pr status showed. No code change.
dazemc changed title from fix(build): the plan's "N files, N jobs, <flags>" line names the game's flags again to WIP: fix(build): the plan's "N files, N jobs, <flags>" line names the game's flags again 2026-11-22 05:50:30 +00:00
Author
Contributor

WIP again until this head has its own full suite, as #2176/#2200 were. Untick: the suite that covered these two hunks ran on #2199's original branch (613b775a); this branch is that change with the check in tests/test_plan_line_flags.py, and a full suite on 7b9f70da is queued for after the compile arms (--jobs 5, 12 GiB, pinned headers). Targeted checks are not the suite. Expected: 23, the baseline's names.

WIP again until this head has its own full suite, as #2176/#2200 were. Untick: the suite that covered these two hunks ran on #2199's original branch (613b775a); this branch is that change with the check in tests/test_plan_line_flags.py, and a full suite on 7b9f70da is queued for after the compile arms (--jobs 5, 12 GiB, pinned headers). Targeted checks are not the suite. Expected: 23, the baseline's names.
Author
Contributor

Suite on this head: 912 passed, 23 failed, 18 skipped in 402 s (--jobs 5, 12 GiB, pinned headers, worktree at 7b9f70da). The 23 names are exactly the a2dc5385 baseline set, no new name. Box ticked.

Suite on this head: 912 passed, 23 failed, 18 skipped in 402 s (--jobs 5, 12 GiB, pinned headers, worktree at 7b9f70da). The 23 names are exactly the a2dc5385 baseline set, no new name. Box ticked.
dazemc changed title from WIP: fix(build): the plan's "N files, N jobs, <flags>" line names the game's flags again to fix(build): the plan's "N files, N jobs, <flags>" line names the game's flags again 2026-11-22 08:13:25 +00:00
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 6s
This pull request doesn't have enough approvals yet. 0 of 1 approvals granted.
Some workflows are waiting to be reviewed.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'fix/plan-line-flags:dazemc-fix/plan-line-flags'
git switch 'dazemc-fix/plan-line-flags'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!2217
No description provided.