Skip to content

feat(services): export runtime variables from streaming targets - #77

Open
ark-archastro wants to merge 4 commits into
mainfrom
feature/target-variable-exports
Open

feat(services): export runtime variables from streaming targets#77
ark-archastro wants to merge 4 commits into
mainfrom
feature/target-variable-exports

Conversation

@ark-archastro

Copy link
Copy Markdown
Contributor

What changed

Streaming service targets can set exports_vars = true and publish JSON snapshots over a private Unix FIFO (ASTER_EXPORT_VAR_PATH). Direct dependents consume allowlisted names through inherit_env; explicit service env, ports, Aster internals, and leading command assignments stay final. Snapshot changes restart only consumers whose effective environment changed. Invalid or missing snapshots hold those consumers until a healthy one arrives. Exporter targets cannot run outside aster services up.

The daemon protocol is 5 so ready-deadline refresh records are not treated as ready by a v4 daemon.

Verification

  • cargo fmt --all and cargo clippy --locked --all-targets --all-features -- -D warnings
  • cargo test --locked --all-features --lib (unit tests)
  • cargo test --locked --all-features --test dev_services exported_variable (exporter integration and CLI gate)
  • cargo test --locked --all-features --test integration --test watch_tests --test config_bug_bash
  • Confirm a credentials-style exporter publishes a first snapshot, a direct consumer with inherit_env restarts on an effective change, and aster run / aster watch / aster <target> reject the exporter.

Checklist

  • Tests cover the behavior change
  • Documentation is updated where needed
  • No secrets, private fixtures, or generated artifacts are included
  • Formatting, clippy, tests, and docs pass locally

Streaming service targets can set exports_vars to publish JSON snapshots
over a private FIFO. Direct dependents consume allowlisted names through
inherit_env, and exporter targets are restricted to services up.
- Exporter start failure after ready aborted the supervisor — hold
  consumers instead, matching process-exit after the first snapshot.
- 20s first-snapshot timer included prerequisites and later generations —
  start the clock when the process is running and abort only before ready.
- Colliding export keys unwound the event loop — treat collisions as a
  hold for the consumer, not a supervisor fatal error.
- aster run (and watch/executor spawn) could still execute exporters —
  reject at the CLI closure and at the spawn seams.
- Daemon ready deadline was a single 25s window for serial exporters —
  refresh it as the supervisor starts each generation.
- No tests for the services-up-only gate — added CLI and spawn coverage.

Reviewers: grok-native, review-principles
- Ready-deadline refresh used protocol 4 records an old daemon treats as
  ready — bump to protocol 5 so mixed binaries replace the daemon.
- Invalid snapshot reasons forwarded serde text that can include payload
  values — keep parser errors generic so secrets stay out of logs.
- Invalid data after a first snapshot left ready hung with no 20s abort —
  re-arm the wait and time out on unhealthy, not only missing values.
- Daemon deadline was not refreshed while a start generation ran —
  keep extending it while a start is in flight.
- Non-Unix rejected any workspace exporter, not just selected services —
  gate Unix support on the selected plan.
- --no-deps still walked exporter dependencies — skip that closure when
  the exporter would not run.

Reviewers: grok-native, codex-cli, review-principles
- Homogeneous --no-deps still collected same-project exporter deps and
  failed the run — skip dependency expansion in execute_internal too.
- Pre-ready abort still said "initial snapshot" after invalid-after-
  snapshot — report that the exporter did not become healthy.

Reviewers: grok-native, review-principles
@ark-archastro
ark-archastro requested a review from a team September 3, 2026 17:39
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