Skip to content

fix: repair the main Test failures left by the merge train - #2491

Open
houko wants to merge 6 commits into
mainfrom
fix/main-tests-1130
Open

houko wants to merge 6 commits into
mainfrom
fix/main-tests-1130

Conversation

@houko

@houko houko commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Makes main's Test workflow green again apart from the "Test the X template against its pinned modules" jobs, which stay red until a release built on NSGo v0.4.0 exists. Failures are from run 46279350607; each is fixed in its own commit.

Failures, causes and fixes

  • TestTemplatesMatchTemplateModules (internal/gamecli): _templates/projects/{platformer2d,rpg2d} scene_file_test.go and entry scenes differed from template/*/template. 042c85e and 0fe7534 were both cut from 4645e85. 0fe7534 restored 5754892's scenes and tests (on the data files' cells, with canonical-form and drift tests) in template/, while 042c85e copied the older ade190e scenes into _templates and indexed them under new UIDs on both sides. Fix: copy the template/ versions into _templates.
  • TestExamplesIndexed (pkg/tooling/refs): the same 042c85e rewrote both game.index.yaml files to UIDs the template scenes do not carry. Fix: put back the UIDs fe24a61 indexed (w2hp63r7xa3ta, z8hf2h77x4mkx), which is what game index writes.
  • TestSceneEditRefusesStaleBaseVersion (pkg/editor/editormcp): the test was stale, not the product. sceneVersion still hashes only the saved scene. The merge 6223816 interleaved 44ac833's TestSceneEditRefusesStaleBaseVersion with eabef61's TestSceneEditRejectsStaleRevisionAndDuplicateRequest into one function that applies a scene_edit and then expects the version not to have changed. Fix: restore both tests as their commits wrote them.
  • TestPointerAndTouchSnapshots (pkg/input): 4989c8d and b8fbe0d both added Actions.Touches for Input: pointer position, touches with IDs and the wheel, sampled each step in virtual coordinates and recorded in replays #1702. The reconcile ec59761 kept b8fbe0d's version, which documents ID order but appends straight from a map, so the order followed map iteration. Fix: reuse dst from length zero and sort by ID, as 4989c8d did. This is the same pointer.go change as fix(input): repair pointer and touch snapshots #2472, so the two merge cleanly in either order. fix(input): repair pointer and touch snapshots #2472 also adds the buffer-reuse test, docs and changelog.
  • Example (pkg/platformer, interleaved with the postfx output in the log): 0716b01 added an Example that prints platformer.JumpNone and expects 0, but JumpKind.String has returned none since 72e732f. Fix: expect none.
  • TestSettingsExportAppleTeamIDCacheAndLifecycleReset (pkg/editor, Windows only): no handle leaks, since every reader closes nsgo.yaml. The cause is a race. OpenProject starts a project check on another goroutine, and every edit schedules another one 80 ms later (e2cbad8). Both read nsgo.yaml through project.Check. Go opens files on Windows without FILE_SHARE_DELETE, so a check that overlaps the test's os.Remove makes it fail with a sharing violation. This has been latent since the test was added in 50c0e33 and passed on the earlier main runs. Fix: call WaitForProblems before the test touches the file, as other editor tests do.

No changelog fragment: the only product fix, Touches ordering, is in an API that has not been released yet. Its feature fragment is still in changelog.d.

Verification

go tool nsgo test on blackmac passed for ./internal/gamecli/..., ./pkg/input/..., ./pkg/platformer/..., ./pkg/editor/editormcp/..., ./pkg/project/..., ./pkg/tooling/refs/..., the platformer2d and rpg2d template modules, and TestSettingsExportAppleTeamIDCacheAndLifecycleReset. Windows is covered by this PR's CI.

Screenshots

None.

… overwrote

042c85e and 0fe7534 were both cut from 4645e85 to resync the platformer2d and rpg2d entry scenes. 0fe7534 restored the version of 5754892 (scenes on the data files' cells, canonical-form and drift tests) in template/, while 042c85e copied the older ade190e scenes and tests into internal/gamecli/_templates and indexed them under new UIDs on both sides. Merging both left the two copies different and game.index.yaml pointing at UIDs the template scenes do not carry.

Copy the template modules' scenes and tests into _templates and put back the UIDs fe24a61 indexed (w2hp63r7xa3ta, z8hf2h77x4mkx) in both game.index.yaml files.
44ac833 added TestSceneEditRefusesStaleBaseVersion (selection and view leave the version alone; a stale baseVersion is refused without changes) and eabef61 moved TestSceneEditRejectsStaleRevisionAndDuplicateRequest to baseVersion. The merge 6223816 interleaved them into one function that applies a scene_edit and then expects the version not to have changed. sceneVersion still hashes only the saved scene, so restore the two tests as their commits wrote them.
4989c8d and b8fbe0d both added Actions.Pointer and Actions.Touches for #1702. The reconcile ec59761 kept b8fbe0d's Touches in pkg/input/pointer.go, which documents ID order but appends straight from the touches map onto whatever dst held, so the order followed map iteration and TestPointerAndTouchSnapshots from 4989c8d failed. Restore 4989c8d's contract: reuse dst from length zero and sort by ID. This is the same pointer.go change as #2472, which also adds the buffer-reuse test and docs.
0716b01 added a package Example that prints platformer.JumpNone and expects 0, but JumpKind has had a String method returning "none", "ground" or "wall" since 72e732f, so fmt prints none. Expect the documented output.
TestSettingsExportAppleTeamIDCacheAndLifecycleReset (50c0e33) rewrites and then removes the project's nsgo.yaml right after OpenProject and AddExportPreset. OpenProject starts a project check on its own goroutine and every edit schedules another one 80 ms later (e2cbad8); both read nsgo.yaml through project.Check. Go opens files on Windows without FILE_SHARE_DELETE, so when the Windows runner is slow enough for a check to overlap os.Remove, the remove fails with a sharing violation. Nothing leaks the handle: every reader closes it. Wait for the checks with WaitForProblems before touching the file, as the other editor tests do.
@houko houko added the skip-changelog Internal change that needs no changelog.d fragment label Nov 29, 2026
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Nov 29, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/template bug Something isn't working documentation Improvements or additions to documentation pkg/editor pkg/input pkg/internal pkg/platformer size/M skip-changelog Internal change that needs no changelog.d fragment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant