Skip to content

Add guarded API 3 native map invalidation - #107

Closed
Roxas2712 wants to merge 20 commits into
UNDERdecoded:mainfrom
Roxas2712:codex/api3-map-invalidation
Closed

Roxas2712 wants to merge 20 commits into
UNDERdecoded:mainfrom
Roxas2712:codex/api3-map-invalidation

Conversation

@Roxas2712

@Roxas2712 Roxas2712 commented Oct 22, 2026 •

Copy link
Copy Markdown

Depends on #106 and its API ancestors. Merge those first and rebase before merging. Isolated implementation: b191fdcc3d904e51619e250f0c984236e8980aed (focused diff).

Enable mod.world:invalidateMap(mapId) for API-3 generations 1–3. Validate map identifiers and Gen3 aliases; reuse the NPC/object/block idle-world, owner-lease and reentry guards. Dispatch through the existing native reloadMap path, preserving target/neighbor cache eviction, seamless active reload with player coordinates/facing/music, and the native heal-point fallback when the new geometry cannot contain the player. Inactive invalidation does not relocate the player. Gen4/5, API-1/2 and portable script verbs remain unchanged.

All 24 world method names in the pinned Gen1 API-3 facade now have host adapters for generations 1–3. This is availability, not identical internals or a promise of complete native behavioral equivalence. Native flags and version datasets remain follow-up work.

Contract and reproduction. Retain native lifecycle semantics: host emits map.reloaded on accepted inactive invalidation; pinned Gen1's Gen2 backend does not. Native failure can happen after cache eviction and is not transactional rollback.

Validation

  • 148/148 targeted checks: real host OverworldState.reloadMap and MapLoader.invalidate with synthetic cache/setMap seams; target/neighbor eviction, current coordinates/facing/music, geometry fallback, malformed/busy requests, failure/guard release, reentry and retired owners.
  • 64 cross-engine comparisons /128 isolated loader runs at clean feature head, pinned Gen1 79ea62f45fb2ea8f65d081a109431e4eb1bbdb36. Eight new identical public-only fixture cases run under both loaders for Red, Blue, Yellow, Gold, Silver, Crystal, FireRed and Emerald. Compare validation, active reload, notification and inactive acceptance; no engine imports/backend branches in the mod.
  • Full ROM-free tests: 81/91 engine, SDK 3/3, B30 PASS. Fresh Add API 3 public NPC actions with cross-engine contracts #105 baseline79/89; previous Add guarded API 3 wild encounters and shared contracts #106 80/90. All 27 complete FAIL lines match the baseline exactly, in order.
  • All-PR integration through Add guarded API 3 wild encounters and shared contracts #106 plus this commit (1bf94ae7345a31a1fc9a9e0a2df21c292087bced): 86/96 engine, SDK3/3, B30 PASS; identical baseline failures. The same 64 comparisons /128 runs pass on the clean integration tree.
  • Changed Lua formatting and diff checks pass. Native rendering is an instrumented seam; no ROM gameplay/render equivalence is claimed. Existing API-3 CI includes invalidate mode automatically.

The unchanged failing suites are gate_fingerprint, gate_meta_coverage, quit_thread_shutdown, rebind_capture_bug510, rebind_swap_clear_bug589, soft_reset_bug563, tool_mod_hooks, update_check_tests, update_tests and wide_battle_layout; full test entry therefore remains nonzero.

Hosted CI

Published open/non-draft at the tested head. API 3 contracts and ci currently conclude action_required pending maintainer fork-workflow approval. Hosted CI is not green; the validation above ran locally.

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