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
@@ -11,7 +11,15 @@ pub fn check(
|
||||
) -> i32 {
|
||||
let prepared = match prepare_project(file, json, plugins) {
|
||||
Ok(prepared) => prepared,
|
||||
Err(code) => return code,
|
||||
Err(code) => {
|
||||
// A failed check never leaves a success artifact behind: a consumer
|
||||
// must not be able to bind `run` to a previous Analysis after the
|
||||
// project stopped loading or compiling.
|
||||
if let Some(path) = emit {
|
||||
let _ = std::fs::remove_file(path);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
};
|
||||
let mut project = prepared.loaded;
|
||||
if refs {
|
||||
|
||||
@@ -21,16 +21,25 @@ pub fn execute(
|
||||
);
|
||||
return 2;
|
||||
}
|
||||
// Strict runs project code under the isolation supervisor, which owns
|
||||
// stdout. A live JSONL stream or a file destination would bypass that
|
||||
// supervisor, so reject the destination before any session is opened: an
|
||||
// unsupported destination must never produce a partial stream.
|
||||
if settings.mode == "strict"
|
||||
&& (observation.output == OutputFormat::Jsonl || observation.file.is_some())
|
||||
{
|
||||
return fail(
|
||||
None,
|
||||
"strict",
|
||||
"strict.unsupported_grant",
|
||||
"strict mode supports text and JSON snapshots on stdout; it rejects live or file destinations",
|
||||
2,
|
||||
);
|
||||
}
|
||||
// Open before preparation so option, compile and authorization failures
|
||||
// can still publish a rejection on the requested observation destination.
|
||||
let strict_destination_rejected = settings.mode == "strict"
|
||||
&& (observation.output == OutputFormat::Jsonl || observation.file.is_some());
|
||||
let mut destinations = observation.clone();
|
||||
if strict_destination_rejected {
|
||||
destinations.file = None;
|
||||
}
|
||||
let events = if destinations.enabled() {
|
||||
match ObservationSession::open(&destinations) {
|
||||
let events = if observation.enabled() {
|
||||
match ObservationSession::open(observation) {
|
||||
Ok(events) => Some(events),
|
||||
Err(error) => return transport_failure(&error),
|
||||
}
|
||||
@@ -38,15 +47,6 @@ pub fn execute(
|
||||
None
|
||||
};
|
||||
let stream = events.as_ref();
|
||||
if strict_destination_rejected {
|
||||
return fail(
|
||||
stream,
|
||||
"strict",
|
||||
"strict.unsupported_grant",
|
||||
"strict mode supports text and JSON snapshots on stdout; it rejects live or file destinations",
|
||||
2,
|
||||
);
|
||||
}
|
||||
let named_args = match named_args {
|
||||
Ok(args) => args,
|
||||
Err(message) => return fail(stream, "prepare", "cli.invalid_argument", &message, 2),
|
||||
|
||||
Reference in new issue
Block a user