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

3.3 KiB

Large additional-generation stability fix

Reproduced failure

The previous build could roll back or appear to stop for larger selections. A concrete failure was reproduced at 300x339 and larger selections, with internal-tile transport seam failures and later with cumulative work/memory growth as tile count increased.

Root causes fixed

  1. Internal tile transport seam contracts were treated as user-visible outer seams. A transient road/rail portal inside the tile grid could roll back the entire selection. Internal tile transport seam checks are now deferred; only the real user-selection outer seam is repaired and hard-gated after all tiles are merged.
  2. Tile-count thresholds jumped unnecessarily. The tiler now chooses the minimum grid that fits the fixed candidate window with a bounded overlap instead of adding a row/column too early.
  3. Full structural administration repair ran once per internal tile. This repeatedly rescanned an ever-growing world. Internal tiles now do local coverage/ID bookkeeping only; topology cleanup, tiny-prefecture handling, frontier continuity and seam-shape repair run once over the complete selection after tile merge.
  4. Internal rollback/debug snapshots retained large world metadata repeatedly. Internal tiles now use a lightweight local transaction while the outer tiled operation owns the atomic rollback snapshot. Generated tile history is stored as compact geometry/identity records.
  5. Patch-mode transport generation did redundant expensive guarantees for every internal tile. Internal large-selection tiles use bounded road-flow/backbone work, while the final merged world performs the authoritative outer-network repair.
  6. Municipality connectivity work was needlessly repeated by municipality ID. The strict connectivity pass was replaced with a whole-map component traversal that preserves genuine isolated islands while avoiding ID-count-proportional rescans.
  7. Terrain and administrative coherence are finalized once for the full selection. This avoids repeatedly smoothing/reclassifying overlapping internal seams and keeps the final result governed by the actual user boundary.

Verification performed on this build

  • 300x339 direct: PASS, 4 tiles, seam clean.
  • 500x350 direct: PASS, 4 tiles, seam clean.
  • 600x400 direct: PASS, 9 tiles, seam clean, about 42.8 s in this environment.
  • 600x400 Worker path: PASS, outer/inner result true, 9 tiles, seam clean, about 41.1 s.
  • 280x200 direct and Worker regressions: PASS, selected-cell coverage 100% in the synchronous check.
  • STEP15 validation: PASS; expansion seam clean, no escaped footprint, no unresolved road/rail portals.
  • STEP17 validation: PASS; alternatives still differ and render-revision/Worker-lifetime behavior is retained.
  • Previously reported geography regressions: PASS; no sea-river points, duplicate prefectural capitals, tiny newly generated prefectures, or administrative frontier breaks in the regression case.
  • Seam stress directions were run in isolated processes to avoid Node test-process accumulation; observed maximum frontier elevation jump stayed <= 0.0364 versus the 0.075 hard limit.

Island handling

Small disconnected components belonging to a larger prefecture are not automatically deleted. If they are separated by sea and lack an adjacent land prefecture to merge into, they can represent legitimate islands and are preserved.