map/archive/generated-history/FIX_3_TO_7_NOTES.md
2026-08-08 17:41:30 +09:00

3.3 KiB
Raw Blame History

Fixes 3-7: additional-generation integrity and UI controls

This revision intentionally addresses items 3-7 from the post-audit list. Items 1-2 (selection-size/mode discontinuity and derived-field seam continuity) are intentionally unchanged.

3. Prefectural capitals and prefecture metadata

  • Every active prefecture raster ID is now required to have exactly one capital-like modernCities record.
  • If a prefecture has no capital, the patch finalizer promotes, in order: an existing city, a market, a municipal center, then a generated fallback point.
  • Duplicate capitals are still demoted.
  • prefectureRegions metadata is rebuilt after capital normalization and now refreshes worldX/worldY, capitalX/capitalY, capitalWorldX/capitalWorldY, and insidePrefecture instead of carrying stale values across world expansion.

Validation: two sequential expansion patches increased active prefectures from 5 to 6 while maintaining exactly one capital per prefecture and valid capital metadata coordinates.

4. River sanitation locality

  • River-vs-sea cleanup is now restricted to the patch writeRect.
  • Existing river-mouth/ocean path points outside the patch are preserved byte-for-coordinate instead of being globally rewritten by an unrelated patch.
  • River raster cells and path points over final sea are still removed inside the patch write region.

Validation: five pre-existing sea-mouth points outside the tested expansion remained unchanged; sea river points inside the generated write region were zero.

5. Freeform selection tiling

  • Polygon/lasso expansion no longer uses the full bounding-box row × column Cartesian grid.
  • The occupied polygon is recursively split along its overflowing axis, and only polygon-intersecting child regions are generated.
  • Rectangular selections retain the existing regular tiling path.

Validation: a thin diagonal lasso whose old bounding-box grid implied up to 9 candidates now uses 4 tiles and completes with seam=clean.

6. Cancel and watchdog

  • Added a Cancel Generation button.
  • Escape cancels an active patch generation.
  • Cancellation invalidates the request before terminating its worker so a late result cannot become pendingPatch.
  • Added a 60-second inactivity watchdog. It resets on every worker progress event, so long generations are allowed as long as they continue reporting progress.

7. Clear Selection / pending preview state

  • Clear Selection now discards any un-applied pending preview as well as the selection overlay.
  • Escape outside generation does the same.
  • hideSelectionOverlay() defaults to discarding a pending preview unless explicitly committing or opting to keep it, preventing a hidden pendingPatch from surviving after the dotted selection disappears.

Regression status

  • STEP15: PASS; expansion seam clean, no footprint escape, no unresolved road/rail portals, rollback preserved.
  • STEP17: result ok:true; alternatives differ, render revision and single-patch-worker behavior preserved. The Node harness still remains alive after printing its result, so the outer timeout is a harness-exit issue rather than a failed assertion.
  • Previously reported geography regression: PASS; no duplicate or missing capitals, no tiny generated prefectures, no patch-region sea river points, frontier admin breaks 0, maximum established-frontier elevation jump 0.0268, seam clean.