Skip to content

fix: clearer plugin 404 / access errors at the registry boundary#95

Merged
albanm merged 2 commits into
masterfrom
chore-better-plugin-404
May 28, 2026
Merged

fix: clearer plugin 404 / access errors at the registry boundary#95
albanm merged 2 commits into
masterfrom
chore-better-plugin-404

Conversation

@albanm
Copy link
Copy Markdown
Member

@albanm albanm commented May 28, 2026

Turns opaque 500s from the registry boundary into actionable 403/404 responses, and lets a superadmin still create a processing for an owner who has no plugin access (it lands in the existing broken-plugin state instead of failing the POST).

What changed:

  • ensurePluginAndReadSchema now translates registry errors at the boundary (lib-express/error-handler was collapsing every AxiosRequestError to 500): 403 → Le compte X n'a pas accès au plugin Y., 404 → Le plugin Y est introuvable dans le registre., anything else → 502.
  • prepareProcessing short-circuits when the processing has no config — there's nothing to prepare, and skipping the registry fetch lets a no-config / inactive processing be created even when the owner lacks plugin access. Same broken-state UX the UI already handles for deleted plugins via the pluginBroken banner.
  • GET /:id/plugin-config-schema now returns a descriptive 404 body instead of empty when the plugin ships no schema (covers v5 legacy plugins where the schema lives in plugin.json#processingConfigSchema, now read as a fallback).
  • UI: a watch on configSchemaFetch.error surfaces non-404 fetch errors as a toast (configSchemaFetchError / Échec du chargement du schéma de configuration du plugin).

Why: a superadmin can list every registry artefact regardless of privateAccess, so the create-processing wizard let them pick a plugin and pair it with an owner that had no access — and the POST then 500'd with no actionable message. Pairs with registry 38217ee (0.5.1), which makes the /:id/download route return 403 instead of 404 when the caller's account isn't on privateAccess, so the owner name surfaces in the processings-side message.

Regression risks:

  • prepareProcessing is no longer called on bare create (config absent). Any plugin whose prepare() had side effects independent of the config would silently stop running until the first config-bearing PATCH. The known plugins all key off the config, but worth a sanity check against your plugin set.
  • POST/PATCH now return 403/404/502 where they used to return 500 for registry failures. Any caller / dashboard / alert keying off 500 will shift — the worker is already explicit about 403/404 so it's unaffected.
  • The catch-all 502 swallows the underlying axios message in the response body. The original is still logged via internalError (5xx branch), but ops will lean on logs rather than the body when the registry itself is broken.
  • The UI configSchemaFetchError toast now fires whenever an admin opens a processing whose owner lacks plugin access. Probably what you want — flagging anyway.

albanm and others added 2 commits May 28, 2026 14:21
Legacy v5 plugins ship the schema as plugin.json#processingConfigSchema,
which the v5→registry migration packs verbatim — so v6's API returned
404 on /plugin-config-schema for every migrated plugin. Fall back to
plugin.json when the standalone file is absent, give the 404 a
descriptive body, and notify on non-404 fetch errors so the page no
longer fails silently.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
A superadmin can pick any plugin in the create-processing wizard, but
the registry then 404s the artefact download for owners that aren't on
its privateAccess list. lib-express collapses the AxiosRequestError to
500, leaving the user with no actionable feedback.

- Skip the registry fetch in both validateFullProcessing and
  prepareProcessing when the processing has no config: a no-config /
  inactive processing can now be created even if the owner lacks plugin
  access, landing in the same broken state the UI already handles for
  deleted plugins (pluginBroken banner).
- Translate registry errors at the boundary in ensurePluginAndReadSchema:
  403 -> "Le compte X n'a pas accès au plugin Y.", 404 -> "Le plugin Y
  est introuvable dans le registre.", everything else -> 502.

Pairs with registry 38217ee, which makes the download route return 403
(no access) instead of 404 (filtered) so the owner name surfaces in the
processings API message.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the fix label May 28, 2026
@albanm albanm merged commit ebd5a4c into master May 28, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant