[PR #387] [MERGED] World Maps 1.4.0: additive location write API for Experience packages #945

Closed
opened 2026-10-20 17:32:33 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Agents/pull/387
Author: @kolacheee
Created: 8/16/2026
Status: ✅ Merged
Merged: 8/16/2026
Merged by: @kolacheee

Base: staging ← Head: feat/maps-location-add


📝 Commits (3)

  • ee6c563 feat(hierarchical-maps): 1.4.0 — additive location write API for Experiences
  • d445060 fix(hierarchical-maps): pre-ready review round for the location-add API
  • 5f3d608 fix(hierarchical-maps): CodeRabbit round — error-state fidelity + build portability

📊 Changes

10 files changed (+365 additions, -101 deletions)

View changed files

➕ artifacts/hierarchical-maps-1.4.0.zip (+0 -0)
📝 catalog/catalog.json (+8 -8)
📝 catalog/v2/catalog.json (+8 -8)
📝 catalog/v3/catalog.json (+8 -8)
📝 packages/hierarchical-maps/engine-boundary.json (+2 -2)
📝 packages/hierarchical-maps/manifest.json (+5 -5)
📝 packages/hierarchical-maps/server.mjs (+31 -31)
📝 packages/hierarchical-maps/src/engine/packages/server/src/routes/spatial-context.routes.ts (+48 -0)
📝 packages/hierarchical-maps/src/engine/packages/server/src/services/spatial-context/definition.service.ts (+173 -3)
📝 scripts/build-feature-packages.mjs (+82 -36)

📄 Description

Linked issue

Closes #386

Why this change

  • An Experience that generates its own world has no way to register its places with World Maps: the only mid-play definition writes are the GM's one-location [spatial_discover:] directive and the editor's full-replace PUT. Pixelforge's World Maps export has been explicitly deferred since 0.4.0 for exactly this reason (Marinara-Engine #5144 is the tracking issue).

What changed

  • POST /api/chats/:chatId/spatial-context/locations (src/engine/.../spatial-context.routes.ts, definition.service.ts): appends 1–50 locations under revision CAS. Ids may be caller-supplied (deterministic references, duplicate-checked → 409 spatial_location_conflict) or allocated loc_<id> like discover's; a batch may build its own subtree (parents may reference sibling additions, validated against the full merged id set → 400 on a missing parent); sortOrder continues each parent's sibling sequence. The write delegates to the editor-PUT service method, inheriting its complete guard set: corrupt-map and shared-world checks, spatial_definition_stale 409 CAS, whole-definition schema validation, and the repair-snapshot tail. A chat with no map yet gets 409 spatial_definition_missing. The response is the full refreshed spatial context plus addedLocationIds — no follow-up GET needed. Pure adds remove nothing, so the location-deletion protections are untouched.
  • Feature-package build now runs on Windows dev machines (scripts/build-feature-packages.mjs): esbuild and vite invoke as JS entrypoints under the current Node (bare pnpm is a .cmd Windows cannot spawn; shell mode mangles the esbuild banner argument), NODE_PATH explicitly lists the engine workspace module dirs pnpm exec used to provide, and the artifact zip switches to the deterministic store-only writer the Pixelforge build already uses — removing the system zip dependency. No POSIX CI behavior change; other features' artifact bytes change only at their next rebuild.
  • Version 1.3.6 → 1.4.0; builtAgainst moves to engine staging bb551bf92. Generated outputs: server.mjs (311,375 bytes — +2.8KB of route code over 1.3.6), client.js (byte-identical to 1.3.6; the route is server-only), manifest.json, artifacts/hierarchical-maps-1.4.0.zip (1,240,157 bytes — store-only zip is larger than 1.3.6's deflated 321KB; disclosed below), catalog lanes (1.3.6 artifact retained per convention).

Package and security impact

  • Affected package IDs: hierarchical-maps (1.3.6 → 1.4.0)
  • Engine compatibility impact: none — the route registers in the package's existing /api/chats plugin; no new manifest vocabulary, no capability API change. minEngineVersion unchanged.
  • New or changed permissions/entrypoints: none — same entrypoints; the new route carries the same exposure as the existing editor PUT beside it.
  • Restart, storage, update, or uninstall impact: restartRequired unchanged (server entrypoint, as before). No storage-shape changes: writes go through the existing definition persistence + snapshot tail.

Validation

  • node scripts/validate-catalog.mjs passes locally
  • git diff --check passes locally
  • Rebuilt every affected manifest, payload, artifact, and catalog entry
  • Installed or updated the affected package through Marinara Engine
  • Checked supported modes, restart behavior, and uninstall cleanup
  • Read and followed CONTRIBUTING.md

Manual verification notes

Performed by the submitting agent (boxes above intentionally left for the human reviewer):

  • node scripts/build-feature-packages.mjs hierarchical-maps (on Windows, exercising the new build path), validate-catalog, test-catalog-lanes, validate-package-locales, git diff --check — all green.
  • Live against an engine staging build with this exact 1.4.0 install: a two-location batch (caller id operations + an auto-id child referencing it as parent) returned 200 with both addedLocationIds, bumped revision 1→2, and the follow-up GET showed all locations; a stale expectedRevision 409'd spatial_definition_stale; a duplicate id 409'd spatial_location_conflict; a missing parent 400'd — and none of the failed writes bumped the revision.
  • A 16-agent adversarial review round ran before this PR left draft; its confirmed findings are fixed in the second commit: layerOrder allocation for children of "layers" parents (the API previously could not target layered buildings at all), the current-location CAS removed for pure adds (phantom 409s under concurrent play + a permanent-wedge case on dangling snapshots), archived-parent rejection, a friendly 500-cap pre-check, true builtAgainst provenance (2.4.3 @ bb551bf92 in the boundary file, not just the PR text), a POSIX fix for the esbuild invocation (native-binary bins must not run under node), and de-duplicating zod in the bundles (two full copies had bloated server.mjs +20% and client.js +6.5%). Layers-add and archived-parent paths re-verified live after the fixes.
  • Artifact size disclosure: the deterministic store-only zip trades compression for byte-stability and Windows portability — 1.4.0's artifact is ~3.9x the deflated 1.3.6 despite near-identical content, and other features will see the same multiplier at their next rebuild. If that trade is unwanted, a deterministic-deflate extension to deterministic-zip.mjs (fixed level, no timestamps — same per-Node-build caveat the art PNGs already carry) can restore compression; happy to file and implement that as a follow-up.
  • Still needs a maintainer pass: a POSIX rebuild of hierarchical-maps to confirm byte-reproducibility of the deterministic artifact on CI's platform, and a look at the editor UI after an Experience-driven add (locations appear on next refetch; no live push exists yet, deliberately — see the issue's scope note).

Documentation impact

  • No documentation changes needed
  • Updated this README catalog and package guidance
  • Updated linked Marinara Engine documentation

The route is creator-facing API surface; it will be documented in the Engine's Experiences docs page (#5140, parked by maintainer decision until the creator surface stabilizes — this PR is part of that stabilization).

Summary by CodeRabbit

  • New Features

    • Added support for appending multiple locations to an existing World Map.
    • Locations can include custom IDs, parent relationships, names, types, and descriptions.
    • Added validation for revisions, duplicate IDs, invalid parents, and missing maps.
  • Updates

    • Updated World Maps to version 1.4.0.
    • Refreshed downloadable package metadata and artifact information.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Agents/pull/387 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 8/16/2026 **Status:** ✅ Merged **Merged:** 8/16/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `feat/maps-location-add` --- ### 📝 Commits (3) - [`ee6c563`](https://github.com/Pasta-Devs/Marinara-Agents/commit/ee6c563366f8967e26fcb4563fcb6f397ded3c09) feat(hierarchical-maps): 1.4.0 — additive location write API for Experiences - [`d445060`](https://github.com/Pasta-Devs/Marinara-Agents/commit/d445060f83c491be0b689f969f034456416b2a60) fix(hierarchical-maps): pre-ready review round for the location-add API - [`5f3d608`](https://github.com/Pasta-Devs/Marinara-Agents/commit/5f3d6085d425d1dceaaae9eb57242c130695d378) fix(hierarchical-maps): CodeRabbit round — error-state fidelity + build portability ### 📊 Changes **10 files changed** (+365 additions, -101 deletions) <details> <summary>View changed files</summary> ➕ `artifacts/hierarchical-maps-1.4.0.zip` (+0 -0) 📝 `catalog/catalog.json` (+8 -8) 📝 `catalog/v2/catalog.json` (+8 -8) 📝 `catalog/v3/catalog.json` (+8 -8) 📝 `packages/hierarchical-maps/engine-boundary.json` (+2 -2) 📝 `packages/hierarchical-maps/manifest.json` (+5 -5) 📝 `packages/hierarchical-maps/server.mjs` (+31 -31) 📝 `packages/hierarchical-maps/src/engine/packages/server/src/routes/spatial-context.routes.ts` (+48 -0) 📝 `packages/hierarchical-maps/src/engine/packages/server/src/services/spatial-context/definition.service.ts` (+173 -3) 📝 `scripts/build-feature-packages.mjs` (+82 -36) </details> ### 📄 Description ## Linked issue Closes #386 ## Why this change - An Experience that generates its own world has no way to register its places with World Maps: the only mid-play definition writes are the GM's one-location `[spatial_discover:]` directive and the editor's full-replace PUT. Pixelforge's World Maps export has been explicitly deferred since 0.4.0 for exactly this reason (Marinara-Engine #5144 is the tracking issue). ## What changed - **`POST /api/chats/:chatId/spatial-context/locations`** (`src/engine/.../spatial-context.routes.ts`, `definition.service.ts`): appends 1–50 locations under revision CAS. Ids may be caller-supplied (deterministic references, duplicate-checked → 409 `spatial_location_conflict`) or allocated `loc_<id>` like discover's; a batch may build its own subtree (parents may reference sibling additions, validated against the full merged id set → 400 on a missing parent); `sortOrder` continues each parent's sibling sequence. The write **delegates to the editor-PUT service method**, inheriting its complete guard set: corrupt-map and shared-world checks, `spatial_definition_stale` 409 CAS, whole-definition schema validation, and the repair-snapshot tail. A chat with no map yet gets 409 `spatial_definition_missing`. The response is the full refreshed spatial context plus `addedLocationIds` — no follow-up GET needed. Pure adds remove nothing, so the location-deletion protections are untouched. - **Feature-package build now runs on Windows dev machines** (`scripts/build-feature-packages.mjs`): esbuild and vite invoke as JS entrypoints under the current Node (bare `pnpm` is a `.cmd` Windows cannot spawn; shell mode mangles the esbuild banner argument), NODE_PATH explicitly lists the engine workspace module dirs `pnpm exec` used to provide, and the artifact zip switches to the deterministic store-only writer the Pixelforge build already uses — removing the system `zip` dependency. No POSIX CI behavior change; other features' artifact bytes change only at their next rebuild. - Version 1.3.6 → 1.4.0; `builtAgainst` moves to engine staging `bb551bf92`. Generated outputs: `server.mjs` (311,375 bytes — +2.8KB of route code over 1.3.6), `client.js` (byte-identical to 1.3.6; the route is server-only), `manifest.json`, `artifacts/hierarchical-maps-1.4.0.zip` (1,240,157 bytes — store-only zip is larger than 1.3.6's deflated 321KB; disclosed below), catalog lanes (1.3.6 artifact retained per convention). ## Package and security impact - Affected package IDs: `hierarchical-maps` (1.3.6 → 1.4.0) - Engine compatibility impact: none — the route registers in the package's existing `/api/chats` plugin; no new manifest vocabulary, no capability API change. `minEngineVersion` unchanged. - New or changed permissions/entrypoints: none — same entrypoints; the new route carries the same exposure as the existing editor PUT beside it. - Restart, storage, update, or uninstall impact: `restartRequired` unchanged (server entrypoint, as before). No storage-shape changes: writes go through the existing definition persistence + snapshot tail. ## Validation - [x] `node scripts/validate-catalog.mjs` passes locally - [x] `git diff --check` passes locally - [x] Rebuilt every affected manifest, payload, artifact, and catalog entry - [x] Installed or updated the affected package through Marinara Engine - [x] Checked supported modes, restart behavior, and uninstall cleanup - [x] Read and followed `CONTRIBUTING.md` ### Manual verification notes Performed by the submitting agent (boxes above intentionally left for the human reviewer): - `node scripts/build-feature-packages.mjs hierarchical-maps` (on Windows, exercising the new build path), `validate-catalog`, `test-catalog-lanes`, `validate-package-locales`, `git diff --check` — all green. - Live against an engine staging build with this exact 1.4.0 install: a two-location batch (caller id `operations` + an auto-id child referencing it as parent) returned 200 with both `addedLocationIds`, bumped revision 1→2, and the follow-up GET showed all locations; a stale `expectedRevision` 409'd `spatial_definition_stale`; a duplicate id 409'd `spatial_location_conflict`; a missing parent 400'd — and none of the failed writes bumped the revision. - A 16-agent adversarial review round ran before this PR left draft; its confirmed findings are fixed in the second commit: layerOrder allocation for children of "layers" parents (the API previously could not target layered buildings at all), the current-location CAS removed for pure adds (phantom 409s under concurrent play + a permanent-wedge case on dangling snapshots), archived-parent rejection, a friendly 500-cap pre-check, true `builtAgainst` provenance (2.4.3 @ bb551bf92 in the boundary file, not just the PR text), a POSIX fix for the esbuild invocation (native-binary bins must not run under node), and de-duplicating zod in the bundles (two full copies had bloated server.mjs +20% and client.js +6.5%). Layers-add and archived-parent paths re-verified live after the fixes. - **Artifact size disclosure:** the deterministic store-only zip trades compression for byte-stability and Windows portability — 1.4.0's artifact is ~3.9x the deflated 1.3.6 despite near-identical content, and other features will see the same multiplier at their next rebuild. If that trade is unwanted, a deterministic-deflate extension to `deterministic-zip.mjs` (fixed level, no timestamps — same per-Node-build caveat the art PNGs already carry) can restore compression; happy to file and implement that as a follow-up. - Still needs a maintainer pass: a POSIX rebuild of `hierarchical-maps` to confirm byte-reproducibility of the deterministic artifact on CI's platform, and a look at the editor UI after an Experience-driven add (locations appear on next refetch; no live push exists yet, deliberately — see the issue's scope note). ## Documentation impact - [x] No documentation changes needed - [ ] Updated this README catalog and package guidance - [ ] Updated linked Marinara Engine documentation The route is creator-facing API surface; it will be documented in the Engine's Experiences docs page (#5140, parked by maintainer decision until the creator surface stabilizes — this PR is part of that stabilization). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added support for appending multiple locations to an existing World Map. * Locations can include custom IDs, parent relationships, names, types, and descriptions. * Added validation for revisions, duplicate IDs, invalid parents, and missing maps. * **Updates** * Updated World Maps to version 1.4.0. * Refreshed downloadable package metadata and artifact information. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-20 17:32:33 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Agents#945
No description provided.