feat(cli): route print through the bundled stdlib (Compat-B)

- Add Program.print_override and lazy stdlib injection: only programs that
  call 打印/print load std:io and route to io.写值 (ADR-0030).
- Record resource.open/read/write/close as trace effect events so the stdlib
  print path is auditable; HostOp::Print no longer runs on that path.
- Permit only stdio/stdout (existing console) in strict; file/network
  resource opens remain permission.denied.
- Exclude std: modules from the human-readable checked-module count; update
  the Python analysis consumer to accept std: instance ids.
- Add print-routing and strict-console tests, ADR-0030 and evidence.

Gate: fmt, clippy -D warnings, 418 tests passed.
This commit is contained in:
cflmy committed 2026-11-20 22:10:59 +08:00
1 parent e119727c5d
commit e26971f489
21 files changed
+560 -36

No files matched your search

+7 -1
View File
@@ -353,7 +353,13 @@ pub fn check(
let text = output::render_text(&project.diagnostics);
eprint!("{text}");
if errors == 0 {
println!("checked {} module(s): ok", project.program.modules.len());
let checked = project
.program
.modules
.keys()
.filter(|id| !id.instance.starts_with("std:"))
.count();
println!("checked {checked} module(s): ok");
} else {
eprintln!(
"check failed: {} error(s), {} warning(s)",