[PR #4279] [MERGED] feat: support shared World Maps artwork #6315

Closed
opened 2026-10-23 04:09:15 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/4279
Author: @thetopham
Created: 7/30/2026
Status: ✅ Merged
Merged: 7/30/2026
Merged by: @thetopham

Base: staging ← Head: feature/spatial-global-gallery-4278


📝 Commits (10+)

  • c292522 feat: resolve shared spatial artwork
  • ad360c8 docs: explain shared map artwork
  • a061a61 feat: protect shared map artwork
  • 1a609e4 feat(maps): add roleplay agent menu shortcut
  • 69d18cd Merge remote-tracking branch 'origin/staging' into HEAD
  • 8409e2b test: harden shared artwork reference checks
  • cdfe8e1 Merge staging and harden Global Gallery references
  • d1a39f0 Merge latest staging into shared World Maps artwork
  • 5c8f158 Merge latest staging into shared World Maps artwork
  • 2cc343a perf: skip irrelevant gallery reference scans

📊 Changes

11 files changed (+726 additions, -90 deletions)

View changed files

📝 docs/agents/hierarchical-maps.md (+71 -22)
📝 e2e/core-flows.e2e.ts (+6 -1)
📝 package.json (+1 -1)
📝 packages/client/src/components/chat/AgentSettingsControls.tsx (+8 -1)
📝 packages/client/src/components/chat/ChatSettingsDrawer.tsx (+46 -7)
📝 packages/server/src/routes/global-gallery.routes.ts (+29 -5)
📝 packages/server/src/services/capability-packages/capability-persistence.service.ts (+68 -41)
📝 packages/server/src/services/image/gallery-file-lifecycle.ts (+27 -6)
➕ packages/server/src/services/image/global-gallery-capability-references.ts (+155 -0)
📝 packages/server/src/services/image/spatial-location-reference.ts (+37 -6)
➕ scripts/regressions/spatial-location-reference.regression.ts (+278 -0)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #4278

Implements the Engine-owned portions of Pasta-Devs/Marinara-Agents#129, Pasta-Devs/Marinara-Agents#130, Pasta-Devs/Marinara-Agents#133, and Pasta-Devs/Marinara-Agents#137 for companion package PR Pasta-Devs/Marinara-Agents#136.

Why this change

Reusable templates and linked shared worlds need one account-owned location image to work across many chats. Provider-facing spatial references previously accepted only Gallery images owned by the active chat, Global Gallery deletion did not know when saved capability documents or chat drafts still referenced an image, and Roleplay users had no Agent Menus shortcut to installed World Maps controls.

What changed

  • Resolve namespaced global-gallery:<image-id> spatial references through guarded Global Gallery storage.
  • Preserve legacy unqualified chat Gallery references and chat-ownership checks.
  • Keep missing, malformed, cross-chat, unsafe-path, and missing-file references non-fatal with debug visibility.
  • Scan capability documents and chat metadata for exact Global Gallery references before deletion and return 409 global_gallery_image_in_use with document/chat counts while saved maps own an image.
  • Coordinate the final reference scan and metadata deletion with capability-document/chat-metadata reference creation through per-image Gallery lifecycle locks and transactions.
  • Reject a newly-created reference if deletion wins the race instead of persisting a dangling Global Gallery id.
  • Bound generic JSON traversal incrementally so oversized records fail closed without spreading entire collections.
  • Add exact-match, near-match, missing-record, missing-file, unsafe-path, legacy ownership, and both concurrency-interleaving regressions.
  • Add World Maps to Roleplay Agent Menus when the package is installed and active; expand Tracker Agents, scroll to Maps, and focus its controls.
  • Document independent templates, canonical shared worlds, private per-chat state, drafts, revisions/conflicts/forks, artwork ownership, deduplication, and portable import/export.
  • Gallery lifecycle PR #4276 is merged into staging and included in this branch.
  • This PR extends its shared lifecycle layer; it does not introduce a competing file-cleanup path.
  • Companion Agents PR Pasta-Devs/Marinara-Agents#136 remains dependent on this Engine contract landing first.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Automated evidence at pushed head e115a731a

  • corepack pnpm regression:spatial passed, including deterministic writer-first and deletion-first Global Gallery race coverage.
  • corepack pnpm regression:gallery-delete passed the merged shared-file lifecycle regression.
  • corepack pnpm --filter @marinara-engine/server lint passed.
  • corepack pnpm lint passed.
  • corepack pnpm localization:check passed.
  • Shared and server production builds passed; client TypeScript and Vite/PWA production builds passed sequentially with constrained Node 22 on the unstable host.
  • git diff --check passed.
  • Stored capability/chat JSON now skips parsing and traversal when it cannot contain the requested Global Gallery reference marker.
  • Current Engine staging through 7759b9d45 is integrated; the focused regressions and server typecheck passed again after that merge.
  • All five CodeRabbit findings have been fixed, replied to, and resolved.

Local baseline limitations

  • pnpm check stops at the known Impeccable context loader did not return valid JSON boundary; its remaining lanes were run directly above.
  • The current origin/staging open-issues regression has an unrelated pre-existing background-organization expectation mismatch (favorites: []).
  • Parallel client builds under Node 24 exited without diagnostics on the unstable host; the constrained Node 22 sequential client build completed successfully.

Manual verification still required before merge

  • Manually verify a referenced shared-world/template image cannot be deleted, then can be deleted after every durable reference is removed.
  • Manually verify Roleplay Illustrator and Game Storyboards resolve shared location artwork and legacy chat Gallery artwork.
  • Manually verify the Roleplay shortcut opens Tracker Agents and focuses World Maps.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

The English World Maps guide is updated. Translation follow-up is tracked by #4280. No Engine version bump is included.

UI evidence (if applicable)

Screenshots or recordings are still required for the new Roleplay Agent Menus shortcut.

Summary by CodeRabbit

  • New Features
    • Use shared Global Gallery artwork as location reference images across chats.
    • Link multiple chats to a shared world with draft, publish, discard, and fork controls.
    • Navigate directly to Hierarchical Maps settings from the chat settings drawer.
  • Bug Fixes
    • Prevent deletion of Global Gallery artwork still in use.
    • Improve handling of missing or invalid location reference images.
  • Documentation
    • Updated World Maps guidance for shared worlds, artwork, imports, exports, and chat linking.

🔄 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-Engine/pull/4279 **Author:** [@thetopham](https://github.com/thetopham) **Created:** 7/30/2026 **Status:** ✅ Merged **Merged:** 7/30/2026 **Merged by:** [@thetopham](https://github.com/thetopham) **Base:** `staging` ← **Head:** `feature/spatial-global-gallery-4278` --- ### 📝 Commits (10+) - [`c292522`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c292522c421211554e004c80418a387dbaaad14d) feat: resolve shared spatial artwork - [`ad360c8`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ad360c8fb663cf8d1e6afd1a6dbfb88228939ccf) docs: explain shared map artwork - [`a061a61`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a061a61279319bf23f7e5b3599db3ffae9e64f1b) feat: protect shared map artwork - [`1a609e4`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1a609e445d56a00aae0dadf7d1604e19a7299d70) feat(maps): add roleplay agent menu shortcut - [`69d18cd`](https://github.com/Pasta-Devs/Marinara-Engine/commit/69d18cdaa15856f8bb2bf70e988a04f1f6b08c3d) Merge remote-tracking branch 'origin/staging' into HEAD - [`8409e2b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8409e2ba39b93faae0c0c3d7b591f95e39135833) test: harden shared artwork reference checks - [`cdfe8e1`](https://github.com/Pasta-Devs/Marinara-Engine/commit/cdfe8e12fb1d906d0718d2c50207ceae87b2ac96) Merge staging and harden Global Gallery references - [`d1a39f0`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d1a39f0027eda494c6fe29077402c75d8bef6f5f) Merge latest staging into shared World Maps artwork - [`5c8f158`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5c8f158db57f5bf7a3b21ebb62682b5ad2e52ca4) Merge latest staging into shared World Maps artwork - [`2cc343a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2cc343aa1c8cbae9394dc0b69d32e7325929af70) perf: skip irrelevant gallery reference scans ### 📊 Changes **11 files changed** (+726 additions, -90 deletions) <details> <summary>View changed files</summary> 📝 `docs/agents/hierarchical-maps.md` (+71 -22) 📝 `e2e/core-flows.e2e.ts` (+6 -1) 📝 `package.json` (+1 -1) 📝 `packages/client/src/components/chat/AgentSettingsControls.tsx` (+8 -1) 📝 `packages/client/src/components/chat/ChatSettingsDrawer.tsx` (+46 -7) 📝 `packages/server/src/routes/global-gallery.routes.ts` (+29 -5) 📝 `packages/server/src/services/capability-packages/capability-persistence.service.ts` (+68 -41) 📝 `packages/server/src/services/image/gallery-file-lifecycle.ts` (+27 -6) ➕ `packages/server/src/services/image/global-gallery-capability-references.ts` (+155 -0) 📝 `packages/server/src/services/image/spatial-location-reference.ts` (+37 -6) ➕ `scripts/regressions/spatial-location-reference.regression.ts` (+278 -0) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. ## Linked issue Closes #4278 Implements the Engine-owned portions of Pasta-Devs/Marinara-Agents#129, Pasta-Devs/Marinara-Agents#130, Pasta-Devs/Marinara-Agents#133, and Pasta-Devs/Marinara-Agents#137 for companion package PR Pasta-Devs/Marinara-Agents#136. ## Why this change Reusable templates and linked shared worlds need one account-owned location image to work across many chats. Provider-facing spatial references previously accepted only Gallery images owned by the active chat, Global Gallery deletion did not know when saved capability documents or chat drafts still referenced an image, and Roleplay users had no Agent Menus shortcut to installed World Maps controls. ## What changed - Resolve namespaced `global-gallery:<image-id>` spatial references through guarded Global Gallery storage. - Preserve legacy unqualified chat Gallery references and chat-ownership checks. - Keep missing, malformed, cross-chat, unsafe-path, and missing-file references non-fatal with debug visibility. - Scan capability documents and chat metadata for exact Global Gallery references before deletion and return `409 global_gallery_image_in_use` with document/chat counts while saved maps own an image. - Coordinate the final reference scan and metadata deletion with capability-document/chat-metadata reference creation through per-image Gallery lifecycle locks and transactions. - Reject a newly-created reference if deletion wins the race instead of persisting a dangling Global Gallery id. - Bound generic JSON traversal incrementally so oversized records fail closed without spreading entire collections. - Add exact-match, near-match, missing-record, missing-file, unsafe-path, legacy ownership, and both concurrency-interleaving regressions. - Add World Maps to Roleplay Agent Menus when the package is installed and active; expand Tracker Agents, scroll to Maps, and focus its controls. - Document independent templates, canonical shared worlds, private per-chat state, drafts, revisions/conflicts/forks, artwork ownership, deduplication, and portable import/export. ## Dependency and Gallery lifecycle integration - Gallery lifecycle PR #4276 is merged into `staging` and included in this branch. - This PR extends its shared lifecycle layer; it does not introduce a competing file-cleanup path. - Companion Agents PR Pasta-Devs/Marinara-Agents#136 remains dependent on this Engine contract landing first. ## Validation - [x] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [x] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Automated evidence at pushed head `e115a731a` - `corepack pnpm regression:spatial` passed, including deterministic writer-first and deletion-first Global Gallery race coverage. - `corepack pnpm regression:gallery-delete` passed the merged shared-file lifecycle regression. - `corepack pnpm --filter @marinara-engine/server lint` passed. - `corepack pnpm lint` passed. - `corepack pnpm localization:check` passed. - Shared and server production builds passed; client TypeScript and Vite/PWA production builds passed sequentially with constrained Node 22 on the unstable host. - `git diff --check` passed. - Stored capability/chat JSON now skips parsing and traversal when it cannot contain the requested Global Gallery reference marker. - Current Engine `staging` through `7759b9d45` is integrated; the focused regressions and server typecheck passed again after that merge. - All five CodeRabbit findings have been fixed, replied to, and resolved. ### Local baseline limitations - `pnpm check` stops at the known `Impeccable context loader did not return valid JSON` boundary; its remaining lanes were run directly above. - The current `origin/staging` open-issues regression has an unrelated pre-existing background-organization expectation mismatch (`favorites: []`). - Parallel client builds under Node 24 exited without diagnostics on the unstable host; the constrained Node 22 sequential client build completed successfully. ### Manual verification still required before merge - Manually verify a referenced shared-world/template image cannot be deleted, then can be deleted after every durable reference is removed. - Manually verify Roleplay Illustrator and Game Storyboards resolve shared location artwork and legacy chat Gallery artwork. - Manually verify the Roleplay shortcut opens Tracker Agents and focuses World Maps. ## Docs and release impact - [x] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) The English World Maps guide is updated. Translation follow-up is tracked by #4280. No Engine version bump is included. ## UI evidence (if applicable) Screenshots or recordings are still required for the new Roleplay Agent Menus shortcut. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Use shared Global Gallery artwork as location reference images across chats. - Link multiple chats to a shared world with draft, publish, discard, and fork controls. - Navigate directly to Hierarchical Maps settings from the chat settings drawer. - **Bug Fixes** - Prevent deletion of Global Gallery artwork still in use. - Improve handling of missing or invalid location reference images. - **Documentation** - Updated World Maps guidance for shared worlds, artwork, imports, exports, and chat linking. <!-- 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-23 04:09:15 +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-Engine#6315
No description provided.