Repository navigation
sandbox apply: print the decoded sandbox, YAML 1.1-safe, under --dry-run (into #373) - #374
Merged
joehorsnell merged 4 commits intoSep 25, 2026
Conversation
--dry-run printed the document as read, after substitution. That made the output depend on how the file spelled things, and needed wholeNumbers to undo the YAML reader turning every integer into a float. Print the request as decoded into the API model instead, which is exactly what an apply sends: numbers keep their types, and nothing the decoder would drop can appear. The output is unchanged on every fixture the sandbox Action uses. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The previous commit carried only its test: the change to apply.go was left out of it. This is that change. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
-f reads YAML 1.1, where an unquoted yes, on, No, y or 1e3 is a bool or a number, but --dry-run printed through a YAML 1.2 printer that leaves those strings unquoted. A spec with env DEBUG=yes rendered to 'value: yes', and passing that back to -f failed with 'cannot unmarshal bool into ... env.value of type string'. The sandbox Action applies exactly those bytes, so every such value failed the apply after validation had passed. Print with sigs.k8s.io/yaml, the library -f reads with. Output is unchanged on every fixture the Action uses. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…rt as strings (into #374) (#375) Stacked: #362 ← #373 ← #374 ← this one. ## Why The template language has no escape for a literal `@{`. So a spec that `--dry-run` has rendered can't always be rendered again: ```console $ signadot sandbox apply -f t.yaml --dry-run=client --set 'd=build @{sha} ok' > r.yaml $ signadot sandbox apply -f r.yaml --dry-run=client Error: unexpanded variable: sha ``` The sandbox Action renders once, then validates and applies the result. So any value containing `@{` after the first render failed the step: a PR title in `description`, an `@{embed: file}` of a Spring config (`server.url=@{/login}`), or an env value. The Action's correctness audit rated this high. ## What - New hidden bool flag `--no-template`: `-f` is decoded as a finished spec, with no `@{…}` substitution. - `--set` together with `--no-template` is refused, because there's nothing to bind. - Hidden like `--dry-run`, for the same reason: the Action is the only caller that needs it while the interface settles. ## Also: labels and resource params called `port` `port2Int` turned every string under a key named `port` into a number, including inside `spec.labels` and `resources[].params`, whose keys are the user's own names. So a label or a param called `port` was refused with `cannot unmarshal number into … params of type string`. It now skips those two maps, and endpoint ports still convert as before (`TestPortKeysInFreeFormMapsStayStrings`). Found by the sandbox Action's re-audit. ## Tests - `TestNoTemplateReadsARenderedSpecAsItIs`: a value containing `@{sha}` and `@{embed: x}` renders once, fails to render a second time without the flag, and with the flag produces byte-identical output. - `TestNoTemplateRefusesSet` - `TestNoTemplateIsHidden` 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
joehorsnell
approved these changes
Sep 25, 2026
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.


Stacked: #362 ← #373 (hide the flag) ← this one. Two changes to what
--dry-run=clientprints.1. Print the decoded sandbox, not the document as read
--dry-run=clientnow prints the sandbox as decoded intomodels.Sandbox, which is exactly what an apply sends. Before, it printed the substituted document as it was read.wholeNumbers. Numbers come from the typed model, so they're already the right type. The model goes back through JSON withUseNumber, and integers are restored as integers.nulls the generated models emit for unset lists (forks,local,endpoints, …).(The first commit,
d594cd2, accidentally carried only its test.14d21bais theapply.gochange it was meant to include.)2. Quote YAML 1.1 lookalikes, a bug in #362
-freads YAML 1.1 (sigs.k8s.io/yaml), but--dry-runprinted through goccy, a YAML 1.2 printer that leavesyes,on,No,y,OFFand1e3unquoted:The sandbox Action applies exactly those bytes. So
env: DEBUG=yes, a label value likepreview=yes, ordescription: Nofailed the apply after validation had passed, and adry-run: truejob published arendered-specthat couldn't be applied. Found by the Action's correctness audit. The dry-run YAML is now printed withsigs.k8s.io/yaml, the same library-freads with.--dry-runnever had a-o yamlformat of its own, so no other command is affected.Evidence
|blocks.TestDryRunPrintsOnlyWhatIsSetTestDryRunQuotesYAML11Lookalikes:yes,on,No,1e3,1_000,yandOFFcome out quoted, and rendering the output again reproduces it exactly.Not fixed here:
@{in a rendered valueThe template language has no escape for a literal
@{, and the sandbox Action renders the document more than once. So any value that contains@{after the first render breaks the next one: a PR title, an@{embed: file}whose file has@{in it (for example Spring'sserver.url=@{/login}), or an env value. Options, to decide separately:@@{→ literal@{) and escape strings in dry-run output.🤖 Generated with Claude Code