Repository navigation
feat: T130 — The command that waits for a box copies its declared exports back to the project - #3448
minimal-foundry[bot] wants to merge 12 commits into
Conversation
An absolute path, a path with a .. component, or a path that names the project root fails the expansion with exit 3 (BOX-189), so no box is created. Adds file_export_paths for the client copy.
An attached run, an attach and min box wait copy each declared [[file_exports]] path from /workbench in the ended box to the project. A folder export creates its tree and deletes nothing. Each file is written under a temporary name and renamed into place (BOX-185 to 188).
Covers the wait and attach copy, a detach and a stop that copy nothing, a folder export that deletes nothing, and the atomic write of each file (BOX-185 to BOX-188).
The command that waits for a box now copies [[file_exports]] on the client (BOX-185), so the daemon no longer lists it as unenforced.
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
…d-that-waits-for-a-box-copies-its-decl # Conflicts: # crates/minimal/src/tests.rs
|
A merge of main before round 1, not counted against the cap (1 of 3), pushed as Resolved conflicts in:
Verify Outside the task's
Converted to a draft: something above needs a person before review. A task box whose entry declares a file and a directory export ends, and the waiting command leaves both in the project. A detached run copies nothing. An export path outside the project fails before any box is created. The branch now merges cleanly with main. Notes from the agent: Revise round: resolved the one conflict in crates/minimal/src/tests.rs. Both sides only added tests at the end of the file: this branch's file export tests and main's expander_skew_reports_and_continues. The resolution keeps both, unchanged. The merge commit is fcc1411. cargo clippy -p minimal --all-targets is clean after the merge, and main's expander_skew_reports_and_continues also passes. |
|
Reviewed: no findings; approval withheld, 12 threads unresolved at APPROVE withheld: 12 unresolved threads — minimal-foundry[bot] crates/minimal/src/cmd/boxes/exports.rs:624, minimal-arch[bot] crates/minimal/src/cmd/boxes/exports.rs:454, minimal-arch[bot] crates/minimal/src/cmd/boxes/exports.rs, minimal-arch[bot] crates/minimal/src/cmd/boxes/attach.rs:1525, minimal-arch[bot] crates/minimal/src/cmd/boxes/wait.rs:242, …. Resolving the last thread releases the approval on this head. Resolve the open threads. Resolving the last one releases the approval on this head; no new review is required. Verdict APPROVE, posted as a comment: the App cannot review its own pull request; the check and the label carry it. Clobber: none seen in the touched code. |
| ExportKind::File | ||
| } else if file_type.is_symlink() { | ||
| // The file service refuses a link that leaves the box's | ||
| // folders, so a link it follows stays inside them. | ||
| match self.kind(&format!("{path}/{name}")).await { | ||
| Ok(kind) => kind, | ||
| Err(e) => return Err(e), | ||
| } | ||
| } else { | ||
| tracing::debug!( | ||
| path, |
There was a problem hiding this comment.
MEDIUM · correctness · confidence 0.60 · in BoxFiles::list
One dangling symlink inside a folder export aborts the whole export. list calls self.kind on each link, metadata returns NoSuchFile, and that error propagates out of read_tree through ?. copy_one then reports 'a folder inside ... is no longer in the box', and nothing is copied. Skip the link, or treat it as a failed entry, so the other files still come back.
What the reviewer checked
exports.rs list():
file_type.is_symlink() => match self.kind(...).await { Ok(kind) => kind, Err(e) => return Err(e) }; read_tree:let mut names = source.list(&dir).await?;
Hand this to an agent
Act on a code-review finding.
File: crates/minimal/src/cmd/boxes/exports.rs
Lines: 455-465
Category: correctness
Severity: medium (reviewer confidence 0.60)
Finding:
One dangling symlink inside a folder export aborts the whole export. `list` calls `self.kind` on each link, `metadata` returns NoSuchFile, and that error propagates out of `read_tree` through `?`. `copy_one` then reports 'a folder inside ... is no longer in the box', and nothing is copied. Skip the link, or treat it as a failed entry, so the other files still come back.
First verify this against the code yourself. It is model output and
may be wrong. If it is wrong, or the tradeoff was deliberate, say so
and change nothing.
👍 useful · 👎 noise — react to tell the reviewer. Replying works too, and says more.
There was a problem hiding this comment.
Addressed in bc14088cc58a: BoxFiles::list now skips a link whose target is not found (debug log), so one dangling link no longer aborts the folder export. Other read failures still propagate.
…d-that-waits-for-a-box-copies-its-decl
There was a problem hiding this comment.
arch-review: CONDITIONS · 4 conditions · the full ruling
The copy is in the right place, and BOX-186 and BOX-189 conform. This change makes exports live, but the copy does not check symlinks at copy time. Section File exports line 516 requires that check on both sides. A symlink committed in a cloned project can send the write outside the project root (C1). A box link into the box's home passes the file service (C2). attach and wait write into the record's project root from any project, and line 514 forbids that (C3). Name each rule that later tasks own (125, once per end, file_exported) with its issue in the PR body (C4).
Ruled at fcc1411 against gominimal/arch@327e1b57d16b by claude-opus-5-5.
| }; | ||
| let rel = parts.join("/"); | ||
| let src = format!("{BOX_PROJECT_DIR}/{rel}"); | ||
| let dest = parts |
There was a problem hiding this comment.
C1 · This destination is not resolved before the write. create_dir_all and tempfile_in follow a symlink in the project, so a committed link sends the write outside the project root. Section File exports line 516 forbids this. Canonicalize each destination of the export first, and write nothing for the export if one escapes.
There was a problem hiding this comment.
Addressed in 6184244d35ae: copy_one now resolves every destination (the export's dest, and each folder and file of a folder export) with canonicalize before any write, and writes nothing for an export that leads outside the project root. New test: export_through_escaping_symlink_writes_nothing.
| } else if file_type.is_file() { | ||
| ExportKind::File | ||
| } else if file_type.is_symlink() { | ||
| // The file service refuses a link that leaves the box's |
There was a problem hiding this comment.
C2 · The file service serves /workbench and the box's home. A link into the home passes its check. Line 516 limits the source to the box's copy of the project. Canonicalize each source through sftp.canonicalize, and refuse the export unless the path is under /workbench. Remove this comment.
There was a problem hiding this comment.
Addressed in 6184244d35ae: Each source and every folder and file of its tree is resolved through SftpSession::canonicalize and must be /workbench or under it, else the export writes nothing. The comment in BoxFiles::list is removed. New test: export_source_symlink_out_of_workbench_writes_nothing.
| if let BoxAfterAttach::Listed(entry) = &ended | ||
| && matches!(entry.state.as_str(), "stopped" | "exited") | ||
| { | ||
| let root = entry.project_root.as_ref(); |
There was a problem hiding this comment.
C3 · This root comes from the box record, not from the command. Line 514 says a command copies only when its own project root is the one the record names. Discover the command's root, compare the two, and copy nothing on a mismatch. Print one stderr line that names the box and its project folder.
There was a problem hiding this comment.
Addressed in 6184244d35ae: The attach now finds its own project root from the cwd and passes it to attach_on_hosts. copy_box_exports copies only when it equals the record's project_root, else it prints one line naming the box and that folder.
| if let Some(ended) = wait_exit(&shown.record, target) { | ||
| // BOX-185: the wait copies the box's declared exports, on | ||
| // every end, before it gives back the box's code. | ||
| let root = shown.record.project_root.as_ref(); |
There was a problem hiding this comment.
C3 · The same issue as in attach.rs: the wait writes into the record's root from any cwd. Pass the command's own project root into box_wait_on_hosts, and copy only when it equals shown.record.project_root.
There was a problem hiding this comment.
Addressed in 6184244d35ae: cmd_box_wait passes the command's own project root into box_wait_on_hosts, and the copy happens only when it equals shown.record.project_root. New test: exports_not_copied_from_another_project.
| root.map(|root| std::path::Path::new(root.as_str())), | ||
| &mut std::io::stderr(), | ||
| ) | ||
| .await; |
There was a problem hiding this comment.
C4 · The outcomes are discarded, so a skipped export does not give exit 125 (line 517). Nothing claims the end, so a later wait copies again (line 512). Nothing reports the outcome as file_exported (line 518). These rules can stay for later tasks, but the PR body must name each one with its issue.
There was a problem hiding this comment.
|
/revise Arch ruling 1313 on fcc1411 set four conditions. Karl ruled on 2026-11-15 that C1, C2 and C3 are done in this PR: BOX-192 and BOX-196 move here from T131 (#3445), and BOX-199 moves here from T133 (#3447). Do all four. The arch conditions C1 to C3, in full:
Keep the tests this task names passing, and add the tests C1, C2 and C3 ask for. Do not rewrite history and do not force-push. |
|
That Nothing to type again: the command gets a rocket when its round starts, or a refusal that names the reason. No round was counted for it yet. |
|
/revise Addendum to the previous /revise note: use the exact text and test names that the plan fixes for C1, C2 and C3. Each message is one stderr line. The test named next to it pins the text.
|
|
That Nothing to type again: the command gets a rocket when its round starts, or a refusal that names the reason. No round was counted for it yet. |
A link to nothing inside a folder export no longer aborts the whole copy. An attach that ends with another code now waits for the box to leave running only when the box declares an export.
|
/revise Addendum to the two held notes: the runtime caps a task at 6 IDs, so BOX-192, BOX-196 and BOX-199 now belong to a new task, T134 (#3453), and not to T130. The work in the held notes does not change, and this PR still does all of it. In the PR body, add one line that says this PR also delivers T134 (#3453) and covers BOX-192, BOX-196 and BOX-199. Do not use a closing keyword for #3453. |
|
That Nothing to type again: the command gets a rocket when its round starts, or a refusal that names the reason. No round was counted for it yet. |
|
Round 1 of 10 on the runtime's review findings, pushed as
Verify Outside the task's
Converted to a draft: something above needs a person before review. Review threads the coder judged:
A task box whose entry declares a file and a directory export ends, and the waiting command leaves both in the project. A link to nothing inside the directory no longer stops the other files from coming back. A detached run copies nothing. An export path outside the project fails before any box is created. Notes from the agent: Revise round 1. Both review threads are fixed in exports.rs and attach.rs. No new test covers the dangling-link skip, because it is in the SFTP-backed BoxFiles source, and the unit tests use a fake source. The settle change adds one GetBoxSpec read when an attach ends with a code other than 0 or 254 and the box still reads running. |
| crate::cmd::copy_box_exports( | ||
| &mut client, | ||
| id, | ||
| &session_name, | ||
| Some(std::path::Path::new(abs_path.as_str())), | ||
| &mut std::io::stderr(), | ||
| ) | ||
| .await; |
There was a problem hiding this comment.
MEDIUM · correctness · confidence 0.60 · in run_entry
The attached run copies exports on every TaskBoxEnd::Keep, but task_box_end returns Keep for exit == None (a dropped connection) without reading the record. The box can then still run, and the copy overwrites project files with half-written content from a live box. attach.rs copies only when the state is stopped or exited. Apply the same state check here before the copy.
What the reviewer checked
task.rs:2016
None => TaskBoxEnd::Keep(doc: a client that loses its run never ends the box, BOX-015); new call at 1897 has no state check.
Hand this to an agent
Act on a code-review finding.
File: crates/minimal/src/task.rs
Lines: 1897-1904
Category: correctness
Severity: medium (reviewer confidence 0.60)
Finding:
The attached run copies exports on every `TaskBoxEnd::Keep`, but `task_box_end` returns Keep for `exit == None` (a dropped connection) without reading the record. The box can then still run, and the copy overwrites project files with half-written content from a live box. `attach.rs` copies only when the state is `stopped` or `exited`. Apply the same state check here before the copy.
First verify this against the code yourself. It is model output and
may be wrong. If it is wrong, or the tradeoff was deliberate, say so
and change nothing.
👍 useful · 👎 noise — react to tell the reviewer. Replying works too, and says more.
There was a problem hiding this comment.
Addressed in 7fbe33b5ed6f: The attached run now reads the record and copies only when the box is stopped or exited, so a dropped connection with a live box copies nothing.
An export now writes nothing when a destination resolves through a link outside the project root (BOX-192), or when a source in the box resolves outside /workbench (BOX-196). A waiting command copies only when its own project root is the one in the box's record (BOX-199).
|
Round 2 of 10 on a /revise note, pushed as
Verify Outside the task's
Converted to a draft: something above needs a person before review. Review threads the coder judged:
A task box whose entry declares a file and a folder export ends, and Notes from the agent: PR body lines, for the runner (I cannot edit the body): (1) This PR also delivers T134 (#3453) and covers BOX-192, BOX-196 and BOX-199. (2) Residuals, each owned by a later task: exit 125 for an export that was not copied (architecture.md line 517) is BOX-193 and BOX-194 in T131 (#3445) and BOX-197 in T132 (#3446). The once-for-each-end claim (line 512) is BOX-198, BOX-201 and BOX-202 in T132 (#3446). The Design choices: |
| // BOX-185: an attached run copies the box's | ||
| // declared exports once the box ended. A | ||
| // `--detach` run returned above and copies | ||
| // nothing (BOX-186). | ||
| crate::cmd::copy_box_exports( | ||
| 10BC8 &mut client, | ||
| id, | ||
| &session_name, | ||
| Some(std::path::Path::new(abs_path.as_str())), | ||
| Some(std::path::Path::new(abs_path.as_str())), | ||
| &mut std::io::stderr(), | ||
| ) | ||
| .await; | ||
| } |
There was a problem hiding this comment.
MEDIUM · correctness · confidence 0.50 · in run_entry
This copy runs on every TaskBoxEnd::Keep. task_box_end returns Keep when exit is None (the bridge ended with no exit status) without reading the record. The box can then still run. The run copies files from a running box, so the project can get half-written outputs, and the export is reported as done. Copy only when the record shows the box ended, as attach.rs does with its stopped or exited check.
What the reviewer checked
task.rs:
None => TaskBoxEnd::Keepin task_box_end; copy_box_exports is called unconditionally inside the Keep arm.
Hand this to an agent
Act on a code-review finding.
File: crates/minimal/src/task.rs
Lines: 1893-1906
Category: correctness
Severity: medium (reviewer confidence 0.50)
Finding:
This copy runs on every `TaskBoxEnd::Keep`. `task_box_end` returns `Keep` when `exit` is `None` (the bridge ended with no exit status) without reading the record. The box can then still run. The run copies files from a running box, so the project can get half-written outputs, and the export is reported as done. Copy only when the record shows the box ended, as attach.rs does with its `stopped` or `exited` check.
First verify this against the code yourself. It is model output and
may be wrong. If it is wrong, or the tradeoff was deliberate, say so
and change nothing.
👍 useful · 👎 noise — react to tell the reviewer. Replying works too, and says more.
There was a problem hiding this comment.
Addressed in 7fbe33b5ed6f: Same fix as the sibling thread: run_entry gates copy_box_exports on a Stopped or Exited record state.
| pub(crate) async fn copy_exports<S, E>( | ||
| source: &mut S, | ||
| paths: &[String], | ||
| project_root: &std::path::Path, | ||
| label: &str, | ||
| err: &mut E, | ||
| ) -> Vec<ExportOutcome> | ||
| where | ||
| S: ExportSource, | ||
| E: std::io::Write, | ||
| { | ||
| let mut outcomes = Vec::with_capacity(paths.len()); | ||
| for path in paths { | ||
| let mut outcome = ExportOutcome { | ||
| path: path.clone(), | ||
| copied: false, | ||
| files: Vec::new(), | ||
| }; | ||
| let reason = copy_one(source, path, project_root, &mut outcome).await; | ||
| match &reason { | ||
| None => outcome.copied = true, | ||
| Some(line) => { | ||
| let _ = writeln!(err, "{}", line.text(path, label)); | ||
| } | ||
| } | ||
| tracing::info!( | ||
| box_label = label, | ||
| export = %path, | ||
| copied = outcome.copied, | ||
| files = outcome.files.len(), | ||
| "file export" | ||
| ); | ||
| outcomes.push(outcome); | ||
| } | ||
| outcomes | ||
| } |
There was a problem hiding this comment.
MEDIUM · correctness · confidence 0.60 · in copy_exports
The PR states that the box's record carries a file_exported event for each export. No code emits one. rg file_exported finds nothing. The ExportOutcome list (path, copied, files with size and sha256) is built, and all three call sites in attach.rs, wait.rs and task.rs drop it. The data exists for the event, but nothing records it.
What the reviewer checked
wait.rs:
copy_box_exports(...).await;result unused; same in attach.rs and task.rs.rg -n file_exported cratesreturns no hit.
Hand this to an agent
Act on a code-review finding.
File: crates/minimal/src/cmd/boxes/exports.rs
Lines: 366-401
Category: correctness
Severity: medium (reviewer confidence 0.60)
Finding:
The PR states that the box's record carries a `file_exported` event for each export. No code emits one. `rg file_exported` finds nothing. The `ExportOutcome` list (path, copied, files with size and sha256) is built, and all three call sites in attach.rs, wait.rs and task.rs drop it. The data exists for the event, but nothing records it.
First verify this against the code yourself. It is model output and
may be wrong. If it is wrong, or the tradeoff was deliberate, say so
and change nothing.
👍 useful · 👎 noise — react to tell the reviewer. Replying works too, and says more.
There was a problem hiding this comment.
Disputed — not addressed: True that nothing emits file_exported, but that is BOX-195, which this task does not cover. It needs a report RPC in crates/minimald-rpc and a daemon handler in minimald, outside this task's layers. The interim is now stated in the copy_box_exports doc comment.
There was a problem hiding this comment.
arch-review: CONDITIONS · 2 conditions · the full ruling
The compare closes the symlink checks of line 516 and the project-root check of line 514. BOX-185 to BOX-189 now conform. File exports also requires the claim of line 512, exit 125 of line 517 and the file_exported record of line 518, and this head builds none of them. Without the claim, a second min box wait replaces a newer project file. Name an issue for each gap in the PR body (C1). Mark the interim in copy_box_exports and at the three call sites (C2).
Ruled at 6184244 against gominimal/arch@327e1b57d16b by claude-opus-5-5.
| } | ||
|
|
||
| /// [`copy_box_exports_on_host`] over a connected `client`. | ||
| pub(crate) async fn copy_box_exports<E: std::io::Write>( |
There was a problem hiding this comment.
C2 · This function copies again on each call, and its outcomes go nowhere. Line 512 says a later wait must not replace a newer file. Line 517 asks for 125, and line 518 asks for a file_exported event. State this interim in the doc comment, with its flip condition and the issues of C1.
There was a problem hiding this comment.
Addressed in 7fbe33b5ed6f: The copy_box_exports doc comment now states the interim (copies on each call, outcomes unused) and its flip condition, citing BOX-198, BOX-195 and BOX-193.
| // declared exports once the box ended. A | ||
| // `--detach` run returned above and copies | ||
| // nothing (BOX-186). | ||
| crate::cmd::copy_box_exports( |
There was a problem hiding this comment.
C1 · The Vec<ExportOutcome> is dropped here, so a skipped export after a 0 end still exits 0. Line 517 and line 371 say the command returns 125. That is BOX-193, outside this task. Name its issue in the PR body (C1), and bind the result to _outcomes with a comment that points to it (C2).
There was a problem hiding this comment.
Addressed in 7fbe33b5ed6f: task.rs binds the result to _outcomes with a comment that names BOX-193 and BOX-195 as later tasks.
| // every end, before it gives back the box's code. It copies | ||
| // only into its own project (BOX-199). | ||
| let root = shown.record.project_root.as_ref(); | ||
| copy_box_exports( |
There was a problem hiding this comment.
C2 · Each min box wait on an ended box copies again here. Line 512 says no later command copies an export whose result the record holds. Bind the result to _outcomes, and add a comment that points to the BOX-198 and BOX-195 issues of C1.
There was a problem hiding this comment.
Addressed in 7fbe33b5ed6f: wait.rs binds the result to _outcomes with a comment that names BOX-198, BOX-195 and BOX-193 as later tasks.
…d-that-waits-for-a-box-copies-its-decl
A run with no exit status lost its connection, and its box can still run. Read the record first, as the attach does. Mark the unused export outcomes as interim and name BOX-193, BOX-195 and BOX-198.
|
Round 3 of 10 on the runtime's review findings, pushed as
Verify Outside the task's
Converted to a draft: something above needs a person before review. Review threads the coder judged:
A task box whose entry declares a file and a directory export ends, and the waiting command (an attached run, an attach, or min box wait) leaves both in the project. A detached run copies nothing. An attached run that loses its connection while the box still runs now copies nothing. An export path outside the project fails at expansion with exit 3, before any box is created. Notes from the agent: Revise round 3. The attached task run now reads the box record and copies only when the state is stopped or exited. The unused export outcomes are bound to _outcomes in task.rs, attach.rs and wait.rs, and the copy_box_exports doc comment states the interim and its flip condition. I do not know the issue numbers for BOX-193, BOX-195 and BOX-198, because this box has no gh access. The comments cite the requirement IDs, and the PR body must name the issues. The file_exported event (the task's observability line) is not delivered: BOX-195 needs a client report RPC in minimald-rpc and a daemon handler, outside this task's layers. |
|
The runtime will not revise this pull request again on its own: the diff is +1748/-9 (1757 lines), past 3x the plan's estimate of 580 lines (est: 280 code, 300 tests, as #3444 reads now), at round 3 (the last trigger was the runtime's review findings). A person decides now. Remove |
There was a problem hiding this comment.
minimal-review — approval withheld
Verdict COMMENT — APPROVE withheld: 12 unresolved threads — minimal-foundry[bot] crates/minimal/src/cmd/boxes/exports.rs:624, minimal-arch[bot] crates/minimal/src/cmd/boxes/exports.rs:454, minimal-arch[bot] crates/minimal/src/cmd/boxes/exports.rs, minimal-arch[bot] crates/minimal/src/cmd/boxes/attach.rs:1525, minimal-arch[bot] crates/minimal/src/cmd/boxes/wait.rs:242, …. No findings.
Panel: 3 of 3 personas ran (correctness, security, supply-chain).
There was a problem hiding this comment.
arch-review: CONDITIONS · 3 conditions · the full ruling
The attached run copies the exports into the wrong folder when it starts in a subfolder of the project. task.rs run_entry gives abs_path, the folder the command ran in, as the project root, and gives it again as the command's own root. Lines 511 and 1218 of architecture.md put the copy under the project root, and line 514 compares the command's root with the record's. C1 passes upload_root for both. C2 adds a test that proves where the run writes. C3 links the owning issues in the interim comments. The wait and attach paths, the containment checks and the atomic writes conform.
Ruled at 7fbe33b against gominimal/arch@327e1b57d16b by claude-opus-5-5.
| &mut client, | ||
| id, | ||
| &session_name, | ||
| Some(std::path::Path::new(abs_path.as_str())), |
There was a problem hiding this comment.
C1 · abs_path is the folder the command ran in. The record holds upload_root. From a subfolder, the exports go to the subfolder, and the check of line 514 compares the folder with itself. Pass upload_root here and on the next line (architecture.md lines 511, 514, 1218).
There was a problem hiding this comment.
Addressed in a7410f46779b: The attached run's copy now passes upload_root as both project_root and here, through the new task::copy_ended_task_box_exports. It no longer passes abs_path.
| // `min task run --detach`, `min box run --detach` and `min box start | ||
| // --detach` take the `--detach` branch of the one run path, which | ||
| // returns before the copy. | ||
| let source = include_str!("task.rs"); |
There was a problem hiding this comment.
C2 · This checks the source text of task.rs. It does not prove where the attached run writes. Add a test that runs the copy from a folder below the project root, and assert that the file is at <project root>/<path> (line 511).
There was a problem hiding this comment.
Addressed in a7410f46779b: Added attached_run_from_subfolder_copies_exports_to_project_root. It drives copy_ended_task_box_exports from a root resolved from /src/deep. It asserts the file is at /out/report.txt and nothing is below the subfolder.
|
|
||
| /// [`copy_box_exports_on_host`] over a connected `client`. | ||
| /// | ||
| /// Interim: this copies again on each call, and its callers do not use the |
|
/revise Arch ruling 1320 on 7fbe33b set three conditions. Karl accepted this PR's size on 2026-11-16, and the needs-human label is removed. Do all three. In full:
Keep the tests this task and T134 (#3453) name passing. Do not rewrite history and do not force-push. |
|
/revise This replaces the 03:38Z note, which started a round that produced no commit. Do two things.
Keep the tests this task and T134 (#3453) name passing. Do not rewrite history and do not force-push. Add a merge commit. |
|
That Nothing to type again: the command gets a rocket when its round starts, or a refusal that names the reason. No round was counted for it yet. |
…d-that-waits-for-a-box-copies-its-decl # Conflicts: # crates/minimal/src/tests.rs
The attached task run passed the folder the command ran in as the export root. From a subfolder, the exports went below that folder. The copy now takes the root stamped on the create request, and lives in copy_ended_task_box_exports so a test can drive it from a subfolder. The interim comments name the owning issues.
|
Round 2 of 10 on a /revise note, pushed as Resolved conflicts in:
Verify Outside the task's
Converted to a draft: something above needs a person before review. Review threads the coder judged:
A task box whose entry declares a file and a folder export ends, and the waiting command leaves both in the project. An attached run that starts in a subfolder now puts the exports at the project root, not in the subfolder. A detached run copies nothing. An export path outside the project fails before any box is created. Notes from the agent: Merged origin/main (T128, #3441) in a merge commit. The only conflict was in crates/minimal/src/tests.rs, where both sides appended independent tests. I kept both blocks. create.rs merged without conflicts. C1: the attached run's copy moved into task::copy_ended_task_box_exports. That function takes upload_root, which is the root stamped on the create request, and passes it as both project_root and here. It keeps the check that the record shows the box ended. C2: the new test attached_run_from_subfolder_copies_exports_to_project_root resolves the root from /src/deep the way run_entry does, then drives copy_ended_task_box_exports against a harness daemon. It asserts that the file is at /out/report.txt and that the subfolder stays empty. The source-text check in detached_start_or_stop_copies_no_exports now looks for the new function name. C3: exports.rs, wait.rs, attach.rs and task.rs name #3445 beside BOX-193 and #3446 beside BOX-195 and BOX-198. Their flip conditions did not change. I could not find T134 (#3453) on main or on this branch, so I could not run its tests by name. The full minimal suite passed once at the end instead. I did not run just clippy-strict. |
|
The runtime will not revise this pull request again on its own: the diff is +1841/-9 (1850 lines), past 3x the plan's estimate of 580 lines (est: 280 code, 300 tests, as #3444 reads now), at round 2 (the last trigger was a /revise note). A person decides now. Remove |
T130 — The command that waits for a box copies its declared exports back to the project
slice: S2
kind: task
covers: BOX-185, BOX-186, BOX-187, BOX-188, BOX-189
size: L
est: 280 code, 300 tests
executor: agent
difficulty: needs care
model: strongest
diagnostics: each skipped or refused export is named on stderr with its path
observability: the box's record carries a file_exported event for each export
layers:
- expansion:
- crates/mfile/src/expand.rs: refuse an absolute,
..or project-root export path (BOX-189)- crates/mfile/src/error.rs: the BOX-189 refusal
test: cargo nextest run -p mfile export_path_outside_project_refused_exit3
- client:
- crates/minimal/src/cmd/boxes/exports.rs (new): the copy: each export's file or tree, through
min box cp's file reads, each file written under a temporary name and renamed into place (BOX-187, BOX-188)- crates/minimal/src/task.rs: an attached run copies after the box ends;
--detachcopies nothing- crates/minimal/src/cmd/boxes/attach.rs: an attach, and a start that attaches, copy after the box ends
- crates/minimal/src/cmd/boxes/wait.rs:
min box waitcopies for a box that ended- crates/minimal/src/tests.rs: tests
test: cargo nextest run -p minimal waiting_command_copies_file_exports_after_box_ends
test: cargo nextest run -p minimal detached_start_or_stop_copies_no_exports
test: cargo nextest run -p minimal directory_export_copies_its_tree_and_deletes_nothing
test: cargo nextest run -p minimal export_writes_each_file_atomically
- daemon:
- crates/minimald/src/box_manager.rs: drop
file_exportsfromUNENFORCED_SECTIONS, since the client now copies it- crates/minimald/src/box_manager/tests.rs:
unenforced_sections_warn_once_each_naming_sectionno longer expectsfile_exportsproduces:
- crates/minimal/src/cmd/boxes/exports.rs
consumes: none
proof: a task box whose entry declares a file and a directory export ends, and the waiting command leaves both in the project; a detached run copies nothing; an export path outside the project fails before any box is created.
depends on:
- blocked by #2401
Also delivers
This PR also delivers T134 (#3453) and covers BOX-192, BOX-196 and BOX-199: an export that leads out of the project or out of
/workbench, or a copy into another project, is refused and named on stderr.Residuals
Each is owned by a later task:
architecture.mdline 517): BOX-193 and BOX-194 in T131 (T131 — Skip and name each export that cannot be copied, and end a successful command with exit 125 #3445), and BOX-197 in T132 (T132 — Claim each export from the daemon before copying, and record a file_exported event for each #3446).file_exportedreport (line 518), and this task's ownobservability:line: BOX-195 and BOX-200 in T132 (T132 — Claim each export from the daemon before copying, and record a file_exported event for each #3446).Proof
A box whose spec declares a file export and a folder export is stopped. Then
min box wait, or an attach that sees the box end, leaves both in the project folder: the folder export has its whole tree, empty folders included, and no project file is deleted. Each file is written under a temporary name and renamed into place. A detach andmin box stopcopy nothing, and a--detachrun returns before the copy. An export path that is absolute, has a..component, or names the project folder fails the expansion with exit 3, before any box is created.Notes from the agent: Files outside the layers: crates/minimal/src/cmd/boxes.rs declares the new exports module (one
modline and oneuseline). crates/minimal/Cargo.toml addsrussh-sftp.workspace = true, and Cargo.lock changes to match.minneeds it to list the folders of a folder export through the box's file service.min box cpreads one file only, and its reader in events.rs is private, so exports.rs opens the samesftpsubsystem itself.The spec excerpt does not fix the key of a
[[file_exports]]item. The code readspath, or the item itself when it is a string. An item with nopathis not refused, so the existing mfile test that setssrc/dststill passes. A later spec change can pin the key.Observability is not delivered. The
file_exportedevent on the box's record (BOX-195) needs a report RPC in minimald-rpc and minimald, and neither is in this task's layers. The client logs one tracing line per export only, with its path, whether it was copied, and its file count. ExportOutcome already carries each file's path, size and sha256 for that report.Diagnostics: each skipped or failed export prints one stderr line that names its path and the box. These are the lines: "min did not copy
<path>from box , because it was not found in the box.", "... because the path points outside the folder that holds minimal.toml.", "min did not copy all of<path>from box : …[truncated]Tests
cargo nextest run -p mfile export_path_outside_project_refused_exit3cargo nextest run -p minimal waiting_command_copies_file_exports_after_box_endscargo nextest run -p minimal detached_start_or_stop_copies_no_exportscargo nextest run -p minimal directory_export_copies_its_tree_and_deletes_nothingcargo nextest run -p minimal export_writes_each_file_atomicallyVerify
min task run agent-verifyexited 101, so this PR is a draft.Out of scope
These files are outside the task's
layers:, so this PR is a draft:crates/minimal/Cargo.tomlcrates/minimal/src/cmd/boxes.rsCloses #3444