Skip to content

Show params with sources in porter explain output#3604

Draft
kichristensen wants to merge 2 commits into
getporter:mainfrom
kichristensen:issue2905
Draft

Show params with sources in porter explain output#3604
kichristensen wants to merge 2 commits into
getporter:mainfrom
kichristensen:issue2905

Conversation

@kichristensen

@kichristensen kichristensen commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

What does this change

Parameters with a source defined (e.g. an output source) were invisible in porter explain output. They are now shown with (injected) as the default value, indicating Porter will attempt to populate them from a prior run's output.

For install and stateless actions — where there is no prior run to inject from — the parameter is shown without the (injected) label.

A new injected boolean field is included in JSON/YAML output.

Example:

$ porter explain
Parameters:
─────────────────────────────────────────────────────────────────────
 Name        Description  Type     Default     Required  Applies To
─────────────────────────────────────────────────────────────────────
 mysql_user               string   (injected)  false     All Actions
 region                   string   mars        false     All Actions

What issue does it fix

Closes #2905
Closes #2004

Notes for the reviewer

The Injected flag is false (and no label shown) when the action is install or stateless, since Porter cannot inject values in those cases.

Checklist

  • Did you write tests?
  • Did you write documentation?
  • Did you change porter.yaml or a storage document record? Update the corresponding schema file.
  • If this is your first pull request, please add your name to the bottom of our Contributors list. Thank you for making Porter better! 🙇‍♀️

@kichristensen kichristensen changed the title fix: show params with sources in porter explain output Show params with sources in porter explain output Jun 11, 2026
@kichristensen kichristensen marked this pull request as ready for review June 12, 2026 21:42
@kichristensen kichristensen requested a review from a team as a code owner June 12, 2026 21:42
@kichristensen kichristensen marked this pull request as draft June 12, 2026 21:42
Parameters with a source (e.g. output injection) were
hidden from `porter explain`. Show them with an
`(injected)` default label so users know Porter will
attempt to populate them from a prior run's output.

For install and stateless actions where injection is
impossible, the injected flag is false and no label
is shown.

Closes getporter#2905, getporter#2004

Signed-off-by: Kim Christensen <kimworking@gmail.com>
Update persisting-data guide to reflect that parameters
with sources now appear in `porter explain` with an
`(injected)` default label.

Signed-off-by: Kim Christensen <kimworking@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates porter explain to display parameters that use CNAB parameter sources (e.g., sourced from prior outputs), including a new injected flag in JSON/YAML output and an (injected) indicator in the plaintext table output.

Changes:

  • Stop filtering out parameters with sources from porter explain output.
  • Add injected to the explain JSON/YAML schema and show (injected) in table output where applicable.
  • Update explain-related golden testdata and authoring docs to reflect the new behavior.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pkg/porter/explain.go Includes sourced parameters in explain output; adds injected flag and table rendering behavior.
pkg/porter/testdata/explain/params-bundle.json Adds parameter-sources extension + a sourced parameter for explain test fixtures.
pkg/porter/testdata/explain/expected-table-output.txt Updates expected plaintext explain output to include sourced parameter and (injected) label.
pkg/porter/testdata/explain/expected-json-output.json Updates expected JSON explain output to include the new injected field.
pkg/porter/testdata/explain/expected-yaml-output.yaml Updates expected YAML explain output to include the new injected field.
docs/content/docs/development/authoring-a-bundle/persisting-data.md Documents visibility of sourced parameters in porter explain and the (injected) label.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/porter/explain.go
Comment on lines +463 to +466
defaultVal := fmt.Sprintf("%v", p.Default)
if p.Injected && (defaultVal == "<nil>" || defaultVal == "") {
defaultVal = "(injected)"
}
Comment thread pkg/porter/explain.go
Comment on lines +321 to +332
// isInstallOrStatelessAction returns true when Porter cannot inject parameter
// values from previous outputs (install has no prior run; stateless actions
// don't track state).
func isInstallOrStatelessAction(bun cnab.ExtendedBundle, action string) bool {
if action == cnab.ActionInstall {
return true
}
if a, ok := bun.Actions[action]; ok && a.Stateless {
return true
}
return false
}
Comment thread pkg/porter/explain.go
Comment on lines 243 to 247
for p, v := range bun.Parameters {
v := v // Go closures are funny like that
if bun.IsInternalParameter(p) || bun.ParameterHasSource(p) {
if bun.IsInternalParameter(p) {
continue
}
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.

porter explain does not show parameters that have an output source Porter explain doesn't show parameters with sources

2 participants