fix: keep snapshots free of host paths and use the documented error phases
- runtime_error_json reports module_id/relative_path/line/column only; an absolute host path is environment data and must not be embedded in a shareable Observation snapshot. - A bad --arg is a pre-start option error: report phase "options" as the schema defines instead of "prepare". - Document that any provider transport failure, including an over-budget request frame, kills and reaps the helper and is never retried.
This commit is contained in:
1 parent
847cf9fe33
commit
765c8350b0
5 files changed
+13
-17
No files matched your search
@@ -418,7 +418,8 @@ fn runtime_location_json(
|
||||
if let Some(located) = project.locate(module_id, span) {
|
||||
location["line"] = json!(located.line);
|
||||
location["column"] = json!(located.column);
|
||||
location["file"] = json!(located.file.path.display().to_string());
|
||||
// Attribution for a shareable snapshot is the project-relative
|
||||
// path; an absolute host path is environment data, not contract.
|
||||
location["relative_path"] = json!(located.file.module_id.relative_path);
|
||||
}
|
||||
}
|
||||
@@ -444,7 +445,6 @@ fn runtime_error_json(error: &RuntimeError, project: &LoadedProject) -> serde_js
|
||||
"span": location["span"],
|
||||
"line": location["line"],
|
||||
"column": location["column"],
|
||||
"file": location["file"],
|
||||
"relative_path": location["relative_path"],
|
||||
"frames": frames,
|
||||
})
|
||||
|
||||
@@ -49,7 +49,7 @@ pub fn execute(
|
||||
let stream = events.as_ref();
|
||||
let named_args = match named_args {
|
||||
Ok(args) => args,
|
||||
Err(message) => return fail(stream, "prepare", "cli.invalid_argument", &message, 2),
|
||||
Err(message) => return fail(stream, "options", "cli.invalid_argument", &message, 2),
|
||||
};
|
||||
let options = PrepareOptions {
|
||||
plugins: settings.plugins.clone(),
|
||||
|
||||
@@ -989,22 +989,11 @@ fn runtime_error_in_imported_module_reports_that_module() {
|
||||
);
|
||||
assert_eq!(error["relative_path"], "physics.mq.md");
|
||||
assert!(
|
||||
error["file"]
|
||||
.as_str()
|
||||
.unwrap_or_default()
|
||||
.ends_with("physics.mq.md"),
|
||||
"{}",
|
||||
error["file"]
|
||||
error.get("file").is_none(),
|
||||
"a shareable snapshot must not embed an absolute host path: {error}"
|
||||
);
|
||||
let line = error["line"].as_u64().unwrap_or(0);
|
||||
assert!(line >= 5, "expected the failing statement line, got {line}");
|
||||
assert!(
|
||||
!error["file"]
|
||||
.as_str()
|
||||
.unwrap_or_default()
|
||||
.ends_with("index.mq.md"),
|
||||
"must not blame the entry file"
|
||||
);
|
||||
|
||||
let human = cli(dir.path(), &["run", "index.mq.md"]);
|
||||
assert_exit(&human, 1, "human rendering also fails");
|
||||
|
||||
Reference in new issue
Block a user