Skip to content

CI: run the pin-logic checks without the game on GitHub Actions - #7

Merged
kramsey458 merged 2 commits into
mainfrom
claude/checks-ci
Sep 22, 2026
Merged

kramsey458 merged 2 commits into
mainfrom
claude/checks-ci

Conversation

@kramsey458

@kramsey458 kramsey458 commented Sep 22, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

tests/Checks can now run without Timberborn installed. With no arguments it runs the 11 pin-logic (PinSet) checks, reports the 27 game checks as skipped and exits 0. A new GitHub Actions workflow (.github/workflows/tests.yml) runs that mode on a clean Ubuntu runner for every pull request and every push to main. When build.ps1 passes all three arguments, the full 38 checks still run.

The mod DLL, the manifest and the version-1.1 assets are unchanged. build.ps1 copies README.md into the release zip, so the packaged README gains the same one paragraph on running the checks without the game.

Items

CI: Tests without the game (brief section 4.8)

What changed

  • tests/Program.cs
    • With no arguments, it runs the game-free checks and prints: 11 checks passed; 27 checks that need the game were skipped (...). Exit code 0.
    • With one or two arguments (or four), it prints the usage and exits with code 2. Before this change it crashed.
    • With all three arguments, the same 38 checks run as before. After the last check, a guard compares the number of game checks that ran with the GameChecks constant (27) and fails the run if they differ, so the "skipped" count stays honest. The comment at the split and the guard's failure message both say that new checks needing no game files must go above the split.
  • tests/Checks.csproj: no change needed. It already references no game or package DLLs: it links only source/PinSet.cs, which uses only System namespaces, and it loads game assemblies by reflection only after the split.
  • .github/workflows/tests.yml (new):
    • Runs on ubuntu-latest and installs the .NET SDK with actions/setup-dotnet@v6 (8.0.x).
    • Pins that SDK on the runner only, with dotnet new globaljson. The repo's NuGet.Config clears every package source, so a newer default SDK could not restore the net8.0 targeting pack.
    • Then runs dotnet run --project tests/Checks.csproj -c Release.
    • Triggers: pull_request, pushes to main, and workflow_dispatch. There is no paths filter, which matches the other timbermods test workflows.
  • README.md ("Build from source"): one paragraph with the forward-slash command, which works in PowerShell, cmd, bash and zsh.

Test that proves it: the CI step itself, dotnet run --project tests/Checks.csproj -c Release with no arguments.

  • Fails before, on 6197119: after PASS: New map begins without pins it throws Unhandled exception. System.IndexOutOfRangeException: Index was outside the bounds of the array. at Program.<Main>$(String[] args) and exits non-zero.
  • Passes after: 11 passed, 27 skipped, exit 0.
  • The CI run catches real regressions. A reviewer temporarily changed source/PinSet.cs to use default equality. The no-argument run then failed with FAIL: Distinct equal-valued buildings retain separate pins.
  • The count guard works. With GameChecks temporarily set to 26, the full run fails with FAIL: 27 checks ran after the game-free block but GameChecks says 26; move any new check that needs no game files above that block, then set GameChecks to the number that still needs the game.

Tests

Suite Before (6197119) After (879a776)
build.ps1 -GameDir <Timberborn> (build, then Checks with 3 args, then packaging) 38/38 passed, 0 warnings 38/38 passed, 0 warnings, 0 errors, packaging OK
dotnet run --project tests/Checks.csproj -c Release (no args) 11 passed, then crash (IndexOutOfRangeException), non-zero exit 11 passed, 27 skipped, exit 0
Same, with 1 arg crash usage message, exit 2
Runner simulation: git archive copy, empty NUGET_PACKAGES, SDK pinned by dotnet new globaljson n/a 11 passed, 27 skipped, exit 0, no packages downloaded
GitHub Actions "Tests" (ubuntu-latest, run 35725809162) n/a success: 11 passed, 27 skipped

GitHub Actions ran this workflow on this PR (run 35725809162, ubuntu-latest) and it passed. It pinned SDK 8.0.425 and printed 11 checks passed; 27 checks that need the game were skipped.

Co-op impact

None. No simulation, save format, wire format or Harmony patch changes. Only test tooling, CI and one README paragraph change; no file under source/ or packaging/ is touched. Co-op players do not need to update together for this change.

Proposed CHANGELOG lines

None needed for players: the mod itself is unchanged. If you want a developer note:

  • Checks can now run without the game (pin-logic checks only), and GitHub Actions runs them on pull requests.

Merge order with PWA1 (#6) and PWA2 (#8)

PWA1 (claude/pin-refresh-planner, #6) and PWA2 (claude/localize-ui, #8) both add checks to tests/Program.cs, and both conflict with this branch there. Whichever of them merges after this PR must:

  1. Keep every check that needs no game files above the // The checks above use only the mod's game-free sources ... / const int GameChecks block.
    • PWA1's "Refresh planning, against a fake navigation world" block (about 20 PinRefreshPlanner checks) belongs there, directly after the PinSet checks.
    • Its source/PinRefreshPlanner.cs link in Checks.csproj uses only System namespaces, so CI can compile it.
  2. Keep checks that load game assemblies below the split, before the guard.
  3. Set GameChecks to the number the full build.ps1 run reports in the guard message. It becomes 34 once PWA2 (PWA2: Localize the work-area panel and clear-button text #8) is in, and 42 once PWA1 (PWA1: re-query only the pins a navigation change can reach #6) is in as well.
  4. Check that the no-argument run prints the larger game-free count (32 once PWA1 is in). If it still says 11 after PWA1, its planner checks ended up below the split.

The count guard fails closed: a stale GameChecks stops build.ps1 with the exact number to set.

With all three in, the full run is 74/74: 32 game-free checks and GameChecks = 42. Suggested order: this PR (#7), then #8, then #6. #6 and #8 also conflict with each other in the source/WorkAreaService.cs constructor: keep _loc = loc and #6's _reach and _planner.

Needs in-game / two-player testing

Nothing in game: the mod's code and behavior are unchanged.

  • After merging PWA1 or PWA2 on top of this, run build.ps1 once and confirm the GameChecks guard passes (see the merge-order section).

Review

Two adversarial reviewers approved fd57b44. Lenses: save compatibility and cross-mod interaction; is the test real. Their findings:

  • Fixed: a misplaced game-free check is invisible to the count guard (minor). The guard compares only counts, so during the PWA1 merge its pure planner checks could land below the split and silently stop running in CI. The comment at the split and the guard's failure message now say where such checks go, and the merge-order section above gives the expected counts.
    • Not done: a second hand-kept GameFreeChecks constant. It would only catch the mistake if the person resolving the merge set it from intent rather than from the reported number, and it adds another constant to every future merge.
  • Handled in this description: the hand-kept GameChecks constant goes stale when PWA1 or PWA2 merges later (minor). See the merge-order section above.
    • Declined: turning the mismatch into a warning. A warning would let CI keep printing a wrong skipped count unnoticed. Each owner runs build.ps1 after rebasing, and the failure message names the exact value to set.
  • Fixed: the paths filter missed root build inputs (nit), such as global.json and Directory.Build.*, and docs-only PRs would never report the check. The filter is removed; the job takes seconds.
  • Fixed: the README command used a Windows backslash path (nit) that fails in bash and zsh. It now uses tests/Checks.csproj.
  • Fixed: "package unchanged" wording (nit). The packaged README does change. This description now says so; no CHANGELOG entry is needed.

🤖 Generated with Claude Code

kramsey458 and others added 2 commits September 22, 2026 05:03
tests/Checks read args[0] right after the 11 PinSet checks, so a run with
no arguments died with IndexOutOfRangeException and nothing could run the
checks on a machine without Timberborn.

With no arguments Checks now runs the game-free checks, prints how many
passed and how many game checks were skipped, and exits 0. One or two
arguments print the usage and exit 2 instead of crashing. With all three
arguments the same 38 checks run as before, and the run fails if the
GameChecks constant (27) stops matching the checks that need the game, so
the skipped count stays honest when checks are added.

Checks.csproj already references no game or package DLLs, and the repo's
NuGet.Config clears every package source, so the new workflow pins the
.NET 8 SDK it installs (on the runner only) and runs the checks on
ubuntu-latest for pull requests and pushes to main that touch source/,
tests/, NuGet.Config or the workflow. README says how to run them locally.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Review follow-ups. The workflow's paths filter left out root-level build
inputs such as global.json or Directory.Build.props, and a filtered job
never reports on docs-only pull requests, which would block them if the
check is ever made required. The job takes seconds, so it now runs on
every pull request and push to main, like the other timbermods test
workflows.

The GameChecks guard compares only counts, so a check that needs no game
files but lands after the argument split would silently stop running in
CI. The comment at the split and the guard's failure message now say to
keep such checks above the split before updating GameChecks.

The README command uses forward slashes so it also works in bash and zsh.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@kramsey458
kramsey458 marked this pull request as ready for review September 22, 2026 16:38
@kramsey458
kramsey458 merged commit a1f968b into main Sep 22, 2026
1 check passed
kramsey458 added a commit that referenced this pull request Sep 22, 2026
Keep PWA2's localization checks above the GameChecks count guard and
raise GameChecks from 27 to 34. Full run: 45/45; no-argument run: 11
passed, 34 skipped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kramsey458 added a commit that referenced this pull request Sep 22, 2026
- WorkAreaService constructor: keep PWA1's NavigationDistance parameter,
  _reach and _planner alongside PWA2's ILoc.
- tests/Program.cs: keep the planner checks above the game-free split so
  CI runs them, and raise GameChecks from 34 to 42. Full run: 74/74;
  no-argument run: 32 passed, 42 skipped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kramsey458 added a commit that referenced this pull request Sep 22, 2026
- WorkAreaService constructor: keep PWA4's EntityComponentRegistry and
  PWA2's ILoc.
- tests/Program.cs: move the planting-rule and planner Show checks above
  the game-free split so CI runs them, and raise GameChecks to 56.
  Full run: 104/104; no-argument run: 48 passed, 56 skipped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kramsey458 kramsey458 mentioned this pull request Sep 22, 2026
@kramsey458
kramsey458 deleted the claude/checks-ci branch September 22, 2026 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant