Skip to content

Tests: 13 Rust unit tests now call the code they claim to check - #556

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

wormeyman merged 13 commits into
mainfrom
fix-weak-rust-tests

Conversation

@wormeyman

Copy link
Copy Markdown
Collaborator

Fixes 13 Rust unit tests that recomputed a formula inside the test instead of calling the product code, so a broken product could not fail them. No test is deleted, and every edit sits in a #[cfg(test)] module, so engine.wasm is unchanged.

How each fix was proven

Same two-run check as #554: plant one break in product code. The old test (as on main) stays green, the fixed test goes red on its own assertion, and with the break removed the fixed test passes.

test now checks planted break
fulgora_roads.rs the_y_stretch_narrows_the_constant_not_the_product FulgoraRoads::eval against a Voronoi sampled at y * f32(0.8), bit for bit the product narrows y * 0.8 instead of the constant
fulgora_roads.rs the_banding_fields_are_a_truncated_remainder the product's two banding fields at negative dividends .rem_euclid(1.0) in place of % 1.0
fulgora_scrap.rs off_the_default_slider_the_two_forms_disagree FulgoraScrap built at frequency 4/3, cells_cut pinned the product narrows the product, not the constant
elevation_nauvis.rs the_starting_island_term_reads_the_raw_segmentation... the island term read back through eval self.nauvis_seg in place of self.seg
elevation_nauvis.rs the_macro_term_is_half_wave_rectified... 60*a*max(0,b) recovered from two evals the max2 removed
nauvis_climate.rs the_moisture_cutout_reads_all_three_fields the cutout read out of Moisture::eval (bias pinned at its clamp) one of the three terms replaced by infinity (each of the three went red)
starting_spot_at_angle.rs the_radian_conversion_keeps_the_typescripts_association AngleTrig::from_degrees for 1-720 degrees, bit for bit the reassociated angle * (pi / 180)
vulcanus_cracks.rs the_two_flood_cracks_lerp_in_opposite_directions both fields against lerp_f32 over 1,200 points the lerp arguments swapped in flood_cracks_a
starting_patches.rs the_elevation_the_lake_mask_reads_is_elevation_nauvis the layer's elevation bit for bit against ElevationNauvis with_cliff_elevation: false
variable_persistence_multioctave_noise.rs the_persistence_one_branch... the product's p = 1 branch against p = 1 - 1e-7 the branch returns 1/(octaves+1)
placement/roll.rs the_salt_table_is_distinct_and_matches_the_typescripts all 9 salts pinned to the TypeScript literals (read from git at 8516e61^; all 9 matched) ENEMY_BASES off by one
placement/aquilo.rs the_autoplacer_table_is_in_the_games_sorted_order AQUILO_ENTITIES against the game's autoplace order strings the first two entries swapped
fmw-wasm the_all_view_is_terrain_plus_both_overlays a window holding both overlays; each all pixel must be terrain, wells or icebergs, and take the overlay where only one differs VIEW_ALL draws wells only
fixtures.rs the_scorer_resolves_a_single_wrong_point score now delegates to score_with, and the test grades through it the scorer's exact match loosened to abs() < 1e-6

Checked and left alone

  • fmw-wasm the_deep_colour_truncates_rather_than_rounding: its one product assertion already fails when the colour is rounded, so the audit's claim was wrong.
  • the_series_term_powf_is_correctly_rounded_on_this_host: a deliberate canary. Its expected bits are already independent exact values, and failing on a host whose libm rounds differently is its stated purpose.

Gate

scripts/verify-rust.sh passes on the branch: 552 tests in fmw-noise, 52 in fmw-wasm, the poison check, and the engine.wasm byte check. None of the changed tests is in POISONED_TESTS. cargo deny was skipped locally (not installed); CI runs it.

Found by a read-only test audit (the pruning-tests skill). Companion to #554.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Kd6o1dTdCEZ5JSjytamwMZ

wormeyman and others added 12 commits November 26, 2026 10:42
…rmulas

The y-stretch and banding tests never called FulgoraRoads::eval. They now do,
and each is proven red under a planted product break the old test missed
(product-first y narrowing; floored remainder).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kd6o1dTdCEZ5JSjytamwMZ
The test recomputed both f32 forms itself and never built a FulgoraScrap. It now
builds one at frequency 4/3 and pins cells_cut. Proven red when the product
narrows the product instead of the constant.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kd6o1dTdCEZ5JSjytamwMZ
Both tests checked a copy of the formula. The island test now differences two
evals to recover 20*(2.5 - d*seg/200); the macro test differences a far and a
spawn-on-point eval to recover 60*a*max(0,b). Each is proven red under a planted
break (nauvis_seg in the island term; the rectifier removed).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kd6o1dTdCEZ5JSjytamwMZ
The test recomputed the three cutout terms with its own constants. It now pins
moisture_main at its clamp, recovers the cutout from the product's output and
compares it with the smallest term. Proven red when any one of the three terms
is dropped from the product's min.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kd6o1dTdCEZ5JSjytamwMZ
The test compared two f64 associations with each other. It now checks the
product's sin and cos against the game polynomial at the TypeScript's radians.
Proven red when from_degrees uses the tidied association.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kd6o1dTdCEZ5JSjytamwMZ
The test only counted a > b, which holds with the lerps either way round. It now
rebuilds the crack and mix terms and checks both product fields, plus the
saturated mix ends. Proven red when flood_cracks_a swaps its lerp arguments.

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

Any tree other than elevation_lakes used to pass. The test now compares the
layer's elevation bit for bit with a default ElevationNauvis. Proven red when the
layer builds the no-cliff variant.

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

The test checked the limit in its own copy of the formula. It now compares the
product at p == 1 with p just below 1. Proven red when the branch returns
1/(octaves+1).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kd6o1dTdCEZ5JSjytamwMZ
Only FULGORA_SCRAP was pinned; the others only had to stay distinct. All nine now
match the values in the deleted placementRoll.ts (read from git history). Proven
red when ENEMY_BASES moves by one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kd6o1dTdCEZ5JSjytamwMZ
The test sorted a local literal against itself. It now reads AQUILO_ENTITIES,
checks the game's autoplace order strings are strictly increasing in table order
and ties each autoplacer's positioning to its entity kind. Proven red when two
entries swap.

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

The test only looked at pixels where both overlays equal terrain, so an all view
missing the icebergs passed. It now checks every pixel on a window that holds
both overlays. Proven red when the all view paints wells only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kd6o1dTdCEZ5JSjytamwMZ
The test carried a copy of the scoring loop. score gains a score_with variant
that lets the test move one expectation by one ULP, so the real scorer is under
test. Proven red when the scorer's exact match is loosened to a tolerance.

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 5 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: 9fd2b37d-3644-4895-8074-7cfb7b595575
Commits

Reviewing files that changed from the base of the PR and between 428ed87 and 340d6b1.

Files selected for processing: 12

  • crates/fmw-noise/src/expressions/elevation_nauvis.rs
  • crates/fmw-noise/src/expressions/fulgora_roads.rs
  • crates/fmw-noise/src/expressions/fulgora_scrap.rs
  • crates/fmw-noise/src/expressions/nauvis_climate.rs
  • crates/fmw-noise/src/expressions/starting_spot_at_angle.rs
  • crates/fmw-noise/src/expressions/vulcanus_cracks.rs
  • crates/fmw-noise/src/fixtures.rs
  • crates/fmw-noise/src/placement/aquilo.rs
  • crates/fmw-noise/src/placement/roll.rs
  • crates/fmw-noise/src/resources/starting_patches.rs
  • crates/fmw-noise/src/variable_persistence_multioctave_noise.rs
  • crates/fmw-wasm/src/lib.rs
  • 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 216498c into main Nov 26, 2026
16 checks passed
@wormeyman
wormeyman deleted the fix-weak-rust-tests branch November 26, 2026 20: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