refactor(cli,host): split sandbox, resource-open and process modules
This commit is contained in:
1 parent
3ef18fb496
commit
791819a725
9 files changed
+523
-441
No files matched your search
@@ -241,6 +241,12 @@ This is still a **local VM lane**, not a self-hosted GitHub Actions security URL
|
||||
now sorts `.mq.md` by the same relative path key as the CLI. Source/test baseline
|
||||
`0d40de7`; later docs-only commits keep code/test bytes identical. Evidence:
|
||||
[`docs-and-test-migration`](evidence/2026-11-21-docs-and-test-migration.md).
|
||||
- Module-boundary refactor (review RFC-CM P1): CLI sandbox/capability policy
|
||||
moved to `crates/cli/src/commands/sandbox.rs`; host resource open dispatch to
|
||||
`crates/marqdo-host/src/host/resource_ops.rs`; explicitly granted process
|
||||
execution to `crates/marqdo-host/src/process.rs`. `commands.rs` still owns
|
||||
run/check/inspect and `host.rs` still owns provider registration; this is a
|
||||
partial, behavior-preserving split.
|
||||
- Minimal structure observation/construction (RFC-CM CM-A04, ADR-0023):
|
||||
value-semantics `list.append/concat`, `map.keys/has/get/set/remove`,
|
||||
Unicode scalar `text.codepoints`/`text.from_codepoint`, and non-negative
|
||||
|
||||
@@ -62,6 +62,9 @@ Layer rules:
|
||||
human/machine output. It is not a semantic policy centre.
|
||||
5. Callable Plugin and Resource Provider share one registry/authorization/audit
|
||||
mechanism, but keep different capability types.
|
||||
6. CLI sandbox policy is `commands/sandbox.rs`; host open-path policy is
|
||||
`host/resource_ops.rs`; process execution is `process.rs`. These are child
|
||||
modules, not new crates or a second backend.
|
||||
|
||||
## 3. Dependency direction and public contracts
|
||||
|
||||
@@ -124,7 +127,7 @@ that a phase is complete.
|
||||
| P1 | `std:fs/file` read/write/copy and `resource.request` fs metadata/directory operations are implemented; append/seek/watch/recursive walk remain open | open |
|
||||
| P1 | No file append/seek/watch/recursive directory walk | open; future Resource Operation extension |
|
||||
| P1 | JSON/CSV product parsers are implemented; no streaming/multi-line CSV or depth-bounded JSON walker | open |
|
||||
| P1 | `crates/cli/src/commands.rs` and `crates/marqdo-host/src/host.rs` still mix multiple responsibilities | open refactor, behavior-preserving |
|
||||
| P1 | CLI sandbox policy moved to `crates/cli/src/commands/sandbox.rs`; host resource open to `host/resource_ops.rs` and process to `process.rs`; `commands.rs`/`host.rs` still mix run/check/inspect and provider registration | partial refactor, behavior-preserving |
|
||||
| P2 | HTTP parsing is Unicode-codepoint oriented; a general byte body is not the only path | open; convert before a general network release |
|
||||
| P2 | No DNS, TLS, listener or UDP provider | open |
|
||||
| P2 | `std:path`, a regex subset, `std:datetime`, `std:clock`, `std:env` and `std:process` are implemented; no secure random or compression | open |
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
# Evidence: CLI/Host responsibility split
|
||||
|
||||
Date: 2026-11-21 (Asia/Shanghai)
|
||||
Source baseline: `3ef18fb496096d97e3c48ff661f0b2ad00cdcdc3`
|
||||
Repository: `marqdo-cli`
|
||||
RFC item: P1 module boundaries
|
||||
|
||||
## Moved
|
||||
|
||||
| New module | Responsibility |
|
||||
|---|---|
|
||||
| `crates/cli/src/commands/sandbox.rs` | `SandboxSettings`, mode parsing, strict preflight and CLI-to-`Capabilities` mapping; `commands.rs` re-exports it |
|
||||
| `crates/marqdo-host/src/host/resource_ops.rs` | `open_resource_stream` stdio/file/tcp/provider dispatch; child module of `host` |
|
||||
| `crates/marqdo-host/src/process.rs` | explicitly granted `process.run` execution, timeout and output caps |
|
||||
|
||||
This is a **behavior-preserving** refactor: no public CLI flag, host trait
|
||||
method, builtin, spec or stdlib API changed. No new crate was added. Provider
|
||||
registration and `commands.rs` run/check/inspect still live in their original
|
||||
files.
|
||||
|
||||
## Commands
|
||||
|
||||
```text
|
||||
cargo fmt --all -- --check PASS
|
||||
cargo clippy --workspace --all-targets -- -D warnings PASS
|
||||
cargo test --workspace 478 passed, 0 failed, 2 ignored
|
||||
cargo test -p marqdo-cli --test docs_consistency 5 passed
|
||||
cargo test -p marqdo-cli --test architecture_boundaries 4 passed
|
||||
python3 tools/pack-stdlib.py PASS
|
||||
```
|
||||
|
||||
## Not covered
|
||||
|
||||
`commands.rs` still contains run/check/inspect/package/tool command bodies
|
||||
and `host.rs` still contains provider registration and capability dispatch.
|
||||
A complete split needs a later behavior-preserving change; it is not claimed
|
||||
here.
|
||||
Reference in new issue
Block a user