Skip to content

fix(plugin-devkit): fail check when the manifest.renderer entry is missing - #1468

Merged
vastsa merged 3 commits into
vastsa:mainfrom
GalaxyXieyu:fix/devkit-renderer-entry-check
Oct 8, 2026
Merged

vastsa merged 3 commits into
vastsa:mainfrom
GalaxyXieyu:fix/devkit-renderer-entry-check

Conversation

@GalaxyXieyu

Copy link
Copy Markdown
Contributor

Summary

pi-plugin check verified the files named by main, ui.panel, and contributes.views, but not manifest.renderer. A plugin whose renderer module was missing passed check, pack produced a .piplug, and host-core then refused the package at install with PLUGIN_INVALID: renderer entry missing: <entry>. This is the same "passes check, cannot install" class as #943. check now reports renderer.missing, so pack refuses the package too.

Fixes #1464

Root cause

  • check() (packages/plugin-devkit/src/check.ts:191-230 on 779e16d9c) has existence checks for main, ui.panel, and view entries only.
  • The SDK's manifestRendererError (packages/plugin-sdk/src/index.ts:2113) validates the spelling only (relative path, .js / .mjs).
  • The installer additionally requires the entry to be a file inside the package: validate_renderer, crates/host-core/src/plugins/renderer.rs:59-71, called from manifest.rs:76, and covered by renderer.rs:175.

Change

  • check.ts adds a renderer.missing error (manifest.renderer "<entry>" does not exist) when the entry is not a file in the plugin directory. It reuses fileExists, which requires isFile(), so a directory named like a module is refused, as host-core does (renderer.rs:182).
  • No separate "escapes" rule is added. An absolute or .. spelling is already refused by validateManifest before this point (manifest.invalid), and symlinks are already refused by the package walk. The new test pins the .. case.
  • pack runs check first (pack.ts:124), so it refuses the package with no change of its own.

Production diff: +10 in check.ts; the rest is one test (+31) and spec text.

Specs / E2E docs

  • docs/spec/07-plugins/10-plugin-devex.md (en + zh-CN): manifest.renderer is added to the list of referenced files check requires.
  • 06-delivery/04-e2e-test-plan.md E2E-022C steps and expected results (en + zh-CN) cover deleting the renderer entry.

Evidence

Tested commit 1b6f8a33f (fix/devkit-renderer-entry-check), based on main 779e16d9c. pnpm check:pr-base passes. Environment: Linux x64, Node 22.23.

  • New test fails a manifest.renderer entry that does not exist, as the installer does (#1464):
    • missing file, then a directory at the entry path, both reported as renderer.missing;
    • a real module clears the error;
    • ../renderer/index.mjs is refused as manifest.invalid.
    • Fails on 779e16d9c (ok: true for the missing file) and passes with the fix.
  • pnpm --filter @pi-desktop/plugin-devkit test: 50 passed (main: 49).
  • CLI before and after, on a copy of examples/plugins/ui-slots-lab with renderer/index.mjs deleted:
    main      check: OK lab.ui-slots@0.1.0 — 8 files        pack: Packed lab.ui-slots-0.1.0.piplug
    this PR   check: error renderer.missing: manifest.renderer "renderer/index.mjs" does not exist (exit 1)
              pack:  plugin check failed: manifest.renderer "renderer/index.mjs" does not exist (exit 1)
    
    All three examples/plugins/* and both bundled plugins still check with 0 errors.
  • pnpm build:js, pnpm --filter @pi-desktop/desktop typecheck, pnpm lint, node scripts/check-architecture.mjs, and pnpm check:agent-policy: pass.
  • pnpm -r --if-present test: every package suite passes. The apps/desktop failures are unrelated to the devkit and also occur without this change (chat-error-message.test.mjs has a cancelled nested subtest on main; the *-user-path tests need an installed Electron binary; plugin-websocket / jev-api-key-check pass when run alone).
  • pnpm docs:check: pass. git diff --check: clean.
  • E2E: NOT RUN. The change is confined to the devkit CLI's static checks and has no runtime surface in the app; the unit test covers both outcomes directly. Same reasoning as fix(plugin-devkit): reject package-relative theme assets at check time #944.
  • I did not install the broken package in the app. The installer's refusal is taken from validate_renderer and its existing test.

This PR and the #1463 PR both edit check.ts, check.test.ts, and the same two spec files. The hunks do not overlap: git merge-tree of the two branches is clean.

…ssing

pi-plugin check verified that the files named by main, ui.panel, and
contributes.views exist, but not manifest.renderer. The SDK validator only
checks the spelling (relative, .js/.mjs), so a plugin whose renderer module
was missing passed check and pack produced a .piplug that host-core then
refused at install with "PLUGIN_INVALID: renderer entry missing".

Report renderer.missing when the entry is not a file in the plugin
directory, the same rule host-core's validate_renderer applies. pack runs
check first, so it now refuses such a package too. An absolute or ".."
spelling was already refused by validateManifest; the new test pins that
as well.

Fixes vastsa#1464

@muzimu217 muzimu217 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified locally on macOS (worktree off current main): pnpm --filter @pi-desktop/plugin-devkit exec vitest run check → 8/8 pass, including the new renderer-entry test.

The fix restores the documented invariant for renderer entries ("check reproduces every rule the installer enforces, so check passing implies install will pass" — 10-plugin-devex.md §5–§6), which is exactly what #1464 reported broken. Placement mirrors the installer rule ordering (right after the ui.panel check, after validateManifest has already refused absolute/.. spellings), the message names the declared entry the same way panel.missing does, and the test's four branches are the right ones — missing file, a directory wearing the entry's name, the present case, and the escaping path as a negative control pinned to manifest.invalid. Docs updated in both languages on both spec surfaces.

Nothing blocking. One merge-order note: this PR and #1467 both edit 10-plugin-devex.md and 04-e2e-test-plan.md — whoever merges second rebases.

@vastsa
vastsa merged commit 9d1152e into vastsa:main Oct 8, 2026
5 checks passed
@vastsa

vastsa commented Oct 8, 2026

Copy link
Copy Markdown
Owner

Thanks for the concrete reproduction and the minimal checker fix. On the updated candidate, the devkit suite passed (52/52), and a CLI repro confirmed that a missing manifest.renderer blocks both check and pack without producing an artifact. All required CI checks passed; the PR merge ref matched the validated candidate tree. Merged.

GalaxyXieyu pushed a commit to GalaxyXieyu/PI-Desktop that referenced this pull request Oct 8, 2026
…ntry-check

fix(plugin-devkit): fail check when the manifest.renderer entry is missing
@GalaxyXieyu
GalaxyXieyu deleted the fix/devkit-renderer-entry-check branch October 8, 2026 11:25
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.

[Bug] pi-plugin check / pack 不检查 manifest.renderer 入口文件,缺文件也能打包,安装时才报 PLUGIN_INVALID

3 participants