Skip to content

fix(generate): pass deploy inputs only when the callee declares them - #711

Draft
reka18 wants to merge 15 commits into
fix/promote-per-env-retries-626from
fix/deploy-declared-inputs-706
Draft

reka18 wants to merge 15 commits into
fix/promote-per-env-retries-626from
fix/deploy-declared-inputs-706

Conversation

@reka18

@reka18 reka18 commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Stacked on #709. Review only the commits after 02c4bc2. This retargets to main once #709 merges.

What was wrong

GitHub rejects a reusable-workflow call that passes an input the callee doesn't declare, or that leaves out one it requires. #705 fixed promote's rollback jobs and its dry_run passthrough, and #696 fixed the hotfix lanes. The other deploy call sites still passed inputs without checking the callee:

  • promote's single-environment and prod deploys passed environment and sha. The baseline golden passed sha to a callee that doesn't declare it;
  • promote's matrix and per-environment paths passed environment, and operator-wired inputs such as cluster, whether or not the callee declared them;
  • promote's external-block deploys passed environment and sha even when the callee is a local workflow;
  • the standalone rollback workflow passed environment and sha;
  • orchestrate passed environment unconditionally, and passed dry_run based on supports_dry_run rather than on the callee;
  • neither rollback lane passed dry_run, so a callee that requires it passed generate and then failed at dispatch.

What changed

  • One rule at every deploy call site: an input is passed only when the callee declares it, through the shared declaredCallbackInputs helper. That covers orchestrate, promote (matrix, per-environment, single, prod, and external-block deploy and rollback), and the standalone rollback. A cross-repo callee, whose inputs can't be read, falls back to the standard contract, as the hotfix lanes do. This also restores sha for cross-repo matrix and per-environment deploys, which the old lookup dropped.
  • Rollbacks pass dry_run when the callee declares it, using the same null-safe expression as the hotfix rollback. A rollback never runs during a dry run, so it renders false. A required dry_run is now satisfied, not refused.
  • supports_dry_run now only drives promote's dry-run skip guards. The unused internal CallbackInfo.SupportsDryRun field is removed.
  • Builds: orchestrate now passes dry_run to a build or validate callback that declares it.
  • Two new warnings from generate-workflow. Neither stops generation:
    • supports_dry_run: true on a callee that doesn't declare dry_run. The callback would run in a dry-run dispatch with no signal;
    • a rollback-lane callee that doesn't declare sha. The rollback can't pass the target SHA, so the callee redeploys its default ref.
  • Docs: callbacks.md, generated-workflows.md and the CHANGELOG.

Golden changes

  • promote.yaml: the local deploy and rollback jobs drop sha, because the stub callee doesn't declare it. The rollback jobs and the six external deploy jobs gain dry_run. The external callees are cross-repo, so they keep sha through the contract fallback.
  • cascade-rollback.yaml: the deploy jobs drop sha and gain dry_run.
  • orchestrate.yaml: the deploy jobs gain dry_run, because the stub declares it. The build jobs drop environment, because their stubs don't declare it, and build-docs loses its with: block.

Existing manifests

No refusal is added, so nothing that generated before fails now. A manifest whose callee is missing an input it used to receive now gets a valid call without that input. The two warnings above cover the cases where that changes behavior. In cascade-example-4env, the only repo checked, the two rollback lanes gain a valid dry_run line and nothing else changes.

How it's tested

  • go build, go vet, gofmt and go test ./... pass, with actionlint and shellcheck on PATH. The new tests parse the emitted with: blocks at every site. They cover:
    • a declared input;
    • an undeclared input;
    • a cross-repo callee;
    • an unreadable callee;
    • a required dry_run with no default.
  • The tests were checked against the base: 31 new subtests fail without the fix.
  • No new e2e scenario, because act doesn't run GitHub's reusable-workflow input validation. The e2e module's short tests pass.

The required-input check doesn't yet cover external-block deploys or the standalone rollback. That's filed as #710.

Closes #706

reka18 added 14 commits December 3, 2026 10:52
… declared inputs

GitHub rejects a reusable-workflow call that passes an input the callee does
not declare, and promote's single (no declared inputs) and prod deploy jobs
threaded environment and sha unconditionally: a local callee that declared
neither - or only some - of the contract inputs produced a promote workflow
GitHub rejects at parse (#706). Route both with: blocks through the shared
declaredCallbackInputs helper the promote rollback jobs (#705) and the hotfix
lanes (#696) already use, so every input the two jobs thread - environment,
sha, image_tag, image_digest, dry_run - is gated on the callee's declared
workflow_call inputs. A local callee declaring none of them now gets no with:
block, one declaring only some receives those alone, an unreadable local
callee gets no with: block rather than inputs its callee might reject, and a
cross-repo callee falls back to the standard contract
(environment/sha/dry_run) exactly as before. The declared image inputs keep
their existing preflight sources (the shared declared set is the same local
parse deployHasInput read), and the retry shims re-invoke the same gated
with: block, so a retried deploy follows the same rule.

Tests parse the emitted with: blocks per job, covering each declaration
shape, the cross-repo fallback, an unreadable local callee, the retry shim,
and the image sources. The env-gate, env-role, and matrix-strategy tests now
stage callees that declare the inputs they assert on (an empty workflow_call
stub or an unreadable callee emits no with: block under the new rule), and
TestPromoteGenerator_DeployJobPassesEnvironmentAndSHA scopes its assertions
to the deploy-app job: the same two strings also appear in finalize's
manage-release with: block, so the whole-document form kept passing even once
the deploy job threaded neither.

Golden move: the byte-identical baseline's deploy callback stub declares
environment, bundle, and dry_run but not sha, so the baseline promote
workflow no longer passes sha to a callee that does not declare it - the four
sha lines (deploy-app, deploy-sidecar, deploy-app-prod, deploy-sidecar-prod)
are the exact shape the issue called out. environment and the dry_run
passthrough still thread; the stub declares both.

Closes #706

Signed-off-by: Ray Karnes <ray.karnes@stablekernel.com>
…ee's declared inputs

The standalone rollback workflow's deploy jobs threaded environment and sha
unconditionally (#706): a local callee that declared neither - or only some -
of the contract inputs got a cascade-rollback.yaml whose deploy calls GitHub
rejects at parse. Route the with: block through the shared
declaredCallbackInputs helper every other deploy lane uses (#696, #705): each
of environment and sha threads only when the callee declares it, a cross-repo
callee falls back to the standard contract (environment/sha/dry_run), and a
local callee that declares no contract inputs - or cannot be read at all -
gets no with: block rather than inputs its callee might reject.

Tests parse the emitted with: blocks, covering each declaration shape, the
cross-repo fallback, and an unreadable local callee.

Golden move: the byte-identical baseline's deploy callback stub does not
declare sha, so the rollback deploy jobs (deploy-app, deploy-sidecar) no
longer pass the sha line; environment still threads because the stub
declares it.

Signed-off-by: Ray Karnes <ray.karnes@stablekernel.com>
…declared inputs

standardWithInputLines emitted the dry_run passthrough for a callback that
opts in via supports_dry_run, so a local callee whose workflow does not
declare dry_run got an orchestrate call GitHub rejects at parse (#706) - the
same defect #705 fixed on promote. The passthrough now keys on the callee's
declared workflow_call inputs through jobHasInput, the set
discoverOutputsAndInputs populates by parsing the local callee (with
crossRepoInputs as the cross-repo fallback) - the same declared-inputs rule
every deploy lane follows.

supports_dry_run keeps only its skip role: promote's deploy jobs still read
it from the config for their dry-run if: guards. Orchestrate has no
generator-side dry-run skip for a callback (the setup job's run_deploy_*
outputs are pure change detection), so there the field no longer affects
emission at all; CallbackInfo.SupportsDryRun is carried as metadata only,
and validate's supports_dry_run becomes advisory.

A deploy callback that declares dry_run required now generates on every
surface: on orchestrate it previously failed required-input validation
unless the deploy also set supports_dry_run, even though the opt-in never
changed what the emitted call carried. The inverted subtest of
TestGenerator_ValidateRequiredInputs_CountsDryRunPassthrough pins the new
expectation, and the vacuous TestOrchestrate_NoSupportsDryRun_NoDryRunInput
(whose stub never declared dry_run, so it passed under both rules) is folded
into the new TestOrchestrate_DryRunPassthrough_FollowsDeclaredInputs.

Golden move: the byte-identical baseline's deploy callback stub declares
dry_run, so the two orchestrate deploy jobs (deploy-app, deploy-sidecar) gain
the passthrough line; on a real run it renders the same false a boolean
dry_run input defaults to, so the emitted call's runtime behavior is
unchanged.

Signed-off-by: Ray Karnes <ray.karnes@stablekernel.com>
Sync the docs that describe these call sites with the #706 rule every deploy
lane now follows: reference/callbacks.md's standard-inputs table states the
per-surface gating for environment, sha, and dry_run (and that the standalone
rollback never threads dry_run because its deploy jobs never run on a dry
run); reference/generated-workflows.md gains a promote "deploy with: block"
section and the cascade-rollback deploy row states the gating; manifest.md's
supports_dry_run rows are corrected - the deploy row no longer claims
orchestrate skips a non-opted-in callback during a dry run (it never had such
a skip), and validate's row is marked advisory now that the passthrough keys
on the declared input. The CHANGELOG records the three fixes and the
deliberate byte-identical golden moves.

Signed-off-by: Ray Karnes <ray.karnes@stablekernel.com>
…eclared inputs

standardWithInputLines threaded the environment contract input to every
callback whenever the manifest configured environments, so a local callee
whose workflow does not declare environment got an orchestrate call GitHub
rejects at parse - the last orchestrate input outside the declared-inputs
rule sha and the dry_run passthrough already follow (#706). The line now
gates on the callee's declared workflow_call inputs through jobHasInput, the
set discoverOutputsAndInputs populates by parsing the local callee (with
crossRepoInputs as the cross-repo fallback), the same rule every deploy lane
follows. A zero-environment manifest still emits no line, so the
zero-environment required-environment rejection is unchanged, and a required
environment remains satisfied by definition (a required input is necessarily
declared). Orchestrate has no unreadable-callee fallback: discovery refuses
to generate when a local callback cannot be read, which the new tests pin.

Tests parse the deploy job's with: block for the undeclared, declared, and
cross-repo cases (TestGenerator_EnvironmentInput_FollowsDeclaredInputs);
TestEnvGates_Orchestrate_DeployJob_WithGHAEnvironment stages a callee that
declares environment, since the with: input it asserts on no longer threads
to an undeclaring stub.

Golden move: the byte-identical baseline's build stubs declare no
environment input (image-build declares only os/arch, bundle-build only
image), so the three orchestrate build jobs (build-image, build-bundle,
build-docs) lose their environment line and build-docs loses its whole
with: block - it carried only that line. The two deploy jobs keep theirs
because their stub declares environment.

Signed-off-by: Ray Karnes <ray.karnes@stablekernel.com>
…puts on the callee's declared inputs

Three promote deploy call sites still passed inputs without consulting the
callee's declared workflow_call inputs (#706). The matrix path auto-passed
environment whenever the manifest did not wire it as an explicit input; the
per-environment fan-out did the same with the environment literal; and both
keyed sha on deployHasInput, a name-keyed local parse that never read a
cross-repo file, so a cross-repo matrix or per-environment deploy silently
lost sha even though the contract fallback assumes it declares the input.
The external-block deploy jobs (writeExternalDeployJobs) threaded
environment and sha unconditionally, which is right for a cross-repo callee
but wrong for an external block that references a workflow living in the
primary repo - that callee is readable locally, so its declared inputs must
gate the call.

All three now key on the shared declaredCallbackInputs set through
declaredDeployInputs - the same rule every promote deploy lane follows: a
local callee receives only the inputs it declares (no with: block when it
declares none, and none at all when it cannot be read), and a cross-repo
callee falls back to the standard contract (environment/sha/dry_run), which
restores sha on the matrix and per-environment paths and leaves the external
jobs byte-identical for cross-repo callees. With the last callers gone, the
redundant local-parse accessor (deployHasInput and the inputs map it read)
is removed; discoverDeployRequiredInputs keeps discovering the required
inputs the rollback refusal needs, parsing the same normalized location.

Tests parse the emitted with: blocks per job shape, covering the declared,
undeclared, cross-repo, and unreadable callee on each path. No golden moves:
the byte-identical baseline manifest has no deploys with declared inputs
(matrix and per-environment paths stay unexercised there) and its
external-block deploys are cross-repo, whose fallback emits the same pair as
before.

Signed-off-by: Ray Karnes <ray.karnes@stablekernel.com>
…e declares it

A callee that declares dry_run - required or optional - now receives the
same null-safe passthrough on the rollback lanes that the deploy jobs
thread: promote's rollback-<name> jobs (writeRollbackWith) and the
standalone rollback workflow's deploy jobs (writeRollbackDeployWith) emit
dry_run: ${{ github.event.inputs.dry_run == 'true' }} whenever the callee
declares the input, gated through the shared declaredCallbackInputs set with
the standard cross-repo contract as the fallback - the same line the hotfix
rollback lanes thread (#706).

This closes the last gap between promote's required-input validation and its
emission: the dry_run exemption in validateRequiredInputs counted the
declared passthrough as providable, but only the deploy jobs emitted it, so
a callee declaring dry_run required with no default passed generation and
then failed the rollback call's dispatch for the missing input. With every
promote lane emitting the passthrough, the exemption is honest; the
image_tag/image_digest refusal is untouched (#664 tracks the rollback image
source).

The passthrough renders false whenever a rollback lane actually runs. The
standalone rollback's deploy jobs are gated on not-dry-run
(rollbackDeployGuard), and on the repository_dispatch trigger the coalesced
dry_run signal skips the job entirely, so the plain github.event.inputs read
- not the guard's client_payload coalescing - is the correct expression
there. A promote rollback that fires during a dry-run promote (a
supports_dry_run deploy failing its emulation) passes true, so the rollback
re-invokes the callback in emulation too.

Tests parse the rollback jobs' with: blocks for the declared, undeclared,
cross-repo, and required-no-default cases on both lanes; the required
subtest pins the exact regression (generation succeeds and the rollback
call carries the input).

Golden moves: the byte-identical baseline's deploy callback stub declares
dry_run, so the promote rollback jobs (rollback-app, rollback-sidecar, and
the external-block rollback-cdk/dns/etl via the cross-repo contract) and the
standalone rollback's deploy jobs (deploy-app, deploy-sidecar) gain the
passthrough line.

Signed-off-by: Ray Karnes <ray.karnes@stablekernel.com>
…ember

Since the dry_run passthrough keys on the callee's declared workflow_call
inputs, nothing reads CallbackInfo.SupportsDryRun: the promote generator
consults the manifest's supports_dry_run directly from the deploy config for
its dry-run if: skip guards, and orchestrate has no generator-side dry-run
skip for a callback. Remove the member and the two graph seedings. The
manifest's supports_dry_run field stays: it still drives promote's skip
guards, and validate's copy is parsed and documented as advisory.

Signed-off-by: Ray Karnes <ray.karnes@stablekernel.com>
Finish the #706 documentation. The callbacks reference's standard-inputs
table now states the uniform rule - every standard input (environment, sha,
dry_run) is passed when the callback declares it, with the zero-environment
carve-out for environment and the cross-repo standard-contract fallback -
and the dry_run row covers the rollback lanes: every deploy caller including
promote's rollback jobs and the standalone rollback workflow threads the
passthrough to a declaring callee, and the rollback lanes' passthrough
always renders false on a running job. The generated-workflows reference
says every deploy job shape (matrix, per-environment, single, prod,
external-block) and the rollback jobs follow the gating, and the
cascade-rollback deploy row gains dry_run. The CHANGELOG records the
rollback-lane passthrough (with the required-input dispatch fix it closes)
and the three remaining call sites (orchestrate's environment, promote's
matrix/per-environment auto-pass, promote's external-block jobs), each with
its byte-identical golden move.

Signed-off-by: Ray Karnes <ray.karnes@stablekernel.com>
…en the callee declares it

Close the last lane without it: promote's external-block deploy jobs
(deploy-<name> and deploy-<name>-prod in writeExternalDeployJobs) now thread
the same null-safe dry_run passthrough as the rollback lanes whenever the
callee declares the input, gated through the shared declaredCallbackInputs
set with the standard cross-repo contract as the fallback (#706, per the
every-call-site-one-rule decision). Their with: blocks already gated
environment and sha on the callee's declared inputs; dry_run joins them, so a
callee that declares dry_run required is satisfied on every external-block
call - deploy, prod, and rollback alike - where previously only the rollback
call carried it and the deploy calls starved the input after generation
succeeded.

The jobs' if: guards always skip dry runs, so the passthrough renders a real
false whenever one actually runs - the same shape the standalone rollback's
deploy jobs carry.

Tests parse the emitted with: blocks: declared (both jobs), undeclared,
cross-repo contract (the previous subtest's absence assertion inverts), and
the required-no-default shape asserting every external-block job carries the
input. The CHANGELOG and callbacks-reference rows that list the lanes are
updated to include them.

Golden move: the byte-identical baseline's external-block deploys are
cross-repo (org/infra, org/data), so their six deploy jobs (deploy-<name> and
deploy-<name>-prod for cdk, dns, and etl) gain the passthrough line through
the contract fallback.

Signed-off-by: Ray Karnes <ray.karnes@stablekernel.com>
…lared inputs

The matrix and per-environment deploy paths threaded every manifest-wired
operator input unconditionally: a literal, a matrix.* value, or a vars.*
passthrough wired under inputs: reached the with: block even when the local
callee did not declare it, producing a reusable-workflow call GitHub rejects
at parse - the same defect the auto-passed contract inputs had before #706.
Gate both loops on the callee's declared workflow_call inputs through the
shared declaredDeployInputs set, the way orchestrate's renderOperatorInputs
has always gated its operator inputs: an undeclared wired input is dropped
on both paths, a declared one threads exactly as before (from the matrix
entry, the per-environment JSON, or verbatim for a passthrough), and a
cross-repo callee is unchanged because the standard-contract fallback seeds
every manifest-wired input as declared.

Tests parse the with: blocks on both paths for the dropped and kept shapes,
including a vars passthrough, and the cross-repo subtests now also pin the
wired inputs threading through the fallback. The passthrough and
input-passthrough e2e tests and two matrix-strategy table entries stage
callees that declare the inputs they assert on, since an unreadable callee
now emits no with: inputs at all.

No golden move: the byte-identical baseline manifest wires no deploy inputs,
so neither path is exercised there.

Signed-off-by: Ray Karnes <ray.karnes@stablekernel.com>
…each its input

The declared-inputs rule makes two hazards visible that generation used to
pass over silently (#706), and generate-workflow's existing warning channel -
the orchestrate generator's Validate list, printed per orchestrate target -
now carries a warning for each:

A callback that sets supports_dry_run while its workflow does not declare
the dry_run input can never receive the dry-run signal: GitHub rejects an
undeclared input, so the passthrough stays silent, and a dry-run dispatch
runs the callback exactly like a real one (orchestrate does not skip
callbacks on dry runs, and promote deliberately keeps a supports_dry_run
deploy job running through one). The warning names the callback and its
workflow and says to declare dry_run or drop the opt-in; reading validate's
opt-in through config.ValidateConfig.DryRunSupported() also gives that
accessor a generating consumer again.

A deploy callback whose workflow does not declare the sha input cannot be
keyed to a rollback target: the promote rollback jobs and the standalone
rollback workflow re-invoke it with the environment alone, so it redeploys
whatever ref its own logic resolves. The warning fires only when a rollback
lane will actually call the callee (at least one environment), covers
external-block deploys whose workflow lives in the primary repo - they get a
promote rollback job - and says to declare sha to key rollbacks on the
resolved target.

Cross-repo callees are skipped in both warnings: the standard contract
assumes they declare the inputs, and their workflows cannot be read locally.
Both warnings are advisory; generation proceeds.

Tests cover each warning firing (deploy and validate for the dry-run
opt-in; local and external-block-local for the rollback sha) and the silent
shapes: a declaring callee, a cross-repo callee, an undeclaring callee that
never opted in, and - for the rollback warning - a zero-environment
manifest with no rollback lane.

Signed-off-by: Ray Karnes <ray.karnes@stablekernel.com>
Pin review finding 4 of #706: standardWithInputLines is shared by every
orchestrate callback type, so a build callback that declares dry_run
receives the same null-safe passthrough a deploy callback does - and a build
callback that does not declare it never receives the input. The behavior
arrived with the shared declared-inputs gating; this locks it so a future
split of the build emission cannot silently drop it.

Signed-off-by: Ray Karnes <ray.karnes@stablekernel.com>
…lds' dry_run

Record the review follow-ups to #706. The CHANGELOG gains entries for the
matrix/per-environment operator-input gating (with the note that cross-repo
wiring is unchanged and the baseline is unmoved) and for the two advisory
warnings generate-workflow now prints - the supports_dry_run opt-in the
callee cannot receive, and the rollback lane that cannot pass its target SHA
- and the orchestrate dry_run entry now says the shared emission covers
build and validate callbacks too.

The callbacks reference's standard-inputs table states both: the dry_run row
says orchestrate passes it to a build or validate callback that declares the
input, and both the dry_run and sha rows carry a hazard line - setting
supports_dry_run on a workflow that does not declare dry_run buys nothing,
and a deploy callback that does not declare sha cannot be keyed to a
rollback target - each noting that generate-workflow warns on the shape.

Signed-off-by: Ray Karnes <ray.karnes@stablekernel.com>
@reka18
reka18 marked this pull request as draft December 3, 2026 19:24
…eration

The harness generates every workflow from the setup commit, before any step's commit.files land, so the app deploy was read as the generic auto-stub, which declares the standard contract but not message, and the declared-inputs gating (#706) dropped the input from each with: block, failing the two per-environment message assertions.

Seed both deploy callbacks via setup_workflows, the pattern scenarios 43, 66, 73 and the hotfix input scenarios already use; commitN aliases and runtime behavior are unchanged since only action: commit steps advance the aliases and the setup commit is an ancestor of every step commit.

Signed-off-by: Ray Karnes <ray.karnes@stablekernel.com>

This branch has not been deployed

No deployments
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