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
|
|
|
|
mod common;
|
|
|
|
|
|
#[path = "review/reports.rs"]
|
|
|
|
|
|
mod reports;
|
|
|
|
|
|
|
|
|
|
|
|
use common::{library_header, record};
|
|
|
|
|
|
use pheon::{
|
|
|
|
|
|
records::*,
|
2026-11-18 10:58:19 -08:00
|
|
|
|
review::{
|
2026-11-18 23:20:00 -08:00
|
|
|
|
Comparison, Document, TextComparison, TextReportOptions, names::LAYER_SENTINEL,
|
|
|
|
|
|
selection::DisplayFilter,
|
2026-11-18 10:58:19 -08:00
|
|
|
|
},
|
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 std::{fs, path::PathBuf, process::Command};
|
|
|
|
|
|
|
|
|
|
|
|
fn ascii(bytes: &mut Vec<u8>, tag: u16, value: &str) {
|
|
|
|
|
|
let mut value = value.as_bytes().to_vec();
|
|
|
|
|
|
if value.len() % 2 == 1 {
|
|
|
|
|
|
value.push(0);
|
|
|
|
|
|
}
|
|
|
|
|
|
record(bytes, tag, &value);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn xy(bytes: &mut Vec<u8>, points: &[[i32; 2]]) {
|
|
|
|
|
|
record(
|
|
|
|
|
|
bytes,
|
|
|
|
|
|
RTAG_XY,
|
|
|
|
|
|
&points
|
|
|
|
|
|
.iter()
|
|
|
|
|
|
.flatten()
|
|
|
|
|
|
.flat_map(|v| v.to_be_bytes())
|
|
|
|
|
|
.collect::<Vec<_>>(),
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn layout(cells: &[(&str, Vec<Vec<u8>>)]) -> Vec<u8> {
|
|
|
|
|
|
let mut bytes = library_header();
|
|
|
|
|
|
for (name, objects) in cells {
|
|
|
|
|
|
record(&mut bytes, RTAG_BGNSTR, &[0; 24]);
|
|
|
|
|
|
ascii(&mut bytes, RTAG_STRNAME, name);
|
|
|
|
|
|
for object in objects {
|
|
|
|
|
|
bytes.extend_from_slice(object);
|
|
|
|
|
|
}
|
|
|
|
|
|
record(&mut bytes, RTAG_ENDSTR, &[]);
|
|
|
|
|
|
}
|
|
|
|
|
|
record(&mut bytes, RTAG_ENDLIB, &[]);
|
|
|
|
|
|
bytes
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-11-17 16:14:53 -08:00
|
|
|
|
fn gzip(data: &[u8]) -> Vec<u8> {
|
|
|
|
|
|
use std::io::Write;
|
|
|
|
|
|
|
|
|
|
|
|
let mut encoder = flate2::write::GzEncoder::new(Vec::new(), flate2::Compression::default());
|
|
|
|
|
|
encoder.write_all(data).unwrap();
|
|
|
|
|
|
encoder.finish().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
|
|
|
|
fn polygon(points: &[[i32; 2]]) -> Vec<u8> {
|
2026-11-17 21:49:26 -08:00
|
|
|
|
ring(RTAG_BOUNDARY, RTAG_DATATYPE, 1, points)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn ring(kind: u16, type_tag: u16, layer: u16, points: &[[i32; 2]]) -> Vec<u8> {
|
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 bytes = Vec::new();
|
2026-11-17 21:49:26 -08:00
|
|
|
|
record(&mut bytes, kind, &[]);
|
|
|
|
|
|
record(&mut bytes, RTAG_LAYER, &layer.to_be_bytes());
|
|
|
|
|
|
record(&mut bytes, type_tag, &0_u16.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
|
|
|
|
xy(&mut bytes, points);
|
|
|
|
|
|
record(&mut bytes, RTAG_ENDEL, &[]);
|
|
|
|
|
|
bytes
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn square() -> Vec<u8> {
|
|
|
|
|
|
polygon(&[[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]])
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn triangle() -> Vec<u8> {
|
|
|
|
|
|
polygon(&[[0, 0], [10, 0], [0, 10], [0, 0]])
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn reference(target: &str, x: i32, count: i16) -> Vec<u8> {
|
|
|
|
|
|
let mut bytes = Vec::new();
|
|
|
|
|
|
record(
|
|
|
|
|
|
&mut bytes,
|
|
|
|
|
|
if count == 1 { RTAG_SREF } else { RTAG_AREF },
|
|
|
|
|
|
&[],
|
|
|
|
|
|
);
|
|
|
|
|
|
ascii(&mut bytes, RTAG_SNAME, target);
|
|
|
|
|
|
if count == 1 {
|
|
|
|
|
|
xy(&mut bytes, &[[x, 0]]);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
let counts: Vec<_> = [count, 1].into_iter().flat_map(i16::to_be_bytes).collect();
|
|
|
|
|
|
record(&mut bytes, RTAG_COLROW, &counts);
|
|
|
|
|
|
xy(&mut bytes, &[[x, 0], [x + 100, 0], [x, 0]]);
|
|
|
|
|
|
}
|
|
|
|
|
|
record(&mut bytes, RTAG_ENDEL, &[]);
|
|
|
|
|
|
bytes
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn label(carrier: (u16, u16), text: &str) -> Vec<u8> {
|
|
|
|
|
|
let mut bytes = Vec::new();
|
|
|
|
|
|
record(&mut bytes, RTAG_TEXT, &[]);
|
|
|
|
|
|
record(&mut bytes, RTAG_LAYER, &carrier.0.to_be_bytes());
|
|
|
|
|
|
record(&mut bytes, RTAG_TEXTTYPE, &carrier.1.to_be_bytes());
|
|
|
|
|
|
xy(&mut bytes, &[[0, 0]]);
|
|
|
|
|
|
ascii(&mut bytes, RTAG_STRING, text);
|
|
|
|
|
|
record(&mut bytes, RTAG_ENDEL, &[]);
|
|
|
|
|
|
bytes
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-11-18 10:58:19 -08:00
|
|
|
|
fn path(width: Option<i32>, points: &[[i32; 2]]) -> Vec<u8> {
|
|
|
|
|
|
let mut bytes = Vec::new();
|
|
|
|
|
|
record(&mut bytes, RTAG_PATH, &[]);
|
|
|
|
|
|
record(&mut bytes, RTAG_LAYER, &[0, 1]);
|
|
|
|
|
|
record(&mut bytes, RTAG_DATATYPE, &[0, 0]);
|
|
|
|
|
|
if let Some(width) = width {
|
|
|
|
|
|
record(&mut bytes, RTAG_WIDTH, &width.to_be_bytes());
|
|
|
|
|
|
}
|
|
|
|
|
|
xy(&mut bytes, points);
|
|
|
|
|
|
record(&mut bytes, RTAG_ENDEL, &[]);
|
|
|
|
|
|
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
|
|
|
|
fn with_property(mut object: Vec<u8>, value: &str) -> Vec<u8> {
|
|
|
|
|
|
object.truncate(object.len() - 4);
|
|
|
|
|
|
record(&mut object, RTAG_PROPATTR, &17_u16.to_be_bytes());
|
|
|
|
|
|
ascii(&mut object, RTAG_PROPVALUE, value);
|
|
|
|
|
|
record(&mut object, RTAG_ENDEL, &[]);
|
|
|
|
|
|
object
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn shared(geometry: Vec<u8>) -> Vec<u8> {
|
|
|
|
|
|
layout(&[
|
|
|
|
|
|
(
|
|
|
|
|
|
"CHIP",
|
|
|
|
|
|
vec![reference("left", 0, 1), reference("right", 20, 1)],
|
|
|
|
|
|
),
|
|
|
|
|
|
("left", vec![reference("leaf", 0, 2)]),
|
|
|
|
|
|
("right", vec![reference("leaf", 0, 3)]),
|
|
|
|
|
|
("leaf", vec![geometry]),
|
|
|
|
|
|
])
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct Pair {
|
|
|
|
|
|
name: &'static str,
|
|
|
|
|
|
old: Vec<u8>,
|
|
|
|
|
|
new: Vec<u8>,
|
|
|
|
|
|
changed_cells: usize,
|
|
|
|
|
|
removed: usize,
|
|
|
|
|
|
added: usize,
|
|
|
|
|
|
metadata: usize,
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Ten deliberately small fixture pairs specify the first object profile.
|
|
|
|
|
|
fn corpus() -> Vec<Pair> {
|
|
|
|
|
|
let base = layout(&[("CHIP", vec![square(), label((2, 0), "port")])]);
|
|
|
|
|
|
let mut timestamps = base.clone();
|
|
|
|
|
|
timestamps[10] = 1; // BGNLIB payload, ignored by the object profile.
|
|
|
|
|
|
let meta = |name| {
|
|
|
|
|
|
layout(&[(
|
|
|
|
|
|
"CHIP",
|
|
|
|
|
|
vec![
|
|
|
|
|
|
square(),
|
|
|
|
|
|
label((900, 7), LAYER_SENTINEL),
|
|
|
|
|
|
label((900, 7), name),
|
|
|
|
|
|
],
|
|
|
|
|
|
)])
|
|
|
|
|
|
};
|
|
|
|
|
|
vec![
|
|
|
|
|
|
Pair {
|
|
|
|
|
|
name: "record reordering",
|
|
|
|
|
|
old: base.clone(),
|
|
|
|
|
|
new: layout(&[("CHIP", vec![label((2, 0), "port"), square()])]),
|
|
|
|
|
|
changed_cells: 0,
|
|
|
|
|
|
removed: 0,
|
|
|
|
|
|
added: 0,
|
|
|
|
|
|
metadata: 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
Pair {
|
|
|
|
|
|
name: "timestamp edit",
|
|
|
|
|
|
old: base,
|
|
|
|
|
|
new: timestamps,
|
|
|
|
|
|
changed_cells: 0,
|
|
|
|
|
|
removed: 0,
|
|
|
|
|
|
added: 0,
|
|
|
|
|
|
metadata: 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
Pair {
|
|
|
|
|
|
name: "polygon start and winding",
|
|
|
|
|
|
old: layout(&[("CHIP", vec![square()])]),
|
|
|
|
|
|
new: layout(&[(
|
|
|
|
|
|
"CHIP",
|
|
|
|
|
|
vec![polygon(&[[10, 10], [10, 0], [0, 0], [0, 10], [10, 10]])],
|
|
|
|
|
|
)]),
|
|
|
|
|
|
changed_cells: 0,
|
|
|
|
|
|
removed: 0,
|
|
|
|
|
|
added: 0,
|
|
|
|
|
|
metadata: 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
Pair {
|
|
|
|
|
|
name: "duplicate shape",
|
|
|
|
|
|
old: layout(&[("CHIP", vec![square()])]),
|
|
|
|
|
|
new: layout(&[("CHIP", vec![square(), square()])]),
|
|
|
|
|
|
changed_cells: 1,
|
|
|
|
|
|
removed: 0,
|
|
|
|
|
|
added: 1,
|
|
|
|
|
|
metadata: 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
Pair {
|
|
|
|
|
|
name: "same bounds different geometry",
|
|
|
|
|
|
old: layout(&[("CHIP", vec![square()])]),
|
|
|
|
|
|
new: layout(&[("CHIP", vec![triangle()])]),
|
|
|
|
|
|
changed_cells: 1,
|
|
|
|
|
|
removed: 1,
|
|
|
|
|
|
added: 1,
|
|
|
|
|
|
metadata: 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
Pair {
|
|
|
|
|
|
name: "moved reference",
|
|
|
|
|
|
old: layout(&[
|
|
|
|
|
|
("CHIP", vec![reference("leaf", 0, 1)]),
|
|
|
|
|
|
("leaf", vec![square()]),
|
|
|
|
|
|
]),
|
|
|
|
|
|
new: layout(&[
|
|
|
|
|
|
("CHIP", vec![reference("leaf", 5, 1)]),
|
|
|
|
|
|
("leaf", vec![square()]),
|
|
|
|
|
|
]),
|
|
|
|
|
|
changed_cells: 1,
|
|
|
|
|
|
removed: 1,
|
|
|
|
|
|
added: 1,
|
|
|
|
|
|
metadata: 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
Pair {
|
|
|
|
|
|
name: "array count",
|
|
|
|
|
|
old: layout(&[
|
|
|
|
|
|
("CHIP", vec![reference("leaf", 0, 2)]),
|
|
|
|
|
|
("leaf", vec![square()]),
|
|
|
|
|
|
]),
|
|
|
|
|
|
new: layout(&[
|
|
|
|
|
|
("CHIP", vec![reference("leaf", 0, 3)]),
|
|
|
|
|
|
("leaf", vec![square()]),
|
|
|
|
|
|
]),
|
|
|
|
|
|
changed_cells: 1,
|
|
|
|
|
|
removed: 1,
|
|
|
|
|
|
added: 1,
|
|
|
|
|
|
metadata: 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
Pair {
|
|
|
|
|
|
name: "element property",
|
|
|
|
|
|
old: layout(&[("CHIP", vec![with_property(square(), "old")])]),
|
|
|
|
|
|
new: layout(&[("CHIP", vec![with_property(square(), "new")])]),
|
|
|
|
|
|
changed_cells: 1,
|
|
|
|
|
|
removed: 1,
|
|
|
|
|
|
added: 1,
|
|
|
|
|
|
metadata: 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
Pair {
|
|
|
|
|
|
name: "layer name only",
|
|
|
|
|
|
old: meta("1:0:WG"),
|
|
|
|
|
|
new: meta("1:0:CORE:WG"),
|
|
|
|
|
|
changed_cells: 0,
|
|
|
|
|
|
removed: 0,
|
|
|
|
|
|
added: 0,
|
|
|
|
|
|
metadata: 1,
|
|
|
|
|
|
},
|
|
|
|
|
|
Pair {
|
|
|
|
|
|
name: "shared changed descendant",
|
|
|
|
|
|
old: shared(square()),
|
|
|
|
|
|
new: shared(triangle()),
|
|
|
|
|
|
changed_cells: 1,
|
|
|
|
|
|
removed: 1,
|
|
|
|
|
|
added: 1,
|
|
|
|
|
|
metadata: 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
|
fn ten_fixture_pairs_have_explicit_expected_changes() {
|
|
|
|
|
|
for pair in corpus() {
|
|
|
|
|
|
let old = Document::parse(&pair.old).unwrap();
|
|
|
|
|
|
let new = Document::parse(&pair.new).unwrap();
|
|
|
|
|
|
let diff = Comparison::between(&old, &new);
|
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!(
|
|
|
|
|
|
diff.diagnostics.is_empty(),
|
|
|
|
|
|
"{}: {:?}",
|
|
|
|
|
|
pair.name,
|
|
|
|
|
|
diff.diagnostics
|
|
|
|
|
|
);
|
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!(diff.cells.len(), pair.changed_cells, "{}", pair.name);
|
|
|
|
|
|
assert_eq!(
|
|
|
|
|
|
diff.cells.iter().map(|c| c.removed.len()).sum::<usize>(),
|
|
|
|
|
|
pair.removed,
|
|
|
|
|
|
"{}",
|
|
|
|
|
|
pair.name
|
|
|
|
|
|
);
|
|
|
|
|
|
assert_eq!(
|
|
|
|
|
|
diff.cells.iter().map(|c| c.added.len()).sum::<usize>(),
|
|
|
|
|
|
pair.added,
|
|
|
|
|
|
"{}",
|
|
|
|
|
|
pair.name
|
|
|
|
|
|
);
|
|
|
|
|
|
assert_eq!(diff.layer_names.len(), pair.metadata, "{}", pair.name);
|
|
|
|
|
|
let equal = pair.changed_cells + pair.metadata == 0;
|
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().is_equal(), equal, "{}", pair.name);
|
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!(
|
|
|
|
|
|
old.canonical_dump() == new.canonical_dump(),
|
|
|
|
|
|
equal,
|
|
|
|
|
|
"{}",
|
|
|
|
|
|
pair.name
|
|
|
|
|
|
);
|
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(), if equal { 0 } else { 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
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-11-17 16:14:53 -08:00
|
|
|
|
#[test]
|
|
|
|
|
|
fn review_identifies_gzip_and_oasis_input() {
|
|
|
|
|
|
for (bytes, expected) in [
|
|
|
|
|
|
(&b"\x1f\x8b\x08\x00"[..], "gzip-compressed input"),
|
|
|
|
|
|
(&b"%SEMI-OASIS\r\n"[..], "OASIS input"),
|
|
|
|
|
|
] {
|
|
|
|
|
|
let error = Document::parse(bytes).unwrap_err();
|
|
|
|
|
|
assert!(
|
|
|
|
|
|
error.starts_with(&format!("at byte 0: {expected}")),
|
|
|
|
|
|
"{error}"
|
|
|
|
|
|
);
|
|
|
|
|
|
assert_eq!(pheon::review::dump_records(bytes).unwrap_err(), error);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
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 canonical_polygon_dump_is_readable_and_offsets_are_separate() {
|
|
|
|
|
|
let bytes = layout(&[("CHIP", vec![square()])]);
|
|
|
|
|
|
let doc = Document::parse(&bytes).unwrap();
|
|
|
|
|
|
let dump = doc.canonical_dump();
|
|
|
|
|
|
assert!(
|
2026-11-17 21:49:26 -08:00
|
|
|
|
dump.ends_with("cell \"CHIP\"\n 1/0: rectangle (0, 0) to (10, 10)\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
|
|
|
|
"{dump}"
|
|
|
|
|
|
);
|
|
|
|
|
|
assert!(!dump.contains("BGNSTR"));
|
|
|
|
|
|
assert!(
|
|
|
|
|
|
doc.record_dump()
|
|
|
|
|
|
.contains("0000000000 0002 HEADER size=6 [600]")
|
|
|
|
|
|
);
|
|
|
|
|
|
assert!(doc.record_dump().contains("BGNSTR"));
|
2026-11-17 21:49:26 -08:00
|
|
|
|
let notched = polygon(&[[0, 0], [0, 3], [2, 3], [2, 2], [3, 2], [3, 0], [0, 0]]);
|
|
|
|
|
|
let bytes = layout(&[("CHIP", vec![notched])]);
|
|
|
|
|
|
let dump = Document::parse(&bytes).unwrap().canonical_dump();
|
|
|
|
|
|
assert!(
|
|
|
|
|
|
dump.ends_with(concat!(
|
|
|
|
|
|
" 1/0: polygon xy=[(0, 0), (0, 3), (2, 3), (2, 2),\n",
|
|
|
|
|
|
" (3, 2), (3, 0), (0, 0)]\n",
|
|
|
|
|
|
)),
|
|
|
|
|
|
"{dump}"
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
|
fn canonical_dump_counts_duplicates_by_normalized_object_within_each_cell() {
|
|
|
|
|
|
let test_layout = |copies: usize| {
|
|
|
|
|
|
let mut objects = vec![square(); copies - 1];
|
|
|
|
|
|
objects.push(polygon(&[[10, 10], [10, 0], [0, 0], [0, 10], [10, 10]]));
|
|
|
|
|
|
objects.push(with_property(square(), "marked"));
|
|
|
|
|
|
layout(&[("A", objects), ("B", vec![square()])])
|
|
|
|
|
|
};
|
|
|
|
|
|
let a = test_layout(3);
|
|
|
|
|
|
let b = test_layout(2);
|
|
|
|
|
|
let a = Document::parse(&a).unwrap();
|
|
|
|
|
|
let b = Document::parse(&b).unwrap();
|
|
|
|
|
|
let dump = a.canonical_dump();
|
|
|
|
|
|
assert!(
|
|
|
|
|
|
dump.ends_with(concat!(
|
|
|
|
|
|
"cell \"A\"\n",
|
|
|
|
|
|
" 3x 1/0: rectangle (0, 0) to (10, 10)\n",
|
|
|
|
|
|
" 1/0: rectangle (0, 0) to (10, 10) property[17]=\"marked\"\n",
|
|
|
|
|
|
"cell \"B\"\n",
|
|
|
|
|
|
" 1/0: rectangle (0, 0) to (10, 10)\n",
|
|
|
|
|
|
)),
|
|
|
|
|
|
"{dump}"
|
|
|
|
|
|
);
|
|
|
|
|
|
assert!(b.canonical_dump().contains(" 2x 1/0: rectangle"));
|
|
|
|
|
|
assert_ne!(dump, b.canonical_dump());
|
|
|
|
|
|
assert_eq!(Comparison::between(&a, &b).outcome().exit_code(), 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 canonical_dump_and_hierarchy_match_versioned_goldens() {
|
|
|
|
|
|
let bytes = layout(&[(
|
|
|
|
|
|
"CHIP",
|
|
|
|
|
|
vec![
|
|
|
|
|
|
square(),
|
|
|
|
|
|
label((900, 7), LAYER_SENTINEL),
|
|
|
|
|
|
label((900, 7), "1:0:WG"),
|
|
|
|
|
|
],
|
|
|
|
|
|
)]);
|
|
|
|
|
|
assert_eq!(
|
|
|
|
|
|
Document::parse(&bytes).unwrap().canonical_dump(),
|
|
|
|
|
|
include_str!("golden/review-canonical.txt")
|
|
|
|
|
|
);
|
|
|
|
|
|
let a = shared(square());
|
|
|
|
|
|
let b = shared(triangle());
|
|
|
|
|
|
let a = Document::parse(&a).unwrap();
|
|
|
|
|
|
let b = Document::parse(&b).unwrap();
|
|
|
|
|
|
let diff = Comparison::between(&a, &b);
|
|
|
|
|
|
assert_eq!(
|
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
|
|
|
|
diff.hierarchy(false, 8),
|
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
|
|
|
|
include_str!("golden/review-hierarchy.txt")
|
|
|
|
|
|
);
|
|
|
|
|
|
assert_eq!(
|
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
|
|
|
|
diff.hierarchy(true, 8),
|
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
|
|
|
|
include_str!("golden/review-hierarchy.mmd")
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
|
fn misplaced_library_fields_and_nul_names_are_rejected() {
|
|
|
|
|
|
let mut late = layout(&[("CHIP", vec![])]);
|
|
|
|
|
|
late.truncate(late.len() - 4);
|
|
|
|
|
|
ascii(&mut late, RTAG_LIBNAME, "late");
|
|
|
|
|
|
record(&mut late, RTAG_ENDLIB, &[]);
|
|
|
|
|
|
assert!(
|
|
|
|
|
|
Document::parse(&late)
|
|
|
|
|
|
.unwrap_err()
|
|
|
|
|
|
.contains("library field outside")
|
|
|
|
|
|
);
|
|
|
|
|
|
assert!(
|
|
|
|
|
|
Document::parse(&layout(&[("CH\0IP", vec![])]))
|
|
|
|
|
|
.unwrap_err()
|
|
|
|
|
|
.contains("NUL")
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
|
fn cell_and_property_order_do_not_affect_comparison() {
|
|
|
|
|
|
let a = with_property(with_property(square(), "a"), "b");
|
|
|
|
|
|
let b = with_property(with_property(square(), "b"), "a");
|
|
|
|
|
|
let a = layout(&[("z", vec![a]), ("a", vec![])]);
|
|
|
|
|
|
let b = layout(&[("a", vec![]), ("z", vec![b])]);
|
|
|
|
|
|
let a = Document::parse(&a).unwrap();
|
|
|
|
|
|
let b = Document::parse(&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
|
|
|
|
assert_ne!(a.cells["z"].offset, b.cells["z"].offset);
|
|
|
|
|
|
assert!(Comparison::between(&a, &b).outcome().is_equal());
|
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!(a.canonical_dump(), b.canonical_dump());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
|
fn metadata_requires_a_sentinel_in_the_same_cell_and_carrier_pair() {
|
|
|
|
|
|
let bytes = layout(&[
|
|
|
|
|
|
(
|
|
|
|
|
|
"CHIP",
|
|
|
|
|
|
vec![
|
|
|
|
|
|
label((900, 7), LAYER_SENTINEL),
|
|
|
|
|
|
label((900, 7), "1:0:WG"),
|
|
|
|
|
|
label((900, 8), "2:0:ordinary text"),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
("OTHER", vec![label((900, 7), "3:0:ordinary text")]),
|
|
|
|
|
|
]);
|
|
|
|
|
|
let doc = Document::parse(&bytes).unwrap();
|
|
|
|
|
|
assert_eq!(doc.layer_names.len(), 1);
|
|
|
|
|
|
assert_eq!(doc.layer_names.get(&(1, 0)).unwrap(), "WG");
|
|
|
|
|
|
assert!(doc.canonical_dump().contains("2:0:ordinary text"));
|
|
|
|
|
|
assert!(doc.canonical_dump().contains("3:0:ordinary text"));
|
|
|
|
|
|
assert!(!doc.canonical_dump().contains(LAYER_SENTINEL));
|
|
|
|
|
|
let conflicts = layout(&[(
|
|
|
|
|
|
"CHIP",
|
|
|
|
|
|
vec![
|
|
|
|
|
|
label((9, 0), LAYER_SENTINEL),
|
|
|
|
|
|
label((9, 0), "1:0:A"),
|
|
|
|
|
|
label((9, 0), "1:0:B"),
|
|
|
|
|
|
],
|
|
|
|
|
|
)]);
|
|
|
|
|
|
assert!(
|
|
|
|
|
|
Document::parse(&conflicts)
|
|
|
|
|
|
.unwrap_err()
|
|
|
|
|
|
.contains("conflicting names")
|
|
|
|
|
|
);
|
|
|
|
|
|
assert!(
|
|
|
|
|
|
pheon::review::dump_records(&conflicts)
|
|
|
|
|
|
.unwrap()
|
|
|
|
|
|
.contains("1:0:B")
|
|
|
|
|
|
);
|
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 future = layout(&[("CHIP", vec![label((9, 0), "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 future = Document::parse(&future).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_eq!(
|
|
|
|
|
|
Comparison::between(&future, &future).outcome().exit_code(),
|
|
|
|
|
|
2
|
|
|
|
|
|
);
|
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 unknown_records_never_produce_a_successful_equality_claim() {
|
|
|
|
|
|
let mut unknown = square();
|
|
|
|
|
|
unknown.truncate(unknown.len() - 4);
|
|
|
|
|
|
record(&mut unknown, 0x7f00, &[]);
|
|
|
|
|
|
record(&mut unknown, RTAG_ENDEL, &[]);
|
|
|
|
|
|
let bytes = layout(&[("CHIP", vec![unknown])]);
|
|
|
|
|
|
let doc = Document::parse(&bytes).unwrap();
|
|
|
|
|
|
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!(!diff.outcome().is_equal());
|
|
|
|
|
|
assert_eq!(diff.outcome().exit_code(), 2);
|
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!(doc.record_dump().contains("7f00"));
|
2026-11-17 21:49:26 -08:00
|
|
|
|
let text = diff.text(0);
|
|
|
|
|
|
assert!(text.starts_with("Incomplete\nDiagnostics\n"));
|
|
|
|
|
|
assert!(text.contains("unsupported record 0x7f00"));
|
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]
|
2026-11-18 22:58:12 -08:00
|
|
|
|
fn shared_hierarchy_reports_ancestors_and_each_leaf_placement_count() {
|
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 a = shared(square());
|
|
|
|
|
|
let b = shared(triangle());
|
|
|
|
|
|
let a = Document::parse(&a).unwrap();
|
|
|
|
|
|
let b = Document::parse(&b).unwrap();
|
|
|
|
|
|
let diff = Comparison::between(&a, &b);
|
|
|
|
|
|
assert_eq!(
|
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
|
|
|
|
diff.hierarchy(false, 8),
|
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
|
|
|
|
concat!(
|
2026-11-17 21:49:26 -08:00
|
|
|
|
"Hierarchy\n",
|
2026-11-18 20:12:42 -08:00
|
|
|
|
"CHIP [affected]\n",
|
|
|
|
|
|
" left x1 [affected]\n",
|
|
|
|
|
|
" * leaf x2\n",
|
|
|
|
|
|
" right x1 [affected]\n",
|
2026-11-18 22:58:12 -08:00
|
|
|
|
" * leaf x3\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
|
|
|
|
)
|
|
|
|
|
|
);
|
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 graph = diff.hierarchy(true, 8);
|
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!(graph.matches("leaf [cell changed]").count(), 1);
|
|
|
|
|
|
assert!(graph.contains("x2"));
|
|
|
|
|
|
assert!(graph.contains("x3"));
|
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 limited = diff.hierarchy(false, 1);
|
2026-11-18 20:12:42 -08:00
|
|
|
|
assert!(!limited.contains("leaf"));
|
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!(limited.contains("children omitted"));
|
2026-11-18 20:12:42 -08:00
|
|
|
|
assert_eq!(
|
|
|
|
|
|
diff.hierarchy(false, 0),
|
|
|
|
|
|
"Hierarchy\nCHIP [affected] [children omitted]\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
|
|
|
|
}
|
|
|
|
|
|
|
2026-11-18 23:04:24 -08:00
|
|
|
|
#[test]
|
|
|
|
|
|
fn ascii_diff_folds_single_placement_paths_up_to_branches_and_changed_edges() {
|
|
|
|
|
|
let with_branch = |count, shape| {
|
|
|
|
|
|
layout(&[
|
|
|
|
|
|
("CHIP", vec![reference("block", 0, 1)]),
|
|
|
|
|
|
("block", vec![reference("routing", 0, 1)]),
|
|
|
|
|
|
("routing", vec![reference("fanout", 0, 1)]),
|
|
|
|
|
|
(
|
|
|
|
|
|
"fanout",
|
|
|
|
|
|
vec![reference("left", 0, 1), reference("right", 0, 1)],
|
|
|
|
|
|
),
|
|
|
|
|
|
("left", vec![reference("target", 0, count)]),
|
|
|
|
|
|
("target", vec![]),
|
|
|
|
|
|
("right", vec![reference("unit", 0, 1)]),
|
|
|
|
|
|
("unit", vec![reference("leaf", 0, 1)]),
|
|
|
|
|
|
("leaf", vec![shape]),
|
|
|
|
|
|
])
|
|
|
|
|
|
};
|
|
|
|
|
|
let old = with_branch(2, square());
|
|
|
|
|
|
let new = with_branch(3, triangle());
|
|
|
|
|
|
let diff = Comparison::between(
|
|
|
|
|
|
&Document::parse(&old).unwrap(),
|
|
|
|
|
|
&Document::parse(&new).unwrap(),
|
|
|
|
|
|
);
|
|
|
|
|
|
assert_eq!(
|
|
|
|
|
|
diff.hierarchy(false, 8),
|
|
|
|
|
|
concat!(
|
|
|
|
|
|
"Hierarchy\n",
|
|
|
|
|
|
"CHIP → block → routing [affected]\n",
|
|
|
|
|
|
" fanout x1 [affected]\n",
|
|
|
|
|
|
" * left x1\n",
|
|
|
|
|
|
" target x2 -> x3\n",
|
|
|
|
|
|
" right x1 → unit → * leaf\n",
|
|
|
|
|
|
)
|
|
|
|
|
|
);
|
|
|
|
|
|
assert_eq!(
|
|
|
|
|
|
diff.hierarchy(false, 2),
|
|
|
|
|
|
"Hierarchy\nCHIP → block → routing [affected] [children omitted]\n"
|
|
|
|
|
|
);
|
|
|
|
|
|
assert!(!diff.hierarchy(true, 8).contains('→'));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-11-18 22:58:12 -08:00
|
|
|
|
#[test]
|
|
|
|
|
|
fn ascii_hierarchy_marks_repeated_subtrees_and_depth_limits() {
|
|
|
|
|
|
let bytes = layout(&[
|
|
|
|
|
|
(
|
|
|
|
|
|
"CHIP",
|
|
|
|
|
|
vec![reference("left", 0, 1), reference("right", 0, 1)],
|
|
|
|
|
|
),
|
|
|
|
|
|
("left", vec![reference("branch", 0, 2)]),
|
|
|
|
|
|
("right", vec![reference("branch", 0, 3)]),
|
|
|
|
|
|
("branch", vec![reference("leaf", 0, 1)]),
|
|
|
|
|
|
("leaf", vec![]),
|
|
|
|
|
|
]);
|
|
|
|
|
|
let doc = Document::parse(&bytes).unwrap();
|
|
|
|
|
|
assert_eq!(
|
|
|
|
|
|
doc.hierarchy(false, 8),
|
|
|
|
|
|
concat!(
|
|
|
|
|
|
"Hierarchy\n",
|
|
|
|
|
|
"\"CHIP\"\n",
|
|
|
|
|
|
" \"left\" x1\n",
|
|
|
|
|
|
" \"branch\" x2\n",
|
|
|
|
|
|
" \"leaf\" x1\n",
|
|
|
|
|
|
" \"right\" x1\n",
|
|
|
|
|
|
" \"branch\" x3 [subtree elided]\n",
|
|
|
|
|
|
)
|
|
|
|
|
|
);
|
|
|
|
|
|
assert_eq!(
|
|
|
|
|
|
doc.hierarchy(false, 2),
|
|
|
|
|
|
concat!(
|
|
|
|
|
|
"Hierarchy\n",
|
|
|
|
|
|
"\"CHIP\"\n",
|
|
|
|
|
|
" \"left\" x1\n",
|
|
|
|
|
|
" \"branch\" x2 [children omitted]\n",
|
|
|
|
|
|
" \"right\" x1\n",
|
|
|
|
|
|
" \"branch\" x3 [children omitted]\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 reference_changes_keep_unchanged_targets_and_old_edges_visible() {
|
|
|
|
|
|
for pair in corpus()
|
|
|
|
|
|
.into_iter()
|
|
|
|
|
|
.filter(|p| p.name == "moved reference" || p.name == "array count")
|
|
|
|
|
|
{
|
|
|
|
|
|
let old = Document::parse(&pair.old).unwrap();
|
|
|
|
|
|
let new = Document::parse(&pair.new).unwrap();
|
|
|
|
|
|
let diff = Comparison::between(&old, &new);
|
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 tree = diff.hierarchy(false, 8);
|
2026-11-18 10:58:19 -08:00
|
|
|
|
let edge = if pair.name == "array count" {
|
2026-11-18 20:12:42 -08:00
|
|
|
|
" leaf x2 -> x3\n"
|
2026-11-18 10:58:19 -08:00
|
|
|
|
} else {
|
2026-11-18 20:12:42 -08:00
|
|
|
|
" leaf x1 [reference changed]\n"
|
2026-11-18 10:58:19 -08:00
|
|
|
|
};
|
|
|
|
|
|
assert!(tree.ends_with(edge), "{tree}");
|
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 a = layout(&[
|
|
|
|
|
|
("CHIP", vec![reference("leaf", 0, 1)]),
|
|
|
|
|
|
("leaf", vec![square()]),
|
|
|
|
|
|
]);
|
|
|
|
|
|
let b = layout(&[("CHIP", vec![])]);
|
|
|
|
|
|
let a = Document::parse(&a).unwrap();
|
|
|
|
|
|
let b = Document::parse(&b).unwrap();
|
2026-11-18 10:58:19 -08:00
|
|
|
|
for (old, new, edge) in [
|
2026-11-18 20:12:42 -08:00
|
|
|
|
(&a, &b, " - leaf x1 -> x0\n"),
|
|
|
|
|
|
(&b, &a, " + leaf x0 -> x1\n"),
|
2026-11-18 10:58:19 -08:00
|
|
|
|
] {
|
|
|
|
|
|
let tree = Comparison::between(old, new).hierarchy(false, 8);
|
|
|
|
|
|
assert!(tree.ends_with(edge), "{tree}");
|
|
|
|
|
|
}
|
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 same_bounds_changes_and_truncated_reports_remain_differences() {
|
|
|
|
|
|
let a = layout(&[("CHIP", vec![square()])]);
|
2026-11-18 10:58:19 -08:00
|
|
|
|
let b = layout(&[("CHIP", vec![triangle(), label((2, 0), "new label")])]);
|
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 a = Document::parse(&a).unwrap();
|
|
|
|
|
|
let b = Document::parse(&b).unwrap();
|
|
|
|
|
|
let diff = Comparison::between(&a, &b);
|
|
|
|
|
|
assert_eq!(
|
|
|
|
|
|
diff.cells[0].removed[0].bounds,
|
|
|
|
|
|
diff.cells[0].added[0].bounds
|
|
|
|
|
|
);
|
2026-11-18 10:58:19 -08:00
|
|
|
|
let limited = diff.text(1);
|
|
|
|
|
|
assert!(limited.contains("Omitted · 2 object changes over the limit"));
|
|
|
|
|
|
assert!(limited.contains("+ 2/0: label"));
|
|
|
|
|
|
assert!(!limited.contains("1/0:"));
|
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(), 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
|
|
|
|
assert!(diff.cells[0].removed[0].offset > 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
|
fn unit_changes_report_values_without_claiming_geometry_equivalence() {
|
|
|
|
|
|
let a = layout(&[("CHIP", vec![square()])]);
|
|
|
|
|
|
let units = Document::parse(&a)
|
|
|
|
|
|
.unwrap()
|
|
|
|
|
|
.records
|
|
|
|
|
|
.iter()
|
|
|
|
|
|
.find(|r| r.tag == RTAG_UNITS)
|
|
|
|
|
|
.unwrap()
|
|
|
|
|
|
.offset;
|
|
|
|
|
|
let mut b = a.clone();
|
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 a = Document::parse(&a).unwrap();
|
|
|
|
|
|
let b = Document::parse(&b).unwrap();
|
|
|
|
|
|
let diff = Comparison::between(&a, &b);
|
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(), 1);
|
|
|
|
|
|
assert!(matches!(
|
|
|
|
|
|
diff.library_changes.as_slice(),
|
|
|
|
|
|
[pheon::review::LibraryChange::Record {
|
|
|
|
|
|
tag: RTAG_UNITS,
|
|
|
|
|
|
..
|
|
|
|
|
|
}]
|
|
|
|
|
|
));
|
2026-11-17 21:49:26 -08:00
|
|
|
|
let text = diff.text(0);
|
|
|
|
|
|
assert!(text.contains("library UNITS [0.001, 1e-9] -> [0.001, 2e-9]"));
|
|
|
|
|
|
assert!(text.contains("Coordinates use each file's database units"));
|
|
|
|
|
|
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
|
|
|
|
assert!(diff.cells.is_empty());
|
2026-11-18 10:58:19 -08:00
|
|
|
|
assert!(diff.hierarchy(false, 8).is_empty());
|
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 dangling_references_cycles_and_duplicate_cell_names_are_reported() {
|
|
|
|
|
|
let missing = layout(&[("CHIP", vec![reference("missing", 0, 1)])]);
|
|
|
|
|
|
let missing = Document::parse(&missing).unwrap();
|
|
|
|
|
|
assert!(
|
|
|
|
|
|
missing
|
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
|
|
|
|
.diagnostics
|
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
|
|
|
|
.iter()
|
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
|
|
|
|
.any(|d| d.code == "unresolved_reference")
|
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 cycle = layout(&[
|
|
|
|
|
|
("a", vec![reference("b", 0, 1)]),
|
|
|
|
|
|
("b", vec![reference("a", 0, 1)]),
|
|
|
|
|
|
]);
|
|
|
|
|
|
let cycle = Document::parse(&cycle).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!(
|
|
|
|
|
|
cycle
|
|
|
|
|
|
.diagnostics
|
|
|
|
|
|
.iter()
|
|
|
|
|
|
.any(|d| d.code == "hierarchy_cycle")
|
|
|
|
|
|
);
|
|
|
|
|
|
assert!(cycle.hierarchy(false, 8).len() < 200);
|
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 duplicate = layout(&[("a", vec![]), ("a", vec![])]);
|
|
|
|
|
|
assert!(
|
|
|
|
|
|
Document::parse(&duplicate)
|
|
|
|
|
|
.unwrap_err()
|
|
|
|
|
|
.contains("duplicate cell")
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
|
fn absolute_transform_flags_are_not_discarded() {
|
|
|
|
|
|
let a = reference("leaf", 0, 1);
|
|
|
|
|
|
let mut b = Vec::new();
|
|
|
|
|
|
record(&mut b, RTAG_SREF, &[]);
|
|
|
|
|
|
ascii(&mut b, RTAG_SNAME, "leaf");
|
|
|
|
|
|
record(&mut b, RTAG_STRANS, &[0, 2]);
|
|
|
|
|
|
xy(&mut b, &[[0, 0]]);
|
|
|
|
|
|
record(&mut b, RTAG_ENDEL, &[]);
|
|
|
|
|
|
let a = layout(&[("CHIP", vec![a]), ("leaf", vec![])]);
|
|
|
|
|
|
let b = layout(&[("CHIP", vec![b]), ("leaf", vec![])]);
|
|
|
|
|
|
assert_eq!(
|
|
|
|
|
|
Comparison::between(&Document::parse(&a).unwrap(), &Document::parse(&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
|
|
|
|
.outcome()
|
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
|
|
|
|
.exit_code(),
|
|
|
|
|
|
1
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
|
fn polygon_normalization_handles_repeated_minimum_vertices() {
|
|
|
|
|
|
let ring = [[0, 0], [4, 0], [4, 4], [0, 0], [-2, 2], [-2, 4], [0, 0]];
|
|
|
|
|
|
let baseline = layout(&[("CHIP", vec![polygon(&ring)])]);
|
|
|
|
|
|
let baseline = Document::parse(&baseline).unwrap();
|
|
|
|
|
|
let mut open = ring[..ring.len() - 1].to_vec();
|
|
|
|
|
|
for _ in 0..2 {
|
|
|
|
|
|
for start in 0..open.len() {
|
|
|
|
|
|
let mut rotated = open[start..]
|
|
|
|
|
|
.iter()
|
|
|
|
|
|
.chain(&open[..start])
|
|
|
|
|
|
.copied()
|
|
|
|
|
|
.collect::<Vec<_>>();
|
|
|
|
|
|
rotated.push(rotated[0]);
|
|
|
|
|
|
let candidate = layout(&[("CHIP", vec![polygon(&rotated)])]);
|
|
|
|
|
|
let candidate = Document::parse(&candidate).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!(
|
|
|
|
|
|
Comparison::between(&baseline, &candidate)
|
|
|
|
|
|
.outcome()
|
|
|
|
|
|
.is_equal()
|
|
|
|
|
|
);
|
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
|
|
|
|
}
|
|
|
|
|
|
open.reverse();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
|
fn malformed_lengths_fields_and_units_return_errors_without_panicking() {
|
|
|
|
|
|
let good = layout(&[("CHIP", vec![square()])]);
|
|
|
|
|
|
for length in 0..good.len() {
|
|
|
|
|
|
assert!(
|
|
|
|
|
|
Document::parse(&good[..length]).is_err(),
|
|
|
|
|
|
"accepted truncated length {length}"
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
let mut bad = good.clone();
|
|
|
|
|
|
bad[0..2].copy_from_slice(&3_u16.to_be_bytes());
|
|
|
|
|
|
assert!(Document::parse(&bad).is_err());
|
|
|
|
|
|
let mut bad = good.clone();
|
|
|
|
|
|
let units = Document::parse(&good)
|
|
|
|
|
|
.unwrap()
|
|
|
|
|
|
.records
|
|
|
|
|
|
.iter()
|
|
|
|
|
|
.find(|r| r.tag == RTAG_UNITS)
|
|
|
|
|
|
.unwrap()
|
|
|
|
|
|
.offset;
|
|
|
|
|
|
bad[units + 4..units + 20].fill(0);
|
|
|
|
|
|
assert!(Document::parse(&bad).unwrap_err().contains("UNITS"));
|
|
|
|
|
|
let mut polygon = square();
|
|
|
|
|
|
polygon.truncate(polygon.len() - 4);
|
|
|
|
|
|
record(&mut polygon, RTAG_LAYER, &[0, 1]);
|
|
|
|
|
|
record(&mut polygon, RTAG_ENDEL, &[]);
|
|
|
|
|
|
assert!(
|
|
|
|
|
|
Document::parse(&layout(&[("CHIP", vec![polygon])]))
|
|
|
|
|
|
.unwrap_err()
|
|
|
|
|
|
.contains("duplicate element field")
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
|
fn cli_uses_documented_exit_codes_and_accepts_paths_with_spaces() {
|
|
|
|
|
|
let directory = std::env::temp_dir().join(format!("pheon review {}", 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 old = directory.join("old file.gds");
|
|
|
|
|
|
let new = directory.join("new file.gds");
|
|
|
|
|
|
fs::write(&old, shared(square())).unwrap();
|
|
|
|
|
|
fs::write(&new, shared(triangle())).unwrap();
|
|
|
|
|
|
let command = || Command::new(env!("CARGO_BIN_EXE_pheon"));
|
2026-11-18 10:58:19 -08:00
|
|
|
|
let equal = command()
|
|
|
|
|
|
.arg("diff")
|
|
|
|
|
|
.arg(&old)
|
|
|
|
|
|
.arg(&old)
|
|
|
|
|
|
.args(["--hierarchy", "ascii"])
|
|
|
|
|
|
.output()
|
|
|
|
|
|
.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
|
|
|
|
assert_eq!(equal.status.code(), Some(0));
|
2026-11-17 21:49:26 -08:00
|
|
|
|
assert_eq!(equal.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
|
|
|
|
let diff = command()
|
|
|
|
|
|
.arg("diff")
|
|
|
|
|
|
.arg(&old)
|
|
|
|
|
|
.arg(&new)
|
|
|
|
|
|
.args(["--hierarchy", "mermaid", "--max-changes", "0"])
|
|
|
|
|
|
.output()
|
|
|
|
|
|
.unwrap();
|
|
|
|
|
|
assert_eq!(diff.status.code(), Some(1));
|
|
|
|
|
|
let text = String::from_utf8(diff.stdout).unwrap();
|
2026-11-18 10:58:19 -08:00
|
|
|
|
assert!(text.contains("Omitted · 2 object changes over the limit"));
|
2026-11-17 21:49:26 -08:00
|
|
|
|
assert!(text.contains("Hierarchy\n```mermaid\nflowchart TD"));
|
|
|
|
|
|
assert!(!text.contains("scope top=all"));
|
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 dump = command()
|
|
|
|
|
|
.arg("dump")
|
|
|
|
|
|
.arg(&old)
|
|
|
|
|
|
.args(["--records"])
|
|
|
|
|
|
.output()
|
|
|
|
|
|
.unwrap();
|
|
|
|
|
|
assert_eq!(dump.status.code(), Some(0));
|
|
|
|
|
|
assert!(String::from_utf8(dump.stdout).unwrap().contains("BGNSTR"));
|
|
|
|
|
|
let graph = command()
|
|
|
|
|
|
.arg("hierarchy")
|
|
|
|
|
|
.arg(&old)
|
|
|
|
|
|
.args(["--format", "mermaid"])
|
|
|
|
|
|
.output()
|
|
|
|
|
|
.unwrap();
|
|
|
|
|
|
assert_eq!(graph.status.code(), Some(0));
|
|
|
|
|
|
assert!(
|
|
|
|
|
|
String::from_utf8(graph.stdout)
|
|
|
|
|
|
.unwrap()
|
|
|
|
|
|
.starts_with("flowchart TD")
|
|
|
|
|
|
);
|
2026-11-18 20:12:42 -08:00
|
|
|
|
let with_reference = |x| layout(&[("CHIP", vec![reference("leaf", x, 1)]), ("leaf", vec![])]);
|
|
|
|
|
|
fs::write(&old, with_reference(0)).unwrap();
|
|
|
|
|
|
fs::write(&new, with_reference(5)).unwrap();
|
|
|
|
|
|
let moved = command()
|
|
|
|
|
|
.arg("diff")
|
|
|
|
|
|
.arg(&old)
|
|
|
|
|
|
.arg(&new)
|
|
|
|
|
|
.args(["--hierarchy", "ascii"])
|
|
|
|
|
|
.output()
|
|
|
|
|
|
.unwrap();
|
|
|
|
|
|
assert_eq!(moved.status.code(), Some(1));
|
|
|
|
|
|
assert_eq!(
|
|
|
|
|
|
moved.stdout,
|
|
|
|
|
|
b"Different\nCells:\n* CHIP\n ~ reference \"leaf\" moved by (5, 0) dbu\n"
|
|
|
|
|
|
);
|
|
|
|
|
|
let scoped = command()
|
|
|
|
|
|
.arg("diff")
|
|
|
|
|
|
.arg(&old)
|
|
|
|
|
|
.arg(&new)
|
|
|
|
|
|
.args(["--hierarchy", "ascii", "--cell", "CHIP"])
|
|
|
|
|
|
.output()
|
|
|
|
|
|
.unwrap();
|
|
|
|
|
|
assert_eq!(scoped.status.code(), Some(1));
|
|
|
|
|
|
assert!(
|
|
|
|
|
|
String::from_utf8(scoped.stdout)
|
|
|
|
|
|
.unwrap()
|
|
|
|
|
|
.ends_with("Hierarchy\n* CHIP\n leaf x1 [reference changed] [outside scope]\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
|
|
|
|
fs::write(&new, b"invalid").unwrap();
|
|
|
|
|
|
assert_eq!(
|
|
|
|
|
|
command()
|
|
|
|
|
|
.arg("diff")
|
|
|
|
|
|
.arg(&old)
|
|
|
|
|
|
.arg(&new)
|
|
|
|
|
|
.output()
|
|
|
|
|
|
.unwrap()
|
|
|
|
|
|
.status
|
|
|
|
|
|
.code(),
|
|
|
|
|
|
Some(2)
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-11-18 22:58:12 -08:00
|
|
|
|
#[test]
|
|
|
|
|
|
fn cli_color_preserves_plain_output_and_machine_formats() {
|
|
|
|
|
|
let directory = std::env::temp_dir().join(format!("pheon color {}", 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 old = directory.join("old.gds");
|
|
|
|
|
|
let new = directory.join("new.gds");
|
|
|
|
|
|
let with_changes = |name, shape, positions: std::ops::Range<i32>| {
|
|
|
|
|
|
let objects = positions
|
|
|
|
|
|
.map(|x| reference("leaf", x, 1))
|
|
|
|
|
|
.chain([shape])
|
|
|
|
|
|
.collect();
|
2026-11-18 23:04:24 -08:00
|
|
|
|
layout(&[
|
|
|
|
|
|
("top", vec![reference("route", 0, 1)]),
|
|
|
|
|
|
("route", vec![reference("CHIP", 0, 1)]),
|
|
|
|
|
|
("CHIP", objects),
|
|
|
|
|
|
("leaf", vec![]),
|
|
|
|
|
|
(name, vec![]),
|
|
|
|
|
|
])
|
2026-11-18 22:58:12 -08:00
|
|
|
|
};
|
|
|
|
|
|
fs::write(&old, with_changes("obsolete", square(), 0..2)).unwrap();
|
|
|
|
|
|
fs::write(&new, with_changes("new", triangle(), 10..13)).unwrap();
|
|
|
|
|
|
let command = || Command::new(env!("CARGO_BIN_EXE_pheon"));
|
|
|
|
|
|
let diff = |options: &[&str]| {
|
|
|
|
|
|
let output = command()
|
|
|
|
|
|
.arg("diff")
|
|
|
|
|
|
.arg(&old)
|
|
|
|
|
|
.arg(&new)
|
|
|
|
|
|
.args(options)
|
|
|
|
|
|
.output()
|
|
|
|
|
|
.unwrap();
|
|
|
|
|
|
assert_eq!(output.status.code(), Some(1));
|
|
|
|
|
|
String::from_utf8(output.stdout).unwrap()
|
|
|
|
|
|
};
|
|
|
|
|
|
let plain = diff(&["--hierarchy", "mermaid"]);
|
|
|
|
|
|
let colored = diff(&["--hierarchy", "mermaid", "--color=always"]);
|
|
|
|
|
|
for span in [
|
|
|
|
|
|
"\x1b[31m- obsolete",
|
|
|
|
|
|
"\x1b[32m+ new",
|
|
|
|
|
|
"\x1b[33m* CHIP",
|
|
|
|
|
|
"\x1b[31m-2 refs",
|
|
|
|
|
|
"\x1b[32m+3 refs",
|
|
|
|
|
|
"\x1b[33m1 polygon changed",
|
|
|
|
|
|
] {
|
|
|
|
|
|
assert!(colored.contains(span), "{span:?} in {colored:?}");
|
|
|
|
|
|
}
|
|
|
|
|
|
let strip_ansi = |text: &str| {
|
|
|
|
|
|
let mut parts = text.split("\x1b[");
|
|
|
|
|
|
let mut plain = parts.next().unwrap().to_string();
|
|
|
|
|
|
for part in parts {
|
|
|
|
|
|
let (code, text) = part.split_once('m').unwrap();
|
|
|
|
|
|
assert!(code.bytes().all(|b| b.is_ascii_digit() || b == b';'));
|
|
|
|
|
|
plain.push_str(text);
|
|
|
|
|
|
}
|
|
|
|
|
|
plain
|
|
|
|
|
|
};
|
|
|
|
|
|
assert_eq!(strip_ansi(&colored), plain);
|
|
|
|
|
|
assert_eq!(diff(&["--hierarchy", "mermaid", "--color", "never"]), plain);
|
|
|
|
|
|
assert_eq!(
|
|
|
|
|
|
colored.split_once("```mermaid\n").unwrap().1,
|
|
|
|
|
|
plain.split_once("```mermaid\n").unwrap().1
|
|
|
|
|
|
);
|
|
|
|
|
|
assert_eq!(
|
|
|
|
|
|
diff(&["--color", "always", "--format", "json"]),
|
|
|
|
|
|
diff(&["--format", "json"])
|
|
|
|
|
|
);
|
2026-11-18 23:04:24 -08:00
|
|
|
|
let ascii = diff(&["--hierarchy", "ascii", "--color=always"]);
|
|
|
|
|
|
let folded = ascii
|
|
|
|
|
|
.lines()
|
|
|
|
|
|
.find(|line| line.starts_with("top → route → "))
|
|
|
|
|
|
.unwrap();
|
|
|
|
|
|
assert!(folded.contains("\x1b[33m* CHIP"));
|
|
|
|
|
|
assert_eq!(strip_ansi(&ascii), diff(&["--hierarchy", "ascii"]));
|
2026-11-18 22:58:12 -08:00
|
|
|
|
|
|
|
|
|
|
for (options, token) in [
|
|
|
|
|
|
(&[][..], "\x1b[36mcell \"CHIP\""),
|
|
|
|
|
|
(&["--records"][..], "\x1b[36mBGNSTR"),
|
|
|
|
|
|
] {
|
|
|
|
|
|
let dump = |choice| {
|
|
|
|
|
|
let output = command()
|
|
|
|
|
|
.arg("dump")
|
|
|
|
|
|
.arg(&old)
|
|
|
|
|
|
.args(options)
|
|
|
|
|
|
.args(["--color", choice])
|
|
|
|
|
|
.output()
|
|
|
|
|
|
.unwrap();
|
|
|
|
|
|
assert!(output.status.success());
|
|
|
|
|
|
String::from_utf8(output.stdout).unwrap()
|
|
|
|
|
|
};
|
|
|
|
|
|
let colored = dump("always");
|
|
|
|
|
|
assert!(colored.contains(token), "{colored:?}");
|
|
|
|
|
|
assert_eq!(strip_ansi(&colored), dump("auto"));
|
|
|
|
|
|
assert_eq!(dump("auto"), dump("never"));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-11-18 23:20:00 -08:00
|
|
|
|
#[test]
|
|
|
|
|
|
fn cli_details_show_coordinates_and_properties_within_filters_and_limits() {
|
|
|
|
|
|
let directory = std::env::temp_dir().join(format!("pheon-details-{}", 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 old = directory.join("old.gds");
|
|
|
|
|
|
let new = directory.join("new.gds");
|
|
|
|
|
|
let common_ref = reference("leaf", 0, 1);
|
|
|
|
|
|
let additional_ref = reference("leaf", 5, 1);
|
|
|
|
|
|
let points = [[0, 0], [4, 0], [4, -5], [13, -5], [13, 9]];
|
|
|
|
|
|
let shifted = polygon(&[[2, -1], [12, -1], [12, 9], [2, 9], [2, -1]]);
|
|
|
|
|
|
fs::write(
|
|
|
|
|
|
&old,
|
|
|
|
|
|
layout(&[
|
|
|
|
|
|
(
|
|
|
|
|
|
"CHIP",
|
|
|
|
|
|
vec![with_property(square(), "old"), common_ref.clone()],
|
|
|
|
|
|
),
|
|
|
|
|
|
("leaf", vec![]),
|
|
|
|
|
|
("other", vec![label((2, 0), "before other")]),
|
|
|
|
|
|
("removed", vec![label((2, 0), "payload in removed cell")]),
|
|
|
|
|
|
]),
|
|
|
|
|
|
)
|
|
|
|
|
|
.unwrap();
|
|
|
|
|
|
fs::write(
|
|
|
|
|
|
&new,
|
|
|
|
|
|
layout(&[
|
|
|
|
|
|
(
|
|
|
|
|
|
"CHIP",
|
|
|
|
|
|
vec![
|
|
|
|
|
|
with_property(shifted, "new"),
|
|
|
|
|
|
with_property(path(Some(8), &points), "path property"),
|
|
|
|
|
|
common_ref,
|
|
|
|
|
|
additional_ref.clone(),
|
|
|
|
|
|
additional_ref,
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
("leaf", vec![]),
|
|
|
|
|
|
("other", vec![label((2, 0), "after other")]),
|
|
|
|
|
|
("added", vec![label((2, 0), "payload in added cell")]),
|
|
|
|
|
|
]),
|
|
|
|
|
|
)
|
|
|
|
|
|
.unwrap();
|
|
|
|
|
|
let diff = |options: &[&str]| {
|
|
|
|
|
|
let output = Command::new(env!("CARGO_BIN_EXE_pheon"))
|
|
|
|
|
|
.arg("diff")
|
|
|
|
|
|
.arg(&old)
|
|
|
|
|
|
.arg(&new)
|
|
|
|
|
|
.args(options)
|
|
|
|
|
|
.output()
|
|
|
|
|
|
.unwrap();
|
|
|
|
|
|
assert_eq!(
|
|
|
|
|
|
output.status.code(),
|
|
|
|
|
|
Some(1),
|
|
|
|
|
|
"{}",
|
|
|
|
|
|
String::from_utf8_lossy(&output.stderr)
|
|
|
|
|
|
);
|
|
|
|
|
|
String::from_utf8(output.stdout).unwrap()
|
|
|
|
|
|
};
|
|
|
|
|
|
let detailed = diff(&["--show-cell", "CHIP", "--details", "--hierarchy", "ascii"]);
|
|
|
|
|
|
assert!(detailed.contains(concat!(
|
|
|
|
|
|
" ~ 1/0: rectangle\n",
|
|
|
|
|
|
" - 1/0: rectangle (0, 0) to (10, 10) property[17]=\"old\"\n",
|
|
|
|
|
|
" + 1/0: rectangle (2, -1) to (12, 9) property[17]=\"new\"\n",
|
|
|
|
|
|
)));
|
|
|
|
|
|
assert!(detailed.contains(concat!(
|
|
|
|
|
|
" + 1/0: path width=[8] xy=[(0, 0), (4, 0), (4, -5), (13, -5),\n",
|
|
|
|
|
|
" (13, 9)] property[17]=\"path property\"\n",
|
|
|
|
|
|
)));
|
|
|
|
|
|
assert!(detailed.contains(" + 2× reference \"leaf\" xy=(5, 0) · placements 1 -> 3\n"));
|
|
|
|
|
|
assert!(!detailed.contains("Hierarchy\n"));
|
|
|
|
|
|
assert!(!detailed.contains("after other"));
|
|
|
|
|
|
let limited = diff(&[
|
|
|
|
|
|
"--show-cell",
|
|
|
|
|
|
"CHIP",
|
|
|
|
|
|
"--details",
|
|
|
|
|
|
"--max-changes",
|
|
|
|
|
|
"1",
|
|
|
|
|
|
"--hierarchy",
|
|
|
|
|
|
"ascii",
|
|
|
|
|
|
]);
|
|
|
|
|
|
assert!(limited.contains("4 object changes over the limit"));
|
|
|
|
|
|
assert!(!limited.contains("~ 1/0: rectangle"));
|
|
|
|
|
|
assert!(!limited.contains("property[17]=\"old\""));
|
|
|
|
|
|
assert!(limited.ends_with("Hierarchy\n* CHIP\n leaf x1 -> x3\n"));
|
|
|
|
|
|
|
|
|
|
|
|
let all = diff(&["--details"]);
|
|
|
|
|
|
assert!(all.contains("Cells:\n- removed\n+ added\n* CHIP\n"));
|
|
|
|
|
|
assert!(!all.contains("payload in"));
|
|
|
|
|
|
assert_eq!(
|
|
|
|
|
|
diff(&["--details", "--format", "json"]),
|
|
|
|
|
|
diff(&["--format", "json"])
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-11-17 16:14:53 -08:00
|
|
|
|
#[test]
|
|
|
|
|
|
fn cli_decodes_gzip_by_header_and_checks_the_trailer() {
|
|
|
|
|
|
let directory = std::env::temp_dir().join(format!("pheon gzip {}", 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 plain = directory.join("plain.gds");
|
|
|
|
|
|
let compressed = directory.join("compressed.gds");
|
|
|
|
|
|
let data = shared(square());
|
|
|
|
|
|
// Splitting a record between gzip members must preserve the decompressed layout.
|
|
|
|
|
|
let mut encoded = [gzip(&data[..7]), gzip(&data[7..])].concat();
|
|
|
|
|
|
fs::write(&plain, &data).unwrap();
|
|
|
|
|
|
fs::write(&compressed, &encoded).unwrap();
|
|
|
|
|
|
let command = || Command::new(env!("CARGO_BIN_EXE_pheon"));
|
|
|
|
|
|
let dump = |path: &PathBuf| {
|
|
|
|
|
|
let output = command()
|
|
|
|
|
|
.arg("dump")
|
|
|
|
|
|
.arg(path)
|
|
|
|
|
|
.arg("--records")
|
|
|
|
|
|
.output()
|
|
|
|
|
|
.unwrap();
|
|
|
|
|
|
assert!(
|
|
|
|
|
|
output.status.success(),
|
|
|
|
|
|
"{}",
|
|
|
|
|
|
String::from_utf8_lossy(&output.stderr)
|
|
|
|
|
|
);
|
|
|
|
|
|
output.stdout
|
|
|
|
|
|
};
|
|
|
|
|
|
assert_eq!(dump(&plain), dump(&compressed));
|
|
|
|
|
|
let compare = || {
|
|
|
|
|
|
let output = command()
|
|
|
|
|
|
.arg("diff")
|
|
|
|
|
|
.arg(&plain)
|
|
|
|
|
|
.arg(&compressed)
|
|
|
|
|
|
.args(["--format", "json"])
|
|
|
|
|
|
.output()
|
|
|
|
|
|
.unwrap();
|
|
|
|
|
|
let report: serde_json::Value = serde_json::from_slice(&output.stdout).unwrap();
|
|
|
|
|
|
(output.status.code(), report)
|
|
|
|
|
|
};
|
|
|
|
|
|
let (code, report) = compare();
|
|
|
|
|
|
assert_eq!(code, Some(0));
|
|
|
|
|
|
assert_eq!(report["result"], "equal");
|
|
|
|
|
|
|
|
|
|
|
|
// Corrupt the last CRC after all the GDSII bytes have already been decoded.
|
|
|
|
|
|
let crc = encoded.len() - 8;
|
|
|
|
|
|
encoded[crc] ^= 0xff;
|
|
|
|
|
|
fs::write(&compressed, encoded).unwrap();
|
|
|
|
|
|
let (code, report) = compare();
|
|
|
|
|
|
assert_eq!(code, Some(2));
|
|
|
|
|
|
assert_eq!(report["status"], "failed");
|
|
|
|
|
|
let diagnostic = &report["diagnostics"][0];
|
|
|
|
|
|
assert_eq!(diagnostic["code"], "invalid_input");
|
|
|
|
|
|
assert_eq!(diagnostic["side"], "new");
|
|
|
|
|
|
assert!(
|
|
|
|
|
|
diagnostic["message"]
|
|
|
|
|
|
.as_str()
|
|
|
|
|
|
.unwrap()
|
|
|
|
|
|
.contains("gzip decompression failed")
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
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 metadata_writer_preserves_unrelated_bytes_and_consolidates_updates() {
|
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
|
|
|
|
use pheon::review::names::write_layer_names;
|
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 std::collections::BTreeMap;
|
|
|
|
|
|
let mut bytes = shared(with_property(square(), "keep this"));
|
|
|
|
|
|
bytes.extend_from_slice(&[0; 32]);
|
|
|
|
|
|
let updates = BTreeMap::from([
|
|
|
|
|
|
((1, 0), "WG".to_string()),
|
|
|
|
|
|
((2, 3), "HEATER:draw".to_string()),
|
|
|
|
|
|
]);
|
|
|
|
|
|
let output = write_layer_names(&bytes, "CHIP", (900, 7), &updates).unwrap();
|
|
|
|
|
|
let doc = Document::parse(&output).unwrap();
|
|
|
|
|
|
assert_eq!(doc.layer_names, updates);
|
|
|
|
|
|
let meta: Vec<_> = doc.cells["CHIP"]
|
|
|
|
|
|
.objects
|
|
|
|
|
|
.iter()
|
|
|
|
|
|
.filter(|o| o.layer == Some((900, 7)))
|
|
|
|
|
|
.collect();
|
|
|
|
|
|
let start = meta.iter().map(|o| o.offset).min().unwrap();
|
|
|
|
|
|
let end = meta.iter().map(|o| o.end_offset).max().unwrap();
|
|
|
|
|
|
assert_eq!([&output[..start], &output[end..]].concat(), bytes);
|
|
|
|
|
|
let updated = write_layer_names(
|
|
|
|
|
|
&output,
|
|
|
|
|
|
"CHIP",
|
|
|
|
|
|
(900, 7),
|
|
|
|
|
|
&BTreeMap::from([((1, 0), "CORE".to_string())]),
|
|
|
|
|
|
)
|
|
|
|
|
|
.unwrap();
|
|
|
|
|
|
let parsed = Document::parse(&updated).unwrap();
|
|
|
|
|
|
assert_eq!(parsed.layer_names[&(1, 0)], "CORE");
|
|
|
|
|
|
assert_eq!(parsed.layer_names[&(2, 3)], "HEATER:draw");
|
|
|
|
|
|
assert_eq!(
|
|
|
|
|
|
parsed.cells["CHIP"]
|
|
|
|
|
|
.objects
|
|
|
|
|
|
.iter()
|
|
|
|
|
|
.filter(|o| o.layer == Some((900, 7)))
|
|
|
|
|
|
.count(),
|
|
|
|
|
|
3
|
|
|
|
|
|
);
|
|
|
|
|
|
let diff = Comparison::between(&Document::parse(&output).unwrap(), &parsed);
|
|
|
|
|
|
assert!(diff.cells.is_empty());
|
|
|
|
|
|
assert_eq!(diff.layer_names.len(), 1);
|
|
|
|
|
|
assert_eq!(
|
|
|
|
|
|
write_layer_names(&updated, "CHIP", (900, 7), &BTreeMap::new()).unwrap(),
|
|
|
|
|
|
updated
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
|
fn metadata_writer_rejects_ambiguous_carriers_versions_and_bad_names() {
|
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
|
|
|
|
use pheon::review::names::{parse_layer_name, write_layer_names};
|
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 std::collections::BTreeMap;
|
|
|
|
|
|
let bytes = layout(&[("CHIP", vec![label((900, 7), "ordinary label")])]);
|
|
|
|
|
|
assert!(
|
|
|
|
|
|
write_layer_names(&bytes, "CHIP", (900, 7), &BTreeMap::new())
|
|
|
|
|
|
.unwrap_err()
|
|
|
|
|
|
.contains("ordinary design")
|
|
|
|
|
|
);
|
|
|
|
|
|
assert!(
|
|
|
|
|
|
write_layer_names(&bytes, "missing", (901, 7), &BTreeMap::new())
|
|
|
|
|
|
.unwrap_err()
|
|
|
|
|
|
.contains("does not exist")
|
|
|
|
|
|
);
|
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 bytes = layout(&[("CHIP", 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
|
|
|
|
assert!(
|
|
|
|
|
|
write_layer_names(&bytes, "CHIP", (901, 7), &BTreeMap::new())
|
|
|
|
|
|
.unwrap_err()
|
|
|
|
|
|
.contains("unsupported")
|
|
|
|
|
|
);
|
|
|
|
|
|
let bytes = layout(&[("CHIP", vec![square()])]);
|
|
|
|
|
|
for value in ["".to_string(), "bad\0name".to_string(), "x".repeat(65536)] {
|
|
|
|
|
|
assert!(
|
|
|
|
|
|
write_layer_names(&bytes, "CHIP", (901, 7), &BTreeMap::from([((1, 0), value)]))
|
|
|
|
|
|
.is_err()
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
for text in ["+1:0:name", "1:-1:name", "1:0:", "65536:0:name"] {
|
|
|
|
|
|
assert!(parse_layer_name(text).is_err());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
|
fn metadata_cli_creates_a_separate_file_and_refuses_existing_output() {
|
|
|
|
|
|
let directory = std::env::temp_dir().join(format!("pheon-metadata-{}", std::process::id()));
|
|
|
|
|
|
fs::create_dir_all(&directory).unwrap();
|
2026-11-17 16:14:53 -08:00
|
|
|
|
let source = directory.join("source.gds.gz");
|
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 output = directory.join("output.gds");
|
2026-11-17 16:14:53 -08:00
|
|
|
|
let bytes = gzip(&shared(square()));
|
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(&source, &bytes).unwrap();
|
|
|
|
|
|
let _ = fs::remove_file(&output);
|
|
|
|
|
|
let mut command = Command::new(env!("CARGO_BIN_EXE_pheon"));
|
|
|
|
|
|
command.arg("name-layers").arg(&source).arg(&output).args([
|
|
|
|
|
|
"--cell",
|
|
|
|
|
|
"CHIP",
|
|
|
|
|
|
"--carrier",
|
|
|
|
|
|
"900/7",
|
|
|
|
|
|
"--name",
|
|
|
|
|
|
"1:0:WG",
|
|
|
|
|
|
]);
|
|
|
|
|
|
let result = command.output().unwrap();
|
|
|
|
|
|
assert!(
|
|
|
|
|
|
result.status.success(),
|
|
|
|
|
|
"{}",
|
|
|
|
|
|
String::from_utf8_lossy(&result.stderr)
|
|
|
|
|
|
);
|
|
|
|
|
|
assert_eq!(fs::read(&source).unwrap(), bytes);
|
|
|
|
|
|
let generated = fs::read(&output).unwrap();
|
|
|
|
|
|
assert_eq!(
|
|
|
|
|
|
Document::parse(&generated).unwrap().layer_names[&(1, 0)],
|
|
|
|
|
|
"WG"
|
|
|
|
|
|
);
|
|
|
|
|
|
assert_eq!(command.output().unwrap().status.code(), Some(2));
|
|
|
|
|
|
assert_eq!(fs::read(&output).unwrap(), generated);
|
|
|
|
|
|
fs::remove_dir_all(directory).unwrap();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
|
fn scope_selection_distinguishes_reachable_subtrees_from_exact_cells() {
|
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
|
|
|
|
use pheon::review::selection::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
|
|
|
|
let a = layout(&[
|
|
|
|
|
|
("CHIP", vec![reference("leaf", 0, 1)]),
|
|
|
|
|
|
("leaf", vec![square()]),
|
|
|
|
|
|
("unused", vec![square()]),
|
|
|
|
|
|
]);
|
|
|
|
|
|
let b = layout(&[
|
|
|
|
|
|
("CHIP", vec![reference("leaf", 0, 1)]),
|
|
|
|
|
|
("leaf", vec![triangle()]),
|
|
|
|
|
|
("unused", vec![triangle()]),
|
|
|
|
|
|
]);
|
|
|
|
|
|
let top = Scope {
|
|
|
|
|
|
top: Some("CHIP".to_string()),
|
|
|
|
|
|
..Scope::default()
|
|
|
|
|
|
};
|
|
|
|
|
|
let old = Document::parse(&a).unwrap().selected(&top, false).unwrap();
|
|
|
|
|
|
let new = Document::parse(&b).unwrap().selected(&top, false).unwrap();
|
|
|
|
|
|
assert_eq!(
|
|
|
|
|
|
old.cells.keys().map(String::as_str).collect::<Vec<_>>(),
|
|
|
|
|
|
["CHIP", "leaf"]
|
|
|
|
|
|
);
|
|
|
|
|
|
assert_eq!(Comparison::between(&old, &new).cells.len(), 1);
|
2026-11-17 21:49:26 -08:00
|
|
|
|
assert!(old.canonical_dump().contains("Scope top=\"CHIP\"\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
|
|
|
|
let cell = Scope {
|
|
|
|
|
|
cell: Some("CHIP".to_string()),
|
|
|
|
|
|
..Scope::default()
|
|
|
|
|
|
};
|
|
|
|
|
|
let old = Document::parse(&a).unwrap().selected(&cell, false).unwrap();
|
|
|
|
|
|
let new = Document::parse(&b).unwrap().selected(&cell, 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
|
|
|
|
assert!(old.diagnostics.is_empty());
|
|
|
|
|
|
assert!(Comparison::between(&old, &new).outcome().is_equal());
|
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 missing = Scope {
|
|
|
|
|
|
top: Some("missing".to_string()),
|
|
|
|
|
|
..Scope::default()
|
|
|
|
|
|
};
|
|
|
|
|
|
assert!(
|
|
|
|
|
|
Document::parse(&a)
|
|
|
|
|
|
.unwrap()
|
|
|
|
|
|
.selected(&missing, false)
|
|
|
|
|
|
.is_err()
|
|
|
|
|
|
);
|
|
|
|
|
|
let wrong = Scope {
|
|
|
|
|
|
top: Some("CHIP".to_string()),
|
|
|
|
|
|
cell: Some("unused".to_string()),
|
|
|
|
|
|
layer: None,
|
|
|
|
|
|
};
|
|
|
|
|
|
assert!(
|
|
|
|
|
|
wrong
|
|
|
|
|
|
.validate_pair(&Document::parse(&a).unwrap(), &Document::parse(&b).unwrap())
|
|
|
|
|
|
.is_err()
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
|
fn layer_scope_filters_geometry_and_references_by_descendant_coverage() {
|
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
|
|
|
|
use pheon::review::selection::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
|
|
|
|
let mut other_layer = square();
|
|
|
|
|
|
other_layer[8..10].copy_from_slice(&2_u16.to_be_bytes());
|
|
|
|
|
|
let a = layout(&[
|
|
|
|
|
|
(
|
|
|
|
|
|
"CHIP",
|
|
|
|
|
|
vec![reference("wg", 0, 1), reference("heater", 0, 1)],
|
|
|
|
|
|
),
|
|
|
|
|
|
("wg", vec![square()]),
|
|
|
|
|
|
("heater", vec![other_layer.clone()]),
|
|
|
|
|
|
]);
|
|
|
|
|
|
let b = layout(&[
|
|
|
|
|
|
(
|
|
|
|
|
|
"CHIP",
|
|
|
|
|
|
vec![reference("wg", 0, 1), reference("heater", 5, 1)],
|
|
|
|
|
|
),
|
|
|
|
|
|
("wg", vec![square()]),
|
|
|
|
|
|
("heater", vec![other_layer]),
|
|
|
|
|
|
]);
|
|
|
|
|
|
for (layer, expected) in [((1, 0), 0), ((2, 0), 1)] {
|
|
|
|
|
|
let scope = Scope {
|
|
|
|
|
|
layer: Some(layer),
|
|
|
|
|
|
..Scope::default()
|
|
|
|
|
|
};
|
|
|
|
|
|
let old = Document::parse(&a)
|
|
|
|
|
|
.unwrap()
|
|
|
|
|
|
.selected(&scope, false)
|
|
|
|
|
|
.unwrap();
|
|
|
|
|
|
let new = Document::parse(&b)
|
|
|
|
|
|
.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
|
|
|
|
assert_eq!(
|
|
|
|
|
|
Comparison::between(&old, &new).outcome().exit_code(),
|
|
|
|
|
|
expected
|
|
|
|
|
|
);
|
|
|
|
|
|
assert!(old.diagnostics.is_empty());
|
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 scoped_issues_do_not_hide_relevant_unsupported_objects_or_cycles() {
|
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
|
|
|
|
use pheon::review::selection::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
|
|
|
|
let mut unknown = square();
|
|
|
|
|
|
unknown.truncate(unknown.len() - 4);
|
|
|
|
|
|
record(&mut unknown, 0x7f00, &[]);
|
|
|
|
|
|
record(&mut unknown, RTAG_ENDEL, &[]);
|
|
|
|
|
|
let bytes = layout(&[("CHIP", vec![square()]), ("unused", vec![unknown])]);
|
|
|
|
|
|
let scope = Scope {
|
|
|
|
|
|
cell: Some("CHIP".to_string()),
|
|
|
|
|
|
..Scope::default()
|
|
|
|
|
|
};
|
|
|
|
|
|
assert!(
|
|
|
|
|
|
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
|
|
|
|
.diagnostics
|
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
|
|
|
|
.is_empty()
|
|
|
|
|
|
);
|
|
|
|
|
|
let scope = Scope {
|
|
|
|
|
|
cell: Some("unused".to_string()),
|
|
|
|
|
|
..Scope::default()
|
|
|
|
|
|
};
|
|
|
|
|
|
assert!(
|
|
|
|
|
|
!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
|
|
|
|
.diagnostics
|
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
|
|
|
|
.is_empty()
|
|
|
|
|
|
);
|
|
|
|
|
|
let bytes = layout(&[
|
|
|
|
|
|
("a", vec![reference("b", 0, 1)]),
|
|
|
|
|
|
("b", vec![reference("a", 0, 1)]),
|
|
|
|
|
|
]);
|
|
|
|
|
|
let scope = Scope {
|
|
|
|
|
|
layer: Some((999, 0)),
|
|
|
|
|
|
..Scope::default()
|
|
|
|
|
|
};
|
|
|
|
|
|
assert!(
|
|
|
|
|
|
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
|
|
|
|
.diagnostics
|
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
|
|
|
|
.iter()
|
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
|
|
|
|
.any(|d| d.code == "hierarchy_cycle")
|
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 display_filters_never_change_equality_or_totals() {
|
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
|
|
|
|
use pheon::review::selection::DisplayFilter;
|
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 a = layout(&[("CHIP", vec![square()])]);
|
|
|
|
|
|
let b = layout(&[("CHIP", vec![triangle()])]);
|
|
|
|
|
|
let diff = Comparison::between(&Document::parse(&a).unwrap(), &Document::parse(&b).unwrap());
|
|
|
|
|
|
let text = diff.text_filtered(
|
|
|
|
|
|
100,
|
|
|
|
|
|
&DisplayFilter {
|
|
|
|
|
|
cell: None,
|
|
|
|
|
|
layer: Some((42, 0)),
|
|
|
|
|
|
},
|
|
|
|
|
|
);
|
2026-11-18 10:58:19 -08:00
|
|
|
|
assert!(text.starts_with("Different · 1 cell modified\n"));
|
2026-11-17 21:49:26 -08:00
|
|
|
|
assert!(text.contains("Display filter layer=42/0\n"));
|
2026-11-18 10:58:19 -08:00
|
|
|
|
assert!(text.contains("Omitted · 2 object changes filtered out"));
|
2026-11-18 20:12:42 -08:00
|
|
|
|
assert!(!text.contains("Cells:\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
|
|
|
|
assert_eq!(diff.outcome().exit_code(), 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
|
|
|
|
}
|
|
|
|
|
|
|
2026-11-17 21:49:26 -08:00
|
|
|
|
#[test]
|
|
|
|
|
|
fn text_hides_empty_headings_and_counts_filtered_and_limited_changes() {
|
|
|
|
|
|
use pheon::review::selection::DisplayFilter;
|
|
|
|
|
|
|
|
|
|
|
|
let mut attributes = Vec::new();
|
|
|
|
|
|
record(&mut attributes, RTAG_STRCLASS, &[0, 1]);
|
|
|
|
|
|
let a = layout(&[
|
|
|
|
|
|
("changed", vec![square()]),
|
|
|
|
|
|
("other", vec![square()]),
|
2026-11-18 20:12:42 -08:00
|
|
|
|
(
|
|
|
|
|
|
"gone",
|
|
|
|
|
|
vec![square(), triangle(), reference("target", 0, 1)],
|
|
|
|
|
|
),
|
2026-11-17 21:49:26 -08:00
|
|
|
|
("header", vec![]),
|
2026-11-18 20:12:42 -08:00
|
|
|
|
("target", vec![]),
|
2026-11-17 21:49:26 -08:00
|
|
|
|
]);
|
|
|
|
|
|
let b = layout(&[
|
|
|
|
|
|
("changed", vec![triangle()]),
|
|
|
|
|
|
("other", vec![triangle()]),
|
2026-11-18 20:12:42 -08:00
|
|
|
|
("new", vec![square(), reference("target", 0, 1)]),
|
2026-11-17 21:49:26 -08:00
|
|
|
|
("empty", vec![]),
|
|
|
|
|
|
("header", vec![attributes]),
|
2026-11-18 20:12:42 -08:00
|
|
|
|
("target", vec![]),
|
2026-11-17 21:49:26 -08:00
|
|
|
|
]);
|
|
|
|
|
|
let diff = Comparison::between(&Document::parse(&a).unwrap(), &Document::parse(&b).unwrap());
|
|
|
|
|
|
let text = diff.text(0);
|
2026-11-18 10:58:19 -08:00
|
|
|
|
assert!(text.starts_with("Different · 3 cells modified, 2 added, 1 removed\n"));
|
2026-11-18 20:12:42 -08:00
|
|
|
|
assert!(text.ends_with(concat!(
|
|
|
|
|
|
"Cells:\n",
|
|
|
|
|
|
"- gone\n",
|
|
|
|
|
|
"+ empty\n",
|
|
|
|
|
|
"+ new\n",
|
|
|
|
|
|
"* header (attributes changed)\n",
|
|
|
|
|
|
)));
|
2026-11-18 10:58:19 -08:00
|
|
|
|
assert!(text.contains("Omitted · 4 object changes over the limit"));
|
2026-11-17 21:49:26 -08:00
|
|
|
|
|
|
|
|
|
|
let text = diff.text_filtered(
|
|
|
|
|
|
1,
|
|
|
|
|
|
&DisplayFilter {
|
|
|
|
|
|
cell: Some("changed".to_string()),
|
|
|
|
|
|
layer: Some((1, 0)),
|
|
|
|
|
|
},
|
|
|
|
|
|
);
|
|
|
|
|
|
assert!(text.contains(concat!(
|
|
|
|
|
|
"Display filter cell=\"changed\" layer=1/0\n",
|
2026-11-18 10:58:19 -08:00
|
|
|
|
"Omitted · 2 object changes filtered out · 2 object changes over the limit",
|
|
|
|
|
|
" · 4 cell-level changes filtered out\n",
|
2026-11-17 21:49:26 -08:00
|
|
|
|
)));
|
2026-11-18 20:12:42 -08:00
|
|
|
|
assert!(!text.contains("Cells:\n"));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
|
fn cell_list_quotes_names_with_whitespace() {
|
|
|
|
|
|
let old = layout(&[("old name", vec![]), ("same\nname", vec![square()])]);
|
|
|
|
|
|
let new = layout(&[("new_name", vec![]), ("same\nname", vec![triangle()])]);
|
|
|
|
|
|
let diff = Comparison::between(
|
|
|
|
|
|
&Document::parse(&old).unwrap(),
|
|
|
|
|
|
&Document::parse(&new).unwrap(),
|
|
|
|
|
|
);
|
|
|
|
|
|
assert_eq!(
|
|
|
|
|
|
diff.text(100),
|
|
|
|
|
|
concat!(
|
|
|
|
|
|
"Different\n",
|
|
|
|
|
|
"Cells:\n",
|
|
|
|
|
|
"- \"old name\"\n",
|
|
|
|
|
|
"+ new_name\n",
|
|
|
|
|
|
"* \"same\\nname\"\n",
|
|
|
|
|
|
" 1/0: 1 polygon changed\n",
|
|
|
|
|
|
)
|
|
|
|
|
|
);
|
|
|
|
|
|
assert!(diff.hierarchy(false, 8).is_empty());
|
2026-11-17 21:49:26 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
2026-11-18 10:58:19 -08:00
|
|
|
|
fn reference_summaries_group_repeated_targets_and_keep_full_placements_in_dumps() {
|
2026-11-17 21:49:26 -08:00
|
|
|
|
let empty = layout(&[("leaf", vec![]), ("other", vec![])]);
|
|
|
|
|
|
let with_chip = layout(&[
|
|
|
|
|
|
(
|
|
|
|
|
|
"CHIP",
|
|
|
|
|
|
vec![
|
2026-11-18 10:58:19 -08:00
|
|
|
|
square(),
|
|
|
|
|
|
label((2, 0), "chip label"),
|
|
|
|
|
|
label((900, 7), LAYER_SENTINEL),
|
|
|
|
|
|
label((900, 7), "3:0:WG"),
|
2026-11-17 21:49:26 -08:00
|
|
|
|
reference("leaf", 0, 1),
|
|
|
|
|
|
reference("leaf", 5, 1),
|
|
|
|
|
|
reference("leaf", 2, 2),
|
|
|
|
|
|
reference("other", 10, 1),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
("leaf", vec![]),
|
|
|
|
|
|
("other", vec![]),
|
|
|
|
|
|
]);
|
|
|
|
|
|
let existing_chip = layout(&[("CHIP", vec![]), ("leaf", vec![]), ("other", vec![])]);
|
|
|
|
|
|
let empty = Document::parse(&empty).unwrap();
|
|
|
|
|
|
let with_chip = Document::parse(&with_chip).unwrap();
|
|
|
|
|
|
let existing_chip = Document::parse(&existing_chip).unwrap();
|
|
|
|
|
|
|
2026-11-18 20:12:42 -08:00
|
|
|
|
for (old, new, sign) in [(&empty, &with_chip, '+'), (&with_chip, &empty, '-')] {
|
2026-11-17 21:49:26 -08:00
|
|
|
|
let diff = Comparison::between(old, new);
|
2026-11-18 10:58:19 -08:00
|
|
|
|
let text_diff = TextComparison::between(old, new);
|
2026-11-17 21:49:26 -08:00
|
|
|
|
let text = diff.text(100);
|
2026-11-18 20:12:42 -08:00
|
|
|
|
assert!(text.ends_with(&format!("Cells:\n{sign} CHIP\n")));
|
|
|
|
|
|
assert!(!text.contains("\n "));
|
2026-11-18 10:58:19 -08:00
|
|
|
|
assert!(!text.contains("1/0"));
|
|
|
|
|
|
assert!(!text.contains("2/0"));
|
|
|
|
|
|
assert!(!text.contains("Omitted"));
|
2026-11-18 20:12:42 -08:00
|
|
|
|
assert_eq!(diff.text(0), text);
|
2026-11-18 10:58:19 -08:00
|
|
|
|
assert_eq!(text_diff.outcome(), diff.outcome());
|
|
|
|
|
|
for mermaid in [false, true] {
|
|
|
|
|
|
assert_eq!(text_diff.hierarchy(mermaid, 8), diff.hierarchy(mermaid, 8));
|
|
|
|
|
|
}
|
|
|
|
|
|
for show in [
|
|
|
|
|
|
DisplayFilter::default(),
|
|
|
|
|
|
DisplayFilter {
|
|
|
|
|
|
cell: Some("other".into()),
|
|
|
|
|
|
layer: None,
|
|
|
|
|
|
},
|
|
|
|
|
|
DisplayFilter {
|
|
|
|
|
|
cell: None,
|
|
|
|
|
|
layer: Some((1, 0)),
|
|
|
|
|
|
},
|
|
|
|
|
|
] {
|
|
|
|
|
|
for max in [0, 2, 100] {
|
|
|
|
|
|
assert_eq!(
|
|
|
|
|
|
text_diff.render_text(max, &show, true),
|
|
|
|
|
|
diff.text_filtered(max, &show)
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-11-17 21:49:26 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-11-18 10:58:19 -08:00
|
|
|
|
for (old, new, sign) in [
|
|
|
|
|
|
(&existing_chip, &with_chip, "+"),
|
|
|
|
|
|
(&with_chip, &existing_chip, "-"),
|
|
|
|
|
|
] {
|
|
|
|
|
|
let text = Comparison::between(old, new).text(100);
|
|
|
|
|
|
assert!(text.contains(&format!(
|
2026-11-18 20:12:42 -08:00
|
|
|
|
" {sign} 2 refs, 1 array ref to leaf (4 placements)\n"
|
2026-11-18 10:58:19 -08:00
|
|
|
|
)));
|
|
|
|
|
|
assert!(!text.contains("\"leaf\" xy="));
|
|
|
|
|
|
assert!(text.contains(&format!(" {sign} reference \"other\" xy=(10, 0)\n")));
|
|
|
|
|
|
}
|
2026-11-17 21:49:26 -08:00
|
|
|
|
let dump = with_chip.canonical_dump();
|
|
|
|
|
|
assert!(dump.contains(" reference \"leaf\" xy=(5, 0)\n"));
|
|
|
|
|
|
assert!(dump.contains(" array reference \"leaf\" (2 × 1) xy=[(2, 0), (102, 0), (2, 0)]\n"));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-11-18 20:12:42 -08:00
|
|
|
|
#[test]
|
|
|
|
|
|
fn reference_summaries_combine_visible_changes_to_a_target() {
|
|
|
|
|
|
let make_layout = |positions: std::ops::Range<i32>, moving_x| {
|
|
|
|
|
|
let mut refs: Vec<_> = positions
|
|
|
|
|
|
.chain(20..27)
|
|
|
|
|
|
.map(|x| reference("leaf", x, 1))
|
|
|
|
|
|
.collect();
|
|
|
|
|
|
refs.push(reference("moving", moving_x, 1));
|
|
|
|
|
|
refs.push(reference("moving", 99, 1));
|
|
|
|
|
|
layout(&[("CHIP", refs), ("leaf", vec![]), ("moving", vec![])])
|
|
|
|
|
|
};
|
|
|
|
|
|
let old = make_layout(0..3, 0);
|
|
|
|
|
|
let new = make_layout(10..16, 5);
|
|
|
|
|
|
let diff = Comparison::between(
|
|
|
|
|
|
&Document::parse(&old).unwrap(),
|
|
|
|
|
|
&Document::parse(&new).unwrap(),
|
|
|
|
|
|
);
|
|
|
|
|
|
assert_eq!(
|
|
|
|
|
|
diff.text(100),
|
|
|
|
|
|
concat!(
|
|
|
|
|
|
"Different\nCells:\n* CHIP\n",
|
|
|
|
|
|
" ~ reference \"moving\" moved by (5, 0) dbu · 2 total placements\n",
|
|
|
|
|
|
" leaf · -3 refs, +6 refs · placements 10 -> 13\n",
|
|
|
|
|
|
)
|
|
|
|
|
|
);
|
|
|
|
|
|
let ascii =
|
|
|
|
|
|
|max, show: &DisplayFilter| diff.render_text_with_ascii_hierarchy(max, show, true, 8);
|
|
|
|
|
|
assert_eq!(ascii(100, &Default::default()), diff.text(100));
|
|
|
|
|
|
assert!(diff.text(5).ends_with(" - 3 refs to leaf\n"));
|
|
|
|
|
|
let limited = diff.text(6);
|
|
|
|
|
|
assert!(
|
|
|
|
|
|
limited.starts_with(
|
|
|
|
|
|
"Different · 1 cell modified\nOmitted · 5 object changes over the limit\n"
|
|
|
|
|
|
)
|
|
|
|
|
|
);
|
|
|
|
|
|
assert!(limited.ends_with(" leaf · -3 refs, +1 ref\n"));
|
|
|
|
|
|
let limited_ascii = ascii(6, &Default::default());
|
|
|
|
|
|
assert!(limited_ascii.starts_with(&limited));
|
|
|
|
|
|
assert!(limited_ascii.ends_with("Hierarchy\n* CHIP\n leaf x10 -> x13\n"));
|
|
|
|
|
|
|
|
|
|
|
|
let filtered = ascii(
|
|
|
|
|
|
100,
|
|
|
|
|
|
&DisplayFilter {
|
|
|
|
|
|
cell: None,
|
|
|
|
|
|
layer: Some((1, 0)),
|
|
|
|
|
|
},
|
|
|
|
|
|
);
|
|
|
|
|
|
assert!(filtered.contains("11 object changes filtered out"));
|
|
|
|
|
|
assert!(filtered.ends_with(" leaf x10 -> x13\n moving x2 [reference changed]\n"));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
|
fn combined_ascii_hierarchy_preserves_paths_to_changed_and_shared_cells() {
|
|
|
|
|
|
let make_layout = |x, shape| {
|
|
|
|
|
|
layout(&[
|
|
|
|
|
|
(
|
|
|
|
|
|
"CHIP",
|
|
|
|
|
|
vec![reference("left", 0, 1), reference("right", 0, 1)],
|
|
|
|
|
|
),
|
|
|
|
|
|
(
|
|
|
|
|
|
"left",
|
|
|
|
|
|
vec![
|
|
|
|
|
|
reference("shared", x, 1),
|
|
|
|
|
|
reference("changed", x, 1),
|
|
|
|
|
|
reference("local", x, 1),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
("right", vec![reference("shared", x, 1)]),
|
|
|
|
|
|
("shared", vec![]),
|
|
|
|
|
|
("changed", vec![shape]),
|
|
|
|
|
|
("local", vec![]),
|
|
|
|
|
|
])
|
|
|
|
|
|
};
|
|
|
|
|
|
let old = make_layout(0, square());
|
|
|
|
|
|
let new = make_layout(5, triangle());
|
|
|
|
|
|
let diff = Comparison::between(
|
|
|
|
|
|
&Document::parse(&old).unwrap(),
|
|
|
|
|
|
&Document::parse(&new).unwrap(),
|
|
|
|
|
|
);
|
|
|
|
|
|
let text = diff.render_text_with_ascii_hierarchy(100, &Default::default(), true, 8);
|
|
|
|
|
|
let (cells, hierarchy) = text.split_once("Hierarchy\n").unwrap();
|
|
|
|
|
|
assert!(cells.contains("reference \"local\" moved by (5, 0) dbu"));
|
|
|
|
|
|
assert_eq!(
|
|
|
|
|
|
hierarchy,
|
|
|
|
|
|
concat!(
|
|
|
|
|
|
"CHIP [affected]\n",
|
|
|
|
|
|
" * left x1\n",
|
|
|
|
|
|
" * changed x1 [reference changed]\n",
|
|
|
|
|
|
" shared x1 [reference changed]\n",
|
|
|
|
|
|
" * right x1\n",
|
2026-11-18 22:58:12 -08:00
|
|
|
|
" shared x1 [reference changed]\n",
|
2026-11-18 20:12:42 -08:00
|
|
|
|
)
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
|
fn combined_reference_summaries_keep_array_counts_and_placements() {
|
|
|
|
|
|
let old = layout(&[
|
|
|
|
|
|
(
|
|
|
|
|
|
"CHIP",
|
|
|
|
|
|
vec![
|
|
|
|
|
|
reference("leaf", 0, 1),
|
|
|
|
|
|
reference("leaf", 10, 2),
|
|
|
|
|
|
reference("leaf", 20, 3),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
("leaf", vec![]),
|
|
|
|
|
|
]);
|
|
|
|
|
|
let new = layout(&[
|
|
|
|
|
|
(
|
|
|
|
|
|
"CHIP",
|
|
|
|
|
|
vec![
|
|
|
|
|
|
reference("leaf", 50, 1),
|
|
|
|
|
|
reference("leaf", 60, 1),
|
|
|
|
|
|
reference("leaf", 70, 2),
|
|
|
|
|
|
reference("leaf", 80, 4),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
("leaf", vec![]),
|
|
|
|
|
|
]);
|
|
|
|
|
|
let diff = Comparison::between(
|
|
|
|
|
|
&Document::parse(&old).unwrap(),
|
|
|
|
|
|
&Document::parse(&new).unwrap(),
|
|
|
|
|
|
);
|
|
|
|
|
|
assert_eq!(
|
|
|
|
|
|
diff.text(100),
|
|
|
|
|
|
concat!(
|
|
|
|
|
|
"Different\nCells:\n* CHIP\n",
|
|
|
|
|
|
" leaf · -1 ref, -2 array refs (6 placements), +2 refs, +2 array refs (8 placements)\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 git_external_driver_handles_changes_additions_deletions_and_errors() {
|
|
|
|
|
|
let directory = std::env::temp_dir().join(format!(
|
|
|
|
|
|
"pheon-git-review-{}-{}",
|
|
|
|
|
|
std::process::id(),
|
|
|
|
|
|
std::time::SystemTime::now()
|
|
|
|
|
|
.duration_since(std::time::UNIX_EPOCH)
|
|
|
|
|
|
.unwrap()
|
|
|
|
|
|
.as_nanos()
|
|
|
|
|
|
));
|
|
|
|
|
|
fs::create_dir_all(&directory).unwrap();
|
|
|
|
|
|
let inherited_path = std::env::var_os("PATH").unwrap_or_default();
|
|
|
|
|
|
let git_path = std::env::join_paths(
|
|
|
|
|
|
std::iter::once(
|
|
|
|
|
|
PathBuf::from(env!("CARGO_BIN_EXE_pheon"))
|
|
|
|
|
|
.parent()
|
|
|
|
|
|
.unwrap()
|
|
|
|
|
|
.to_path_buf(),
|
|
|
|
|
|
)
|
|
|
|
|
|
.chain(std::env::split_paths(&inherited_path)),
|
|
|
|
|
|
)
|
|
|
|
|
|
.unwrap();
|
|
|
|
|
|
let git = |args: &[&str]| {
|
|
|
|
|
|
let result = Command::new("git")
|
|
|
|
|
|
.env("PATH", &git_path)
|
|
|
|
|
|
.arg("-C")
|
|
|
|
|
|
.arg(&directory)
|
|
|
|
|
|
.args(args)
|
|
|
|
|
|
.output()
|
|
|
|
|
|
.unwrap();
|
|
|
|
|
|
assert!(
|
|
|
|
|
|
result.status.success(),
|
|
|
|
|
|
"git {args:?}: {}",
|
|
|
|
|
|
String::from_utf8_lossy(&result.stderr)
|
|
|
|
|
|
);
|
|
|
|
|
|
result
|
|
|
|
|
|
};
|
|
|
|
|
|
git(&["init", "-q"]);
|
|
|
|
|
|
git(&["config", "user.name", "Review Fixture"]);
|
|
|
|
|
|
git(&["config", "user.email", "fixture@example.invalid"]);
|
|
|
|
|
|
git(&["config", "commit.gpgsign", "false"]);
|
|
|
|
|
|
git(&["config", "core.hooksPath", "/dev/null"]);
|
|
|
|
|
|
git(&[
|
|
|
|
|
|
"config",
|
|
|
|
|
|
"include.path",
|
|
|
|
|
|
concat!(env!("CARGO_MANIFEST_DIR"), "/contrib/git/config"),
|
|
|
|
|
|
]);
|
|
|
|
|
|
assert_eq!(
|
|
|
|
|
|
String::from_utf8(git(&["config", "--get", "diff.pheon.trustExitCode"]).stdout)
|
|
|
|
|
|
.unwrap()
|
|
|
|
|
|
.trim(),
|
|
|
|
|
|
"false"
|
|
|
|
|
|
);
|
|
|
|
|
|
fs::write(
|
|
|
|
|
|
directory.join(".gitattributes"),
|
|
|
|
|
|
include_str!("../contrib/git/attributes"),
|
|
|
|
|
|
)
|
|
|
|
|
|
.unwrap();
|
|
|
|
|
|
let path = directory.join("chip layout.gds");
|
|
|
|
|
|
fs::write(&path, layout(&[("CHIP", vec![square()])])).unwrap();
|
|
|
|
|
|
git(&["add", "."]);
|
|
|
|
|
|
git(&["commit", "-qm", "baseline"]);
|
|
|
|
|
|
fs::write(&path, layout(&[("CHIP", vec![triangle()])])).unwrap();
|
|
|
|
|
|
let changed = git(&["diff", "--", "chip layout.gds"]);
|
|
|
|
|
|
assert!(
|
|
|
|
|
|
String::from_utf8(changed.stdout)
|
|
|
|
|
|
.unwrap()
|
2026-11-18 20:12:42 -08:00
|
|
|
|
.contains("Different\nCells:\n* CHIP\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
|
|
|
|
);
|
|
|
|
|
|
fs::write(&path, b"invalid").unwrap();
|
|
|
|
|
|
let invalid = Command::new("git")
|
|
|
|
|
|
.env("PATH", &git_path)
|
|
|
|
|
|
.arg("-C")
|
|
|
|
|
|
.arg(&directory)
|
|
|
|
|
|
.args(["diff", "--", "chip layout.gds"])
|
|
|
|
|
|
.output()
|
|
|
|
|
|
.unwrap();
|
|
|
|
|
|
assert!(!invalid.status.success());
|
|
|
|
|
|
assert!(String::from_utf8_lossy(&invalid.stderr).contains("pheon:"));
|
|
|
|
|
|
fs::write(&path, layout(&[("CHIP", vec![square()])])).unwrap();
|
2026-11-18 10:58:19 -08:00
|
|
|
|
let mode_change = Command::new(env!("CARGO_BIN_EXE_pheon"))
|
|
|
|
|
|
.args(["git-diff", "--hierarchy", "ascii", "--", "chip layout.gds"])
|
|
|
|
|
|
.arg(&path)
|
|
|
|
|
|
.args(["old", "100644"])
|
|
|
|
|
|
.arg(&path)
|
|
|
|
|
|
.args(["new", "100755"])
|
|
|
|
|
|
.output()
|
|
|
|
|
|
.unwrap();
|
|
|
|
|
|
assert!(mode_change.status.success());
|
|
|
|
|
|
assert_eq!(
|
|
|
|
|
|
mode_change.stdout,
|
|
|
|
|
|
b"layout \"chip layout.gds\"\nmode \"100644\" -> \"100755\"\nEqual\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
|
|
|
|
let added = directory.join("added layout.gds");
|
|
|
|
|
|
fs::write(&added, shared(square())).unwrap();
|
|
|
|
|
|
git(&["add", "added layout.gds"]);
|
|
|
|
|
|
let result = git(&["diff", "--cached", "--", "added layout.gds"]);
|
2026-11-18 10:58:19 -08:00
|
|
|
|
let text = String::from_utf8(result.stdout).unwrap();
|
|
|
|
|
|
assert!(text.starts_with("layout \"added layout.gds\" added\nDifferent · 4 cells added\n"));
|
2026-11-18 20:12:42 -08:00
|
|
|
|
assert!(text.contains("Cells:\n+ CHIP\n+ leaf\n+ left\n+ right\nHierarchy\n"));
|
2026-11-18 10:58:19 -08:00
|
|
|
|
assert!(!text.contains("\nmode "));
|
|
|
|
|
|
assert!(!text.contains("\nlibrary "));
|
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(&path).unwrap();
|
|
|
|
|
|
git(&["add", "-u"]);
|
|
|
|
|
|
let result = git(&["diff", "--cached", "--", "chip layout.gds"]);
|
2026-11-18 10:58:19 -08:00
|
|
|
|
let text = String::from_utf8(result.stdout).unwrap();
|
2026-11-18 20:12:42 -08:00
|
|
|
|
assert_eq!(
|
|
|
|
|
|
text,
|
|
|
|
|
|
"layout \"chip layout.gds\" deleted\nDifferent\nCells:\n- CHIP\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
|
|
|
|
// Textconv is an alternative to the external driver, with a separate cache.
|
|
|
|
|
|
git(&["commit", "-qm", "replace fixture"]);
|
|
|
|
|
|
git(&["mv", "added layout.gds", "renamed layout.gds"]);
|
|
|
|
|
|
let renamed = directory.join("renamed layout.gds");
|
|
|
|
|
|
fs::write(&renamed, shared(triangle())).unwrap();
|
|
|
|
|
|
git(&["add", "renamed layout.gds"]);
|
|
|
|
|
|
let result = git(&["diff", "--cached", "--find-renames"]);
|
|
|
|
|
|
let text = String::from_utf8(result.stdout).unwrap();
|
|
|
|
|
|
assert!(text.contains("renamed layout.gds"), "{text}");
|
2026-11-18 20:12:42 -08:00
|
|
|
|
assert!(text.contains("Different\nCells:\n* leaf\n"), "{text}");
|
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
|
|
|
|
git(&["commit", "-qm", "rename fixture"]);
|
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
|
|
|
|
fs::write(directory.join(".gitattributes"), "*.gds diff=pheon-text\n").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(&renamed, shared(square())).unwrap();
|
|
|
|
|
|
let result = git(&["diff", "--", "renamed layout.gds"]);
|
|
|
|
|
|
assert!(
|
|
|
|
|
|
String::from_utf8(result.stdout)
|
|
|
|
|
|
.unwrap()
|
2026-11-17 21:49:26 -08:00
|
|
|
|
.contains("- 1/0: polygon")
|
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_dir_all(directory).unwrap();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
|
fn replacement_explanations_are_unique_and_keep_full_evidence() {
|
|
|
|
|
|
for pair in corpus().into_iter().filter(|p| {
|
|
|
|
|
|
[
|
|
|
|
|
|
"same bounds different geometry",
|
|
|
|
|
|
"moved reference",
|
|
|
|
|
|
"array count",
|
|
|
|
|
|
]
|
|
|
|
|
|
.contains(&p.name)
|
|
|
|
|
|
}) {
|
|
|
|
|
|
let old = Document::parse(&pair.old).unwrap();
|
|
|
|
|
|
let new = Document::parse(&pair.new).unwrap();
|
|
|
|
|
|
let diff = Comparison::between(&old, &new);
|
|
|
|
|
|
assert_eq!(diff.cells[0].replacements.len(), 1);
|
|
|
|
|
|
let text = diff.text(100);
|
|
|
|
|
|
match pair.name {
|
2026-11-17 21:49:26 -08:00
|
|
|
|
"moved reference" => {
|
|
|
|
|
|
assert!(text.contains(" ~ reference \"leaf\" moved by (5, 0) dbu\n"))
|
|
|
|
|
|
}
|
|
|
|
|
|
"array count" => {
|
|
|
|
|
|
assert!(text.contains(" ~ array reference \"leaf\" columns/rows 2 x 1 -> 3 x 1\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
|
|
|
|
_ => assert_eq!(text, include_str!("golden/review-diff.txt")),
|
|
|
|
|
|
}
|
2026-11-17 21:49:26 -08:00
|
|
|
|
assert!(!text.contains(" - "));
|
|
|
|
|
|
assert!(!text.contains(" + "));
|
|
|
|
|
|
assert!(!text.contains("bbox="));
|
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!(!diff.text(0).contains(" ~ "));
|
2026-11-18 10:58:19 -08:00
|
|
|
|
assert_eq!(
|
|
|
|
|
|
diff.text(1),
|
|
|
|
|
|
"Different · 1 cell modified\nOmitted · 2 object changes over the limit\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
|
|
|
|
}
|
|
|
|
|
|
let a = layout(&[("CHIP", vec![square(), square()])]);
|
|
|
|
|
|
let b = layout(&[("CHIP", vec![triangle(), triangle()])]);
|
|
|
|
|
|
let diff = Comparison::between(&Document::parse(&a).unwrap(), &Document::parse(&b).unwrap());
|
|
|
|
|
|
assert!(diff.cells[0].replacements.is_empty());
|
2026-11-17 21:49:26 -08:00
|
|
|
|
let text = diff.text(100);
|
|
|
|
|
|
assert!(text.contains(" 1/0: 2 rectangles removed · 2 polygons added\n"));
|
|
|
|
|
|
assert!(!text.contains("bbox="));
|
|
|
|
|
|
assert!(!text.contains("xy="));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-11-18 23:16:09 -08:00
|
|
|
|
#[test]
|
|
|
|
|
|
fn layer_only_shape_replacements_keep_evidence_and_respect_selection() {
|
|
|
|
|
|
let rect = [[10, 0], [0, 0], [0, 10], [10, 10], [10, 0]];
|
|
|
|
|
|
let on_core = ring(RTAG_BOUNDARY, RTAG_DATATYPE, 2, &rect);
|
|
|
|
|
|
let named = |mut objects: Vec<Vec<u8>>, names: &[&str]| {
|
|
|
|
|
|
objects.push(label((900, 7), LAYER_SENTINEL));
|
|
|
|
|
|
objects.extend(names.iter().map(|name| label((900, 7), name)));
|
|
|
|
|
|
layout(&[("CHIP", objects)])
|
|
|
|
|
|
};
|
|
|
|
|
|
let old = named(vec![square()], &["1:0:WG", "2:0:CORE"]);
|
|
|
|
|
|
let new = named(vec![on_core.clone()], &["1:0:WG", "2:0:CORE"]);
|
|
|
|
|
|
let old = Document::parse(&old).unwrap();
|
|
|
|
|
|
let diff = Comparison::between(&old, &Document::parse(&new).unwrap());
|
|
|
|
|
|
assert_eq!(
|
|
|
|
|
|
diff.text(2),
|
|
|
|
|
|
"Different\nCells:\n* CHIP\n ~ 1/0 (WG) → 2/0 (CORE) · rectangle\n"
|
|
|
|
|
|
);
|
2026-11-18 23:20:00 -08:00
|
|
|
|
assert!(
|
|
|
|
|
|
diff.render_text_with_options(
|
|
|
|
|
|
2,
|
|
|
|
|
|
&Default::default(),
|
|
|
|
|
|
true,
|
|
|
|
|
|
TextReportOptions {
|
|
|
|
|
|
details: true,
|
|
|
|
|
|
..Default::default()
|
|
|
|
|
|
},
|
|
|
|
|
|
)
|
|
|
|
|
|
.ends_with(concat!(
|
|
|
|
|
|
" ~ 1/0 (WG) → 2/0 (CORE) · rectangle\n",
|
|
|
|
|
|
" - 1/0: rectangle (0, 0) to (10, 10)\n",
|
|
|
|
|
|
" + 2/0: rectangle (0, 0) to (10, 10)\n",
|
|
|
|
|
|
))
|
|
|
|
|
|
);
|
2026-11-18 23:16:09 -08:00
|
|
|
|
let limited = diff.text(1);
|
|
|
|
|
|
assert!(limited.contains("2 object changes over the limit"));
|
|
|
|
|
|
assert!(!limited.contains("Cells:"));
|
|
|
|
|
|
for (pair, suffix) in [
|
|
|
|
|
|
((1, 0), " 1/0 (WG): 1 rectangle removed\n"),
|
|
|
|
|
|
((2, 0), " 2/0 (CORE): 1 rectangle added\n"),
|
|
|
|
|
|
] {
|
|
|
|
|
|
let filtered = diff.text_filtered(
|
|
|
|
|
|
1,
|
|
|
|
|
|
&DisplayFilter {
|
|
|
|
|
|
cell: None,
|
|
|
|
|
|
layer: Some(pair),
|
|
|
|
|
|
},
|
|
|
|
|
|
);
|
|
|
|
|
|
assert!(filtered.contains("1 object change filtered out"));
|
|
|
|
|
|
assert!(filtered.ends_with(suffix), "{filtered}");
|
|
|
|
|
|
}
|
|
|
|
|
|
let json = diff.json_report(&Default::default(), &Default::default());
|
|
|
|
|
|
let replacement = &json["cell_changes"][0]["replacements"][0];
|
|
|
|
|
|
assert_eq!(replacement["match_rule"], "unique_layer_change");
|
|
|
|
|
|
assert_eq!(replacement["field_changes"].as_array().unwrap().len(), 1);
|
|
|
|
|
|
assert_eq!(replacement["field_changes"][0]["tag"], RTAG_LAYER);
|
|
|
|
|
|
assert_eq!(json["summary"]["removed_objects"], "1");
|
|
|
|
|
|
assert_eq!(json["summary"]["added_objects"], "1");
|
|
|
|
|
|
|
|
|
|
|
|
let old = named(vec![square()], &["1:0:WG"]);
|
|
|
|
|
|
let new = named(vec![on_core], &["2:0:CORE"]);
|
|
|
|
|
|
let diff = Comparison::between(
|
|
|
|
|
|
&Document::parse(&old).unwrap(),
|
|
|
|
|
|
&Document::parse(&new).unwrap(),
|
|
|
|
|
|
);
|
|
|
|
|
|
assert!(
|
|
|
|
|
|
diff.text(2)
|
|
|
|
|
|
.ends_with(" ~ 1/0 (WG) → 2/0 (CORE) · rectangle\n")
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
|
fn layer_only_matching_requires_unique_shapes_and_identical_payloads() {
|
|
|
|
|
|
let core_square = ring(
|
|
|
|
|
|
RTAG_BOUNDARY,
|
|
|
|
|
|
RTAG_DATATYPE,
|
|
|
|
|
|
2,
|
|
|
|
|
|
&[[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]],
|
|
|
|
|
|
);
|
|
|
|
|
|
for (old, new) in [
|
|
|
|
|
|
(vec![square(), square()], vec![core_square.clone()]),
|
|
|
|
|
|
(
|
|
|
|
|
|
vec![square()],
|
|
|
|
|
|
vec![core_square.clone(), core_square.clone()],
|
|
|
|
|
|
),
|
|
|
|
|
|
(vec![square()], vec![with_property(core_square, "new")]),
|
|
|
|
|
|
(
|
|
|
|
|
|
vec![square()],
|
|
|
|
|
|
vec![ring(
|
|
|
|
|
|
RTAG_BOUNDARY,
|
|
|
|
|
|
RTAG_DATATYPE,
|
|
|
|
|
|
2,
|
|
|
|
|
|
&[[0, 0], [10, 0], [0, 10], [0, 0]],
|
|
|
|
|
|
)],
|
|
|
|
|
|
),
|
|
|
|
|
|
] {
|
|
|
|
|
|
let old = layout(&[("CHIP", old)]);
|
|
|
|
|
|
let new = layout(&[("CHIP", new)]);
|
|
|
|
|
|
let diff = Comparison::between(
|
|
|
|
|
|
&Document::parse(&old).unwrap(),
|
|
|
|
|
|
&Document::parse(&new).unwrap(),
|
|
|
|
|
|
);
|
|
|
|
|
|
assert!(diff.cells[0].replacements.is_empty());
|
|
|
|
|
|
assert!(diff.text(100).contains(" removed\n"));
|
|
|
|
|
|
assert!(diff.text(100).contains(" added\n"));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
|
fn datatype_only_path_changes_pair_on_the_same_layer() {
|
|
|
|
|
|
let old = layout(&[("CHIP", vec![path(Some(8), &[[0, 0], [10, 10]])])]);
|
|
|
|
|
|
let old_doc = Document::parse(&old).unwrap();
|
|
|
|
|
|
let at = old_doc
|
|
|
|
|
|
.records
|
|
|
|
|
|
.iter()
|
|
|
|
|
|
.find(|record| record.tag == RTAG_DATATYPE)
|
|
|
|
|
|
.unwrap()
|
|
|
|
|
|
.offset
|
|
|
|
|
|
+ 4;
|
|
|
|
|
|
let mut new = old.clone();
|
|
|
|
|
|
new[at..at + 2].copy_from_slice(&3_u16.to_be_bytes());
|
|
|
|
|
|
let diff = Comparison::between(&old_doc, &Document::parse(&new).unwrap());
|
|
|
|
|
|
assert!(diff.text(2).ends_with(" ~ 1/0 → 1/3 · path\n"));
|
|
|
|
|
|
assert_eq!(
|
|
|
|
|
|
diff.cells[0].replacements[0].match_rule,
|
|
|
|
|
|
"unique_layer_change"
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-11-17 21:49:26 -08:00
|
|
|
|
#[test]
|
2026-11-18 23:01:57 -08:00
|
|
|
|
fn polygon_diff_reports_single_displacements_and_groups_bulk_moves() {
|
2026-11-17 21:49:26 -08:00
|
|
|
|
let before = layout(&[("CHIP", vec![with_property(square(), "old")])]);
|
|
|
|
|
|
let before = Document::parse(&before).unwrap();
|
|
|
|
|
|
for (shape, label) in [
|
|
|
|
|
|
(
|
|
|
|
|
|
polygon(&[[-5, 2], [5, 2], [5, 12], [-5, 12], [-5, 2]]),
|
|
|
|
|
|
"1 rectangle changed",
|
|
|
|
|
|
),
|
|
|
|
|
|
(
|
|
|
|
|
|
polygon(&[[0, 0], [20, 0], [20, 10], [0, 10], [0, 0]]),
|
|
|
|
|
|
"1 rectangle changed",
|
|
|
|
|
|
),
|
|
|
|
|
|
(
|
|
|
|
|
|
polygon(&[[5, 0], [10, 5], [5, 10], [0, 5], [5, 0]]),
|
|
|
|
|
|
"1 polygon changed",
|
|
|
|
|
|
),
|
|
|
|
|
|
(square(), "1 rectangle changed"),
|
|
|
|
|
|
] {
|
|
|
|
|
|
let after = layout(&[("CHIP", vec![with_property(shape, "new")])]);
|
|
|
|
|
|
let after = Document::parse(&after).unwrap();
|
|
|
|
|
|
let diff = Comparison::between(&before, &after);
|
|
|
|
|
|
let text = diff.text(100);
|
|
|
|
|
|
assert!(text.contains(&format!(" 1/0: {label}\n")), "{text}");
|
|
|
|
|
|
assert!(!text.contains("dbu"));
|
|
|
|
|
|
assert!(!text.contains("bbox="));
|
|
|
|
|
|
assert!(!text.contains("xy="));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-11-18 23:01:57 -08:00
|
|
|
|
let moved_triangle = polygon(&[[2, -1], [12, -1], [2, 9], [2, -1]]);
|
|
|
|
|
|
let moved_square = polygon(&[[2, -1], [12, -1], [12, 9], [2, 9], [2, -1]]);
|
|
|
|
|
|
let named_layout = |mut objects: Vec<Vec<u8>>| {
|
|
|
|
|
|
objects.extend([label((900, 7), LAYER_SENTINEL), label((900, 7), "1:0:WG")]);
|
|
|
|
|
|
layout(&[("CHIP", objects)])
|
|
|
|
|
|
};
|
2026-11-17 21:49:26 -08:00
|
|
|
|
for (shape, shifted, name) in [
|
2026-11-18 23:01:57 -08:00
|
|
|
|
(triangle(), moved_triangle, "polygon"),
|
|
|
|
|
|
(square(), moved_square.clone(), "rectangle"),
|
2026-11-17 21:49:26 -08:00
|
|
|
|
(
|
2026-11-18 23:01:57 -08:00
|
|
|
|
ring(
|
|
|
|
|
|
RTAG_BOX,
|
|
|
|
|
|
RTAG_BOXTYPE,
|
|
|
|
|
|
1,
|
|
|
|
|
|
&[[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]],
|
|
|
|
|
|
),
|
|
|
|
|
|
ring(
|
|
|
|
|
|
RTAG_BOX,
|
|
|
|
|
|
RTAG_BOXTYPE,
|
|
|
|
|
|
1,
|
|
|
|
|
|
&[[2, -1], [12, -1], [12, 9], [2, 9], [2, -1]],
|
|
|
|
|
|
),
|
|
|
|
|
|
"box",
|
2026-11-17 21:49:26 -08:00
|
|
|
|
),
|
|
|
|
|
|
] {
|
2026-11-18 23:01:57 -08:00
|
|
|
|
let before = named_layout(vec![shape]);
|
|
|
|
|
|
let after = named_layout(vec![shifted]);
|
2026-11-17 21:49:26 -08:00
|
|
|
|
let diff = Comparison::between(
|
|
|
|
|
|
&Document::parse(&before).unwrap(),
|
|
|
|
|
|
&Document::parse(&after).unwrap(),
|
|
|
|
|
|
);
|
2026-11-18 23:01:57 -08:00
|
|
|
|
assert!(
|
|
|
|
|
|
diff.text(100)
|
|
|
|
|
|
.contains(&format!(" 1/0 (WG): {name} moved by (2, -1) dbu\n"))
|
|
|
|
|
|
);
|
2026-11-17 21:49:26 -08:00
|
|
|
|
}
|
2026-11-18 23:01:57 -08:00
|
|
|
|
|
|
|
|
|
|
let before = named_layout(vec![square()]);
|
|
|
|
|
|
let after = named_layout(vec![
|
|
|
|
|
|
moved_square,
|
|
|
|
|
|
ring(
|
|
|
|
|
|
RTAG_BOX,
|
|
|
|
|
|
RTAG_BOXTYPE,
|
|
|
|
|
|
1,
|
|
|
|
|
|
&[[20, 0], [30, 0], [30, 10], [20, 10], [20, 0]],
|
|
|
|
|
|
),
|
|
|
|
|
|
]);
|
|
|
|
|
|
let diff = Comparison::between(
|
|
|
|
|
|
&Document::parse(&before).unwrap(),
|
|
|
|
|
|
&Document::parse(&after).unwrap(),
|
|
|
|
|
|
);
|
|
|
|
|
|
assert!(
|
|
|
|
|
|
diff.text(100)
|
|
|
|
|
|
.contains(" 1/0 (WG): 1 rectangle moved · 1 box added\n")
|
|
|
|
|
|
);
|
|
|
|
|
|
assert!(
|
|
|
|
|
|
diff.text(2)
|
|
|
|
|
|
.contains(" 1/0 (WG): rectangle moved by (2, -1) dbu\n")
|
|
|
|
|
|
);
|
2026-11-17 21:49:26 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
|
fn polygon_diff_groups_shapes_by_layer_across_dimensions() {
|
|
|
|
|
|
let shapes = [
|
|
|
|
|
|
square(),
|
|
|
|
|
|
polygon(&[[30, 0], [50, 0], [50, 5], [30, 5], [30, 0]]),
|
|
|
|
|
|
polygon(&[[70, 0], [80, 0], [71, 9], [70, 0]]),
|
|
|
|
|
|
ring(
|
|
|
|
|
|
RTAG_BOUNDARY,
|
|
|
|
|
|
RTAG_DATATYPE,
|
|
|
|
|
|
2,
|
|
|
|
|
|
&[[0, 0], [10, 0], [0, 10], [0, 0]],
|
|
|
|
|
|
),
|
|
|
|
|
|
];
|
|
|
|
|
|
let layout_with_property = |value| {
|
|
|
|
|
|
let objects = shapes
|
|
|
|
|
|
.iter()
|
|
|
|
|
|
.map(|shape| with_property(shape.clone(), value))
|
|
|
|
|
|
.collect();
|
|
|
|
|
|
layout(&[("CHIP", objects)])
|
|
|
|
|
|
};
|
|
|
|
|
|
let before = layout_with_property("old");
|
|
|
|
|
|
let after = layout_with_property("new");
|
|
|
|
|
|
let diff = Comparison::between(
|
|
|
|
|
|
&Document::parse(&before).unwrap(),
|
|
|
|
|
|
&Document::parse(&after).unwrap(),
|
|
|
|
|
|
);
|
|
|
|
|
|
assert_eq!(
|
|
|
|
|
|
diff.text(100),
|
|
|
|
|
|
concat!(
|
2026-11-18 20:12:42 -08:00
|
|
|
|
"Different\n",
|
|
|
|
|
|
"Cells:\n* CHIP\n",
|
2026-11-17 21:49:26 -08:00
|
|
|
|
" 1/0: 2 rectangles, 1 polygon changed\n",
|
|
|
|
|
|
" 2/0: 1 polygon changed\n",
|
|
|
|
|
|
)
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
|
fn polygon_diff_distinguishes_boxes_from_rectangular_boundaries() {
|
|
|
|
|
|
let before = layout(&[("CHIP", vec![square()])]);
|
|
|
|
|
|
let points = [[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]];
|
|
|
|
|
|
let after = layout(&[("CHIP", vec![ring(RTAG_BOX, RTAG_BOXTYPE, 1, &points)])]);
|
|
|
|
|
|
let diff = Comparison::between(
|
|
|
|
|
|
&Document::parse(&before).unwrap(),
|
|
|
|
|
|
&Document::parse(&after).unwrap(),
|
|
|
|
|
|
);
|
|
|
|
|
|
let text = diff.text(100);
|
|
|
|
|
|
assert!(text.contains(" 1/0: 1 rectangle removed · 1 box added\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 path_width_explanation_preserves_absent_and_zero() {
|
2026-11-18 10:58:19 -08:00
|
|
|
|
let points = [[0, 0], [10, 10]];
|
|
|
|
|
|
let a = layout(&[("CHIP", vec![path(None, &points)])]);
|
|
|
|
|
|
let b = layout(&[("CHIP", vec![path(Some(0), &points)])]);
|
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 diff = Comparison::between(&Document::parse(&a).unwrap(), &Document::parse(&b).unwrap());
|
2026-11-17 21:49:26 -08:00
|
|
|
|
assert!(
|
|
|
|
|
|
diff.text(100)
|
|
|
|
|
|
.contains(" ~ 1/0: path width absent -> 0 dbu\n")
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-11-18 10:58:19 -08:00
|
|
|
|
#[test]
|
|
|
|
|
|
fn unmatched_paths_summarize_coordinates_that_would_wrap() {
|
|
|
|
|
|
let points = [[0, 0], [4, 0], [4, -5], [13, -5], [13, 9]];
|
|
|
|
|
|
let empty = layout(&[("CHIP", vec![])]);
|
|
|
|
|
|
let paths = layout(&[(
|
|
|
|
|
|
"CHIP",
|
|
|
|
|
|
vec![
|
|
|
|
|
|
path(None, &points),
|
|
|
|
|
|
path(Some(-8), &points),
|
|
|
|
|
|
path(Some(0), &points[..4]),
|
|
|
|
|
|
],
|
|
|
|
|
|
)]);
|
|
|
|
|
|
let empty = Document::parse(&empty).unwrap();
|
|
|
|
|
|
let paths = Document::parse(&paths).unwrap();
|
|
|
|
|
|
for (old, new, sign) in [(&empty, &paths, "+"), (&paths, &empty, "-")] {
|
|
|
|
|
|
let text = Comparison::between(old, new).text(100);
|
|
|
|
|
|
for width in ["absent", "-8 dbu"] {
|
|
|
|
|
|
assert!(text.contains(&format!(
|
|
|
|
|
|
" {sign} 1/0: path · width {width} · 5 vertices · bounds (0, -5) to (13, 9) dbu\n"
|
|
|
|
|
|
)));
|
|
|
|
|
|
}
|
2026-11-18 20:12:42 -08:00
|
|
|
|
assert_eq!(
|
|
|
|
|
|
text.lines().filter(|line| line.starts_with(" ")).count(),
|
|
|
|
|
|
3,
|
|
|
|
|
|
"{text}"
|
|
|
|
|
|
);
|
2026-11-18 10:58:19 -08:00
|
|
|
|
assert!(text.contains("xy=[(0, 0), (4, 0), (4, -5), (13, -5)]"));
|
|
|
|
|
|
}
|
|
|
|
|
|
assert!(paths.canonical_dump().contains("\n (13, 9)]"));
|
|
|
|
|
|
let report =
|
|
|
|
|
|
Comparison::between(&empty, &paths).json_report(&Default::default(), &Default::default());
|
|
|
|
|
|
assert!(
|
|
|
|
|
|
report["cell_changes"][0]["added"]
|
|
|
|
|
|
.as_array()
|
|
|
|
|
|
.unwrap()
|
|
|
|
|
|
.iter()
|
|
|
|
|
|
.flat_map(|object| object["fields"].as_array().unwrap())
|
|
|
|
|
|
.any(|field| field["tag"] == RTAG_XY && field["value"] == serde_json::json!(points))
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-11-18 20:12:42 -08:00
|
|
|
|
#[test]
|
|
|
|
|
|
fn repeated_unmatched_rows_group_only_identical_objects_within_the_limit() {
|
|
|
|
|
|
let points = [[0, 0], [4, 0], [4, -5], [13, -5], [13, 9]];
|
|
|
|
|
|
let mut other_points = points;
|
|
|
|
|
|
other_points[1][0] = 5;
|
|
|
|
|
|
let named_paths = |mut paths: Vec<Vec<u8>>| {
|
|
|
|
|
|
paths.extend([label((900, 7), LAYER_SENTINEL), label((900, 7), "1:0:WG")]);
|
|
|
|
|
|
layout(&[("CHIP", paths)])
|
|
|
|
|
|
};
|
|
|
|
|
|
let empty = named_paths(vec![]);
|
|
|
|
|
|
let paths = named_paths(vec![
|
|
|
|
|
|
path(None, &points),
|
|
|
|
|
|
path(None, &other_points),
|
|
|
|
|
|
path(None, &points),
|
|
|
|
|
|
]);
|
|
|
|
|
|
let empty = Document::parse(&empty).unwrap();
|
|
|
|
|
|
let paths = Document::parse(&paths).unwrap();
|
|
|
|
|
|
for (old, new, sign) in [(&empty, &paths, "+"), (&paths, &empty, "-")] {
|
|
|
|
|
|
let diff = Comparison::between(old, new);
|
|
|
|
|
|
let details = "path · width absent · 5 vertices · bounds (0, -5) to (13, 9) dbu";
|
|
|
|
|
|
let full = diff.text(3);
|
|
|
|
|
|
assert!(full.contains("1/0: name \"WG\"\nCells:\n"));
|
|
|
|
|
|
assert!(full.ends_with(&format!(
|
|
|
|
|
|
" {sign} 2× 1/0: {details}\n {sign} 1/0: {details}\n"
|
|
|
|
|
|
)));
|
|
|
|
|
|
assert!(
|
|
|
|
|
|
diff.text(2)
|
|
|
|
|
|
.ends_with(&format!(" {sign} 2× 1/0 (WG): {details}\n"))
|
|
|
|
|
|
);
|
|
|
|
|
|
let limited = diff.text(1);
|
|
|
|
|
|
assert!(limited.contains("2 object changes over the limit"));
|
|
|
|
|
|
assert!(limited.ends_with(&format!(" {sign} 1/0 (WG): {details}\n")));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-11-17 21:49:26 -08:00
|
|
|
|
#[test]
|
|
|
|
|
|
fn label_replacements_show_only_changed_fields() {
|
|
|
|
|
|
let a = layout(&[("CHIP", vec![label((2, 0), "old")])]);
|
|
|
|
|
|
let b = layout(&[("CHIP", vec![label((2, 0), "new")])]);
|
|
|
|
|
|
let diff = Comparison::between(&Document::parse(&a).unwrap(), &Document::parse(&b).unwrap());
|
|
|
|
|
|
assert_eq!(
|
|
|
|
|
|
diff.text(100),
|
2026-11-18 20:12:42 -08:00
|
|
|
|
"Different\nCells:\n* CHIP\n ~ 2/0: label text \"old\" -> \"new\"\n"
|
2026-11-17 21:49:26 -08:00
|
|
|
|
);
|
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 unchanged_layer_names_explain_geometry_changes_once() {
|
2026-11-18 20:12:42 -08:00
|
|
|
|
let named = |geometry, text| {
|
|
|
|
|
|
layout(&[
|
|
|
|
|
|
(
|
|
|
|
|
|
"CHIP",
|
|
|
|
|
|
vec![
|
|
|
|
|
|
geometry,
|
|
|
|
|
|
label((900, 7), LAYER_SENTINEL),
|
|
|
|
|
|
label((900, 7), "1:0:WG"),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
("leaf", vec![label((1, 0), text)]),
|
|
|
|
|
|
])
|
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
|
|
|
|
};
|
2026-11-18 20:12:42 -08:00
|
|
|
|
let old = named(square(), "old");
|
|
|
|
|
|
let a = Document::parse(&old).unwrap();
|
|
|
|
|
|
let new = named(triangle(), "old");
|
|
|
|
|
|
let diff = Comparison::between(&a, &Document::parse(&new).unwrap());
|
|
|
|
|
|
assert_eq!(
|
|
|
|
|
|
diff.text(100),
|
|
|
|
|
|
"Different\nCells:\n* CHIP\n 1/0 (WG): 1 polygon changed\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
|
|
|
|
assert!(diff.layer_names.is_empty());
|
2026-11-17 21:49:26 -08:00
|
|
|
|
|
2026-11-18 20:12:42 -08:00
|
|
|
|
let new = named(triangle(), "new");
|
|
|
|
|
|
let diff = Comparison::between(&a, &Document::parse(&new).unwrap());
|
|
|
|
|
|
let text = diff.text(100);
|
|
|
|
|
|
assert!(text.contains("1/0: name \"WG\"\nCells:\n"));
|
|
|
|
|
|
assert!(!text.contains("(WG)"));
|
|
|
|
|
|
assert!(diff.text(2).ends_with(" 1/0 (WG): 1 polygon changed\n"));
|
|
|
|
|
|
let show = DisplayFilter {
|
|
|
|
|
|
cell: Some("leaf".into()),
|
|
|
|
|
|
layer: None,
|
|
|
|
|
|
};
|
|
|
|
|
|
assert!(
|
|
|
|
|
|
diff.text_filtered(100, &show)
|
|
|
|
|
|
.ends_with(" ~ 1/0 (WG): label text \"old\" -> \"new\"\n")
|
|
|
|
|
|
);
|
|
|
|
|
|
|
2026-11-17 21:49:26 -08:00
|
|
|
|
let names = corpus()
|
|
|
|
|
|
.into_iter()
|
|
|
|
|
|
.find(|case| case.name == "layer name only")
|
|
|
|
|
|
.unwrap();
|
|
|
|
|
|
let old = Document::parse(&names.old).unwrap();
|
|
|
|
|
|
let new = Document::parse(&names.new).unwrap();
|
|
|
|
|
|
assert!(
|
|
|
|
|
|
Comparison::between(&old, &new)
|
|
|
|
|
|
.text(0)
|
|
|
|
|
|
.contains("1/0: name \"WG\" -> \"CORE:WG\"")
|
|
|
|
|
|
);
|
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]
|
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
|
|
|
|
fn library_presence_changes_distinguish_empty_and_absent_revisions() {
|
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 bytes = layout(&[]);
|
|
|
|
|
|
let doc = Document::parse(&bytes).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 absent = doc.empty_like();
|
|
|
|
|
|
let added = Comparison::between(&absent, &doc);
|
|
|
|
|
|
assert_eq!(added.outcome().exit_code(), 1);
|
2026-11-17 21:49:26 -08:00
|
|
|
|
assert!(added.text(0).contains("library added\n"));
|
|
|
|
|
|
assert!(added.text(0).starts_with("Different · 1 library change\n"));
|
2026-11-18 10:58:19 -08:00
|
|
|
|
assert_eq!(
|
|
|
|
|
|
added.render_text(0, &Default::default(), false),
|
|
|
|
|
|
"Different\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 removed = Comparison::between(&doc, &absent);
|
|
|
|
|
|
assert_eq!(removed.outcome().exit_code(), 1);
|
2026-11-17 21:49:26 -08:00
|
|
|
|
assert!(removed.text(0).contains("library removed\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 cli_scope_and_display_filters_have_distinct_exit_behavior() {
|
|
|
|
|
|
let directory = std::env::temp_dir().join(format!("pheon-scope-{}", std::process::id()));
|
|
|
|
|
|
fs::create_dir_all(&directory).unwrap();
|
|
|
|
|
|
let old = directory.join("old.gds");
|
|
|
|
|
|
let new = directory.join("new.gds");
|
|
|
|
|
|
fs::write(&old, shared(square())).unwrap();
|
|
|
|
|
|
fs::write(&new, shared(triangle())).unwrap();
|
|
|
|
|
|
for (options, expected) in [
|
|
|
|
|
|
(vec!["--cell", "CHIP"], 0),
|
|
|
|
|
|
(vec!["--top", "CHIP"], 1),
|
|
|
|
|
|
(vec!["--layer", "99/0"], 0),
|
|
|
|
|
|
(vec!["--show-cell", "missing"], 1),
|
|
|
|
|
|
(vec!["--show-layer", "99/0"], 1),
|
|
|
|
|
|
(vec!["--top", "missing"], 2),
|
|
|
|
|
|
] {
|
|
|
|
|
|
let output = Command::new(env!("CARGO_BIN_EXE_pheon"))
|
|
|
|
|
|
.arg("diff")
|
|
|
|
|
|
.args(&options)
|
|
|
|
|
|
.arg(&old)
|
|
|
|
|
|
.arg(&new)
|
|
|
|
|
|
.output()
|
|
|
|
|
|
.unwrap();
|
|
|
|
|
|
assert_eq!(
|
|
|
|
|
|
output.status.code(),
|
|
|
|
|
|
Some(expected),
|
|
|
|
|
|
"{options:?}: {}",
|
|
|
|
|
|
String::from_utf8_lossy(&output.stderr)
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
fs::write(&old, layout(&[])).unwrap();
|
|
|
|
|
|
let output = Command::new(env!("CARGO_BIN_EXE_pheon"))
|
|
|
|
|
|
.args(["diff", "--top", "CHIP"])
|
|
|
|
|
|
.arg(&old)
|
|
|
|
|
|
.arg(&new)
|
|
|
|
|
|
.output()
|
|
|
|
|
|
.unwrap();
|
|
|
|
|
|
assert_eq!(output.status.code(), Some(1));
|
|
|
|
|
|
fs::remove_dir_all(directory).unwrap();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-11-18 23:07:22 -08:00
|
|
|
|
#[test]
|
|
|
|
|
|
fn cli_resolves_layer_names_before_applying_scope_and_display_filters() {
|
|
|
|
|
|
let directory = std::env::temp_dir().join(format!("pheon-named-layer-{}", 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 old = directory.join("old.gds");
|
|
|
|
|
|
let new = directory.join("new.gds");
|
|
|
|
|
|
let fixture = |shape, text, name| {
|
|
|
|
|
|
layout(&[
|
|
|
|
|
|
("CHIP", vec![shape, label((2, 0), text)]),
|
|
|
|
|
|
(
|
|
|
|
|
|
"legend",
|
|
|
|
|
|
vec![label((900, 7), LAYER_SENTINEL), label((900, 7), name)],
|
|
|
|
|
|
),
|
|
|
|
|
|
])
|
|
|
|
|
|
};
|
|
|
|
|
|
fs::write(&old, fixture(square(), "before", "1:0:WG")).unwrap();
|
|
|
|
|
|
fs::write(&new, fixture(triangle(), "after", "1:0:CORE")).unwrap();
|
|
|
|
|
|
let command = || Command::new(env!("CARGO_BIN_EXE_pheon"));
|
|
|
|
|
|
let diff = |options: &[&str]| {
|
|
|
|
|
|
command()
|
|
|
|
|
|
.arg("diff")
|
|
|
|
|
|
.arg(&old)
|
|
|
|
|
|
.arg(&new)
|
|
|
|
|
|
.args(options)
|
|
|
|
|
|
.output()
|
|
|
|
|
|
.unwrap()
|
|
|
|
|
|
};
|
|
|
|
|
|
for (option, name) in [("--layer", "WG"), ("--show-layer", "CORE")] {
|
|
|
|
|
|
for format in ["text", "json"] {
|
|
|
|
|
|
let named = diff(&[option, name, "--cell", "CHIP", "--format", format]);
|
|
|
|
|
|
let numeric = diff(&[option, "1/0", "--cell", "CHIP", "--format", format]);
|
|
|
|
|
|
assert_eq!(
|
|
|
|
|
|
named.status.code(),
|
|
|
|
|
|
Some(1),
|
|
|
|
|
|
"{}",
|
|
|
|
|
|
String::from_utf8_lossy(&named.stderr)
|
|
|
|
|
|
);
|
|
|
|
|
|
assert_eq!(named.stdout, numeric.stdout);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let dump = |layer| {
|
|
|
|
|
|
let output = command()
|
|
|
|
|
|
.arg("dump")
|
|
|
|
|
|
.arg(&old)
|
|
|
|
|
|
.args(["--layer", layer])
|
|
|
|
|
|
.output()
|
|
|
|
|
|
.unwrap();
|
|
|
|
|
|
assert!(output.status.success());
|
|
|
|
|
|
output.stdout
|
|
|
|
|
|
};
|
|
|
|
|
|
assert_eq!(dump("WG"), dump("1/0"));
|
|
|
|
|
|
|
|
|
|
|
|
let unknown = diff(&["--show-layer", "wg", "--format", "json"]);
|
|
|
|
|
|
assert_eq!(unknown.status.code(), Some(2));
|
|
|
|
|
|
let report: serde_json::Value = serde_json::from_slice(&unknown.stdout).unwrap();
|
|
|
|
|
|
assert_eq!(report["diagnostics"][0]["code"], "command_error");
|
|
|
|
|
|
assert_eq!(
|
|
|
|
|
|
report["diagnostics"][0]["message"],
|
|
|
|
|
|
"--show-layer unknown layer name \"wg\""
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
fs::write(&new, fixture(triangle(), "after", "2:0:WG")).unwrap();
|
|
|
|
|
|
let ambiguous = diff(&["--layer", "WG"]);
|
|
|
|
|
|
assert_eq!(ambiguous.status.code(), Some(2));
|
|
|
|
|
|
assert_eq!(
|
|
|
|
|
|
String::from_utf8(ambiguous.stderr).unwrap().trim_end(),
|
|
|
|
|
|
"pheon: --layer ambiguous layer name \"WG\" (choose 1/0, 2/0)"
|
|
|
|
|
|
);
|
|
|
|
|
|
assert_eq!(diff(&["--layer", "1/0"]).status.code(), Some(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 large_polygons_and_billion_instance_arrays_stay_compact() {
|
|
|
|
|
|
let mut points = vec![[0, 0], [0, 1]];
|
|
|
|
|
|
points.extend((1..8187).map(|x| [x, 1]));
|
|
|
|
|
|
points.extend([[8186, 0], [0, 0]]);
|
|
|
|
|
|
let mut array = Vec::new();
|
|
|
|
|
|
record(&mut array, RTAG_AREF, &[]);
|
|
|
|
|
|
ascii(&mut array, RTAG_SNAME, "leaf");
|
|
|
|
|
|
record(&mut array, RTAG_COLROW, &[0x7f, 0xff, 0x7f, 0xff]);
|
|
|
|
|
|
xy(&mut array, &[[0, 0], [32767, 0], [0, 32767]]);
|
|
|
|
|
|
record(&mut array, RTAG_ENDEL, &[]);
|
|
|
|
|
|
let bytes = layout(&[("CHIP", vec![array]), ("leaf", vec![polygon(&points)])]);
|
|
|
|
|
|
let doc = Document::parse(&bytes).unwrap();
|
|
|
|
|
|
assert_eq!(
|
|
|
|
|
|
doc.edges()[&("CHIP".to_string(), "leaf".to_string())],
|
|
|
|
|
|
32767 * 32767
|
|
|
|
|
|
);
|
|
|
|
|
|
assert_eq!(doc.cells["CHIP"].objects.len(), 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!(doc.hierarchy(false, 8).len() < 200);
|
|
|
|
|
|
assert!(Comparison::between(&doc, &doc).outcome().is_equal());
|
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 deep_hierarchy_comparison_and_rendering_are_iterative() {
|
|
|
|
|
|
let names: Vec<_> = (0..2048).map(|i| format!("cell_{i}")).collect();
|
|
|
|
|
|
let cells = |leaf: Vec<u8>| {
|
|
|
|
|
|
names
|
|
|
|
|
|
.iter()
|
|
|
|
|
|
.enumerate()
|
|
|
|
|
|
.map(|(i, name)| {
|
|
|
|
|
|
(
|
|
|
|
|
|
name.as_str(),
|
|
|
|
|
|
if i + 1 == names.len() {
|
|
|
|
|
|
vec![leaf.clone()]
|
|
|
|
|
|
} else {
|
|
|
|
|
|
vec![reference(&names[i + 1], 0, 1)]
|
|
|
|
|
|
},
|
|
|
|
|
|
)
|
|
|
|
|
|
})
|
|
|
|
|
|
.collect::<Vec<_>>()
|
|
|
|
|
|
};
|
|
|
|
|
|
let a = layout(&cells(square()));
|
|
|
|
|
|
let b = layout(&cells(triangle()));
|
|
|
|
|
|
let a = Document::parse(&a).unwrap();
|
|
|
|
|
|
let b = Document::parse(&b).unwrap();
|
|
|
|
|
|
let diff = Comparison::between(&a, &b);
|
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 tree = diff.hierarchy(false, 5);
|
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!(diff.cells.len(), 1);
|
|
|
|
|
|
assert!(tree.contains("children omitted"));
|
|
|
|
|
|
assert!(tree.len() < 500);
|
|
|
|
|
|
}
|