test(simulation): D-239 tile-derivation verification harness (T-1031) #165

Closed
jpmschweitzer wants to merge 0 commits from verification-harness into main
Owner

T-1031 — D-239 Tile-Derivation Verification Harness

Capstone test for the T-974 tile-derivation epic. New server/tests/derivation_harness.rs (29 tests) plus its seed→tile golden fixture, covering four domains:

  1. Golden-seed determinism regression (D-239 §1 / D-010) — pins (seed, region, chunk_pos, tile_pos) → VoxelColumn as a JSON golden; any drift in the derivation chain trips it.
  2. §8 binding-law sweeps (D-239 §8) — drainage monotonicity, lithology→landform, glaciation→form (FjordWall only at GlaciationGrade ≥ 2), climate→vegetation no-skip + riparian band.
  3. Per-family <5 ms/chunk budget (D-239 §10) — derives a full 64×64 chunk per family; hard gate under BUDGET_ASSERT=1.
  4. Validation bodies (D-239 §1) — lore-anchored, DB-free: Kallast/Glødberg/Marevna validated; Velen/Gruenfeld skipped (not in wiki) with logged reason.

D-240 alignment

This branch was rebased onto the merged T-1033 class-envelope temperature work:

  • Validation-body fixtures no longer set the removed BodyParams orbit/star fields (orbital_period_days, axial_tilt_deg, spectral_class, star_type).
  • Marevna's temperature note/assertion rewritten for the envelope model: oceanic band [-12, 28]°C + maritime factor 0.6 + standard-atmosphere greenhouse → ~+26°C at the equator (replacing the stale ~-56°C orbit-equilibrium note).
  • Harness fmt'd + one clippy lint fixed (the file predated the gate's cargo-test/clippy coverage).

Closes T-1031. Completes epic T-974.

🤖 Generated with Claude Code

## T-1031 — D-239 Tile-Derivation Verification Harness Capstone test for the **T-974** tile-derivation epic. New `server/tests/derivation_harness.rs` (29 tests) plus its seed→tile golden fixture, covering four domains: 1. **Golden-seed determinism regression** (D-239 §1 / D-010) — pins `(seed, region, chunk_pos, tile_pos) → VoxelColumn` as a JSON golden; any drift in the derivation chain trips it. 2. **§8 binding-law sweeps** (D-239 §8) — drainage monotonicity, lithology→landform, glaciation→form (FjordWall only at GlaciationGrade ≥ 2), climate→vegetation no-skip + riparian band. 3. **Per-family <5 ms/chunk budget** (D-239 §10) — derives a full 64×64 chunk per family; hard gate under `BUDGET_ASSERT=1`. 4. **Validation bodies** (D-239 §1) — lore-anchored, DB-free: Kallast/Glødberg/Marevna validated; Velen/Gruenfeld skipped (not in wiki) with logged reason. ### D-240 alignment This branch was rebased onto the merged **T-1033** class-envelope temperature work: - Validation-body fixtures no longer set the removed `BodyParams` orbit/star fields (`orbital_period_days`, `axial_tilt_deg`, `spectral_class`, `star_type`). - Marevna's temperature note/assertion rewritten for the envelope model: oceanic band `[-12, 28]°C` + maritime factor `0.6` + standard-atmosphere greenhouse → **~+26°C at the equator** (replacing the stale ~-56°C orbit-equilibrium note). - Harness `fmt`'d + one clippy lint fixed (the file predated the gate's cargo-test/clippy coverage). Closes **T-1031**. Completes epic **T-974**. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
jpmschweitzer added 3 commits 2026-06-08 19:39:52 +02:00
D-239 §1/§8/§9/§10 verification harness (server/tests/derivation_harness.rs):
golden-seed determinism regression, §8 binding-law sweeps (drainage monotonicity,
lithology->landform, glaciation->form no-glacial-U-at-grade-0, climate->vegetation
no-skip + riparian), per-family <5ms/chunk budget assertion, and validation-case
bodies (Kallast=alluvial pass; Velen/Gruenfeld skipped-not-in-wiki). Exposes
derive_morphology_zone as pub for the integration test.

NOTE: golden file not yet generated + fixtures predate the T-1033 BodyParams strip;
fixed in follow-up commits after merging main.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adapt the believability/budget verification harness to the T-1033 BodyParams
strip: validation-body fixtures (Kallast/Glødberg/Marevna) no longer set the
removed orbit/star fields (orbital_period_days, axial_tilt_deg, spectral_class,
star_type). Temperature is now derived from the planet_class envelope (D-240),
so the Marevna validation note/assertion is rewritten — oceanic band [-12,28]°C
+ maritime 0.6 + standard-atmosphere greenhouse yields ~+26°C at the equator
(was a stale ~-56°C orbit-equilibrium note). Add the seed→tile golden fixture
(tests/golden/derivation_harness.json) that the determinism regression locks.

Also fmt the harness and fix one clippy lint (iter().copied().collect() ->
to_vec()) — the file predated the pre-push gate's cargo-test/clippy coverage.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Author
Owner

Review: verification-harness → main (type: code)

Two code reviewers (Hoshe — code quality/QA, Tyre — architecture). Both APPROVE; Hoshe raised three actionable findings, all addressed in 5cc4ff6c.

Hoshe (code quality / test correctness): APPROVE

The harness covers all four stated domains; the golden is a real regression surface (double-derivation equality + JSON value comparison). Three silent-pass / dead-code issues:

# File Issue Resolution
1 derivation_harness.rs assert_drainage_monotonicity + the 3 sweep tests Helper returns early when a chunk has no wet tiles; sweeps couldn't guarantee any chunk exercised the law → could pass with zero assertions Helper now returns whether it actually checked; each sweep asserts ≥1 chunk hit the wet path. Fixed.
2 derivation_harness.rs law_drainage_monotonicity_fjord_floor_at_sea_level Single-row Y=32 probe may miss the trough → sea-level law silently skipped Scans the full 64×64 chunk and asserts the deep-water trough exists. Fixed.
3 derivation_harness.rs make_test_terrain_analysis Dead code behind #[allow(dead_code)] + "future use" comment Removed. Fixed.

Tyre (architecture): APPROVE

The harness faithfully encodes the D-239 contract — the four §8 laws map onto real classifier behavior (not tautologies), the FjordWall GlaciationGrade ≥ 2 gate is tested on both sides against the actual gate, the golden pins the integer-discriminant surface per D-010, and the D-240 class-envelope alignment is sound. Making derive_morphology_zone pub is the correct minimal exposure (integration tests are a separate crate; pub(crate) would not link). All notes were informational/non-blocking:

  • Marevna temp comment (~+26°C) — verified against the runtime value (26.225°C); accurate. (Tyre's hand-calc of ~28°C assumed a flat greenhouse add + warm-end clamp that the implementation doesn't produce.)
  • +3 m levee tolerance and the fjord-floor ≤5 m asymmetry are correctly grounded in D-239 §9. No change.
  • Brittleness note: has_active_channel coupling may shift when Phase 4 BraidedPlain/lithology lands — harness degrades gracefully; re-confirm golden cases hit the wet path then. (Informational.)

Verdict: APPROVED (findings addressed in 5cc4ff6c)

Closes T-1031; completes epic T-974. Pre-push gate green (fmt, clippy -D warnings, full cargo test).

## Review: verification-harness → main (type: code) Two code reviewers (Hoshe — code quality/QA, Tyre — architecture). Both **APPROVE**; Hoshe raised three actionable findings, all addressed in `5cc4ff6c`. ### Hoshe (code quality / test correctness): APPROVE The harness covers all four stated domains; the golden is a real regression surface (double-derivation equality + JSON value comparison). Three silent-pass / dead-code issues: | # | File | Issue | Resolution | |---|------|-------|------------| | 1 | `derivation_harness.rs` `assert_drainage_monotonicity` + the 3 sweep tests | Helper returns early when a chunk has no wet tiles; sweeps couldn't guarantee any chunk exercised the law → could pass with zero assertions | Helper now returns whether it actually checked; each sweep asserts ≥1 chunk hit the wet path. **Fixed.** | | 2 | `derivation_harness.rs` `law_drainage_monotonicity_fjord_floor_at_sea_level` | Single-row `Y=32` probe may miss the trough → sea-level law silently skipped | Scans the full 64×64 chunk and asserts the deep-water trough exists. **Fixed.** | | 3 | `derivation_harness.rs` `make_test_terrain_analysis` | Dead code behind `#[allow(dead_code)]` + "future use" comment | Removed. **Fixed.** | ### Tyre (architecture): APPROVE The harness faithfully encodes the D-239 contract — the four §8 laws map onto real classifier behavior (not tautologies), the FjordWall `GlaciationGrade ≥ 2` gate is tested on both sides against the actual gate, the golden pins the integer-discriminant surface per D-010, and the D-240 class-envelope alignment is sound. Making `derive_morphology_zone` `pub` is the correct minimal exposure (integration tests are a separate crate; `pub(crate)` would not link). All notes were informational/non-blocking: - Marevna temp comment (~+26°C) — verified against the **runtime** value (`26.225°C`); accurate. (Tyre's hand-calc of ~28°C assumed a flat greenhouse add + warm-end clamp that the implementation doesn't produce.) - `+3 m` levee tolerance and the fjord-floor `≤5 m` asymmetry are correctly grounded in D-239 §9. No change. - Brittleness note: `has_active_channel` coupling may shift when Phase 4 BraidedPlain/lithology lands — harness degrades gracefully; re-confirm golden cases hit the wet path then. (Informational.) ### Verdict: APPROVED (findings addressed in `5cc4ff6c`) Closes **T-1031**; completes epic **T-974**. Pre-push gate green (fmt, clippy `-D warnings`, full `cargo test`).
jpmschweitzer added 1 commit 2026-06-08 22:36:14 +02:00
Hoshe review findings — close silent-pass gaps in the §8 drainage tests:
- assert_drainage_monotonicity now returns whether it actually checked (chunk
  had both wet and dry tiles); the three sweep tests (Alluvial/Meander/Braided
  Delta) assert at least one chunk exercised the law, so a regression that
  zeroes all channels fails loudly instead of passing vacuously.
- The fjord-floor test scans the full 64x64 chunk instead of a single Y=32 row
  and asserts the deep-water trough exists, so the sea-level floor law can no
  longer be skipped by a probe that missed the trough.
- Remove the unreferenced make_test_terrain_analysis helper (was behind
  #[allow(dead_code)] with a 'future use' comment — the maintenance trap the
  review flagged); make_dry_terrain_analysis covers the validation bodies.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
jpmschweitzer closed this pull request 2026-06-08 22:38:59 +02:00

Pull request closed

This pull request cannot be reopened because the branch was deleted.
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: jpmschweitzer/settled-reach#165