[PR #2803] [MERGED] fix(client): surface extension & Mari workspace import failures (#2802) #5737

Closed
opened 2026-10-22 04:19:01 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2803
Author: @kolacheee
Created: 6/22/2026
Status: ✅ Merged
Merged: 6/22/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/issue-2802-extension-import-errors


📝 Commits (2)

  • ecc32db fix(client): surface extension & Mari workspace import failures (#2802)
  • 9a2f643 Resolve staging conflicts for extension import errors

📊 Changes

3 files changed (+41 additions, -10 deletions)

View changed files

📝 packages/client/src/components/chat/HomeProfessorMariChat.tsx (+2 -2)
📝 packages/client/src/components/panels/SettingsPanel.tsx (+22 -8)
📝 packages/client/src/lib/api-client.ts (+17 -0)

📄 Description

Linked issue

Closes #2802

Why this change

When an extension import fails, the error was swallowed to console.warn only and the user saw, at most, a generic "Failed to install 1 extension" toast with no reason — even though the client already held the server's exact error message. The same silent-failure pattern existed on Professor Mari's workspace approve/reject handlers, whose void call sites discarded the promise rejection entirely.

The single most common real cause is the privileged-access gate returning 403 (accessing the app over a non-loopback address without an ADMIN_SECRET) — confirmed gated for both POST /extensions and the Mari workspace approve/reject routes. Nothing in the UI said so, so users hit a dead end on a core feature with no breadcrumb toward the fix (real report: Arch + Firefox, "the extensions and mari package import things just silently fail for me").

This is purely an observability / UX fix. The 403 itself is intended security (extension install is a JS-injection route) and is unchanged — this only makes the failure visible and actionable.

What changed

  • lib/api-client.ts — new getPrivilegedActionErrorMessage(error, fallback) helper (+ exported PRIVILEGED_ACCESS_HINT). For a privileged-gate 403 it returns an actionable hint ("open via localhost, or set ADMIN_SECRET and enter it under Settings → Advanced → Admin Access"), appending the terse server reason so missing vs invalid secret is distinguishable; otherwise it passes through the server/Error message.
  • panels/SettingsPanel.tsx → importExtensionEntries — replaced the count-only toast.warning with toast.error carrying the real per-entry cause (first failure + "(+N more)"). Also counts silently-skipped (normalizeExtensionImportEntry === null) entries and reports them in the success toast, instead of dropping them with no feedback.
  • SettingsPanel.tsx — routed the direct .js/.css file and folder import catch blocks through the same helper, so single-file installs also get the 403 hint.
  • chat/HomeProfessorMariChat.tsx — wrapped approveWorkspaceChange / rejectWorkspaceChange in try/catch with an error toast; previously their void approveWorkspaceChange(id) call sites swallowed the rejection, so a failed workspace apply showed nothing.

Background/automatic Mari loads (workspace status, skills list) intentionally keep their console.error-only handling — the issue scopes user-facing toasts to user-initiated actions, and toasting on every mount-time load failure would be noisy. The skill create/save/toggle/delete and send handlers already toast.

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 check already run by the author: pnpm check (clean-stale-client + impeccable:check + lint/tsc + full build) completed successfully on this branch.

Still needs manual verification by a human before merge — these are TO-DOs, not done:

  • Manually verify the 403 path: open the app over a non-loopback address (e.g. LAN IP) with no ADMIN_SECRET set, import a .js/.css/.zip/.json extension, and confirm a toast now shows the actionable admin-secret hint (not a silent failure or bare count).
  • Manually verify recovery: set ADMIN_SECRET on the server, enter it under Settings → Advanced → Admin Access, retry the import, and confirm it succeeds.
  • Manually verify the non-403 error path: import a malformed/garbage extension file and confirm the toast shows the real parse/server message.
  • Manually verify skipped-entry reporting: import a file mixing valid + non-importable entries and confirm the success toast notes "(N skipped — no importable entry)".
  • Manually verify Mari workspace: with the privileged gate active, trigger a Professor Mari workspace change and click Approve/Reject; confirm a failure now raises an error toast instead of doing nothing. Confirm the success path still shows "Workspace change applied."
  • Manually verify no regression for the normal loopback/localhost case: extension and Mari workspace imports still succeed with their usual success toasts.

Docs and release impact

  • No docs changes needed

Client-only UX/observability change; no server behavior, config, or version-bearing files touched. No version bump. (Optional follow-up: a TROUBLESHOOTING.md note about the privileged-access 403 could help, but is out of scope here.)

UI evidence (if applicable)

Not added — change surfaces toast text on an error path; see Manual verification notes for how to reproduce. Before/after screenshots of the error toast can be attached during manual verification.

Summary by CodeRabbit

  • Bug Fixes

    • Workspace approval and rejection operations now display clear error messages instead of failing silently.
    • Extension import operations provide detailed feedback on successful imports, skipped items, and failures.
  • Improvements

    • Privileged access errors now show more informative user-facing messages.

🔄 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/2803 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 6/22/2026 **Status:** ✅ Merged **Merged:** 6/22/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/issue-2802-extension-import-errors` --- ### 📝 Commits (2) - [`ecc32db`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ecc32dbe8b6a3ba1067790769c90b83ee63ef133) fix(client): surface extension & Mari workspace import failures (#2802) - [`9a2f643`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9a2f643ba1e526c12be943671feec1e4d0dddc1d) Resolve staging conflicts for extension import errors ### 📊 Changes **3 files changed** (+41 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/chat/HomeProfessorMariChat.tsx` (+2 -2) 📝 `packages/client/src/components/panels/SettingsPanel.tsx` (+22 -8) 📝 `packages/client/src/lib/api-client.ts` (+17 -0) </details> ### 📄 Description <!-- Target branch: staging --> ## Linked issue Closes #2802 ## Why this change When an extension import fails, the error was **swallowed to `console.warn` only** and the user saw, at most, a generic *"Failed to install 1 extension"* toast with no reason — even though the client already held the server's exact error message. The same silent-failure pattern existed on Professor Mari's workspace approve/reject handlers, whose `void` call sites discarded the promise rejection entirely. The single most common real cause is the privileged-access gate returning **403** (accessing the app over a non-loopback address without an `ADMIN_SECRET`) — confirmed gated for both `POST /extensions` and the Mari workspace `approve`/`reject` routes. Nothing in the UI said so, so users hit a dead end on a core feature with no breadcrumb toward the fix (real report: Arch + Firefox, *"the extensions and mari package import things just silently fail for me"*). This is purely an **observability / UX** fix. The 403 itself is intended security (extension install is a JS-injection route) and is unchanged — this only makes the failure visible and actionable. ## What changed - **`lib/api-client.ts`** — new `getPrivilegedActionErrorMessage(error, fallback)` helper (+ exported `PRIVILEGED_ACCESS_HINT`). For a privileged-gate **403** it returns an actionable hint ("open via localhost, or set `ADMIN_SECRET` and enter it under Settings → Advanced → Admin Access"), appending the terse server reason so *missing* vs *invalid* secret is distinguishable; otherwise it passes through the server/`Error` message. - **`panels/SettingsPanel.tsx` → `importExtensionEntries`** — replaced the count-only `toast.warning` with `toast.error` carrying the **real per-entry cause** (first failure + "(+N more)"). Also **counts silently-skipped** (`normalizeExtensionImportEntry === null`) entries and reports them in the success toast, instead of dropping them with no feedback. - **`SettingsPanel.tsx`** — routed the direct `.js`/`.css` file and folder import `catch` blocks through the same helper, so single-file installs also get the 403 hint. - **`chat/HomeProfessorMariChat.tsx`** — wrapped `approveWorkspaceChange` / `rejectWorkspaceChange` in `try/catch` with an error toast; previously their `void approveWorkspaceChange(id)` call sites swallowed the rejection, so a failed workspace apply showed nothing. Background/automatic Mari loads (workspace status, skills list) intentionally **keep** their `console.error`-only handling — the issue scopes user-facing toasts to *user-initiated* actions, and toasting on every mount-time load failure would be noisy. The skill create/save/toggle/delete and send handlers already toast. ## Validation <!-- Boxes intentionally left unchecked: they are a to-do list for the human contributor, not proof of completion. --> - [ ] `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 check already run by the author: `pnpm check` (clean-stale-client + impeccable:check + lint/tsc + full build) completed successfully on this branch. Still needs manual verification by a human before merge — these are TO-DOs, not done: - **Manually verify the 403 path:** open the app over a non-loopback address (e.g. LAN IP) with no `ADMIN_SECRET` set, import a `.js`/`.css`/`.zip`/`.json` extension, and confirm a toast now shows the actionable admin-secret hint (not a silent failure or bare count). - **Manually verify recovery:** set `ADMIN_SECRET` on the server, enter it under Settings → Advanced → Admin Access, retry the import, and confirm it succeeds. - **Manually verify the non-403 error path:** import a malformed/garbage extension file and confirm the toast shows the real parse/server message. - **Manually verify skipped-entry reporting:** import a file mixing valid + non-importable entries and confirm the success toast notes "(N skipped — no importable entry)". - **Manually verify Mari workspace:** with the privileged gate active, trigger a Professor Mari workspace change and click Approve/Reject; confirm a failure now raises an error toast instead of doing nothing. Confirm the success path still shows "Workspace change applied." - **Manually verify no regression** for the normal loopback/localhost case: extension and Mari workspace imports still succeed with their usual success toasts. ## Docs and release impact - [ ] No docs changes needed Client-only UX/observability change; no server behavior, config, or version-bearing files touched. No version bump. (Optional follow-up: a TROUBLESHOOTING.md note about the privileged-access 403 could help, but is out of scope here.) ## UI evidence (if applicable) Not added — change surfaces toast text on an error path; see Manual verification notes for how to reproduce. Before/after screenshots of the error toast can be attached during manual verification. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Workspace approval and rejection operations now display clear error messages instead of failing silently. * Extension import operations provide detailed feedback on successful imports, skipped items, and failures. * **Improvements** * Privileged access errors now show more informative user-facing messages. <!-- 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-22 04:19:01 +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#5737
No description provided.