Skip to content

feat(minimal): T41 — Box spec lists a box's hooks with their declarer - #3490

Draft
minimal-foundry[bot] wants to merge 1 commit into
mainfrom
agent/3283-box-spec-lists-a-box-s-hooks-with-their-declarer
Draft

minimal-foundry[bot] wants to merge 1 commit into
mainfrom
agent/3283-box-spec-lists-a-box-s-hooks-with-their-declarer

Conversation

@minimal-foundry

Copy link
Copy Markdown
Contributor

T41 — Box spec lists a box's hooks with their declarer

slice: S5
kind: task
covers: BCLI-022
size: S
est: 70 code, 80 tests
executor: agent
difficulty: routine
model: standard
diagnostics: none new
observability: none new
layers:
- client:
- crates/minimal/src/cmd/box_spec.rs: min box spec <box> lists the stored lifecycle hooks, with the event, the command, its description and who declared it (BOX-179's declared_by)
- crates/minimal/src/tests.rs: the in-process minimald test harness gains this layer's tests
test: cargo nextest run -p minimal box_spec_box_lists_hooks
produces: none
consumes: none
proof: min box spec <box> lists each stored lifecycle hook with its event, command, description and declarer.
depends on:
- blocked by #2906
- blocked by #3409

Proof

min box spec <box> now opens its TOML render with a # Lifecycle hooks: comment list. It has one line for each event of each stored hook, with the event, the description, the command and its declarer, for example # on_attach: echo rust (from loadout rust). A box stored with an empty hook list shows # Lifecycle hooks: none.

Notes from the agent: The list is in the TOML render only, as comment lines, so the output stays valid TOML. The -o json and -o yaml renders already carry the stored lifecycle_hooks with declared_by unchanged, so this change does not touch them. An inline command with more than one line shows its first line and then .... An external script shows as script <path>. A spec stored before hooks were stored has no lifecycle_hooks key and shows no list. The existing test box_spec_box_renders_stored_copy still passes. cargo clippy -p minimal --all-targets is clean.

Tests

line exit tail
cargo nextest run -p minimal box_spec_box_lists_hooks 0 warning: unknown fields in task runtime-implement-test-0: network help: do you need to update to a newer version of minimal? Running task runtime-implement-test-0 in box runtime-implement-test-0-1... Compiling paths v0.0.1 (/workbench/crates/paths) Compiling ot v0.0.1 (/workbench/crates/ot)

Verify

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

54s] ( 700/1173) minimal tests::box_cp_reads_stopped_box_as_box_017
        PASS [   0.018s] ( 701/1173) minimal tests::box_exec_detach_prints_id_and_returns
        PASS [   3.049s] ( 702/1173) minimal tests::box_attach_reattaches_pty_box
        PASS [   2.737s] ( 703/1173) minimal tests::box_attach_without_address_picks_running_else_sole_retained
        PASS [   2.457s] ( 704/1173) minimal tests::box_attach_without_address_unreachable_host_exit7
        FAIL [   0.858s] ( 705/1173) minimal tests::box_exec_show_logs_wait_stop_end_to_end
  stdout ───

    running 1 test
    test tests::box_exec_show_logs_wait_stop_end_to_end ... FAILED

    failures:

    failures:
        tests::box_exec_show_logs_wait_stop_end_to_end

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

  stderr ───

    thread 'tests::box_exec_show_logs_wait_stop_end_to_end' (4065) panicked at crates/minimal/src/tests.rs:17532:36:
    the exec stop: web has no exec 01928a3b-4c5d-7e6f-8a9b-0c1d2e3f5c01. Run `min box show web` to see the commands that run in the box now.
    commands run so far:
    $ min box exec web -t -- sh -i
      stdout: "$ "
      stderr: "01928a3b-4c5d-7e6f-8a9b-0c1d2e3f5c01\n"
      exit: 0
    $ min box exec web --detach -- sh -c 'echo building; sleep 600'
      stdout: "01928a3b-4c5d-7e6f-8a9b-0c1d2e3f5c02\n"
      stderr: ""
      exit: 0
    $ min box show web
      stdout: "ID:         01a1e86c-ce67-7b84-a247-f81c2bada52d\nName:       web\nType:       task\nParent:     -\nProject:    /tmp/.tmpjCTbdT\nState:      running\nIdentity:   none\nProvider:   local-minvmd\nHost:       alpha.local-minvmd0\nLive execs:\n  01928a3b-4c5d-7e6f-8a9b-0c1d2e3f5c01  tty       sh -i\n  01928a3b-4c5d-7e6f-8a9b-0c1d2e3f5c02  detached  sh -c 'echo building; sleep 600'\n"
      stderr: ""
      exit: 0
    $ min box logs web --exec 01928a3b-4c5d-7e6f-8a9b-0c1d2e3f5c02
      stdout: "building\n"
      stderr: ""
      exit: Ok(0)
    $ min box stop web --exec 01928a3b-4c5d-7e6f-8a9b-0c1d2e3f5c01
      stdout: ""
      stderr: ""
      exit: Err("web has no exec 01928a3b-4c5d-7e6f-8a9b-0c1d2e3f5c01. Run `min box show web` to see the commands that run in the box now.")

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

  Cancelling due to test failure: 3 tests still running
        PASS [   1.176s] ( 706/1173) minimal tests::box_exec_runs_command_and_exits_with_its_code
        PASS [   0.322s] ( 707/1173) minimal tests::box_exec_t_attach_sends_configured_session_keys
        PASS [   0.928s] ( 708/1173) minimal tests::box_exec_t_invalid_session_keys_starts_no_exec
────────────
     Summary [  23.745s] 708/1173 tests run: 707 passed, 1 failed, 2 skipped
        FAIL [   0.858s] ( 705/1173) minimal tests::box_exec_show_logs_wait_stop_end_to_end
warning: 465/1173 tests were not run due to test failure (run with --no-fail-fast to run all tests, or run with --max-fail)
error: test run failed

Closes #3283

The TOML render of a box's stored spec now opens with a comment list of
its lifecycle hooks: one line for each event, with the command, the
description and who declared the hook (minimal.toml or a loadout).
The list is comments, so the render stays valid TOML (BCLI-022, BOX-179).
@coderabbitai

coderabbitai Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

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: b738edae-b55d-4a68-b85b-dd7fdcf817a6

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

Use the checkbox below for a quick retry:

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

This branch has not been deployed

No deployments
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.

T41 — Box spec lists a box's hooks with their declarer

0 participants