Skip to content

fix(filename-template): restore hostPermissions + pack-time manifest validation - #1

Merged
agalwood merged 2 commits into
mainfrom
fix/filename_template_host_permissions_20260724
Jul 24, 2026
Merged

fix(filename-template): restore hostPermissions + pack-time manifest validation#1
agalwood merged 2 commits into
mainfrom
fix/filename_template_host_permissions_20260724

Conversation

@agalwood

Copy link
Copy Markdown
Member

What

Two independent-but-related fixes for the motrix.filename-template@1.1.0 incident (a signed release that every Motrix host rejects at install with plugin.manifest.host_permissions_required_for_hooks):

  1. 36ed788 fix(filename-template): restore "hostPermissions": ["*://*/*"] (dropped in b5e5ff8 while contributes.hooks.beforeFinalize remained — violating the host invariant that declared hooks require ≥1 hostPermissions entry) and bump to 1.1.1. 1.1.0 is inherently uninstallable and must be superseded.
  2. 44a93e8 ci(pack): pack.mjs now runs full manifest validation (scripts/validate-manifest.mjs) before producing any artifact bytes: @motrix/plugin-manifest-schema ManifestSchema.parse() for structure + the hooks⇒hostPermissions cross-field invariant with the host's canonical error code (replicated with provenance notes — the schema package deliberately leaves it to the host, and @motrix/plugin-cli ships bin-only so it can't be imported). Covers both pnpm test and the release workflow's pack step; no bypass path.

Test plan

  • TDD: fixture-based negative test (hooks without hostPermissions fails pack) written red-first
  • pnpm test 46 passed; pnpm -r build / typecheck OK; biome clean
  • Full three-plugin pack succeeds; deterministic digests for scraper-hook / url-resolver byte-identical to the already-released artifacts pinned in motrix-turbo's lockfile
  • End-to-end negative: removing hostPermissions → pack exits 1, no artifact produced

After merge

Tag motrix.filename-template@1.1.1 on main to trigger the signed release (registry dispatch will regenerate the entry via motrixapp/plugin-registry# logic once that PR lands first).

agalwood added 2 commits July 24, 2026 16:13
1.1.0 (tag motrix.filename-template@1.1.0) dropped the
`"hostPermissions": ["*://*/*"]` entry while keeping
`contributes.hooks.beforeFinalize`. The Motrix host enforces a hard
manifest invariant: any manifest declaring `contributes.hooks` MUST
declare at least one `hostPermissions` entry
(error `plugin.manifest.host_permissions_required_for_hooks`). The
1.1.0 artifact is therefore uninstallable — every host rejects it at
manifest parse, so the in-app builtin Update fails with that AppError.

Restore the entry (as 1.0.1 had it, right after `permissions`) and bump
to 1.1.1. This must ship as a new 1.1.1 release; 1.1.0 cannot be fixed
in place because its artifact is already signed and pinned.
…king

motrix.filename-template@1.1.0 shipped a signed, uninstallable .moext
because pack.mjs validated nothing but manifest.id vs the directory name,
so a manifest dropping hostPermissions while keeping contributes.hooks
sailed through pack, sign, and release.

Add scripts/validate-manifest.mjs and run it in packOne() before any
artifact bytes are written (so both `pnpm test` and the release workflow's
pack step fail loudly on an invalid manifest). Validation is composed from
the published plugin SDK: @motrix/plugin-manifest-schema's ManifestSchema
for structure, plus the cross-field "hooks require hostPermissions"
invariant, which the schema deliberately leaves to the host and which
@motrix/plugin-cli only exposes through a bin-only bundle — so its exact
rule and canonical error code (plugin.manifest.host_permissions_required_
for_hooks) are reproduced here.
@agalwood
agalwood merged commit 672998e into main Jul 24, 2026
1 check passed
@agalwood
agalwood deleted the fix/filename_template_host_permissions_20260724 branch July 24, 2026 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant