Skip to content

feat: resolve env refs in PARAM lines and preset values - #285

Merged
outofcoffee merged 4 commits into
mainfrom
env-refs-in-param-and-preset-values
Nov 23, 2026
Merged

outofcoffee merged 4 commits into
mainfrom
env-refs-in-param-and-preset-values

Conversation

@outofcoffee

Copy link
Copy Markdown
Collaborator

Values in PARAM spinloop lines and preset .ini entries resolve $FOO, ${FOO} and ${FOO:-bar} against the process environment, so a shared Spinloop or preset can carry machine-specific paths and tags.

Summary

  • PARAM values and preset entry values interpolate $FOO, ${FOO} and ${FOO:-fallback} (the fallback stands when the variable is unset or empty); $$ is a literal $ and a stray $ stays literal.
  • Resolution runs where a consuming command builds its configuration — spinloop serve, spinloop cloud deploy, a node wake — so printed and dry-run commands show resolved values, while parsing, show and export keep the raw text and can never leak a resolved value into a re-rendered file.
  • A malformed reference (unterminated ${, bad name, any other ${...} form) fails naming the offending preset line or PARAM key, rather than passing raw text to an engine.
  • Keys are never resolved: preset entry keys and PARAM keys are flag names.
  • Docs updated: Spinloop file format, serve presets and PARAMs, cloud deploy, and a maintainer note on why resolution sits at the two choke points.

Implementation details

Expansion lives in a new stdlib-only leaf, internal/envref, called from exactly two places — preset.Parse and selectionParams — both reached only by the serve and deploy derivations. That placement keeps internal/spinloop I/O-free (its standing invariant) and gives the timing rule for free: nothing else that reads a Spinloop resolves anything. The OpenSpec change records the behaviour as new requirements on spinloop-files, local-serving and remote-endpoint; it still needs archiving before merge.

Closes #283

Planning artifacts for #283: PARAM and preset entry values resolve
$FOO, ${FOO} and ${FOO:-bar} against the process environment at
consumption time, keeping raw text through parse and export.
Values in PARAM spinloop lines and preset entries resolve $FOO,
${FOO} and ${FOO:-bar} against the process environment, with $$ for
a literal dollar. Expansion lives in a new internal/envref leaf and runs
where a consuming command builds its configuration — preset.Parse for
presets, selectionParams for PARAMs — so serve and deploy show resolved
values while Parse, show and export keep the raw text. A malformed
reference fails naming the preset line or PARAM key.

Closes #283
Describe the syntax on the Spinloop-file, serve and cloud docs pages,
record the choke-point rationale in the maintainer notes, pin the
literal-default behaviour with tests, and align the local-serving delta
with where each command's environment actually comes from.
@outofcoffee outofcoffee added the enhancement New feature or request label Nov 23, 2026
Sync the three delta requirements into the main specs and move the
completed change to the archive.
@outofcoffee
outofcoffee marked this pull request as ready for review November 23, 2026 09:39
@outofcoffee
outofcoffee merged commit ee113a5 into main Nov 23, 2026
5 checks passed
@outofcoffee
outofcoffee deleted the env-refs-in-param-and-preset-values branch November 23, 2026 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: resolve $FOO, ${FOO} and ${FOO:-bar} env refs in PARAM lines and preset files

1 participant