Repository navigation
fix(plugin): validator accepts only what the step executors run (#1130, #1055) - #1221
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This was referenced Oct 20, 2026
#1055) Each step section now accepts only the step types its executor runs and, per type, only the Step fields the executor reads; a gate derives both from the executors' source. CheckSporeOS uses NormalizeOS, gated to agree with platform conditions. spawn plugin install validates before any local step.
scttfrdmn
force-pushed
the
fix/plugin-validator-agree
branch
from
October 20, 2026 06:35
7456b33 to
59b7881
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1130
Fixes #1055
#1130: what each case became
pushinlocal.deprovisionRunDeprovisionrefuses it at teardown, and nothing follows a teardown step to receive the value.local.reconcilespawn startcallsreconcileAllLocalPlugins(cmd/state.go:410), which replaysrec.Reconcile, the copy saved in the local plugin record, throughRunDeprovision(cmd/plugin.go). A grep forLocal.Reconcilemisses it. Because it runs throughRunDeprovision, it now gets the same run-only schema, sopushthere is rejected too. spore-sync uses it.capture:on a remote stepbackground:/as_user:on a local stepcapture:inlocal.deprovision/reconcile(found while doing this)runCaptureis split intorunLocal+captureOutputs, andRunDeprovisioncalls onlyrunLocal.The validator now has one schema per section, giving each step type and the yaml fields that type takes (
pkg/plugin/validate.go). Any other type, or any other set field, is an error that names the field and lists what the type takes. It replaces the old type sets and the special-casesha256 only on fetchcheck. Empty maps count as unset, because re-marshalling a Step writescapture: {}.spawn plugin installnow runsspec.Validatebefore any local step. spored already validated on receipt (pushapi.go), so a spec it would refuse used to leave a local footprint first.Stale comments fixed:
spec.gosha256 ("the registry's publish-time CI requires it": nothing in spore-plugins does),as_user("ignored for local steps": now rejected), andtemplate.goshellEscapeContext/RenderShellStep("instance values … left unescaped": they are quoted too).Gates (each watched failing against a compiling revert)
TestValidatorAcceptsExactlyWhatTheExecutorsRun(pkg/plugin/step_schema_gate_test.go):[]Stepfield ofPluginSpec. Each one must map to the function that runs it, and a new section with no mapping fails.go list -exportand go/types loadpkg/pluginandpkg/pluginruntime. From each executor entry point the gate follows calls into those packages, skipping renderers (functions returning a Step). It collects Step field selections by type, not by name, and attributes them per step type, using the cases of aswitchonStep.Typeor anif step.Type != "x" { return }guard.Validate. Every type the executor runs is accepted, and every other type is rejected. On an accepted type, every field it reads is accepted, and every other field is rejected by name.The discovered sets match the table: provision run {run, env, capture}, push {key, value}; deprovision run {run, env}; remote run {run, env, background, as_user}, fetch {url, dest, sha256}, extract {src, dest}.
Reverts it caught:
capturepushin teardownbackground/as_userRunDeprovisioncallsrunCaptureagain. This one is an executor change: the gate then demands that the validator accept capture._ = step.Captureadded to the remoterunCommandKnown blind spot: an executor that silently skips a type (
if step.Type == "push" { continue }) is not seen as dispatch, so the gate stays green.TestCheckSporeOSAgreesWithPlatformConditions(#1055) asserts, for each spelling, refused ⇔ anos: windowsplatform condition passes, refused ⇒os: linuxfails, and Linux ⇒ neither. It fails against a compiling hand-rolled normaliser ("\tWINDOWS\n"). The pre-changeEqualFold(TrimSpace)agreed withNormalizeOS, so this is a drift gate, not a bug repro.TestRunPluginInstall_InvalidSpecRunsNoLocalStepfails with the new Validate call disabled: the local step runs and the install proceeds to ssh.Registry check
Every
plugins/*/plugin.yamlin spore-host/spore-plugins (12) passesspawn plugin validate --strictwith this build. Positive control: docker passes. Negative control: docker withcapture:added to a remote run step fails and names the field.Checks
make checkpasses through step 6. Step 7,check-build-tags, fails identically on unmodified main in a /private/tmp worktree. semgrep is clean. No help text changed.