analysis: project document and program facts through one typed encoder
Replace the program-only projection with ADR-0069's typed model: exact source and digest, the public document AST, complete heading scopes with parent/mode origin/range, anchors, functions, imports, references, calls and resources. Project identity now carries the entry, captured manifest/lock digests, stdlib and the static extension identities that participated in preparation. Run and call bind Observation to the same canonical bytes, inspect reuses the same AST, unit and reference projectors, and the retired duplicate link resolver is deleted. Emit refuses to overwrite inputs, directories, symlinks or hard links and publishes through an owner-only exclusive temporary file.
This commit is contained in:
1 parent
1b214d48da
commit
99789616a4
12 files changed
+2017
-915
No files matched your search
@@ -267,9 +267,16 @@ print(1)
|
||||
assert_eq!(code["language"], "python");
|
||||
assert_eq!(formula["content_digest"].as_str().unwrap().len(), 64);
|
||||
assert_eq!(code["content_digest"].as_str().unwrap().len(), 64);
|
||||
assert!(
|
||||
!analysis.to_string().contains("A = x + 1"),
|
||||
"resource payloads stay in source, not Analysis"
|
||||
let source = analysis["modules"][0]["source"]
|
||||
.as_str()
|
||||
.expect("exact source is public");
|
||||
assert!(source.contains("A = x + 1"));
|
||||
assert_eq!(
|
||||
source.len(),
|
||||
analysis["modules"][0]["source_digest"]
|
||||
.as_str()
|
||||
.map(|_| source.len())
|
||||
.unwrap_or(0)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -663,7 +663,7 @@ fn inspect_outputs_ast_units_signatures_ir_and_refs() {
|
||||
assert_exit(&refs, 0, "inspect --refs");
|
||||
let value = json_stdout(&refs);
|
||||
let edges = value["refs"].as_array().expect("refs array");
|
||||
assert!(edges.iter().any(|edge| edge["resolved"] == true));
|
||||
assert!(edges.iter().any(|edge| edge["state"] == "resolved"));
|
||||
|
||||
// A broken #anchor is reported as unresolved by `inspect --refs`.
|
||||
let dir = TempDir::new("refs");
|
||||
@@ -677,7 +677,8 @@ fn inspect_outputs_ast_units_signatures_ir_and_refs() {
|
||||
let edges = value["refs"].as_array().expect("refs array");
|
||||
assert_eq!(edges.len(), 1);
|
||||
assert_eq!(edges[0]["url"], "#不存在的标题");
|
||||
assert_eq!(edges[0]["resolved"], false);
|
||||
assert_eq!(edges[0]["state"], "missing");
|
||||
assert_eq!(edges[0]["target_unit"], serde_json::Value::Null);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user