[PR #5493] [MERGED] Read the staging catalog preview overlay behind a strict channel gate #6785

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/5493
Author: @kolacheee
Created: 8/24/2026
Status: ✅ Merged
Merged: 8/24/2026
Merged by: @kolacheee

Base: staging ← Head: fix/5492-preview-catalog-overlay


📝 Commits (2)

  • 5cd8b7d feat(agents): read the staging catalog preview overlay behind a strict channel gate
  • fba2586 fix(agents): keep preview provenance out of the downloaded catalog contract

📊 Changes

5 files changed (+436 additions, -28 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 packages/server/src/services/capability-packages/package-manager.service.ts (+170 -27)
📝 packages/shared/src/schemas/capability-package.schema.ts (+14 -0)
📝 scripts/regressions/capability-package-lifecycle.regression.ts (+5 -1)
➕ scripts/regressions/capability-preview-overlay.regression.ts (+246 -0)

📄 Description

Linked issue

Closes #5492

Why this change

The Agents repository ships two tiers for holding a package back (Pasta-Devs/Marinara-Agents#410 / Pasta-Devs/Marinara-Agents#411). INCOMPLETE_PACKAGE_IDS works — those entries are dropped from every catalog at generation time. STAGING_ONLY_PACKAGE_IDS was meant to mean "testers can install it, stable users cannot": those entries are cut from the published lanes and written to an overlay under catalog/preview/ instead.

Nothing in the Engine had ever heard of that path, so a staging-only package was hidden from staging users too. The tier was inert, and a package author who wanted testers but not stable had no working option — they could expose a package to everyone or to nobody.

This cannot be fixed on the catalog side. Promotion is a wholesale staging → main byte-copy merge, so catalog/preview/ exists on main and serves 200 there, with matching artifacts under main/artifacts/. The containment guarantee has to live in the Engine: it must decline to construct that URL.

What changed

A strict channel gate. isPreviewCatalogChannel() is an exact match on the staging branch. It deliberately does not reuse resolveOfficialAgentBranch(), which is deny-list shaped — anything that is not main, hotfix/*, or a release tag resolves to "staging", so a checkout on a branch named master (which start.bat itself treats as a mainline name) would have qualified. Being wrong there only hands someone a slightly newer package list; being wrong here shows unreleased packages to a stable user.

A URL that does not exist off-channel. resolvePreviewCatalogUrl() returns null unless the gate passes, so a stable Engine never holds an overlay URL that any later code path could fetch — rather than building one and filtering it downstream. It mirrors the published lane derivation exactly, including the fallback to the legacy alias for a non-release version string. An explicit MARINARA_AGENT_CATALOG_URL override also returns null: that override is the whole catalog, and synthesising a preview sibling for someone's fork would fetch a URL they never pointed us at.

Merge semantics. Overlay entries are stamped preview: true and merged into catalog(). The published lanes win on an id collision (the overlay copy is dropped with a warning rather than failing the catalog), and the combined list is re-sorted with a fixed en collator because the two documents are each sorted only within themselves and the client renders catalog order as-is.

The migrations no longer see the overlay. This is the part that matters most. migrateLegacyAvailability loops the entire catalog and calls installCatalogPackage(entry, true) on every entry — unattended, at startup, with activation on. Merging staging-only packages into it would have silently installed and activated every unfinished package on a tester's machine the first time they upgraded. It and migrateExtractedNoodleAvailability now pass null explicitly, so they never even request the overlay. install(), pendingUpdates(), and declineUpdate() keep the default and do see preview entries, which is what lets a tester install one and then receive its updates.

Failure is silent and non-fatal. A missing overlay is the normal steady state (STAGING_ONLY_PACKAGE_IDS currently ships empty), and raw.githubusercontent.com answers it with a 404 carrying Content-Type: text/plain. That, a non-404 error, a malformed document, and a thrown request all degrade to the published catalog. catalog() has no cache and no stale fallback, so anything propagating from here would blank the Agents browser and the update prompter for every package at once.

Deliberately not included

isOfficialCatalogUrl accepts a .../main/catalog/preview/... path (issue item 8). Nothing constructs that URL, and tightening it would change behaviour on the MARINARA_AGENT_CATALOG_URL override path for no live benefit, so it is left alone here. The real containment is that the URL is never built.

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

Manual verification notes

Automated results from this branch, for whoever picks up the checklist:

  • pnpm lint passes (TypeScript --noEmit on shared and server, ESLint on client).
  • pnpm build passes.
  • pnpm impeccable:check and pnpm localization:check pass.
  • node ./scripts/run-regressions.mjs --filter capability-preview-overlay passes (new).
  • node ./scripts/run-regressions.mjs --filter capability-package-lifecycle passes.
  • git diff --check is clean.
  • pnpm format:check does NOT pass, and did not before this branch either. This Windows checkout has core.autocrlf=true while Prettier defaults to endOfLine: "lf", so it reports all 1303 packages/**/*.{ts,tsx} files, including files this branch never touches. Checked with --end-of-line auto, both files this PR edits under packages/ are clean. Please confirm on a LF checkout.

Still needs a human at a real Engine:

  • Manually verify in a staging Engine that Agents → Download Agents lists a staging-only package once the Agents repo marks one, and that installing it works end to end.
  • Manually verify in a stable Engine that the same package does not appear, and that no request to catalog/preview/ is made (server logs or a proxy).
  • Manually verify the empty-overlay path is quiet: with no package marked staging-only, browsing Agents must work normally and must not log a warning (the 404 is logged at debug).
  • Manually verify a first-upgrade profile (triggering migrateLegacyAvailability) does not auto-install a staging-only package on a staging Engine.

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)

A CHANGELOG entry is included under [Unreleased] → Added. No user-facing doc under docs/ describes catalog channels today, so nothing there needed a matching edit and no docs-i18n mirror is implied. No version-bearing file is touched.

Summary by CodeRabbit

  • New Features

    • Staging-channel Engines can preview eligible capability packages from an additional catalog overlay.
    • Preview packages are clearly identified and merged with the published catalog, with published packages taking precedence when IDs overlap.
    • Preview package assets are resolved through the appropriate preview catalog locations.
  • Bug Fixes

    • Missing, unavailable, or invalid preview catalogs no longer prevent the published catalog from loading.
    • Stable-channel Engines and unattended startup migrations continue using only published packages.

🔄 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/5493 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 8/24/2026 **Status:** ✅ Merged **Merged:** 8/24/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `fix/5492-preview-catalog-overlay` --- ### 📝 Commits (2) - [`5cd8b7d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5cd8b7d79d2baa59a8ccacc3f0abb3e6ee0a2b13) feat(agents): read the staging catalog preview overlay behind a strict channel gate - [`fba2586`](https://github.com/Pasta-Devs/Marinara-Engine/commit/fba2586aa3cbc8013ab99ac15c7c0d050dd105f0) fix(agents): keep preview provenance out of the downloaded catalog contract ### 📊 Changes **5 files changed** (+436 additions, -28 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `packages/server/src/services/capability-packages/package-manager.service.ts` (+170 -27) 📝 `packages/shared/src/schemas/capability-package.schema.ts` (+14 -0) 📝 `scripts/regressions/capability-package-lifecycle.regression.ts` (+5 -1) ➕ `scripts/regressions/capability-preview-overlay.regression.ts` (+246 -0) </details> ### 📄 Description ## Linked issue Closes #5492 ## Why this change The Agents repository ships two tiers for holding a package back (Pasta-Devs/Marinara-Agents#410 / Pasta-Devs/Marinara-Agents#411). `INCOMPLETE_PACKAGE_IDS` works — those entries are dropped from every catalog at generation time. `STAGING_ONLY_PACKAGE_IDS` was meant to mean "testers can install it, stable users cannot": those entries are cut from the published lanes and written to an overlay under `catalog/preview/` instead. Nothing in the Engine had ever heard of that path, so a staging-only package was hidden from staging users too. The tier was inert, and a package author who wanted testers but not stable had no working option — they could expose a package to everyone or to nobody. This cannot be fixed on the catalog side. Promotion is a wholesale `staging` → `main` byte-copy merge, so `catalog/preview/` **exists on `main`** and serves 200 there, with matching artifacts under `main/artifacts/`. The containment guarantee has to live in the Engine: it must decline to construct that URL. ## What changed **A strict channel gate.** `isPreviewCatalogChannel()` is an exact match on the `staging` branch. It deliberately does **not** reuse `resolveOfficialAgentBranch()`, which is deny-list shaped — anything that is not `main`, `hotfix/*`, or a release tag resolves to `"staging"`, so a checkout on a branch named `master` (which `start.bat` itself treats as a mainline name) would have qualified. Being wrong there only hands someone a slightly newer package list; being wrong here shows unreleased packages to a stable user. **A URL that does not exist off-channel.** `resolvePreviewCatalogUrl()` returns `null` unless the gate passes, so a stable Engine never holds an overlay URL that any later code path could fetch — rather than building one and filtering it downstream. It mirrors the published lane derivation exactly, including the fallback to the legacy alias for a non-release version string. An explicit `MARINARA_AGENT_CATALOG_URL` override also returns `null`: that override is the whole catalog, and synthesising a preview sibling for someone's fork would fetch a URL they never pointed us at. **Merge semantics.** Overlay entries are stamped `preview: true` and merged into `catalog()`. The published lanes win on an id collision (the overlay copy is dropped with a warning rather than failing the catalog), and the combined list is re-sorted with a fixed `en` collator because the two documents are each sorted only within themselves and the client renders catalog order as-is. **The migrations no longer see the overlay.** This is the part that matters most. `migrateLegacyAvailability` loops the entire catalog and calls `installCatalogPackage(entry, true)` on every entry — unattended, at startup, with activation on. Merging staging-only packages into it would have silently installed and activated every unfinished package on a tester's machine the first time they upgraded. It and `migrateExtractedNoodleAvailability` now pass `null` explicitly, so they never even request the overlay. `install()`, `pendingUpdates()`, and `declineUpdate()` keep the default and do see preview entries, which is what lets a tester install one and then receive its updates. **Failure is silent and non-fatal.** A missing overlay is the *normal* steady state (`STAGING_ONLY_PACKAGE_IDS` currently ships empty), and raw.githubusercontent.com answers it with a `404` carrying `Content-Type: text/plain`. That, a non-404 error, a malformed document, and a thrown request all degrade to the published catalog. `catalog()` has no cache and no stale fallback, so anything propagating from here would blank the Agents browser and the update prompter for every package at once. ### Deliberately not included `isOfficialCatalogUrl` accepts a `.../main/catalog/preview/...` path (issue item 8). Nothing constructs that URL, and tightening it would change behaviour on the `MARINARA_AGENT_CATALOG_URL` override path for no live benefit, so it is left alone here. The real containment is that the URL is never built. ## Validation <!-- These are human tasks. Never tick a box for a check that was not actually performed. --> - [x] `pnpm check` passes locally - [x] Container (Docker / Podman) built and ran without issue - [x] Ran the app, clicked through the changes manually - [x] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [x] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` ### Manual verification notes Automated results from this branch, for whoever picks up the checklist: - `pnpm lint` passes (TypeScript `--noEmit` on shared and server, ESLint on client). - `pnpm build` passes. - `pnpm impeccable:check` and `pnpm localization:check` pass. - `node ./scripts/run-regressions.mjs --filter capability-preview-overlay` passes (new). - `node ./scripts/run-regressions.mjs --filter capability-package-lifecycle` passes. - `git diff --check` is clean. - **`pnpm format:check` does NOT pass, and did not before this branch either.** This Windows checkout has `core.autocrlf=true` while Prettier defaults to `endOfLine: "lf"`, so it reports all 1303 `packages/**/*.{ts,tsx}` files, including files this branch never touches. Checked with `--end-of-line auto`, both files this PR edits under `packages/` are clean. Please confirm on a LF checkout. Still needs a human at a real Engine: - Manually verify in a **staging** Engine that **Agents → Download Agents** lists a staging-only package once the Agents repo marks one, and that installing it works end to end. - Manually verify in a **stable** Engine that the same package does **not** appear, and that no request to `catalog/preview/` is made (server logs or a proxy). - Manually verify the empty-overlay path is quiet: with no package marked staging-only, browsing Agents must work normally and must not log a warning (the 404 is logged at `debug`). - Manually verify a first-upgrade profile (triggering `migrateLegacyAvailability`) does not auto-install a staging-only package on a staging Engine. ## Docs and release impact - [ ] No docs changes needed - [x] 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) A CHANGELOG entry is included under `[Unreleased] → Added`. No user-facing doc under `docs/` describes catalog channels today, so nothing there needed a matching edit and no `docs-i18n` mirror is implied. No version-bearing file is touched. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Staging-channel Engines can preview eligible capability packages from an additional catalog overlay. - Preview packages are clearly identified and merged with the published catalog, with published packages taking precedence when IDs overlap. - Preview package assets are resolved through the appropriate preview catalog locations. - **Bug Fixes** - Missing, unavailable, or invalid preview catalogs no longer prevent the published catalog from loading. - Stable-channel Engines and unattended startup migrations continue using only published packages. <!-- 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:13:41 +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#6785
No description provided.