xyops: custom Event Plugin construct (NewPlugin) and plugin-backed pipeline steps #74

Merged
john merged 1 commit from feat/xyops-plugin into main 2026-11-24 15:23:45 +00:00
Owner

Problem

Inline Shell Plugin scripts are event parameters: xySat copies every job param into the job environment and drops any variable above 64 KiB (checkJobEnv), and each event stores its own copy. john/arch has ~22 such scripts (up to 114 KB, several near-identical copies). Upstream recommends custom Event Plugins for this.

Change

  • xyops.NewPlugin declares one xyops_plugin (provider 0.1.2-dev.9). The satellite writes Script to <temp>/plugins/<id> and runs Command <file> with the job as one JSON line on STDIN. The code never enters the job environment (job.script = "(File)").
  • Enforced: ID [a-z0-9_]{1,64}, never a stock ID or anything ending in plug (or starting with _); ID claimed in xyops.PluginNamespace. Title is <stack>-<id>. Command is an absolute path plus fixed single-space words; shell metacharacters, quotes, $, globs, ~ and control characters are refused, because xySat expands $VARS in arguments. Script must be non-empty and is written as a literal. Kill defaults to all. Notes reject <>. PreventDestroy. Import is supported.
  • Nothing is left to defaults: params "[]" (no plugin parameters by design), uid/gid "" (no run-as override), groups [], format "", icon "", runner false, enabled true, type event. The provider treats an omitted optional attribute as unmanaged, so each one is written.
  • EventProps.Plugin: exactly one of Script or Plugin, which must come from the same stack. Plugin events get plugin = <id> and params "{}", and add depends_on the plugin, merged with OnSuccess and sorted. Script events are byte-for-byte unchanged.
  • workflow.PluginTask / Step.Plugin. Plugin steps and a plugin ServiceReleaseProps.Intake count as workers for state and vault grants.
  • Opt-in guard: xyops.CheckInlineScripts(stack, xyops.MaxInlineScript) (16 KiB) returns the Shell Plugin events whose decoded script is over the limit, for consumer tests.
  • Schema snapshot gains xyops_plugin, checked against tofu providers schema -json from the 0.1.2-dev.9 binary. A new test also requires every settable plugin attribute to be written.

Plugin code goes to every satellite, so it must hold no secrets; grant secrets to events. Programs must take their role from job.event, never from job.params.

No VERSION bump (release-check: "merging releases nothing"); the CHANGELOG is updated under [Unreleased].

## Problem Inline Shell Plugin scripts are event **parameters**: xySat copies every job param into the job environment and drops any variable above 64 KiB (`checkJobEnv`), and each event stores its own copy. john/arch has ~22 such scripts (up to 114 KB, several near-identical copies). Upstream recommends custom Event Plugins for this. ## Change - `xyops.NewPlugin` declares one `xyops_plugin` (provider 0.1.2-dev.9). The satellite writes `Script` to `<temp>/plugins/<id>` and runs `Command <file>` with the job as one JSON line on STDIN. The code never enters the job environment (`job.script = "(File)"`). - Enforced: ID `[a-z0-9_]{1,64}`, never a stock ID or anything ending in `plug` (or starting with `_`); ID claimed in `xyops.PluginNamespace`. Title is `<stack>-<id>`. `Command` is an absolute path plus fixed single-space words; shell metacharacters, quotes, `$`, globs, `~` and control characters are refused, because xySat expands `$VARS` in arguments. Script must be non-empty and is written as a literal. `Kill` defaults to `all`. Notes reject `<>`. `PreventDestroy`. Import is supported. - Nothing is left to defaults: `params "[]"` (no plugin parameters by design), `uid`/`gid` `""` (no run-as override), `groups []`, `format ""`, `icon ""`, `runner false`, `enabled true`, `type event`. The provider treats an omitted optional attribute as unmanaged, so each one is written. - `EventProps.Plugin`: exactly one of `Script` or `Plugin`, which must come from the same stack. Plugin events get `plugin = <id>` and `params "{}"`, and add `depends_on` the plugin, merged with OnSuccess and sorted. Script events are byte-for-byte unchanged. - `workflow.PluginTask` / `Step.Plugin`. Plugin steps and a plugin `ServiceReleaseProps.Intake` count as workers for state and vault grants. - Opt-in guard: `xyops.CheckInlineScripts(stack, xyops.MaxInlineScript)` (16 KiB) returns the Shell Plugin events whose decoded script is over the limit, for consumer tests. - Schema snapshot gains `xyops_plugin`, checked against `tofu providers schema -json` from the 0.1.2-dev.9 binary. A new test also requires every settable plugin attribute to be written. Plugin code goes to every satellite, so it must hold no secrets; grant secrets to events. Programs must take their role from `job.event`, never from `job.params`. No VERSION bump (release-check: "merging releases nothing"); the CHANGELOG is updated under [Unreleased].
feat(xyops): add custom Event Plugins (NewPlugin) and plugin-backed pipeline steps
All checks were successful
CI / release-check-1 (pull_request) Successful in 13s
CI / release-check (pull_request) Successful in 0s
CI / checks (pull_request) Successful in 1m55s
5344459273
Large inline Shell Plugin scripts are copied into the job environment,
where xySat drops any variable above 64 KiB, and every event stores its
own copy. xyops.NewPlugin declares a custom Event Plugin instead: the
satellite runs `Command <script file>` with the job on STDIN.

- NewPlugin writes every xyops_plugin attribute (params "[]", empty
  uid/gid, kill all by default, runner false) and refuses stock-like IDs,
  relative commands and shell metacharacters.
- EventProps.Plugin: exactly one of Script or Plugin; plugin events pass
  params "{}" and depend on the plugin. Script events are unchanged.
- workflow.PluginTask / Step.Plugin; plugin steps and a plugin intake are
  service-release workers.
- Opt-in CheckInlineScripts and MaxInlineScript for consumer tests.
- Schema snapshot gains xyops_plugin (checked against the provider binary).
john merged commit 58c6d4688f into main 2026-11-24 15:23:45 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
john/cdk!74
No description provided.