Skip to content

feat(plugin): plugin inspect + install --dry-run (#387) - #393

Merged
scttfrdmn merged 1 commit into
mainfrom
feat/387-plugin-inspect
Jul 19, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
feat/387-plugin-inspect

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Implements #387 (docs-review follow-up). Builds on #388 (permissions block, merged).

What

spawn plugin inspect <ref> and spawn plugin install <ref> --dry-run render exactly what installing a plugin would do — without executing anything or contacting an instance:

$ spawn plugin inspect ./demo.yaml
Plugin:      demo v1.2.0
Source:      local file ./demo.yaml

⚠ Installing runs this plugin's code on your machine and, on the
  instance, as root. Review the steps below before installing.

On your machine (controller):
  reads env: TS_API_CLIENT_SECRET
  1. run as root: echo minting key
On the instance:
  [install 1] download https://example.com/app.tgz → /opt/app.tgz
  [start 1] run as login user (background): /opt/app/serve --port 8080
Health check (every 10s): ...
Declared permissions:
  instance:   root=true network=true ports=[8080] files=[/etc/demo]

How it stays side-effect-free

renderInspect calls only DefaultResolver().Resolve + the static spec.Validate("") and walks the parsed struct. It never touches either executor (pkg/plugin/local_executor.go or pkg/pluginruntime). --dry-run short-circuits runPluginInstall before any local condition check / SSH / spored POST, and (like inspect) doesn't require --instance.

Honest about limits: ports/files created inside opaque run shell steps can't be inferred statically — the preview labels the permissions block as the author's declared intent, and points there.

Tests

cmd/plugin_inspect_test.go: section rendering (env, downloads, as_user, health, permissions), the dry-run banner, third-party/unpinned warnings, and an end-to-end resolve of a local-file fixture (no network/instance).

Notes

  • docs-gen/plugin.md regenerated (new command + --dry-run flag).
  • gofmt/vet/go test ./cmd/ clean for the new code.

Closes #387

Preview what installing a plugin would do — resolved source/version,
local (controller) vs remote (instance) steps, requested controller
env, root vs login-user execution, downloads, health checks, cleanup,
and the declared permissions block (#388) — WITHOUT executing anything
or contacting an instance.

Implemented purely via the resolver + static validator; renderInspect
never calls either executor (local_executor / pkg/pluginruntime), so it
has no side effects. `install --dry-run` routes to the same preview and,
like `inspect`, does not require --instance. A trust banner warns that
installing runs the author's code locally and as root, and unpinned /
third-party (github:) sources are flagged.

Closes #387
@codecov

codecov Bot commented Jul 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 72.82609% with 50 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/plugin_inspect.go 75.86% 34 Missing and 8 partials ⚠️
cmd/plugin.go 20.00% 8 Missing ⚠️

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit c9dab7e into main Jul 19, 2026
7 checks passed
@scttfrdmn
scttfrdmn deleted the feat/387-plugin-inspect branch July 19, 2026 16:11
scttfrdmn added a commit that referenced this pull request Aug 1, 2026
* chore(deps): bump substrate test dependency to v0.81.0

Test-only; no runtime or API change (root + lambda/dns-updater).

The reason to take it now is substrate#412: RunInstances previously accepted an
empty ImageId and launched an instance, so our guard against launching without a
resolved AMI had no offline test that could fail -- the bug we filed it for
shipped, and was caught only by a paid smoke test against real AWS. Substrate now
returns MissingParameter / HTTP 400 when no AMI resolves from any source
(request or launch template), so that path is reachable in -short tests.

Fixing it also surfaced a substrate request-parser defect: an explicitly-empty
query-protocol body parameter was coerced to the bare-key sentinel "1", so
ImageId= arrived as the string 1 and launched from an AMI named 1 -- affecting
every EC2/IAM/STS/SQS/SNS parameter sent empty.

Also newly testable offline: Invalid*ID.NotFound for explicit EC2 IDs (#391),
symbolic Error.Code per service (#392), Lambda invoke omitting FunctionError and
LogResult (#393), S3 Range and conditional requests (#396, #397),
x-amz-checksum-* verification (#399), storage classes and CopyObject metadata
directives (#398), Content-Encoding surviving a multipart upload (#406), and a
seedable SQS create-then-lookup consistency window with the correct
QueueDoesNotExist code -- the legacy dotted form was uncatchable as a typed
error in either SDK, which is what the taskpool queue-lifecycle tests assert on
(#413).

Note: cmd's TestCatalogValid fails on main already (two private ECR images in
the shipped app catalog, #392) and is unrelated to this bump.

* fix(ttl-reaper): bump accountlifecycle past the substrate import move

The Security job on this branch (and on main — this is not PR-introduced) failed
with `go: updates to go.mod needed` in lambda/ttl-reaper. Cause is Go MVS plus
upstream tag timing, not any commit here:

  ttl-reaper requires spore-host/lambda/accountlifecycle at a pseudo-version
  whose *test* imported substrate at its old root path. Substrate moved that
  package to /emulator in v0.70.0, so once v0.80.0 (2026-08-01 02:11Z) and
  v0.81.0 (06:12Z) were tagged — after spawn main's last green Security run
  (2026-07-31 17:52Z) — resolution broke with no local change involved.

#509 fixed the import; this bumps the pin to that merged commit
(14e273c). Verified: `go mod tidy -diff` clean, `go build ./...` clean, and
govulncheck (v1.3.0, as CI pins) reports no vulnerabilities.

Note the go.sum-only tidy drift in alert-handler, autoscale-orchestrator and
sweep-orchestrator is pre-existing on main and does not affect govulncheck,
which is what the job actually runs. Left alone here to keep this fix scoped.
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.

spawn plugin inspect + install --dry-run (pre-install trust preview)

1 participant