fix: close rc.3 review defects in strict destinations and Analysis cleanup
- Reject strict live/file observation destinations before opening a session: a rejected destination no longer writes a partial JSONL stream or snapshot. - Remove a previous `check --emit` artifact when the project cannot be loaded, not only when it has compile errors, so a consumer can never bind a run to a stale Analysis document. - Report the concrete `fs.exists|metadata|list|mkdir|remove|rename` effect operation instead of collapsing all six into `resource.request`. - Preserve the plugin ABI frame codes through the shared worker transport: an over-limit frame is `worker_frame_too_large` and an encode failure is `worker_encode_failed`, not a generic `worker_frame_invalid`. - Give the event and snapshot schemas the same capture `level` enum and document the levels in spec/observation.md. - Add a regression test for each fix.
This commit is contained in:
1 parent
238e4065c1
commit
44a118003f
9 files changed
+203
-19
No files matched your search
@@ -337,6 +337,31 @@ fn failed_check_removes_stale_analysis() {
|
||||
assert!(!target.exists(), "stale success artifact must be removed");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn check_that_cannot_load_the_project_removes_stale_analysis() {
|
||||
let dir = TempDir::new("analysis-load-error");
|
||||
write(dir.path(), "index.mq.md", "## @exec main\n\n`return 1`\n");
|
||||
let target = dir.path().join("analysis.json");
|
||||
let first = cli(
|
||||
dir.path(),
|
||||
&["check", "index.mq.md", "--emit", target.to_str().unwrap()],
|
||||
);
|
||||
assert_eq!(first.status.code(), Some(0), "{first:?}");
|
||||
assert!(target.exists());
|
||||
|
||||
// The load failure happens before the compile-error cleanup branch, so the
|
||||
// remove must also cover the prepare path.
|
||||
let failed = cli(
|
||||
dir.path(),
|
||||
&["check", "missing.mq.md", "--emit", target.to_str().unwrap()],
|
||||
);
|
||||
assert_ne!(failed.status.code(), Some(0), "{failed:?}");
|
||||
assert!(
|
||||
!target.exists(),
|
||||
"a load failure must not leave the previous Analysis in place"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn snapshot_records_calls_effects_and_status_without_secrets() {
|
||||
let dir = TempDir::new("trace");
|
||||
|
||||
@@ -878,3 +878,46 @@ fn loop_transfers_are_ordered_structural_events_with_source_spans() {
|
||||
assert_eq!(statement["span"], span);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn strict_mode_rejects_live_and_file_destinations_before_opening_a_stream() {
|
||||
let dir = TempDir::new("strict-destinations");
|
||||
dir.write("index.mq.md", BASIC);
|
||||
let snapshot = dir.path().join("snapshot.json");
|
||||
let snapshot_arg = snapshot.to_str().unwrap().to_string();
|
||||
|
||||
for args in [
|
||||
vec![
|
||||
"run",
|
||||
"index.mq.md",
|
||||
"--mode",
|
||||
"strict",
|
||||
"--output",
|
||||
"jsonl",
|
||||
],
|
||||
vec![
|
||||
"run",
|
||||
"index.mq.md",
|
||||
"--mode",
|
||||
"strict",
|
||||
"--output",
|
||||
"text",
|
||||
"--observation-file",
|
||||
snapshot_arg.as_str(),
|
||||
],
|
||||
] {
|
||||
let output = cli(dir.path(), &args);
|
||||
assert_eq!(output.status.code(), Some(2), "{args:?}: {output:?}");
|
||||
assert!(
|
||||
output.stdout.is_empty(),
|
||||
"a rejected strict destination must not emit a partial stream: {}",
|
||||
String::from_utf8_lossy(&output.stdout)
|
||||
);
|
||||
let stderr = String::from_utf8_lossy(&output.stderr);
|
||||
assert!(stderr.contains("strict.unsupported_grant"), "{stderr}");
|
||||
assert!(
|
||||
!snapshot.exists(),
|
||||
"a rejected strict destination must not publish a snapshot file"
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user