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.
This commit is contained in:
Jan Petykiewicz 2026-11-16 20:45:06 -08:00
commit df62677f5c
5 changed files with 870 additions and 504 deletions

View file

@ -1,6 +1,6 @@
# Comparison rules
Pheon compares GDSII objects using the `klamath-object-v2` profile. Use it to
Pheon compares GDSII objects using the `pheon-structural-v1` profile. Use it to
review exact layout changes while ignoring incidental ordering and timestamps.
The [CLI guide](cli.md) explains how to choose cells and layers.

View file

@ -1,7 +1,7 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Pheon diff report version 1",
"description": "Object-profile comparison evidence, not a layout serialization. Unknown additional fields are permitted for compatible extensions.",
"description": "Structural comparison evidence, not a layout serialization. Unknown additional fields are permitted for compatible extensions.",
"type": "object",
"required": ["schema_version", "kind", "producer", "comparison_profile", "inputs", "scope", "coordinates", "status", "result", "exit_code", "summary", "report_selection", "layer_legend", "library_changes", "layer_name_changes", "cell_changes", "hierarchy", "diagnostics"],
"properties": {

View file

@ -3,7 +3,7 @@
Use JSON reports to automate layout review while retaining the evidence behind
a result. The [comparison rules](comparison.md) define equality; the
[version 1 JSON Schema](diff-report-v1.schema.json) defines every field.
A [complete example](../tests/golden/report-geometry.json) shows geometry changes.
A [complete example](https://mpxd.net/code/jan/pheon/src/branch/master/tests/golden/report-geometry.json) shows geometry changes.
```sh
pheon diff before.gds after.gds --format json > report.json
@ -114,7 +114,7 @@ object limits, and text depth do not trim the graph.
## Versions
`schema_version` is 1, `comparison_profile` is `klamath-object-v2`, and
`schema_version` is 1, `comparison_profile` is `pheon-structural-v1`, and
`producer.name` is `pheon`. Structure, equality rules, and producer version evolve
independently. Understand the profile before interpreting equality. Consumers
should tolerate additional optional fields and unknown codes/rules without

View file

@ -23,7 +23,7 @@ byte. Input and annotation validation finish before the output is created.
## Annotation format
A text label whose exact string is `KLAMATH_LAYER_NAMES_V1` identifies a carrier
A text label whose exact string is `PHEON_LAYER_NAMES_V1` identifies a carrier
pair in its cell. Every other text label on that pair in the same cell is a
mapping of the form:
@ -33,7 +33,7 @@ layer:datatype:name
For example, `1:0:WG` names pair `(1, 0)` as WG. Numbers are unsigned 16-bit
decimals. The name must be nonempty UTF-8 and may contain colons; only the first
two colons separate fields. The legacy marker remains part of the format.
two colons separate fields.
Mappings are collected across the library. Identical duplicates are accepted;
conflicting names for the same pair are errors. Recognized annotation labels

View file

@ -21,6 +21,16 @@ to load only those cells. Each range must span one complete cell. Readers return
`(remainder, StructArray)` on success. The selected reader returns the original
input as its remainder, since selection is random access.
Layout-review APIs live in `pheon::review`, with layer-name helpers in
`pheon::review::names` and scope/display selectors in `pheon::review::selection`.
`Comparison::between(&old, &new)` captures an owned result with revision metadata,
changes, and structured diagnostics. Use `outcome()` for completeness, equality,
and exit status. Its `text`, `json_report`, and `hierarchy` renderers work after
the source documents and byte buffers are dropped. Standalone hierarchy inspection
uses `Document::hierarchy`. Reference counts are captured with the result;
union-graph and ancestor analysis run only when a hierarchy is requested.
The `record`, `records`, and `basic` modules also provide low-level GDSII record
writing. There is no high-level writer for the Arrow layout. REAL8 writing is
exact for representable in-range `f64` values: magnitudes below `2^-260`
@ -29,7 +39,7 @@ underflow to zero; magnitudes at least `2^252` and nonfinite values are rejected
## C API
Build the shared library with `cargo build --release --locked`. The
[header](../pheon/_ffi.h) defines the functions and Arrow C Data structures.
[header](https://mpxd.net/code/jan/pheon/src/branch/master/pheon/_ffi.h) defines the functions and Arrow C Data structures.
The library is `libpheon.so`, `libpheon.dylib`, or `pheon.dll` on Linux, macOS,
or Windows respectively.