Introduce Pheon GDSII parsing and layout review tools
Implement native GDSII reading and writing with Arrow interchange, hierarchy
scans and selective cell loading. Validate numeric packing and array pitches,
and preserve normalized REAL8 encodings exactly within the supported range.
Add standalone dump, structural diff, hierarchy, layer-name annotation and Git
diff commands. Provide scoped text and JSON reports, deterministic comparison,
and record-preserving metadata edits.
Package the shared library and optional Python Arrow readers as pheon using
CFFI ABI mode and Python-independent platform wheels. Include locked source
builds, native API checks, cross-platform artifact workflows, documentation
and regression coverage. Require Rust 1.88 or newer and Python 3.11 or newer.
Validation: 87 native tests, 14 binding tests on Python 3.11/3.13/3.14,
and 71 installed companion integration tests pass. Full, scanned and selected
Arrow layouts match the previous schemas.
2026-11-16 16:21:21 -08:00
|
|
|
use super::*;
|
|
|
|
|
use pheon::review::{
|
2026-11-18 10:58:19 -08:00
|
|
|
Diagnostic, Outcome, RevisionPair, Side,
|
Introduce Pheon GDSII parsing and layout review tools
Implement native GDSII reading and writing with Arrow interchange, hierarchy
scans and selective cell loading. Validate numeric packing and array pitches,
and preserve normalized REAL8 encodings exactly within the supported range.
Add standalone dump, structural diff, hierarchy, layer-name annotation and Git
diff commands. Provide scoped text and JSON reports, deterministic comparison,
and record-preserving metadata edits.
Package the shared library and optional Python Arrow readers as pheon using
CFFI ABI mode and Python-independent platform wheels. Include locked source
builds, native API checks, cross-platform artifact workflows, documentation
and regression coverage. Require Rust 1.88 or newer and Python 3.11 or newer.
Validation: 87 native tests, 14 binding tests on Python 3.11/3.13/3.14,
and 71 installed companion integration tests pass. Full, scanned and selected
Arrow layouts match the previous schemas.
2026-11-16 16:21:21 -08:00
|
|
|
report::{ReportInputs, ReportOptions, failure_report},
|
Make Pheon structural review results self-contained
Capture revision metadata, cell presence and attributes, and structured
diagnostics in owned comparison results. Derive outcomes and render text,
JSON, and hierarchy reports without retaining source documents. Keep derived
descriptions and graph analysis in their renderers.
Use pheon-structural-v1 and PHEON_LAYER_NAMES_V1 consistently, expose helpers
through their defining modules, and remove obsolete re-exports. Update user
guides and report fixtures without changing schema version 1.
Cover dropped inputs, diagnostic ordering, absent and empty cells, offset
independence, and CLI failures. All 92 Rust tests pass in debug and release;
report and hierarchy goldens retain their behavior.
2026-11-16 20:45:06 -08:00
|
|
|
selection::{DisplayFilter, Scope},
|
Introduce Pheon GDSII parsing and layout review tools
Implement native GDSII reading and writing with Arrow interchange, hierarchy
scans and selective cell loading. Validate numeric packing and array pitches,
and preserve normalized REAL8 encodings exactly within the supported range.
Add standalone dump, structural diff, hierarchy, layer-name annotation and Git
diff commands. Provide scoped text and JSON reports, deterministic comparison,
and record-preserving metadata edits.
Package the shared library and optional Python Arrow readers as pheon using
CFFI ABI mode and Python-independent platform wheels. Include locked source
builds, native API checks, cross-platform artifact workflows, documentation
and regression coverage. Require Rust 1.88 or newer and Python 3.11 or newer.
Validation: 87 native tests, 14 binding tests on Python 3.11/3.13/3.14,
and 71 installed companion integration tests pass. Full, scanned and selected
Arrow layouts match the previous schemas.
2026-11-16 16:21:21 -08:00
|
|
|
};
|
|
|
|
|
use serde_json::{Value, json};
|
|
|
|
|
|
|
|
|
|
fn inputs() -> ReportInputs {
|
|
|
|
|
ReportInputs {
|
|
|
|
|
old: Some("before.gds".into()),
|
|
|
|
|
new: Some("after.gds".into()),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn report(old: &[u8], new: &[u8], options: &ReportOptions) -> Value {
|
|
|
|
|
let a = Document::parse(old).unwrap();
|
|
|
|
|
let b = Document::parse(new).unwrap();
|
Make Pheon structural review results self-contained
Capture revision metadata, cell presence and attributes, and structured
diagnostics in owned comparison results. Derive outcomes and render text,
JSON, and hierarchy reports without retaining source documents. Keep derived
descriptions and graph analysis in their renderers.
Use pheon-structural-v1 and PHEON_LAYER_NAMES_V1 consistently, expose helpers
through their defining modules, and remove obsolete re-exports. Update user
guides and report fixtures without changing schema version 1.
Cover dropped inputs, diagnostic ordering, absent and empty cells, offset
independence, and CLI failures. All 92 Rust tests pass in debug and release;
report and hierarchy goldens retain their behavior.
2026-11-16 20:45:06 -08:00
|
|
|
Comparison::between(&a, &b).json_report(&inputs(), options)
|
Introduce Pheon GDSII parsing and layout review tools
Implement native GDSII reading and writing with Arrow interchange, hierarchy
scans and selective cell loading. Validate numeric packing and array pitches,
and preserve normalized REAL8 encodings exactly within the supported range.
Add standalone dump, structural diff, hierarchy, layer-name annotation and Git
diff commands. Provide scoped text and JSON reports, deterministic comparison,
and record-preserving metadata edits.
Package the shared library and optional Python Arrow readers as pheon using
CFFI ABI mode and Python-independent platform wheels. Include locked source
builds, native API checks, cross-platform artifact workflows, documentation
and regression coverage. Require Rust 1.88 or newer and Python 3.11 or newer.
Validation: 87 native tests, 14 binding tests on Python 3.11/3.13/3.14,
and 71 installed companion integration tests pass. Full, scanned and selected
Arrow layouts match the previous schemas.
2026-11-16 16:21:21 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn unknown(geometry: Vec<u8>) -> Vec<u8> {
|
|
|
|
|
let mut object = geometry;
|
|
|
|
|
object.truncate(object.len() - 4);
|
|
|
|
|
record(&mut object, 0x7f02, &[0, 42]);
|
|
|
|
|
record(&mut object, RTAG_ENDEL, &[]);
|
|
|
|
|
layout(&[("CHIP", vec![object])])
|
|
|
|
|
}
|
|
|
|
|
|
2026-11-18 10:58:19 -08:00
|
|
|
#[test]
|
|
|
|
|
fn adaptive_pair_rebases_diagnostics_and_keeps_metadata_and_graph_state() {
|
|
|
|
|
let mut stable = vec![square(); 512];
|
|
|
|
|
stable.extend([
|
|
|
|
|
reference("leaf", 0, 2),
|
|
|
|
|
label((900, 7), LAYER_SENTINEL),
|
|
|
|
|
label((900, 7), "1:0:WG"),
|
|
|
|
|
label((900, 8), "PHEON_LAYER_NAMES_V2"),
|
|
|
|
|
]);
|
|
|
|
|
let mut unsupported = square();
|
|
|
|
|
unsupported.truncate(unsupported.len() - 4);
|
|
|
|
|
record(&mut unsupported, 0x7f02, &[0, 42]);
|
|
|
|
|
record(&mut unsupported, RTAG_ENDEL, &[]);
|
|
|
|
|
let old = layout(&[
|
|
|
|
|
("leaf", vec![]),
|
|
|
|
|
("changed", vec![square()]),
|
|
|
|
|
("stable", stable.clone()),
|
|
|
|
|
("unsupported", vec![unsupported.clone()]),
|
|
|
|
|
]);
|
|
|
|
|
let mut new = layout(&[
|
|
|
|
|
("unsupported", vec![unsupported]),
|
|
|
|
|
("stable", stable),
|
|
|
|
|
("changed", vec![triangle()]),
|
|
|
|
|
]);
|
|
|
|
|
let stable_offset = Document::parse(&new).unwrap().cells["stable"].offset;
|
|
|
|
|
new[stable_offset + 4..stable_offset + 6].copy_from_slice(&2026_u16.to_be_bytes());
|
|
|
|
|
|
|
|
|
|
let full = Comparison::between(
|
|
|
|
|
&Document::parse(&old).unwrap(),
|
|
|
|
|
&Document::parse(&new).unwrap(),
|
|
|
|
|
);
|
|
|
|
|
let adaptive = RevisionPair::parse(&old, &new).unwrap().compare();
|
|
|
|
|
let options = ReportOptions {
|
|
|
|
|
hierarchy: true,
|
|
|
|
|
..ReportOptions::default()
|
|
|
|
|
};
|
|
|
|
|
let actual = adaptive.json_report(&inputs(), &options);
|
|
|
|
|
assert_eq!(actual, full.json_report(&inputs(), &options));
|
|
|
|
|
assert_eq!(actual["layer_legend"][0]["name"], "WG");
|
|
|
|
|
assert_eq!(actual["status"], "incomplete");
|
|
|
|
|
assert!(
|
|
|
|
|
actual["diagnostics"]
|
|
|
|
|
.as_array()
|
|
|
|
|
.unwrap()
|
|
|
|
|
.iter()
|
|
|
|
|
.any(|issue| { issue["code"] == "unresolved_reference" && issue["side"] == "new" })
|
|
|
|
|
);
|
|
|
|
|
let text = RevisionPair::parse(&old, &new).unwrap().compare_text();
|
|
|
|
|
assert_eq!(
|
|
|
|
|
text.render_text(100, &DisplayFilter::default(), true),
|
|
|
|
|
full.text(100)
|
|
|
|
|
);
|
|
|
|
|
assert_eq!(text.hierarchy(false, 8), full.hierarchy(false, 8));
|
|
|
|
|
assert_eq!(text.hierarchy(true, 8), full.hierarchy(true, 8));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
fn adaptive_pair_prioritizes_old_structure_errors_over_new_frame_errors() {
|
|
|
|
|
let mut old = layout(&[("CHIP", vec![square()])]);
|
|
|
|
|
let name_offset = Document::parse(&old)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.records
|
|
|
|
|
.iter()
|
|
|
|
|
.find(|r| r.tag == RTAG_LIBNAME)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.offset;
|
|
|
|
|
old[name_offset + 2] = 0x7f;
|
|
|
|
|
let error = RevisionPair::parse(&old, b"bad").unwrap_err();
|
|
|
|
|
assert_eq!(error.side, Some(Side::Old));
|
|
|
|
|
assert!(error.message.contains("LIBNAME and UNITS"));
|
|
|
|
|
}
|
|
|
|
|
|
Make Pheon structural review results self-contained
Capture revision metadata, cell presence and attributes, and structured
diagnostics in owned comparison results. Derive outcomes and render text,
JSON, and hierarchy reports without retaining source documents. Keep derived
descriptions and graph analysis in their renderers.
Use pheon-structural-v1 and PHEON_LAYER_NAMES_V1 consistently, expose helpers
through their defining modules, and remove obsolete re-exports. Update user
guides and report fixtures without changing schema version 1.
Cover dropped inputs, diagnostic ordering, absent and empty cells, offset
independence, and CLI failures. All 92 Rust tests pass in debug and release;
report and hierarchy goldens retain their behavior.
2026-11-16 20:45:06 -08:00
|
|
|
#[test]
|
|
|
|
|
fn comparison_reports_survive_dropped_documents_and_overwritten_inputs() {
|
|
|
|
|
let comparison = {
|
|
|
|
|
let mut old_bytes = shared(square());
|
|
|
|
|
let mut new_bytes = shared(triangle());
|
|
|
|
|
let old = Document::parse(&old_bytes).unwrap();
|
|
|
|
|
let new = Document::parse(&new_bytes).unwrap();
|
|
|
|
|
let comparison = Comparison::between(&old, &new);
|
|
|
|
|
drop(old);
|
|
|
|
|
drop(new);
|
|
|
|
|
old_bytes.fill(0);
|
|
|
|
|
new_bytes.fill(0);
|
|
|
|
|
comparison
|
|
|
|
|
};
|
|
|
|
|
assert_eq!(comparison.outcome(), Outcome::Different);
|
|
|
|
|
assert!(comparison.old.present && comparison.new.present);
|
|
|
|
|
assert_eq!(comparison.old.units.as_ref().unwrap().len(), 16);
|
|
|
|
|
let mut actual = comparison.json_report(
|
|
|
|
|
&inputs(),
|
|
|
|
|
&ReportOptions {
|
|
|
|
|
hierarchy: true,
|
|
|
|
|
..Default::default()
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
actual["producer"]["version"] = json!("test");
|
|
|
|
|
let expected: Value =
|
|
|
|
|
serde_json::from_str(include_str!("../golden/report-geometry.json")).unwrap();
|
|
|
|
|
assert_eq!(actual, expected);
|
|
|
|
|
assert_eq!(
|
|
|
|
|
comparison.hierarchy(false, 8),
|
|
|
|
|
include_str!("../golden/review-hierarchy.txt")
|
|
|
|
|
);
|
|
|
|
|
assert_eq!(
|
|
|
|
|
comparison.hierarchy(true, 8),
|
|
|
|
|
include_str!("../golden/review-hierarchy.mmd")
|
|
|
|
|
);
|
|
|
|
|
// Display choices affect evidence, not the captured outcome or full graph.
|
|
|
|
|
let limited = comparison.json_report(
|
|
|
|
|
&inputs(),
|
|
|
|
|
&ReportOptions {
|
|
|
|
|
hierarchy: true,
|
|
|
|
|
max_objects: Some(0),
|
|
|
|
|
..Default::default()
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
assert_eq!(limited["hierarchy"], actual["hierarchy"]);
|
|
|
|
|
assert_eq!(limited["summary"], actual["summary"]);
|
|
|
|
|
assert_eq!(limited["exit_code"], 1);
|
2026-11-18 10:58:19 -08:00
|
|
|
assert!(
|
|
|
|
|
comparison
|
|
|
|
|
.text(0)
|
|
|
|
|
.contains("Omitted · 2 object changes over the limit")
|
|
|
|
|
);
|
Make Pheon structural review results self-contained
Capture revision metadata, cell presence and attributes, and structured
diagnostics in owned comparison results. Derive outcomes and render text,
JSON, and hierarchy reports without retaining source documents. Keep derived
descriptions and graph analysis in their renderers.
Use pheon-structural-v1 and PHEON_LAYER_NAMES_V1 consistently, expose helpers
through their defining modules, and remove obsolete re-exports. Update user
guides and report fixtures without changing schema version 1.
Cover dropped inputs, diagnostic ordering, absent and empty cells, offset
independence, and CLI failures. All 92 Rust tests pass in debug and release;
report and hierarchy goldens retain their behavior.
2026-11-16 20:45:06 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
fn comparison_diagnostics_capture_both_sides_and_scope_mismatch_once() {
|
|
|
|
|
let comparison = {
|
|
|
|
|
let bytes = unknown(square());
|
|
|
|
|
let old = Document::parse(&bytes)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.selected(
|
|
|
|
|
&Scope {
|
|
|
|
|
cell: Some("CHIP".to_string()),
|
|
|
|
|
..Default::default()
|
|
|
|
|
},
|
|
|
|
|
false,
|
|
|
|
|
)
|
|
|
|
|
.unwrap();
|
|
|
|
|
let mut new = Document::parse(&bytes).unwrap();
|
|
|
|
|
let comparison = Comparison::between(&old, &new);
|
|
|
|
|
// Changes to source documents cannot alter an existing result.
|
|
|
|
|
new.scope = old.scope.clone();
|
|
|
|
|
new.diagnostics.clear();
|
|
|
|
|
comparison
|
|
|
|
|
};
|
|
|
|
|
assert_eq!(
|
|
|
|
|
comparison.outcome(),
|
|
|
|
|
Outcome::Incomplete { different: false }
|
|
|
|
|
);
|
|
|
|
|
assert_eq!(comparison.diagnostics.len(), 3);
|
|
|
|
|
assert_eq!(comparison.diagnostics[0].side, Some(Side::Old));
|
|
|
|
|
assert_eq!(comparison.diagnostics[1].side, Some(Side::New));
|
|
|
|
|
assert_eq!(comparison.diagnostics[2].code, "scope_mismatch");
|
|
|
|
|
assert_eq!(comparison.diagnostics[2].side, None);
|
|
|
|
|
let report = comparison.json_report(&inputs(), &ReportOptions::default());
|
|
|
|
|
assert_eq!(report["status"], "incomplete");
|
|
|
|
|
assert_eq!(report["result"], "unknown");
|
|
|
|
|
assert_eq!(report["exit_code"], 2);
|
|
|
|
|
assert_eq!(report["scope"]["cell"], "CHIP");
|
|
|
|
|
assert_eq!(report["diagnostics"].as_array().unwrap().len(), 3);
|
|
|
|
|
assert_eq!(report["diagnostics"][0]["side"], "old");
|
|
|
|
|
assert_eq!(report["diagnostics"][1]["side"], "new");
|
|
|
|
|
assert_eq!(report["diagnostics"][2]["code"], "scope_mismatch");
|
|
|
|
|
let text = comparison.text(0);
|
2026-11-17 21:49:26 -08:00
|
|
|
assert!(text.starts_with("Incomplete\nScope cell=\"CHIP\"\nDiagnostics\n"));
|
|
|
|
|
let scope = text.find("\n comparison scopes differ").unwrap();
|
|
|
|
|
let old = text.find("\n old:").unwrap();
|
|
|
|
|
let new = text.find("\n new:").unwrap();
|
Make Pheon structural review results self-contained
Capture revision metadata, cell presence and attributes, and structured
diagnostics in owned comparison results. Derive outcomes and render text,
JSON, and hierarchy reports without retaining source documents. Keep derived
descriptions and graph analysis in their renderers.
Use pheon-structural-v1 and PHEON_LAYER_NAMES_V1 consistently, expose helpers
through their defining modules, and remove obsolete re-exports. Update user
guides and report fixtures without changing schema version 1.
Cover dropped inputs, diagnostic ordering, absent and empty cells, offset
independence, and CLI failures. All 92 Rust tests pass in debug and release;
report and hierarchy goldens retain their behavior.
2026-11-16 20:45:06 -08:00
|
|
|
assert!(scope < old && old < new);
|
|
|
|
|
}
|
|
|
|
|
|
Introduce Pheon GDSII parsing and layout review tools
Implement native GDSII reading and writing with Arrow interchange, hierarchy
scans and selective cell loading. Validate numeric packing and array pitches,
and preserve normalized REAL8 encodings exactly within the supported range.
Add standalone dump, structural diff, hierarchy, layer-name annotation and Git
diff commands. Provide scoped text and JSON reports, deterministic comparison,
and record-preserving metadata edits.
Package the shared library and optional Python Arrow readers as pheon using
CFFI ABI mode and Python-independent platform wheels. Include locked source
builds, native API checks, cross-platform artifact workflows, documentation
and regression coverage. Require Rust 1.88 or newer and Python 3.11 or newer.
Validation: 87 native tests, 14 binding tests on Python 3.11/3.13/3.14,
and 71 installed companion integration tests pass. Full, scanned and selected
Arrow layouts match the previous schemas.
2026-11-16 16:21:21 -08:00
|
|
|
#[test]
|
|
|
|
|
fn reports_preserve_fixture_results_totals_and_replacement_links() {
|
|
|
|
|
for pair in corpus() {
|
|
|
|
|
let r = report(&pair.old, &pair.new, &ReportOptions::default());
|
|
|
|
|
assert_eq!(r["schema_version"], 1);
|
Make Pheon structural review results self-contained
Capture revision metadata, cell presence and attributes, and structured
diagnostics in owned comparison results. Derive outcomes and render text,
JSON, and hierarchy reports without retaining source documents. Keep derived
descriptions and graph analysis in their renderers.
Use pheon-structural-v1 and PHEON_LAYER_NAMES_V1 consistently, expose helpers
through their defining modules, and remove obsolete re-exports. Update user
guides and report fixtures without changing schema version 1.
Cover dropped inputs, diagnostic ordering, absent and empty cells, offset
independence, and CLI failures. All 92 Rust tests pass in debug and release;
report and hierarchy goldens retain their behavior.
2026-11-16 20:45:06 -08:00
|
|
|
assert_eq!(r["comparison_profile"], "pheon-structural-v1");
|
Introduce Pheon GDSII parsing and layout review tools
Implement native GDSII reading and writing with Arrow interchange, hierarchy
scans and selective cell loading. Validate numeric packing and array pitches,
and preserve normalized REAL8 encodings exactly within the supported range.
Add standalone dump, structural diff, hierarchy, layer-name annotation and Git
diff commands. Provide scoped text and JSON reports, deterministic comparison,
and record-preserving metadata edits.
Package the shared library and optional Python Arrow readers as pheon using
CFFI ABI mode and Python-independent platform wheels. Include locked source
builds, native API checks, cross-platform artifact workflows, documentation
and regression coverage. Require Rust 1.88 or newer and Python 3.11 or newer.
Validation: 87 native tests, 14 binding tests on Python 3.11/3.13/3.14,
and 71 installed companion integration tests pass. Full, scanned and selected
Arrow layouts match the previous schemas.
2026-11-16 16:21:21 -08:00
|
|
|
assert_eq!(r["producer"]["version"], env!("CARGO_PKG_VERSION"));
|
|
|
|
|
assert_eq!(r["status"], "complete", "{}", pair.name);
|
|
|
|
|
assert_eq!(
|
|
|
|
|
r["exit_code"],
|
|
|
|
|
if pair.changed_cells + pair.metadata == 0 {
|
|
|
|
|
0
|
|
|
|
|
} else {
|
|
|
|
|
1
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
assert_eq!(
|
|
|
|
|
r["summary"]["changed_cells"],
|
|
|
|
|
pair.changed_cells.to_string()
|
|
|
|
|
);
|
|
|
|
|
assert_eq!(r["summary"]["added_objects"], pair.added.to_string());
|
|
|
|
|
assert_eq!(r["summary"]["removed_objects"], pair.removed.to_string());
|
|
|
|
|
assert_eq!(
|
|
|
|
|
r["summary"]["layer_name_changes"],
|
|
|
|
|
pair.metadata.to_string()
|
|
|
|
|
);
|
|
|
|
|
assert_eq!(r["report_selection"]["truncated"], false);
|
|
|
|
|
for cell in r["cell_changes"].as_array().unwrap() {
|
|
|
|
|
for replacement in cell["replacements"].as_array().unwrap() {
|
|
|
|
|
assert!(
|
|
|
|
|
cell["removed"]
|
|
|
|
|
.as_array()
|
|
|
|
|
.unwrap()
|
|
|
|
|
.iter()
|
|
|
|
|
.any(|o| o["id"] == replacement["removed"])
|
|
|
|
|
);
|
|
|
|
|
assert!(
|
|
|
|
|
cell["added"]
|
|
|
|
|
.as_array()
|
|
|
|
|
.unwrap()
|
|
|
|
|
.iter()
|
|
|
|
|
.any(|o| o["id"] == replacement["added"])
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
assert_eq!(r, report(&pair.old, &pair.new, &ReportOptions::default()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
fn incomplete_reports_distinguish_known_differences_and_include_structured_locations() {
|
|
|
|
|
let a = unknown(square());
|
|
|
|
|
let same = report(&a, &a, &ReportOptions::default());
|
|
|
|
|
assert_eq!(same["status"], "incomplete");
|
|
|
|
|
assert_eq!(same["result"], "unknown");
|
|
|
|
|
assert_eq!(same["exit_code"], 2);
|
|
|
|
|
assert_eq!(same["summary"]["counts"], "observed");
|
|
|
|
|
let diagnostic = &same["diagnostics"][0];
|
|
|
|
|
assert_eq!(diagnostic["code"], "unsupported_record");
|
|
|
|
|
assert_eq!(diagnostic["side"], "old");
|
|
|
|
|
assert_eq!(diagnostic["cell"], "CHIP");
|
|
|
|
|
assert_eq!(diagnostic["layer"], json!({"number":1,"purpose":0}));
|
|
|
|
|
let offset: usize = diagnostic["byte_offset"].as_str().unwrap().parse().unwrap();
|
|
|
|
|
assert_eq!(&a[offset + 2..offset + 4], &0x7f02_u16.to_be_bytes());
|
|
|
|
|
let changed = report(&a, &unknown(triangle()), &ReportOptions::default());
|
|
|
|
|
assert_eq!(changed["status"], "incomplete");
|
|
|
|
|
assert_eq!(changed["result"], "different");
|
|
|
|
|
assert_eq!(changed["exit_code"], 2);
|
|
|
|
|
assert_eq!(
|
|
|
|
|
changed["cell_changes"][0]["removed"][0]["fields"]
|
|
|
|
|
.as_array()
|
|
|
|
|
.unwrap()
|
|
|
|
|
.last()
|
|
|
|
|
.unwrap()["payload_hex"],
|
|
|
|
|
"0x002a"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
fn future_layer_metadata_remains_incomplete_under_geometry_scopes() {
|
|
|
|
|
for location in ["CHIP", "legend"] {
|
|
|
|
|
let bytes = if location == "CHIP" {
|
|
|
|
|
layout(&[(
|
|
|
|
|
"CHIP",
|
Make Pheon structural review results self-contained
Capture revision metadata, cell presence and attributes, and structured
diagnostics in owned comparison results. Derive outcomes and render text,
JSON, and hierarchy reports without retaining source documents. Keep derived
descriptions and graph analysis in their renderers.
Use pheon-structural-v1 and PHEON_LAYER_NAMES_V1 consistently, expose helpers
through their defining modules, and remove obsolete re-exports. Update user
guides and report fixtures without changing schema version 1.
Cover dropped inputs, diagnostic ordering, absent and empty cells, offset
independence, and CLI failures. All 92 Rust tests pass in debug and release;
report and hierarchy goldens retain their behavior.
2026-11-16 20:45:06 -08:00
|
|
|
vec![square(), label((900, 7), "PHEON_LAYER_NAMES_V2")],
|
Introduce Pheon GDSII parsing and layout review tools
Implement native GDSII reading and writing with Arrow interchange, hierarchy
scans and selective cell loading. Validate numeric packing and array pitches,
and preserve normalized REAL8 encodings exactly within the supported range.
Add standalone dump, structural diff, hierarchy, layer-name annotation and Git
diff commands. Provide scoped text and JSON reports, deterministic comparison,
and record-preserving metadata edits.
Package the shared library and optional Python Arrow readers as pheon using
CFFI ABI mode and Python-independent platform wheels. Include locked source
builds, native API checks, cross-platform artifact workflows, documentation
and regression coverage. Require Rust 1.88 or newer and Python 3.11 or newer.
Validation: 87 native tests, 14 binding tests on Python 3.11/3.13/3.14,
and 71 installed companion integration tests pass. Full, scanned and selected
Arrow layouts match the previous schemas.
2026-11-16 16:21:21 -08:00
|
|
|
)])
|
|
|
|
|
} else {
|
|
|
|
|
layout(&[
|
|
|
|
|
("CHIP", vec![square()]),
|
Make Pheon structural review results self-contained
Capture revision metadata, cell presence and attributes, and structured
diagnostics in owned comparison results. Derive outcomes and render text,
JSON, and hierarchy reports without retaining source documents. Keep derived
descriptions and graph analysis in their renderers.
Use pheon-structural-v1 and PHEON_LAYER_NAMES_V1 consistently, expose helpers
through their defining modules, and remove obsolete re-exports. Update user
guides and report fixtures without changing schema version 1.
Cover dropped inputs, diagnostic ordering, absent and empty cells, offset
independence, and CLI failures. All 92 Rust tests pass in debug and release;
report and hierarchy goldens retain their behavior.
2026-11-16 20:45:06 -08:00
|
|
|
("legend", vec![label((900, 7), "PHEON_LAYER_NAMES_V2")]),
|
Introduce Pheon GDSII parsing and layout review tools
Implement native GDSII reading and writing with Arrow interchange, hierarchy
scans and selective cell loading. Validate numeric packing and array pitches,
and preserve normalized REAL8 encodings exactly within the supported range.
Add standalone dump, structural diff, hierarchy, layer-name annotation and Git
diff commands. Provide scoped text and JSON reports, deterministic comparison,
and record-preserving metadata edits.
Package the shared library and optional Python Arrow readers as pheon using
CFFI ABI mode and Python-independent platform wheels. Include locked source
builds, native API checks, cross-platform artifact workflows, documentation
and regression coverage. Require Rust 1.88 or newer and Python 3.11 or newer.
Validation: 87 native tests, 14 binding tests on Python 3.11/3.13/3.14,
and 71 installed companion integration tests pass. Full, scanned and selected
Arrow layouts match the previous schemas.
2026-11-16 16:21:21 -08:00
|
|
|
])
|
|
|
|
|
};
|
|
|
|
|
let source = Document::parse(&bytes).unwrap().diagnostics[0].offset;
|
|
|
|
|
for scope in [
|
|
|
|
|
Scope::default(),
|
|
|
|
|
Scope {
|
|
|
|
|
layer: Some((1, 0)),
|
|
|
|
|
..Default::default()
|
|
|
|
|
},
|
|
|
|
|
Scope {
|
|
|
|
|
layer: Some((999, 0)),
|
|
|
|
|
..Default::default()
|
|
|
|
|
},
|
|
|
|
|
Scope {
|
|
|
|
|
top: Some("CHIP".into()),
|
|
|
|
|
..Default::default()
|
|
|
|
|
},
|
|
|
|
|
Scope {
|
|
|
|
|
cell: Some("CHIP".into()),
|
|
|
|
|
..Default::default()
|
|
|
|
|
},
|
|
|
|
|
Scope {
|
|
|
|
|
top: Some("CHIP".into()),
|
|
|
|
|
layer: Some((1, 0)),
|
|
|
|
|
..Default::default()
|
|
|
|
|
},
|
|
|
|
|
Scope {
|
|
|
|
|
cell: Some("CHIP".into()),
|
|
|
|
|
layer: Some((1, 0)),
|
|
|
|
|
..Default::default()
|
|
|
|
|
},
|
|
|
|
|
] {
|
|
|
|
|
let doc = Document::parse(&bytes)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.selected(&scope, false)
|
|
|
|
|
.unwrap();
|
|
|
|
|
assert_eq!(doc.diagnostics.len(), 1, "{scope:?}");
|
|
|
|
|
let diagnostic = &doc.diagnostics[0];
|
|
|
|
|
assert_eq!(diagnostic.code, "unsupported_metadata_version");
|
|
|
|
|
assert_eq!(diagnostic.cell.as_deref(), Some(location));
|
|
|
|
|
assert_eq!(diagnostic.layer, Some((900, 7)));
|
|
|
|
|
assert_eq!(diagnostic.offset, source);
|
|
|
|
|
let diff = Comparison::between(&doc, &doc);
|
Make Pheon structural review results self-contained
Capture revision metadata, cell presence and attributes, and structured
diagnostics in owned comparison results. Derive outcomes and render text,
JSON, and hierarchy reports without retaining source documents. Keep derived
descriptions and graph analysis in their renderers.
Use pheon-structural-v1 and PHEON_LAYER_NAMES_V1 consistently, expose helpers
through their defining modules, and remove obsolete re-exports. Update user
guides and report fixtures without changing schema version 1.
Cover dropped inputs, diagnostic ordering, absent and empty cells, offset
independence, and CLI failures. All 92 Rust tests pass in debug and release;
report and hierarchy goldens retain their behavior.
2026-11-16 20:45:06 -08:00
|
|
|
assert_eq!(diff.outcome().exit_code(), 2);
|
|
|
|
|
assert!(!diff.outcome().is_equal());
|
2026-11-17 21:49:26 -08:00
|
|
|
assert!(diff.text(0).starts_with("Incomplete\n"));
|
Make Pheon structural review results self-contained
Capture revision metadata, cell presence and attributes, and structured
diagnostics in owned comparison results. Derive outcomes and render text,
JSON, and hierarchy reports without retaining source documents. Keep derived
descriptions and graph analysis in their renderers.
Use pheon-structural-v1 and PHEON_LAYER_NAMES_V1 consistently, expose helpers
through their defining modules, and remove obsolete re-exports. Update user
guides and report fixtures without changing schema version 1.
Cover dropped inputs, diagnostic ordering, absent and empty cells, offset
independence, and CLI failures. All 92 Rust tests pass in debug and release;
report and hierarchy goldens retain their behavior.
2026-11-16 20:45:06 -08:00
|
|
|
let json = diff.json_report(&inputs(), &ReportOptions::default());
|
Introduce Pheon GDSII parsing and layout review tools
Implement native GDSII reading and writing with Arrow interchange, hierarchy
scans and selective cell loading. Validate numeric packing and array pitches,
and preserve normalized REAL8 encodings exactly within the supported range.
Add standalone dump, structural diff, hierarchy, layer-name annotation and Git
diff commands. Provide scoped text and JSON reports, deterministic comparison,
and record-preserving metadata edits.
Package the shared library and optional Python Arrow readers as pheon using
CFFI ABI mode and Python-independent platform wheels. Include locked source
builds, native API checks, cross-platform artifact workflows, documentation
and regression coverage. Require Rust 1.88 or newer and Python 3.11 or newer.
Validation: 87 native tests, 14 binding tests on Python 3.11/3.13/3.14,
and 71 installed companion integration tests pass. Full, scanned and selected
Arrow layouts match the previous schemas.
2026-11-16 16:21:21 -08:00
|
|
|
assert_eq!(json["status"], "incomplete");
|
|
|
|
|
assert_eq!(json["result"], "unknown");
|
|
|
|
|
assert_eq!(json["exit_code"], 2);
|
|
|
|
|
assert_eq!(json["diagnostics"].as_array().unwrap().len(), 2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
fn json_is_unbounded_by_default_and_explicit_filters_do_not_change_totals() {
|
|
|
|
|
let a = layout(&[("CHIP", vec![])]);
|
|
|
|
|
let b = layout(&[("CHIP", vec![square(); 120])]);
|
|
|
|
|
let full = report(&a, &b, &ReportOptions::default());
|
|
|
|
|
assert_eq!(
|
|
|
|
|
full["cell_changes"][0]["added"].as_array().unwrap().len(),
|
|
|
|
|
120
|
|
|
|
|
);
|
|
|
|
|
let limited = report(
|
|
|
|
|
&a,
|
|
|
|
|
&b,
|
|
|
|
|
&ReportOptions {
|
|
|
|
|
max_objects: Some(1),
|
|
|
|
|
..Default::default()
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
assert_eq!(limited["summary"], full["summary"]);
|
|
|
|
|
assert_eq!(limited["exit_code"], 1);
|
|
|
|
|
assert_eq!(limited["report_selection"]["truncated"], true);
|
|
|
|
|
assert_eq!(limited["report_selection"]["limited_objects"], "119");
|
|
|
|
|
assert_eq!(limited["report_selection"]["emitted_objects"], "1");
|
|
|
|
|
let filtered = report(
|
|
|
|
|
&a,
|
|
|
|
|
&b,
|
|
|
|
|
&ReportOptions {
|
|
|
|
|
filter: DisplayFilter {
|
|
|
|
|
cell: Some("absent".into()),
|
|
|
|
|
layer: None,
|
|
|
|
|
},
|
|
|
|
|
..Default::default()
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
assert_eq!(filtered["summary"], full["summary"]);
|
|
|
|
|
assert_eq!(filtered["cell_changes"], json!([]));
|
|
|
|
|
assert_eq!(filtered["report_selection"]["filtered_cells"], "1");
|
|
|
|
|
assert_eq!(filtered["report_selection"]["filtered_objects"], "120");
|
|
|
|
|
let filtered = report(
|
|
|
|
|
&a,
|
|
|
|
|
&b,
|
|
|
|
|
&ReportOptions {
|
|
|
|
|
filter: DisplayFilter {
|
|
|
|
|
cell: None,
|
|
|
|
|
layer: Some((2, 0)),
|
|
|
|
|
},
|
|
|
|
|
..Default::default()
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
assert_eq!(filtered["summary"], full["summary"]);
|
|
|
|
|
assert_eq!(filtered["report_selection"]["filtered_objects"], "120");
|
|
|
|
|
assert_eq!(filtered["cell_changes"][0]["added"], json!([]));
|
|
|
|
|
}
|
|
|
|
|
|
2026-11-18 10:58:19 -08:00
|
|
|
#[test]
|
|
|
|
|
fn streamed_report_keeps_object_ids_and_replacements_across_layer_filter_gaps() {
|
|
|
|
|
let a = layout(&[("CHIP", vec![square(), label((2, 0), "old")])]);
|
|
|
|
|
let b = layout(&[("CHIP", vec![triangle(), label((2, 0), "new")])]);
|
|
|
|
|
let diff = Comparison::between(&Document::parse(&a).unwrap(), &Document::parse(&b).unwrap());
|
|
|
|
|
let options = ReportOptions {
|
|
|
|
|
filter: DisplayFilter {
|
|
|
|
|
cell: None,
|
|
|
|
|
layer: Some((2, 0)),
|
|
|
|
|
},
|
|
|
|
|
max_objects: Some(2),
|
|
|
|
|
..Default::default()
|
|
|
|
|
};
|
|
|
|
|
let mut bytes = Vec::new();
|
|
|
|
|
diff.write_json_report(&mut bytes, &inputs(), &options)
|
|
|
|
|
.unwrap();
|
|
|
|
|
let actual: Value = serde_json::from_slice(&bytes).unwrap();
|
|
|
|
|
assert_eq!(actual, diff.json_report(&inputs(), &options));
|
|
|
|
|
assert_eq!(actual["report_selection"]["filtered_objects"], "2");
|
|
|
|
|
let cell = &actual["cell_changes"][0];
|
|
|
|
|
assert_eq!(cell["added"].as_array().unwrap().len(), 1);
|
|
|
|
|
assert_eq!(cell["removed"].as_array().unwrap().len(), 1);
|
|
|
|
|
assert_eq!(cell["replacements"].as_array().unwrap().len(), 1);
|
|
|
|
|
assert_eq!(cell["replacements"][0]["removed"], "c0:old:1");
|
|
|
|
|
assert_eq!(cell["replacements"][0]["added"], "c0:new:1");
|
|
|
|
|
}
|
|
|
|
|
|
Introduce Pheon GDSII parsing and layout review tools
Implement native GDSII reading and writing with Arrow interchange, hierarchy
scans and selective cell loading. Validate numeric packing and array pitches,
and preserve normalized REAL8 encodings exactly within the supported range.
Add standalone dump, structural diff, hierarchy, layer-name annotation and Git
diff commands. Provide scoped text and JSON reports, deterministic comparison,
and record-preserving metadata edits.
Package the shared library and optional Python Arrow readers as pheon using
CFFI ABI mode and Python-independent platform wheels. Include locked source
builds, native API checks, cross-platform artifact workflows, documentation
and regression coverage. Require Rust 1.88 or newer and Python 3.11 or newer.
Validation: 87 native tests, 14 binding tests on Python 3.11/3.13/3.14,
and 71 installed companion integration tests pass. Full, scanned and selected
Arrow layouts match the previous schemas.
2026-11-16 16:21:21 -08:00
|
|
|
#[test]
|
|
|
|
|
fn typed_evidence_preserves_defaults_properties_bytes_and_real_encodings() {
|
|
|
|
|
let mut a = reference("leaf", 0, 1);
|
|
|
|
|
a.truncate(a.len() - 4);
|
|
|
|
|
record(&mut a, RTAG_MAG, &0x4110000000000000_u64.to_be_bytes());
|
|
|
|
|
record(&mut a, RTAG_PROPATTR, &17_u16.to_be_bytes());
|
|
|
|
|
record(&mut a, RTAG_PROPVALUE, &[0xff, 0xfe]);
|
|
|
|
|
record(&mut a, RTAG_PROPATTR, &17_u16.to_be_bytes());
|
|
|
|
|
record(&mut a, RTAG_PROPVALUE, &[0xff, 0xfe]);
|
|
|
|
|
record(&mut a, RTAG_ENDEL, &[]);
|
|
|
|
|
let mut b = a.clone();
|
|
|
|
|
let mag = Document::parse(&layout(&[("CHIP", vec![a.clone()]), ("leaf", vec![])]))
|
|
|
|
|
.unwrap()
|
|
|
|
|
.records
|
|
|
|
|
.into_iter()
|
|
|
|
|
.find(|r| r.tag == RTAG_MAG)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.offset;
|
|
|
|
|
// Replace the REAL8 payload within the object, retaining the same decoded value.
|
|
|
|
|
let within = a
|
|
|
|
|
.windows(8)
|
|
|
|
|
.position(|v| v == 0x4110000000000000_u64.to_be_bytes())
|
|
|
|
|
.unwrap();
|
|
|
|
|
b[within..within + 8].copy_from_slice(&0x4201000000000000_u64.to_be_bytes());
|
|
|
|
|
let a = layout(&[("CHIP", vec![a]), ("leaf", vec![])]);
|
|
|
|
|
let b = layout(&[("CHIP", vec![b]), ("leaf", vec![])]);
|
2026-11-17 21:49:26 -08:00
|
|
|
let before = Document::parse(&a).unwrap();
|
|
|
|
|
let after = Document::parse(&b).unwrap();
|
|
|
|
|
assert!(before.canonical_dump().contains("mag=1.0 property"));
|
|
|
|
|
assert!(
|
|
|
|
|
after
|
|
|
|
|
.canonical_dump()
|
|
|
|
|
.contains("mag=1.0 raw=0x4201000000000000")
|
|
|
|
|
);
|
|
|
|
|
let text = Comparison::between(&before, &after).text(100);
|
|
|
|
|
assert!(text.contains("mag 1.0 raw=0x4110000000000000 -> 1.0 raw=0x4201000000000000"));
|
|
|
|
|
let omitted = layout(&[("CHIP", vec![reference("leaf", 0, 1)]), ("leaf", vec![])]);
|
|
|
|
|
let omitted = Document::parse(&omitted).unwrap();
|
|
|
|
|
let text = Comparison::between(&before, &omitted).text(100);
|
|
|
|
|
assert!(text.contains("mag 1.0 -> absent"));
|
|
|
|
|
assert!(!text.contains("raw="));
|
Introduce Pheon GDSII parsing and layout review tools
Implement native GDSII reading and writing with Arrow interchange, hierarchy
scans and selective cell loading. Validate numeric packing and array pitches,
and preserve normalized REAL8 encodings exactly within the supported range.
Add standalone dump, structural diff, hierarchy, layer-name annotation and Git
diff commands. Provide scoped text and JSON reports, deterministic comparison,
and record-preserving metadata edits.
Package the shared library and optional Python Arrow readers as pheon using
CFFI ABI mode and Python-independent platform wheels. Include locked source
builds, native API checks, cross-platform artifact workflows, documentation
and regression coverage. Require Rust 1.88 or newer and Python 3.11 or newer.
Validation: 87 native tests, 14 binding tests on Python 3.11/3.13/3.14,
and 71 installed companion integration tests pass. Full, scanned and selected
Arrow layouts match the previous schemas.
2026-11-16 16:21:21 -08:00
|
|
|
let r = report(&a, &b, &ReportOptions::default());
|
|
|
|
|
let replacement = &r["cell_changes"][0]["replacements"][0];
|
|
|
|
|
assert_eq!(replacement["match_rule"], "unique_kind_target");
|
|
|
|
|
let change = &replacement["field_changes"][0];
|
|
|
|
|
assert_eq!(change["tag"], RTAG_MAG);
|
|
|
|
|
assert_eq!(change["before"]["value"], change["after"]["value"]);
|
|
|
|
|
assert_ne!(
|
|
|
|
|
change["before"]["payload_hex"],
|
|
|
|
|
change["after"]["payload_hex"]
|
|
|
|
|
);
|
|
|
|
|
let removed = &r["cell_changes"][0]["removed"][0];
|
|
|
|
|
assert_eq!(removed["properties"].as_array().unwrap().len(), 2);
|
|
|
|
|
assert_eq!(removed["properties"][0]["attribute"], 17);
|
|
|
|
|
assert_eq!(removed["properties"][0]["value"], Value::Null);
|
|
|
|
|
assert_eq!(removed["properties"][0]["payload_hex"], "0xfffe");
|
|
|
|
|
let offset: usize = removed["source"]["byte_offset"]
|
|
|
|
|
.as_str()
|
|
|
|
|
.unwrap()
|
|
|
|
|
.parse()
|
|
|
|
|
.unwrap();
|
|
|
|
|
assert!(offset < mag);
|
|
|
|
|
let end: usize = removed["source"]["end_offset"]
|
|
|
|
|
.as_str()
|
|
|
|
|
.unwrap()
|
|
|
|
|
.parse()
|
|
|
|
|
.unwrap();
|
|
|
|
|
assert_eq!(&a[end - 4..end], &[0, 4, 17, 0]);
|
|
|
|
|
|
|
|
|
|
let mut path = square();
|
|
|
|
|
path[2..4].copy_from_slice(&RTAG_PATH.to_be_bytes());
|
|
|
|
|
let mut width = path.clone();
|
|
|
|
|
width.truncate(width.len() - 4);
|
|
|
|
|
record(&mut width, RTAG_WIDTH, &0_i32.to_be_bytes());
|
|
|
|
|
record(&mut width, RTAG_ENDEL, &[]);
|
|
|
|
|
let r = report(
|
|
|
|
|
&layout(&[("CHIP", vec![path])]),
|
|
|
|
|
&layout(&[("CHIP", vec![width])]),
|
|
|
|
|
&ReportOptions::default(),
|
|
|
|
|
);
|
|
|
|
|
let change = &r["cell_changes"][0]["replacements"][0]["field_changes"][0];
|
|
|
|
|
assert_eq!(change["tag"], RTAG_WIDTH);
|
|
|
|
|
assert_eq!(change["before"], Value::Null);
|
|
|
|
|
assert_eq!(change["after"]["value"], json!([0]));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
fn hierarchy_reports_shared_ancestors_and_symbolic_arrays() {
|
|
|
|
|
let options = ReportOptions {
|
|
|
|
|
hierarchy: true,
|
|
|
|
|
..Default::default()
|
|
|
|
|
};
|
|
|
|
|
let r = report(&shared(square()), &shared(triangle()), &options);
|
|
|
|
|
let graph = &r["hierarchy"];
|
|
|
|
|
assert_eq!(graph["nodes"].as_array().unwrap().len(), 4);
|
|
|
|
|
assert_eq!(
|
|
|
|
|
graph["nodes"]
|
|
|
|
|
.as_array()
|
|
|
|
|
.unwrap()
|
|
|
|
|
.iter()
|
|
|
|
|
.find(|n| n["cell"] == "CHIP")
|
|
|
|
|
.unwrap()["change"],
|
|
|
|
|
"affected"
|
|
|
|
|
);
|
|
|
|
|
assert_eq!(
|
|
|
|
|
graph["nodes"]
|
|
|
|
|
.as_array()
|
|
|
|
|
.unwrap()
|
|
|
|
|
.iter()
|
|
|
|
|
.find(|n| n["cell"] == "leaf")
|
|
|
|
|
.unwrap()["change"],
|
|
|
|
|
"direct"
|
|
|
|
|
);
|
|
|
|
|
let edge = graph["edges"]
|
|
|
|
|
.as_array()
|
|
|
|
|
.unwrap()
|
|
|
|
|
.iter()
|
|
|
|
|
.find(|e| e["parent"] == "right")
|
|
|
|
|
.unwrap();
|
|
|
|
|
assert_eq!(edge["before_count"], "3");
|
|
|
|
|
assert_eq!(edge["reference_changed"], false);
|
|
|
|
|
let bytes = shared(square());
|
|
|
|
|
let scope = Scope {
|
|
|
|
|
cell: Some("CHIP".into()),
|
|
|
|
|
..Default::default()
|
|
|
|
|
};
|
|
|
|
|
let doc = Document::parse(&bytes)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.selected(&scope, false)
|
|
|
|
|
.unwrap();
|
Make Pheon structural review results self-contained
Capture revision metadata, cell presence and attributes, and structured
diagnostics in owned comparison results. Derive outcomes and render text,
JSON, and hierarchy reports without retaining source documents. Keep derived
descriptions and graph analysis in their renderers.
Use pheon-structural-v1 and PHEON_LAYER_NAMES_V1 consistently, expose helpers
through their defining modules, and remove obsolete re-exports. Update user
guides and report fixtures without changing schema version 1.
Cover dropped inputs, diagnostic ordering, absent and empty cells, offset
independence, and CLI failures. All 92 Rust tests pass in debug and release;
report and hierarchy goldens retain their behavior.
2026-11-16 20:45:06 -08:00
|
|
|
let r = Comparison::between(&doc, &doc).json_report(&inputs(), &options);
|
Introduce Pheon GDSII parsing and layout review tools
Implement native GDSII reading and writing with Arrow interchange, hierarchy
scans and selective cell loading. Validate numeric packing and array pitches,
and preserve normalized REAL8 encodings exactly within the supported range.
Add standalone dump, structural diff, hierarchy, layer-name annotation and Git
diff commands. Provide scoped text and JSON reports, deterministic comparison,
and record-preserving metadata edits.
Package the shared library and optional Python Arrow readers as pheon using
CFFI ABI mode and Python-independent platform wheels. Include locked source
builds, native API checks, cross-platform artifact workflows, documentation
and regression coverage. Require Rust 1.88 or newer and Python 3.11 or newer.
Validation: 87 native tests, 14 binding tests on Python 3.11/3.13/3.14,
and 71 installed companion integration tests pass. Full, scanned and selected
Arrow layouts match the previous schemas.
2026-11-16 16:21:21 -08:00
|
|
|
assert_eq!(r["scope"]["cell"], "CHIP");
|
|
|
|
|
assert_eq!(
|
|
|
|
|
r["hierarchy"]["nodes"]
|
|
|
|
|
.as_array()
|
|
|
|
|
.unwrap()
|
|
|
|
|
.iter()
|
|
|
|
|
.find(|n| n["cell"] == "left")
|
|
|
|
|
.unwrap()["after"],
|
|
|
|
|
"outside_scope"
|
|
|
|
|
);
|
|
|
|
|
let dangling = layout(&[("CHIP", vec![reference("missing", 0, 1)])]);
|
|
|
|
|
let r = report(&dangling, &dangling, &options);
|
|
|
|
|
assert_eq!(r["diagnostics"][0]["code"], "unresolved_reference");
|
|
|
|
|
assert_eq!(r["diagnostics"][0]["target"], "missing");
|
|
|
|
|
assert_eq!(r["hierarchy"]["nodes"][1]["after"], "unresolved");
|
|
|
|
|
let cycle = layout(&[("CHIP", vec![reference("CHIP", 0, 1)])]);
|
|
|
|
|
assert_eq!(
|
|
|
|
|
report(&cycle, &cycle, &options)["diagnostics"][0]["code"],
|
|
|
|
|
"hierarchy_cycle"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
fn library_attributes_empty_cells_units_and_absence_are_explicit() {
|
|
|
|
|
let a = layout(&[]);
|
|
|
|
|
let b = layout(&[("empty", vec![])]);
|
|
|
|
|
let r = report(&a, &b, &ReportOptions::default());
|
|
|
|
|
assert_eq!(r["cell_changes"][0]["before"], Value::Null);
|
|
|
|
|
assert_eq!(r["cell_changes"][0]["after"]["attributes"], json!([]));
|
Make Pheon structural review results self-contained
Capture revision metadata, cell presence and attributes, and structured
diagnostics in owned comparison results. Derive outcomes and render text,
JSON, and hierarchy reports without retaining source documents. Keep derived
descriptions and graph analysis in their renderers.
Use pheon-structural-v1 and PHEON_LAYER_NAMES_V1 consistently, expose helpers
through their defining modules, and remove obsolete re-exports. Update user
guides and report fixtures without changing schema version 1.
Cover dropped inputs, diagnostic ordering, absent and empty cells, offset
independence, and CLI failures. All 92 Rust tests pass in debug and release;
report and hierarchy goldens retain their behavior.
2026-11-16 20:45:06 -08:00
|
|
|
assert_eq!(r["cell_changes"][0]["attributes_changed"], true);
|
|
|
|
|
let removed = report(&b, &a, &ReportOptions::default());
|
|
|
|
|
assert_eq!(
|
|
|
|
|
removed["cell_changes"][0]["before"]["attributes"],
|
|
|
|
|
json!([])
|
|
|
|
|
);
|
|
|
|
|
assert_eq!(removed["cell_changes"][0]["after"], Value::Null);
|
|
|
|
|
assert_eq!(removed["cell_changes"][0]["attributes_changed"], true);
|
Introduce Pheon GDSII parsing and layout review tools
Implement native GDSII reading and writing with Arrow interchange, hierarchy
scans and selective cell loading. Validate numeric packing and array pitches,
and preserve normalized REAL8 encodings exactly within the supported range.
Add standalone dump, structural diff, hierarchy, layer-name annotation and Git
diff commands. Provide scoped text and JSON reports, deterministic comparison,
and record-preserving metadata edits.
Package the shared library and optional Python Arrow readers as pheon using
CFFI ABI mode and Python-independent platform wheels. Include locked source
builds, native API checks, cross-platform artifact workflows, documentation
and regression coverage. Require Rust 1.88 or newer and Python 3.11 or newer.
Validation: 87 native tests, 14 binding tests on Python 3.11/3.13/3.14,
and 71 installed companion integration tests pass. Full, scanned and selected
Arrow layouts match the previous schemas.
2026-11-16 16:21:21 -08:00
|
|
|
let mut b = b;
|
|
|
|
|
let end = Document::parse(&b).unwrap().cells["empty"].end_offset;
|
|
|
|
|
let mut attribute = Vec::new();
|
|
|
|
|
record(&mut attribute, RTAG_STRCLASS, &[0, 1]);
|
|
|
|
|
b.splice(end..end, attribute);
|
|
|
|
|
let r = report(&layout(&[("empty", vec![])]), &b, &ReportOptions::default());
|
|
|
|
|
assert_eq!(
|
|
|
|
|
r["cell_changes"][0]["after"]["attributes"][0]["value"],
|
|
|
|
|
json!([1])
|
|
|
|
|
);
|
Make Pheon structural review results self-contained
Capture revision metadata, cell presence and attributes, and structured
diagnostics in owned comparison results. Derive outcomes and render text,
JSON, and hierarchy reports without retaining source documents. Keep derived
descriptions and graph analysis in their renderers.
Use pheon-structural-v1 and PHEON_LAYER_NAMES_V1 consistently, expose helpers
through their defining modules, and remove obsolete re-exports. Update user
guides and report fixtures without changing schema version 1.
Cover dropped inputs, diagnostic ordering, absent and empty cells, offset
independence, and CLI failures. All 92 Rust tests pass in debug and release;
report and hierarchy goldens retain their behavior.
2026-11-16 20:45:06 -08:00
|
|
|
assert_eq!(r["cell_changes"][0]["attributes_changed"], true);
|
Introduce Pheon GDSII parsing and layout review tools
Implement native GDSII reading and writing with Arrow interchange, hierarchy
scans and selective cell loading. Validate numeric packing and array pitches,
and preserve normalized REAL8 encodings exactly within the supported range.
Add standalone dump, structural diff, hierarchy, layer-name annotation and Git
diff commands. Provide scoped text and JSON reports, deterministic comparison,
and record-preserving metadata edits.
Package the shared library and optional Python Arrow readers as pheon using
CFFI ABI mode and Python-independent platform wheels. Include locked source
builds, native API checks, cross-platform artifact workflows, documentation
and regression coverage. Require Rust 1.88 or newer and Python 3.11 or newer.
Validation: 87 native tests, 14 binding tests on Python 3.11/3.13/3.14,
and 71 installed companion integration tests pass. Full, scanned and selected
Arrow layouts match the previous schemas.
2026-11-16 16:21:21 -08:00
|
|
|
assert_eq!(r["inputs"]["old"]["units"]["encoding"], "real8");
|
|
|
|
|
let doc = Document::parse(&a).unwrap();
|
|
|
|
|
let absent = doc.empty_like();
|
Make Pheon structural review results self-contained
Capture revision metadata, cell presence and attributes, and structured
diagnostics in owned comparison results. Derive outcomes and render text,
JSON, and hierarchy reports without retaining source documents. Keep derived
descriptions and graph analysis in their renderers.
Use pheon-structural-v1 and PHEON_LAYER_NAMES_V1 consistently, expose helpers
through their defining modules, and remove obsolete re-exports. Update user
guides and report fixtures without changing schema version 1.
Cover dropped inputs, diagnostic ordering, absent and empty cells, offset
independence, and CLI failures. All 92 Rust tests pass in debug and release;
report and hierarchy goldens retain their behavior.
2026-11-16 20:45:06 -08:00
|
|
|
let r = Comparison::between(&absent, &doc).json_report(&inputs(), &ReportOptions::default());
|
Introduce Pheon GDSII parsing and layout review tools
Implement native GDSII reading and writing with Arrow interchange, hierarchy
scans and selective cell loading. Validate numeric packing and array pitches,
and preserve normalized REAL8 encodings exactly within the supported range.
Add standalone dump, structural diff, hierarchy, layer-name annotation and Git
diff commands. Provide scoped text and JSON reports, deterministic comparison,
and record-preserving metadata edits.
Package the shared library and optional Python Arrow readers as pheon using
CFFI ABI mode and Python-independent platform wheels. Include locked source
builds, native API checks, cross-platform artifact workflows, documentation
and regression coverage. Require Rust 1.88 or newer and Python 3.11 or newer.
Validation: 87 native tests, 14 binding tests on Python 3.11/3.13/3.14,
and 71 installed companion integration tests pass. Full, scanned and selected
Arrow layouts match the previous schemas.
2026-11-16 16:21:21 -08:00
|
|
|
assert_eq!(r["inputs"]["old"]["present"], false);
|
|
|
|
|
assert_eq!(r["inputs"]["old"]["units"], Value::Null);
|
|
|
|
|
assert_eq!(
|
|
|
|
|
r["library_changes"],
|
|
|
|
|
json!([{"field":"presence","tag":null,"before":false,"after":true}])
|
|
|
|
|
);
|
|
|
|
|
let mut b = a.clone();
|
|
|
|
|
let units = doc
|
|
|
|
|
.records
|
|
|
|
|
.iter()
|
|
|
|
|
.find(|r| r.tag == RTAG_UNITS)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.offset;
|
Make Pheon structural review results self-contained
Capture revision metadata, cell presence and attributes, and structured
diagnostics in owned comparison results. Derive outcomes and render text,
JSON, and hierarchy reports without retaining source documents. Keep derived
descriptions and graph analysis in their renderers.
Use pheon-structural-v1 and PHEON_LAYER_NAMES_V1 consistently, expose helpers
through their defining modules, and remove obsolete re-exports. Update user
guides and report fixtures without changing schema version 1.
Cover dropped inputs, diagnostic ordering, absent and empty cells, offset
independence, and CLI failures. All 92 Rust tests pass in debug and release;
report and hierarchy goldens retain their behavior.
2026-11-16 20:45:06 -08:00
|
|
|
b[units + 12..units + 20]
|
|
|
|
|
.copy_from_slice(&pheon::basic::encode_real8(2e-9).unwrap().to_be_bytes());
|
Introduce Pheon GDSII parsing and layout review tools
Implement native GDSII reading and writing with Arrow interchange, hierarchy
scans and selective cell loading. Validate numeric packing and array pitches,
and preserve normalized REAL8 encodings exactly within the supported range.
Add standalone dump, structural diff, hierarchy, layer-name annotation and Git
diff commands. Provide scoped text and JSON reports, deterministic comparison,
and record-preserving metadata edits.
Package the shared library and optional Python Arrow readers as pheon using
CFFI ABI mode and Python-independent platform wheels. Include locked source
builds, native API checks, cross-platform artifact workflows, documentation
and regression coverage. Require Rust 1.88 or newer and Python 3.11 or newer.
Validation: 87 native tests, 14 binding tests on Python 3.11/3.13/3.14,
and 71 installed companion integration tests pass. Full, scanned and selected
Arrow layouts match the previous schemas.
2026-11-16 16:21:21 -08:00
|
|
|
let r = report(&a, &b, &ReportOptions::default());
|
|
|
|
|
assert_eq!(r["library_changes"][0]["tag"], RTAG_UNITS);
|
|
|
|
|
assert_ne!(r["inputs"]["old"]["units"], r["inputs"]["new"]["units"]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
fn reports_keep_extreme_coordinates_unsigned_layers_and_timestamp_equality() {
|
|
|
|
|
let a = layout(&[("quoted\"\\\n日本", vec![])]);
|
|
|
|
|
let mut shape = polygon(&[
|
|
|
|
|
[i32::MIN, i32::MIN],
|
|
|
|
|
[i32::MAX, i32::MIN],
|
|
|
|
|
[i32::MAX, i32::MAX],
|
|
|
|
|
[i32::MIN, i32::MAX],
|
|
|
|
|
[i32::MIN, i32::MIN],
|
|
|
|
|
]);
|
|
|
|
|
shape[8..10].copy_from_slice(&u16::MAX.to_be_bytes());
|
|
|
|
|
let b = layout(&[("quoted\"\\\n日本", vec![shape])]);
|
|
|
|
|
let r = report(&a, &b, &ReportOptions::default());
|
|
|
|
|
let object = &r["cell_changes"][0]["added"][0];
|
|
|
|
|
assert_eq!(object["layer"]["number"], u16::MAX);
|
|
|
|
|
assert_eq!(
|
|
|
|
|
object["bounds"],
|
|
|
|
|
json!([i32::MIN, i32::MIN, i32::MAX, i32::MAX])
|
|
|
|
|
);
|
|
|
|
|
let encoded = serde_json::to_string(&r).unwrap();
|
|
|
|
|
assert_eq!(serde_json::from_str::<Value>(&encoded).unwrap(), r);
|
|
|
|
|
let mut times = b.clone();
|
|
|
|
|
let doc = Document::parse(&b).unwrap();
|
|
|
|
|
for record in doc
|
|
|
|
|
.records
|
|
|
|
|
.iter()
|
|
|
|
|
.filter(|r| matches!(r.tag, RTAG_BGNLIB | RTAG_BGNSTR))
|
|
|
|
|
{
|
|
|
|
|
times[record.offset + 4..record.offset + 28].fill(1);
|
|
|
|
|
}
|
|
|
|
|
let r = report(&b, ×, &ReportOptions::default());
|
|
|
|
|
assert_eq!(r["result"], "equal");
|
|
|
|
|
assert_eq!(r["exit_code"], 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[cfg(unix)]
|
|
|
|
|
#[test]
|
|
|
|
|
fn cli_preserves_non_utf8_path_bytes_and_literal_option_names() {
|
|
|
|
|
use std::os::unix::ffi::OsStringExt;
|
|
|
|
|
let directory = std::env::temp_dir().join(format!("pheon json paths {}", std::process::id()));
|
|
|
|
|
fs::create_dir_all(&directory).unwrap();
|
|
|
|
|
struct Cleanup(PathBuf);
|
|
|
|
|
impl Drop for Cleanup {
|
|
|
|
|
fn drop(&mut self) {
|
|
|
|
|
let _ = fs::remove_dir_all(&self.0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
let _cleanup = Cleanup(directory.clone());
|
|
|
|
|
let path = directory.join(std::ffi::OsString::from_vec(b"file\xff.gds".to_vec()));
|
|
|
|
|
fs::write(&path, layout(&[])).unwrap();
|
|
|
|
|
let output = Command::new(env!("CARGO_BIN_EXE_pheon"))
|
|
|
|
|
.arg("diff")
|
|
|
|
|
.args(["--format", "json", "--"])
|
|
|
|
|
.arg(&path)
|
|
|
|
|
.arg(&path)
|
|
|
|
|
.output()
|
|
|
|
|
.unwrap();
|
|
|
|
|
assert_eq!(output.status.code(), Some(0));
|
|
|
|
|
let r: Value = serde_json::from_slice(&output.stdout).unwrap();
|
|
|
|
|
assert_eq!(r["inputs"]["old"]["path"], Value::Null);
|
|
|
|
|
let expected = "0x".to_string()
|
|
|
|
|
+ &path
|
|
|
|
|
.as_os_str()
|
|
|
|
|
.as_encoded_bytes()
|
|
|
|
|
.iter()
|
|
|
|
|
.map(|b| format!("{b:02x}"))
|
|
|
|
|
.collect::<String>();
|
|
|
|
|
assert_eq!(r["inputs"]["old"]["path_encoded_hex"], expected);
|
|
|
|
|
for name in ["--format", "json"] {
|
|
|
|
|
fs::write(directory.join(name), layout(&[])).unwrap();
|
|
|
|
|
}
|
|
|
|
|
let output = Command::new(env!("CARGO_BIN_EXE_pheon"))
|
|
|
|
|
.current_dir(&directory)
|
|
|
|
|
.args(["diff", "--", "--format", "json"])
|
|
|
|
|
.output()
|
|
|
|
|
.unwrap();
|
|
|
|
|
assert_eq!(output.status.code(), Some(0));
|
2026-11-17 21:49:26 -08:00
|
|
|
assert_eq!(output.stdout, b"Equal\n");
|
Introduce Pheon GDSII parsing and layout review tools
Implement native GDSII reading and writing with Arrow interchange, hierarchy
scans and selective cell loading. Validate numeric packing and array pitches,
and preserve normalized REAL8 encodings exactly within the supported range.
Add standalone dump, structural diff, hierarchy, layer-name annotation and Git
diff commands. Provide scoped text and JSON reports, deterministic comparison,
and record-preserving metadata edits.
Package the shared library and optional Python Arrow readers as pheon using
CFFI ABI mode and Python-independent platform wheels. Include locked source
builds, native API checks, cross-platform artifact workflows, documentation
and regression coverage. Require Rust 1.88 or newer and Python 3.11 or newer.
Validation: 87 native tests, 14 binding tests on Python 3.11/3.13/3.14,
and 71 installed companion integration tests pass. Full, scanned and selected
Arrow layouts match the previous schemas.
2026-11-16 16:21:21 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
fn machine_reports_match_versioned_goldens() {
|
|
|
|
|
let options = ReportOptions {
|
|
|
|
|
hierarchy: true,
|
|
|
|
|
..Default::default()
|
|
|
|
|
};
|
|
|
|
|
let equal = layout(&[("CHIP", vec![square()])]);
|
|
|
|
|
let metadata = corpus()
|
|
|
|
|
.into_iter()
|
|
|
|
|
.find(|p| p.name == "layer name only")
|
|
|
|
|
.unwrap();
|
|
|
|
|
let samples = [
|
|
|
|
|
("equal", report(&equal, &equal, &ReportOptions::default())),
|
|
|
|
|
(
|
|
|
|
|
"geometry",
|
|
|
|
|
report(&shared(square()), &shared(triangle()), &options),
|
|
|
|
|
),
|
|
|
|
|
(
|
|
|
|
|
"metadata",
|
|
|
|
|
report(&metadata.old, &metadata.new, &ReportOptions::default()),
|
|
|
|
|
),
|
|
|
|
|
(
|
|
|
|
|
"incomplete",
|
|
|
|
|
report(
|
|
|
|
|
&unknown(square()),
|
|
|
|
|
&unknown(square()),
|
|
|
|
|
&ReportOptions::default(),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
(
|
|
|
|
|
"failed",
|
|
|
|
|
failure_report(
|
|
|
|
|
&inputs(),
|
|
|
|
|
&Scope::default(),
|
|
|
|
|
&ReportOptions::default(),
|
Make Pheon structural review results self-contained
Capture revision metadata, cell presence and attributes, and structured
diagnostics in owned comparison results. Derive outcomes and render text,
JSON, and hierarchy reports without retaining source documents. Keep derived
descriptions and graph analysis in their renderers.
Use pheon-structural-v1 and PHEON_LAYER_NAMES_V1 consistently, expose helpers
through their defining modules, and remove obsolete re-exports. Update user
guides and report fixtures without changing schema version 1.
Cover dropped inputs, diagnostic ordering, absent and empty cells, offset
independence, and CLI failures. All 92 Rust tests pass in debug and release;
report and hierarchy goldens retain their behavior.
2026-11-16 20:45:06 -08:00
|
|
|
&Diagnostic::new("invalid_input", "truncated record", Some(Side::New)),
|
Introduce Pheon GDSII parsing and layout review tools
Implement native GDSII reading and writing with Arrow interchange, hierarchy
scans and selective cell loading. Validate numeric packing and array pitches,
and preserve normalized REAL8 encodings exactly within the supported range.
Add standalone dump, structural diff, hierarchy, layer-name annotation and Git
diff commands. Provide scoped text and JSON reports, deterministic comparison,
and record-preserving metadata edits.
Package the shared library and optional Python Arrow readers as pheon using
CFFI ABI mode and Python-independent platform wheels. Include locked source
builds, native API checks, cross-platform artifact workflows, documentation
and regression coverage. Require Rust 1.88 or newer and Python 3.11 or newer.
Validation: 87 native tests, 14 binding tests on Python 3.11/3.13/3.14,
and 71 installed companion integration tests pass. Full, scanned and selected
Arrow layouts match the previous schemas.
2026-11-16 16:21:21 -08:00
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
];
|
|
|
|
|
for (name, mut actual) in samples {
|
|
|
|
|
actual["producer"]["version"] = json!("test");
|
|
|
|
|
let path = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
|
|
|
|
|
.join(format!("tests/golden/report-{name}.json"));
|
|
|
|
|
if std::env::var_os("PHEON_UPDATE_REPORT_GOLDENS").is_some() {
|
|
|
|
|
fs::write(&path, serde_json::to_string_pretty(&actual).unwrap() + "\n").unwrap();
|
|
|
|
|
}
|
|
|
|
|
let expected: Value = serde_json::from_slice(&fs::read(&path).unwrap()).unwrap();
|
|
|
|
|
assert_eq!(actual, expected, "{name}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
fn cli_emits_json_for_success_input_errors_scope_errors_and_argument_errors() {
|
|
|
|
|
let directory = std::env::temp_dir().join(format!("pheon json {}", std::process::id()));
|
|
|
|
|
fs::create_dir_all(&directory).unwrap();
|
|
|
|
|
struct Cleanup(PathBuf);
|
|
|
|
|
impl Drop for Cleanup {
|
|
|
|
|
fn drop(&mut self) {
|
|
|
|
|
let _ = fs::remove_dir_all(&self.0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
let _cleanup = Cleanup(directory.clone());
|
|
|
|
|
let a = directory.join("before file.gds");
|
|
|
|
|
let b = directory.join("after file.gds");
|
|
|
|
|
fs::write(&a, shared(square())).unwrap();
|
|
|
|
|
fs::write(&b, shared(triangle())).unwrap();
|
|
|
|
|
let command = |extra: &[&str]| {
|
|
|
|
|
let output = Command::new(env!("CARGO_BIN_EXE_pheon"))
|
|
|
|
|
.arg("diff")
|
|
|
|
|
.arg(&a)
|
|
|
|
|
.arg(&b)
|
|
|
|
|
.args(["--format", "json"])
|
|
|
|
|
.args(extra)
|
|
|
|
|
.output()
|
|
|
|
|
.unwrap();
|
|
|
|
|
assert!(output.stderr.is_empty(), "{:?}", output.stderr);
|
|
|
|
|
let report: Value = serde_json::from_slice(&output.stdout).unwrap();
|
|
|
|
|
assert_eq!(
|
|
|
|
|
output.status.code().unwrap(),
|
|
|
|
|
report["exit_code"].as_i64().unwrap() as i32
|
|
|
|
|
);
|
|
|
|
|
report
|
|
|
|
|
};
|
Make Pheon structural review results self-contained
Capture revision metadata, cell presence and attributes, and structured
diagnostics in owned comparison results. Derive outcomes and render text,
JSON, and hierarchy reports without retaining source documents. Keep derived
descriptions and graph analysis in their renderers.
Use pheon-structural-v1 and PHEON_LAYER_NAMES_V1 consistently, expose helpers
through their defining modules, and remove obsolete re-exports. Update user
guides and report fixtures without changing schema version 1.
Cover dropped inputs, diagnostic ordering, absent and empty cells, offset
independence, and CLI failures. All 92 Rust tests pass in debug and release;
report and hierarchy goldens retain their behavior.
2026-11-16 20:45:06 -08:00
|
|
|
let check_text_failure = |report: &Value, extra: &[&str]| {
|
|
|
|
|
let output = Command::new(env!("CARGO_BIN_EXE_pheon"))
|
|
|
|
|
.arg("diff")
|
|
|
|
|
.arg(&a)
|
|
|
|
|
.arg(&b)
|
|
|
|
|
.args(extra)
|
|
|
|
|
.output()
|
|
|
|
|
.unwrap();
|
|
|
|
|
assert_eq!(output.status.code(), Some(2));
|
|
|
|
|
assert!(output.stdout.is_empty());
|
|
|
|
|
assert_eq!(
|
|
|
|
|
String::from_utf8(output.stderr).unwrap(),
|
|
|
|
|
format!(
|
|
|
|
|
"pheon: {}\n",
|
|
|
|
|
report["diagnostics"][0]["message"].as_str().unwrap()
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
};
|
Introduce Pheon GDSII parsing and layout review tools
Implement native GDSII reading and writing with Arrow interchange, hierarchy
scans and selective cell loading. Validate numeric packing and array pitches,
and preserve normalized REAL8 encodings exactly within the supported range.
Add standalone dump, structural diff, hierarchy, layer-name annotation and Git
diff commands. Provide scoped text and JSON reports, deterministic comparison,
and record-preserving metadata edits.
Package the shared library and optional Python Arrow readers as pheon using
CFFI ABI mode and Python-independent platform wheels. Include locked source
builds, native API checks, cross-platform artifact workflows, documentation
and regression coverage. Require Rust 1.88 or newer and Python 3.11 or newer.
Validation: 87 native tests, 14 binding tests on Python 3.11/3.13/3.14,
and 71 installed companion integration tests pass. Full, scanned and selected
Arrow layouts match the previous schemas.
2026-11-16 16:21:21 -08:00
|
|
|
let full = command(&["--hierarchy", "graph"]);
|
|
|
|
|
assert_eq!(full["result"], "different");
|
|
|
|
|
assert!(full["hierarchy"].is_object());
|
2026-11-18 10:58:19 -08:00
|
|
|
let large = |mut bytes: Vec<u8>| {
|
|
|
|
|
bytes.resize(3 * 1024 * 1024, 0);
|
|
|
|
|
bytes
|
|
|
|
|
};
|
|
|
|
|
let mut large_old = large(shared(square()));
|
|
|
|
|
let mut large_new = large(shared(triangle()));
|
|
|
|
|
fs::write(&a, &large_old).unwrap();
|
|
|
|
|
fs::write(&b, &large_new).unwrap();
|
|
|
|
|
assert_eq!(command(&["--hierarchy", "graph"]), full);
|
|
|
|
|
*large_old.last_mut().unwrap() = 1;
|
|
|
|
|
*large_new.last_mut().unwrap() = 1;
|
|
|
|
|
fs::write(&a, &large_old).unwrap();
|
|
|
|
|
fs::write(&b, &large_new).unwrap();
|
|
|
|
|
assert_eq!(command(&[])["diagnostics"][0]["side"], "old");
|
|
|
|
|
fs::write(&a, shared(square())).unwrap();
|
|
|
|
|
fs::write(&b, shared(triangle())).unwrap();
|
Introduce Pheon GDSII parsing and layout review tools
Implement native GDSII reading and writing with Arrow interchange, hierarchy
scans and selective cell loading. Validate numeric packing and array pitches,
and preserve normalized REAL8 encodings exactly within the supported range.
Add standalone dump, structural diff, hierarchy, layer-name annotation and Git
diff commands. Provide scoped text and JSON reports, deterministic comparison,
and record-preserving metadata edits.
Package the shared library and optional Python Arrow readers as pheon using
CFFI ABI mode and Python-independent platform wheels. Include locked source
builds, native API checks, cross-platform artifact workflows, documentation
and regression coverage. Require Rust 1.88 or newer and Python 3.11 or newer.
Validation: 87 native tests, 14 binding tests on Python 3.11/3.13/3.14,
and 71 installed companion integration tests pass. Full, scanned and selected
Arrow layouts match the previous schemas.
2026-11-16 16:21:21 -08:00
|
|
|
let limited = command(&["--max-changes", "0"]);
|
|
|
|
|
assert_eq!(limited["summary"], full["summary"]);
|
|
|
|
|
assert_eq!(limited["report_selection"]["emitted_objects"], "0");
|
|
|
|
|
for extra in [
|
|
|
|
|
&["--top", "missing"][..],
|
|
|
|
|
&["--unknown"],
|
|
|
|
|
&["--max-changes", "x"],
|
|
|
|
|
&["--hierarchy", "mermaid"],
|
|
|
|
|
&["--depth", "3"],
|
|
|
|
|
] {
|
|
|
|
|
let failure = command(extra);
|
|
|
|
|
assert_eq!(failure["status"], "failed");
|
|
|
|
|
assert_eq!(failure["result"], "unknown");
|
|
|
|
|
assert_eq!(failure["summary"], Value::Null);
|
Make Pheon structural review results self-contained
Capture revision metadata, cell presence and attributes, and structured
diagnostics in owned comparison results. Derive outcomes and render text,
JSON, and hierarchy reports without retaining source documents. Keep derived
descriptions and graph analysis in their renderers.
Use pheon-structural-v1 and PHEON_LAYER_NAMES_V1 consistently, expose helpers
through their defining modules, and remove obsolete re-exports. Update user
guides and report fixtures without changing schema version 1.
Cover dropped inputs, diagnostic ordering, absent and empty cells, offset
independence, and CLI failures. All 92 Rust tests pass in debug and release;
report and hierarchy goldens retain their behavior.
2026-11-16 20:45:06 -08:00
|
|
|
if extra.first() == Some(&"--top") {
|
|
|
|
|
assert_eq!(failure["diagnostics"][0]["code"], "invalid_scope");
|
|
|
|
|
assert_eq!(failure["diagnostics"][0]["side"], Value::Null);
|
|
|
|
|
check_text_failure(&failure, extra);
|
|
|
|
|
}
|
Introduce Pheon GDSII parsing and layout review tools
Implement native GDSII reading and writing with Arrow interchange, hierarchy
scans and selective cell loading. Validate numeric packing and array pitches,
and preserve normalized REAL8 encodings exactly within the supported range.
Add standalone dump, structural diff, hierarchy, layer-name annotation and Git
diff commands. Provide scoped text and JSON reports, deterministic comparison,
and record-preserving metadata edits.
Package the shared library and optional Python Arrow readers as pheon using
CFFI ABI mode and Python-independent platform wheels. Include locked source
builds, native API checks, cross-platform artifact workflows, documentation
and regression coverage. Require Rust 1.88 or newer and Python 3.11 or newer.
Validation: 87 native tests, 14 binding tests on Python 3.11/3.13/3.14,
and 71 installed companion integration tests pass. Full, scanned and selected
Arrow layouts match the previous schemas.
2026-11-16 16:21:21 -08:00
|
|
|
}
|
|
|
|
|
fs::write(&b, b"invalid").unwrap();
|
|
|
|
|
let invalid = command(&[]);
|
|
|
|
|
assert_eq!(invalid["diagnostics"][0]["code"], "invalid_input");
|
|
|
|
|
assert_eq!(invalid["diagnostics"][0]["side"], "new");
|
|
|
|
|
assert_eq!(invalid["inputs"]["new"]["path"], b.to_str().unwrap());
|
Make Pheon structural review results self-contained
Capture revision metadata, cell presence and attributes, and structured
diagnostics in owned comparison results. Derive outcomes and render text,
JSON, and hierarchy reports without retaining source documents. Keep derived
descriptions and graph analysis in their renderers.
Use pheon-structural-v1 and PHEON_LAYER_NAMES_V1 consistently, expose helpers
through their defining modules, and remove obsolete re-exports. Update user
guides and report fixtures without changing schema version 1.
Cover dropped inputs, diagnostic ordering, absent and empty cells, offset
independence, and CLI failures. All 92 Rust tests pass in debug and release;
report and hierarchy goldens retain their behavior.
2026-11-16 20:45:06 -08:00
|
|
|
check_text_failure(&invalid, &[]);
|
|
|
|
|
fs::write(&a, b"invalid").unwrap();
|
|
|
|
|
let invalid = command(&[]);
|
|
|
|
|
assert_eq!(invalid["diagnostics"][0]["code"], "invalid_input");
|
|
|
|
|
assert_eq!(invalid["diagnostics"][0]["side"], "old");
|
|
|
|
|
check_text_failure(&invalid, &[]);
|
|
|
|
|
fs::write(&a, shared(square())).unwrap();
|
Introduce Pheon GDSII parsing and layout review tools
Implement native GDSII reading and writing with Arrow interchange, hierarchy
scans and selective cell loading. Validate numeric packing and array pitches,
and preserve normalized REAL8 encodings exactly within the supported range.
Add standalone dump, structural diff, hierarchy, layer-name annotation and Git
diff commands. Provide scoped text and JSON reports, deterministic comparison,
and record-preserving metadata edits.
Package the shared library and optional Python Arrow readers as pheon using
CFFI ABI mode and Python-independent platform wheels. Include locked source
builds, native API checks, cross-platform artifact workflows, documentation
and regression coverage. Require Rust 1.88 or newer and Python 3.11 or newer.
Validation: 87 native tests, 14 binding tests on Python 3.11/3.13/3.14,
and 71 installed companion integration tests pass. Full, scanned and selected
Arrow layouts match the previous schemas.
2026-11-16 16:21:21 -08:00
|
|
|
fs::remove_file(&b).unwrap();
|
Make Pheon structural review results self-contained
Capture revision metadata, cell presence and attributes, and structured
diagnostics in owned comparison results. Derive outcomes and render text,
JSON, and hierarchy reports without retaining source documents. Keep derived
descriptions and graph analysis in their renderers.
Use pheon-structural-v1 and PHEON_LAYER_NAMES_V1 consistently, expose helpers
through their defining modules, and remove obsolete re-exports. Update user
guides and report fixtures without changing schema version 1.
Cover dropped inputs, diagnostic ordering, absent and empty cells, offset
independence, and CLI failures. All 92 Rust tests pass in debug and release;
report and hierarchy goldens retain their behavior.
2026-11-16 20:45:06 -08:00
|
|
|
let missing = command(&[]);
|
|
|
|
|
assert_eq!(missing["diagnostics"][0]["code"], "io_error");
|
|
|
|
|
assert_eq!(missing["diagnostics"][0]["side"], "new");
|
|
|
|
|
check_text_failure(&missing, &[]);
|
|
|
|
|
fs::remove_file(&a).unwrap();
|
|
|
|
|
let missing = command(&[]);
|
|
|
|
|
assert_eq!(missing["diagnostics"][0]["code"], "io_error");
|
|
|
|
|
assert_eq!(missing["diagnostics"][0]["side"], "old");
|
|
|
|
|
check_text_failure(&missing, &[]);
|
|
|
|
|
fs::write(&a, shared(square())).unwrap();
|
Introduce Pheon GDSII parsing and layout review tools
Implement native GDSII reading and writing with Arrow interchange, hierarchy
scans and selective cell loading. Validate numeric packing and array pitches,
and preserve normalized REAL8 encodings exactly within the supported range.
Add standalone dump, structural diff, hierarchy, layer-name annotation and Git
diff commands. Provide scoped text and JSON reports, deterministic comparison,
and record-preserving metadata edits.
Package the shared library and optional Python Arrow readers as pheon using
CFFI ABI mode and Python-independent platform wheels. Include locked source
builds, native API checks, cross-platform artifact workflows, documentation
and regression coverage. Require Rust 1.88 or newer and Python 3.11 or newer.
Validation: 87 native tests, 14 binding tests on Python 3.11/3.13/3.14,
and 71 installed companion integration tests pass. Full, scanned and selected
Arrow layouts match the previous schemas.
2026-11-16 16:21:21 -08:00
|
|
|
fs::write(&b, fs::read(&a).unwrap()).unwrap();
|
|
|
|
|
assert_eq!(command(&[])["result"], "equal");
|
|
|
|
|
fs::write(&b, unknown(square())).unwrap();
|
|
|
|
|
assert_eq!(command(&[])["status"], "incomplete");
|
|
|
|
|
fs::write(
|
|
|
|
|
&b,
|
|
|
|
|
layout(&[
|
|
|
|
|
("CHIP", vec![square()]),
|
Make Pheon structural review results self-contained
Capture revision metadata, cell presence and attributes, and structured
diagnostics in owned comparison results. Derive outcomes and render text,
JSON, and hierarchy reports without retaining source documents. Keep derived
descriptions and graph analysis in their renderers.
Use pheon-structural-v1 and PHEON_LAYER_NAMES_V1 consistently, expose helpers
through their defining modules, and remove obsolete re-exports. Update user
guides and report fixtures without changing schema version 1.
Cover dropped inputs, diagnostic ordering, absent and empty cells, offset
independence, and CLI failures. All 92 Rust tests pass in debug and release;
report and hierarchy goldens retain their behavior.
2026-11-16 20:45:06 -08:00
|
|
|
("legend", vec![label((900, 7), "PHEON_LAYER_NAMES_V2")]),
|
Introduce Pheon GDSII parsing and layout review tools
Implement native GDSII reading and writing with Arrow interchange, hierarchy
scans and selective cell loading. Validate numeric packing and array pitches,
and preserve normalized REAL8 encodings exactly within the supported range.
Add standalone dump, structural diff, hierarchy, layer-name annotation and Git
diff commands. Provide scoped text and JSON reports, deterministic comparison,
and record-preserving metadata edits.
Package the shared library and optional Python Arrow readers as pheon using
CFFI ABI mode and Python-independent platform wheels. Include locked source
builds, native API checks, cross-platform artifact workflows, documentation
and regression coverage. Require Rust 1.88 or newer and Python 3.11 or newer.
Validation: 87 native tests, 14 binding tests on Python 3.11/3.13/3.14,
and 71 installed companion integration tests pass. Full, scanned and selected
Arrow layouts match the previous schemas.
2026-11-16 16:21:21 -08:00
|
|
|
]),
|
|
|
|
|
)
|
|
|
|
|
.unwrap();
|
|
|
|
|
for flags in [
|
|
|
|
|
&["--layer", "1/0"][..],
|
|
|
|
|
&["--top", "CHIP"],
|
|
|
|
|
&["--cell", "CHIP", "--layer", "1/0"],
|
|
|
|
|
] {
|
|
|
|
|
let report = command(flags);
|
|
|
|
|
assert_eq!(report["status"], "incomplete");
|
|
|
|
|
assert_eq!(report["exit_code"], 2);
|
|
|
|
|
assert_eq!(
|
|
|
|
|
report["diagnostics"][0]["code"],
|
|
|
|
|
"unsupported_metadata_version"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|