8000 feat(minimal): T136 — Carry a box's variables as one env_vars table from the loadout to the daemon by minimal-foundry[bot] · Pull Request #3691 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

feat(minimal): T136 — Carry a box's variables as one env_vars table from the loadout to the daemon - #3691

Merged
mitodrummer merged 5 commits into
mainfrom
agent/3654-carry-a-box-s-variables-as-one-env-vars-table-fr
Nov 21, 2026
Merged

mitodrummer merged 5 commits into
mainfrom
agent/3654-carry-a-box-s-variables-as-one-env-vars-table-fr

Conversation

@minimal-foundry
Copy link
Copy Markdown
Contributor

T136 — Carry a box's variables as one env_vars table from the loadout to the daemon

slice: S5
kind: enablement
covers: none
size: M
est: 190 code, 300 tests
executor: agent
difficulty: needs care
model: strongest
diagnostics: min loadout list shows, in its var column, the number of variables a loadout's env_vars sets, each once
observability: the daemon's compose record for a received entry counts env_vars in place of vars and vars_lenient
layers:
- loadout:
- crates/boxes/src/core/loadout.rs: Loadout holds one variable table; vars_lenient(), with_var_lenient and the lenient half of all_vars go
- crates/boxes/src/core/primitives.rs: StrictVarName accepts lower-case POSIX names; NotPosixName drops the vars_lenient advice
test: cargo nextest run -p boxes loadout_env_vars_hold_one_table
test: cargo nextest run -p boxes strict_var_name_accepts_lower_case_names
- wire:
- crates/boxes/src/wire/request.rs: WireBoxEntry carries one env_vars table; WireContribution carries a loadout's variables under env_vars
- crates/boxes/src/daemon/composer.rs: compose_entry sets each variable of the entry's one table over the project's, and reads a contribution's env_vars
- crates/boxes/src/client/composer.rs: the loadout contribution writes its variables under env_vars
test: cargo nextest run -p boxes wire_box_entry_carries_one_env_vars_table
test: cargo nextest run -p boxes compose_entry_sets_each_env_var
- client:
- crates/minimal/src/cmd/boxes/create.rs: the entry's wire env_vars is the expanded spec's env_vars whole, with no lenient route
- crates/minimal/src/loadouts.rs: min loadout list counts vars() alone
test: cargo nextest run -p minimal loadout_list_counts_each_env_var_once
produces: none
consumes: none
proof: A box started from a minimal.toml and a loadout whose env_vars set EDITOR and http_proxy has both in its environment, and min loadout list counts each variable once.
depends on:
- blocked by #3653

Proof

A loadout or minimal.toml whose env_vars sets EDITOR and http_proxy reads both as variables of one table: the client sends the entry's env_vars whole, the daemon sets each one over the project's value, and a loadout's variables travel under env_vars. min loadout list shows 2 var for such a loadout, so each variable counts once. Tests pin this at the unit level. No live box was started in this session.

Notes from the agent: Touched outside the layers: crates/minimal/src/tests.rs, one line (task.vars -> task.env_var 8000 s), because the WireBoxEntry field rename broke its compile. In-layer extra: create.rs keeps the old capital-letter rule for [secrets] grant names (is_secret_variable_name). It did this because StrictVarName now accepts lower case, and a_grant_whose_name_is_not_a_variable_name_is_refused failed. The spec says [secrets] names are for gominimal/arch#185. The minimald checks in box_manager.rs:269 and box_runtime.rs:851 still use StrictVarName, so the daemon now accepts a lower-case grant name. The client refuses it first. Those checks are outside the layers and are not changed. WireContribution keeps the Rust field vars with serde rename to env_vars, because minimald builds that struct in many places outside the layers. The wire name changes, so an older daemon and a newer client do not agree on the contribution. Not changed: boxes/src/core/expansion.rs validate_strict_var_name still allows only upper-case names in $VAR pattern expansion, and its doc says [A-Z_][A-Z0-9_]*. mfile::Session still has vars_lenient, and minimald still folds stack variables into it. VarError::NotPosixName now prints: variable name <n> is not POSIX-shaped: a name holds only ASCII letters, digits and _, and does not start with a digit. Other runs: cargo nextest run -p boxes (655 passed), cargo nextest run -p minimal (all passed after the secret-name fix), cargo clippy -p minimald --all-targets (clean), and a filtered minimald run (35 passed).

Tests

line exit tail
cargo nextest run -p boxes loadout_env_vars_hold_one_table 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p boxes strict_var_name_accepts_lower_case_names 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p boxes wire_box_entry_carries_one_env_vars_table 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p boxes compose_entry_sets_each_env_var 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p minimal loadout_list_counts_each_env_var_once 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt

Verify

min task run agent-verify exited 100, so this PR is a draft.

3) minimal::bin/min tests::invalid_project_file_for_box_spec_says_spec_cannot_show
        PASS [   0.006s] (1858/1883) minimal::bin/min tests::invalid_project_file_prints_toml_error_once
        PASS [   0.006s] (1859/1883) minimal::bin/min tests::invalid_project_file_prints_toml_error_once_for_io
        PASS [   0.006s] (1860/1883) minimal::bin/min tests::loadout_not_found_exits_4
        PASS [   0.006s] (1861/1883) minimal::bin/min tests::local_host_not_found_exits_4
        PASS [   0.006s] (1862/1883) minimal::bin/min tests::machine_mode_answers_write_failures
        PASS [   0.006s] (1863/1883) minimal::bin/min tests::machine_mode_error_object_is_one_stamped_line
        PASS [   0.008s] (1864/1883) minimal::bin/min tests::machine_mode_error_line_keeps_an_empty_hint
        PASS [   0.005s] (1865/1883) minimal::bin/min tests::machine_mode_error_object_on_stderr
        PASS [   0.005s] (1866/1883) minimal::bin/min tests::machine_mode_names_the_grant_refusal_code
        PASS [   0.005s] (1867/1883) minimal::bin/min tests::machine_output_mode_keys_on_the_output_flag
        PASS [   0.006s] (1868/1883) minimal::bin/min tests::misplaced_run_flag_exits_2
        PASS [   0.005s] (1869/1883) minimal::bin/min tests::network_flag_refusal_exits_2
        PASS [   0.005s] (1870/1883) minimal::bin/min tests::prune_off_tty_needs_yes_exits_2
        PASS [   0.011s] (1871/1883) minimal::bin/min tests::project_file_not_found_exits_4
        PASS [   0.006s] (1872/1883) minimal::bin/min tests::resume_and_session_attach_refusals_map_to_exit_codes
        PASS [   0.008s] (1873/1883) minimal::bin/min tests::rm_running_box_refuses_naming_force_with_exit_2
        PASS [   0.008s] (1874/1883) minimal::bin/min tests::row_not_back_exit_codes
        PASS [   0.007s] (1875/1883) minimal::bin/min tests::run_verbs_and_wait_timeout_return_124_with_code_timeout
        PASS [   0.006s] (1876/1883) minimal::bin/min tests::start_entry_refusals_exit_with_their_codes
        PASS [   0.007s] (1877/1883) minimal::bin/min tests::task_file_invalid_exits_3
        PASS [   0.005s] (1878/1883) minimal::bin/min tests::task_network_key_a_task_does_not_apply_exits_3
        PASS [   0.006s] (1879/1883) minimal::bin/min tests::task_not_found_exits_4
        PASS [   0.005s] (1880/1883) minimal::bin/min tests::task_run_is_a_stdout_contract
        PASS [   0.006s] (1881/1883) minimal::bin/min tests::type_refusals_exit_3_and_4
        PASS [   2.063s] (1882/1883) minimal::named_vm named_vm_reaches_autospawn
  stdout ───

    running 1 test
    test exec_run_attach_and_task_run_share_the_commands_trace ... FAILED

    failures:

    failures:
        exec_run_attach_and_task_run_share_the_commands_trace

    test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 5 filtered out; finished in 13.31s

  stderr ───

    ]
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

  Cancelling due to test failure: 
────────────
error: test run failed

Base

The base branch moved while the coder worked and was merged in before the tests ran. These files changed on BOTH sides since the branch point — read them first, because a rewrite from a stale reading can undo a merge without a conflict:

  • crates/minimal/src/cmd/boxes/create.rs
  • crates/minimal/src/tests.rs

Out of scope

These files are outside the task's layers:, so this PR is a draft:

  • crates/minimal/src/tests.rs

Closes #3654

A loadout holds one variable table, StrictVarName accepts lower-case
POSIX names, WireBoxEntry carries one env_vars table, and a
contribution carries its variables under env_vars on the wire.
The entry's wire env_vars is the expanded spec's env_vars whole, and
min loadout list counts a loadout's variables from vars() alone.
StrictVarName now accepts lower-case names for env_vars. A [secrets]
grant name keeps its own rule until gominimal/arch#185 decides it.
@coderabbitai
coderabbitai Bot commented Nov 20, 2026 •
Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

Ask an organization administrator to verify that this bot has an active assigned CodeRabbit review seat. See the seat-assignment guide. After the seat is confirmed, request a review again.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 03eb4098-2771-413b-b37a-0f7cb8c3be39

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

StrictVarName now accepts lower-case POSIX names, so my_var in the
session defaults lands in vars, not vars_lenient.
@minimal-foundry
Copy link
Copy Markdown
Contributor Author

Round 1 of 10 on a failed check suite, pushed as 35ce73fd2b7b.

line exit tail
cargo nextest run -p boxes loadout_env_vars_hold_one_table 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p boxes strict_var_name_accepts_lower_case_names 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p boxes wire_box_entry_carries_one_env_vars_table 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p boxes compose_entry_sets_each_env_var 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p minimal loadout_list_counts_each_env_var_once 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt

Verify min task run agent-verify exited 100.

8) minimal::bin/min tests::invalid_project_file_for_box_spec_says_spec_cannot_show
        PASS [   0.008s] (2093/2118) minimal::bin/min tests::invalid_project_file_prints_toml_error_once
        PASS [   0.007s] (2094/2118) minimal::bin/min tests::invalid_project_file_prints_toml_error_once_for_io
        PASS [   0.007s] (2095/2118) minimal::bin/min tests::loadout_not_found_exits_4
        PASS [   0.007s] (2096/2118) minimal::bin/min tests::local_host_not_found_exits_4
        PASS [   0.009s] (2097/2118) minimal::bin/min tests::machine_mode_answers_write_failures
        PASS [   0.008s] (2098/2118) minimal::bin/min tests::machine_mode_error_line_keeps_an_empty_hint
        PASS [   0.009s] (2099/2118) minimal::bin/min tests::machine_mode_error_object_is_one_stamped_line
        PASS [   0.007s] (2100/2118) minimal::bin/min tests::machine_mode_error_object_on_stderr
        PASS [   0.006s] (2101/2118) minimal::bin/min tests::machine_output_mode_keys_on_the_output_flag
        PASS [   0.008s] (2102/2118) minimal::bin/min tests::machine_mode_names_the_grant_refusal_code
        PASS [   0.008s] (2103/2118) minimal::bin/min tests::misplaced_run_flag_exits_2
        PASS [   0.008s] (2104/2118) minimal::bin/min tests::network_flag_refusal_exits_2
        PASS [   0.007s] (2105/2118) minimal::bin/min tests::project_file_not_found_exits_4
        PASS [   0.007s] (2106/2118) minimal::bin/min tests::prune_off_tty_needs_yes_exits_2
        PASS [   0.006s] (2107/2118) minimal::bin/min tests::resume_and_session_attach_refusals_map_to_exit_codes
        PASS [   0.006s] (2108/2118) minimal::bin/min tests::rm_running_box_refuses_naming_force_with_exit_2
        PASS [   0.007s] (2109/2118) minimal::bin/min tests::row_not_back_exit_codes
        PASS [   0.008s] (2110/2118) minimal::bin/min tests::run_verbs_and_wait_timeout_return_124_with_code_timeout
        PASS [   0.007s] (2111/2118) minimal::bin/min tests::start_entry_refusals_exit_with_their_codes
        PASS [   0.006s] (2112/2118) minimal::bin/min tests::task_file_invalid_exits_3
        PASS [   0.006s] (2113/2118) minimal::bin/min tests::task_network_key_a_task_does_not_apply_exits_3
        PASS [   0.007s] (2114/2118) minimal::bin/min tests::task_not_found_exits_4
        PASS [   0.006s] (2115/2118) minimal::bin/min tests::task_run_is_a_stdout_contract
        PASS [   0.008s] (2116/2118) minimal::bin/min tests::type_refusals_exit_3_and_4
        PASS [   2.057s] (2117/2118) minimal::named_vm named_vm_reaches_autospawn
  stdout ───

    running 1 test
    test exec_run_attach_and_task_run_share_the_commands_trace ... FAILED

    failures:

    failures:
        exec_run_attach_and_task_run_share_the_commands_trace

    test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 5 filtered out; finished in 13.04s

  stderr ───

    ]
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

  Cancelling due to test failure: 
────────────
error: test run failed

Outside the task's layers::

  • crates/mfile/src/expand.rs
  • crates/minimal/src/tests.rs

Converted to a draft: verify exited 100; outside the task's layers:: crates/mfile/src/expand.rs, crates/minimal/src/tests.rs.

A box started from a minimal.toml and a loadout whose env_vars set EDITOR and http_proxy has both in its environment, and min loadout list counts each variable once. This round makes the CI tests lane pass again: the one failing test now expects the new behaviour.

Notes from the agent: The CI tests job failed on mfile expand::tests::env_vars_read_from_every_layer. That test expected the lower-case name my_var in the session defaults to go to vars_lenient. This task makes StrictVarName accept lower-case POSIX names, so my_var now reads into vars. I updated the assertion in crates/mfile/src/expand.rs. That file is outside the task's layers, but the test pins behaviour that this task changes on purpose. ci-linux-native-success is only the lane aggregator, and it failed because the tests job failed. I did not re-run the full mfile suite after the fix. Its other 889 tests passed before the change, and the change touches only this test. I did not run the workspace-wide suite.

@agent-137
agent-137 marked this pull request as ready for review November 21, 2026 01:07
@agent-137
agent-137 requested a review from a team as a code owner November 21, 2026 01:07
@minimal-foundry
minimal-foundry Bot commented Nov 21, 2026 •
Copy link
Copy Markdown
Contributor Author

Approved: no findings at 35ce73fd2b7b.

Nothing to do.

Verdict APPROVE, posted as a comment: the App cannot review its own pull request; the check and the label carry it.

Clobber: none seen.

@minimal-foundry minimal-foundry Bot left a comment
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

minimal-review — approved

Verdict APPROVE — No findings.

Panel: 3 of 3 personas ran (correctness, security, supply-chain).

@minimal-foundry minimal-foundry Bot added the review:approved minimal-review approved the current head label Nov 21, 2026
@minimal-arch minimal-arch Bot 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.

arch-review: PASS · the full ruling

The change conforms to the design. A loadout and an expanded entry now carry one env_vars table to the daemon. The daemon sets each variable by name over the project's value. This matches [loadouts.env_vars] and the merge-by-name rule in the minimal.toml layout section. The wire rename has no alias, but the must_match_version gate refuses a skewed daemon before the contribution is sent. The design states no case rule for [secrets] names. The client and the daemon now apply different rules there, and gominimal/arch#185 must decide which is correct.

Ruled at 35ce73f against gominimal/arch@4f2eb87d5d12 by claude-opus-5-5.

@mitodrummer mitodrummer left a comment
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approved.

@mitodrummer
mitodrummer added this pull request to the merge queue Nov 21, 2026
Merged via the queue into main with commit 9ef3a4b Nov 21, 2026
40 checks passed
@mitodrummer
mitodrummer deleted the agent/3654-carry-a-box-s-variables-as-one-env-vars-table-fr branch November 21, 2026 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review:approved minimal-review approved the current head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

T136 — Carry a box's variables as one env_vars table from the loadout to the daemon

1 participant

0