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:
cflmy committed 2026-11-24 20:43:23 +08:00
1 parent 238e4065c1
commit 44a118003f
9 files changed
+203 -19

No files matched your search

+31
View File
@@ -333,8 +333,39 @@ fn transport_error(error: TransportError) -> PluginError {
"plugin.crashed",
format!("worker frame I/O failed: {error}"),
),
// The shared transport classifies an over-limit or unencodable frame
// before anything is written. Keep the boundary-specific codes the
// plugin ABI has always reported instead of flattening them into
// `worker_frame_invalid`.
TransportError::Frame(FrameError::Encode(error)) => {
PluginError::wire("worker_encode_failed", error.to_string())
}
TransportError::Frame(FrameError::Length(length)) => PluginError::wire(
"worker_frame_too_large",
format!("worker frame is {length} bytes"),
),
TransportError::Frame(other) => {
PluginError::wire("worker_frame_invalid", other.to_string())
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn transport_errors_keep_the_boundary_specific_codes() {
let too_large = transport_error(TransportError::Frame(FrameError::Length(9 * 1024 * 1024)));
assert_eq!(too_large.code, "worker_frame_too_large");
let over_limit = transport_error(TransportError::Frame(FrameError::PartialPayload {
expected: 10,
actual: 3,
}));
assert_eq!(over_limit.code, "worker_frame_invalid");
let closed = transport_error(TransportError::Closed);
assert_eq!(closed.code, "plugin.crashed");
}
}