Skip to content

Tests: fix 15 tests that would pass with the bug they name - #554

Merged
wormeyman merged 5 commits into
mainfrom
fix-weak-tests
Nov 26, 2026
Merged

wormeyman merged 5 commits into
mainfrom
fix-weak-tests

Conversation

@wormeyman

Copy link
Copy Markdown
Collaborator

Fixes 15 tests that would pass with the bug they name. Each fix is proven, and no test is deleted.

How each fix was proven

The audit's two-run check: plant one break in product code, run the old test as it was at main (it stays green), then run the fixed test under the same break (it goes red on its own assertion). With the break removed, the fixed test passes. A script did each run and restored both files byte for byte.

test what was wrong the planted break
diffArtifacts.spec.ts "never calls rmSync when a traversal case name reaches writeDiffArtifacts" The throw only proved the guard ran at some point. With rmSync moved above it, the test stayed green while the escaped folder was deleted. It now plants a sentinel where the unguarded path resolves and requires it to survive. rmSync on the raw joined path, before artifactPaths
nauvis_stack.rs the_resource_block_starts_where_the_tile_block_ends... assert_eq!(x, x), which cannot fail the resource block's last index reads a field instead of the resolver winner (i < 18 -> i < 19)
seed.spec.ts a randomU32 that always returns 0 passed return 0;
findIslands.spec.ts "marks exactly the refined rows as refined" asserted <= 2, so zero refined rows passed refine nothing
fmw-wasm a_nauvis_request_is_not_surveyed assert_ne!(_, 0), and the request was refused for its length before the planet check ran the planet guard returns 0
fulgora_ocean.rs the_shallow_variants_are_selected_by_sign... ocean_tile answers only "shallow", so the sign was never checked the two shallow formulas swapped
decode.spec.ts Death world time_factor not.toBe(Default) accepted any wrong value; now pinned to the game's 0.00002 (base/prototypes/map-gen-presets.lua) Death world's value doubled on decode
decode.spec.ts cliff control string the name says the whole corpus; it checked Default only a non-Default preset decodes a non-empty control
controlRow.spec.ts always-on control at size 0 every() is true on an empty list sliders hidden at size 0
resourceIcons.spec.ts no icons on the Terrain tab a count of 0 also passed when the tab rendered nothing the tab's table not rendered
terrainTab.spec.ts no info glyph on trees passed when the trees row was missing the trees row not rendered
islandFinderPanel.spec.ts no divider / unclipped row (2 tests) negative checks with no rows rendered still passed island rows not rendered
advancedTab.spec.ts dump in a collapsed details the dump and the details only had to exist the details starts open

One fix is proven the other way round. actionBar.spec.ts waited a fixed 100 ms for the zip export, which can fail on a slow runner with nothing wrong. With the zip delayed 300 ms, the old test failed and the new one, which polls with vi.waitFor, passed.

Also changed, not separately proven

  • wasmVulcanusRenderParity.spec.ts seed trap: the bound > DIFFERING_PX * 10 became > 0 once the frozen count reached 0, and its comment ("an order of magnitude worse") became false. At the raw map seed 940,914 of 1,048,576 pixels differ, so it now asserts more than half. No single break separates old from new here: any break that makes the seed matter less also turns the frozen-count test red.
  • Three tests renamed to say what they check: chainGraph (it never calls boxGap), the Fulgora scrap footprint (it asserts 0 pixels outside), and store's nested views (it checks one float, not bytes).

Checked and left alone

The audit flagged these, and checking showed the claim was wrong:

  • islandFinderPanel "in TILES, not pixels": the old test already fails when the rectangle prints in pixels.
  • devMode.spec.ts: it pins the literal key, so a colliding key already fails it.
  • cliffCatalog.spec.ts's typeof loop: it catches a table shorter than 256 entries.

Gate

pnpm run verify:lint, the full pnpm vp test and scripts/verify-rust.sh pass on this branch. engine.wasm is unchanged, because every Rust edit is inside a #[cfg(test)] module.

The weak Rust tests that recompute a formula instead of calling the product are in a separate PR.

Found by a read-only test audit (the pruning-tests skill).

🤖 Generated with Claude Code

https://claude.ai/code/session_01Kd6o1dTdCEZ5JSjytamwMZ

wormeyman and others added 4 commits November 26, 2026 10:42
Each fix is proven the same way: under one planted break in product code,
the old test stays green and the fixed test goes red; unbroken, the fixed
test passes. The breaks are listed in the PR.

- diffArtifacts: the rmSync guard test now plants a sentinel where an
  unguarded path would resolve and requires it to survive. The throw alone
  passed with rmSync moved above the guard.
- nauvis_stack parity: replace `assert_eq!(x, x)` with the resolver's winner
  and the tree block's first field.
- seed: randomU32 returning a constant passed the range test.
- findIslands: "marks exactly the refined rows" asserted `<= 2`.
- fmw-wasm survey: the Nauvis request never reached the planet guard; it
  now has a well-formed Nauvis case and asserts exact statuses.
- fulgora_ocean: the shallow-variant test now reads both variants.
- decode: the cliff.control test checks every preset, and Death world's
  time_factor is pinned to the game's 0.00002 instead of `not.toBe`.

Also corrects the Vulcanus seed-trap bound, which became `> 0` once the
frozen count reached 0. No single break separates old from new there, so
that one is a comment-and-scale correction, not a proven fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kd6o1dTdCEZ5JSjytamwMZ
Proven the same way as the first batch (old green and fixed red under one
planted break, unless noted):

- controlRow: count the sliders before `every()`, which is true on an
  empty list (break: hide the sliders at size 0).
- resourceIcons, terrainTab, islandFinderPanel (x2): each negative check now
  first asserts the element it looks inside exists (breaks: the tab, the
  trees row, the island rows not rendered).
- advancedTab: the expression dump must sit inside a details that starts
  closed (break: the details opens by default).
- actionBar: poll for the blob URL instead of sleeping 100 ms. Proven in the
  other direction: with the zip delayed 300 ms the old test failed and the
  new one passed.
- Renamed three tests whose names claimed more than they check (chainGraph,
  the Fulgora scrap footprint, store's nested views).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kd6o1dTdCEZ5JSjytamwMZ
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kd6o1dTdCEZ5JSjytamwMZ
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kd6o1dTdCEZ5JSjytamwMZ
@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 22 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f5dbd90b-846a-4130-b634-761bdedf83f7
Commits

Reviewing files that changed from the base of the PR and between b4934cb and 9941b9b.

Files selected for processing: 17

  • crates/fmw-noise/src/expressions/nauvis_stack.rs
  • crates/fmw-noise/src/tiles/fulgora_ocean.rs
  • crates/fmw-wasm/src/lib.rs
  • test/actionBar.spec.ts
  • test/advancedTab.spec.ts
  • test/chainGraph.spec.ts
  • test/controlRow.spec.ts
  • test/decode.spec.ts
  • test/diffArtifacts.spec.ts
  • test/findIslands.spec.ts
  • test/islandFinderPanel.spec.ts
  • test/resourceIcons.spec.ts
  • test/seed.spec.ts
  • test/store.spec.ts
  • test/terrainTab.spec.ts
  • test/wasmFulgoraRenderParity.spec.ts
  • test/wasmVulcanusRenderParity.spec.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@claude

claude Bot commented Nov 26, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@wormeyman
wormeyman merged commit 2826ed4 into main Nov 26, 2026
16 checks passed
@wormeyman
wormeyman deleted the fix-weak-tests branch November 26, 2026 19:10
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