Wr038 — Re-emitted file uses entity-numbering pattern that breaks round-trip equivalence

§12.13 writer-pathology (sub-class: instance numbering)

P3 — cosmetic / metadata-only

round-trip writer

Sources

Sender

Writers that insert a timestamp or random suffix into entity numbering

Description

A round-trip (read STEP → no-op → write STEP) produces a file that differs from the input not in geometry but in the choice of `#N` numbering; every export uses different numbers. This breaks regression tests that compare files for equivalence by hash. Bug-reporter language: "STEP files differ after no-op round-trip", "file hashes change every export", "diff is just renumbering".

Reproducer recipe

a file with deliberately non-canonical numbering (`#42, #17, #99, #1`) to demonstrate the post-pathology state.

Expected kernel behavior

Heal and accept: normalize / emit canonical, deterministic numbering on write so a no-op round-trip produces byte-identical output (modulo timestamp-bearing fields like FILE_NAME date).

Notes

Drift-detection test that flags this is the canonical CI signal. Provenance tier: writer-side (Q5 reclassification 2026-07-01).

Expected validation

occt=empty/empty gmsh=empty ifc=schema_n/a

Provenance tier

writer-side — defect not fully embodied in fixture bytes.

Byte assertions

Tier-3 assertions

Live oracle output

No live oracle data — run _run_corpus to populate.

Fixture content

Show fixture bytes (with defect highlighting)
1ISO-10303-21;
2/* Wr038: non-canonical entity numbering breaks round-trip equivalence */
3/* Entity numbers (#42, #17, #99, #1) are in non-sequential, non-canonical order */
4/* Writer assigned numbers in internal-representation visit order (unordered set) */
5/* Every export run produces different numbering — file hashes change with each write */
6/* A no-op round-trip (read then write) produces a byte-different file */
7HEADER;
8FILE_DESCRIPTION(('Wr038: non-canonical entity numbering'),'2;1');
9FILE_NAME('Wr038.stp','2026-06-17T00:00:00',(''),(''),'cad-research-suite','','');
10FILE_SCHEMA(('AUTOMOTIVE_DESIGN { 1 0 10303 214 3 1 1 }'));
11ENDSEC;
12DATA;
13/* DEFECT: entity numbers skip and reorder: #42, #17, #99, #1 — non-canonical */
14/* Canonical form would assign #1, #2, #3, #4 sequentially */
15#42=APPLICATION_CONTEXT('automotive_design');
16#17=CARTESIAN_POINT('origin',(0.,0.,0.));
17#99=CARTESIAN_POINT('corner',(1.,1.,1.));
18#1=GEOMETRIC_CURVE_SET('non-canonical-numbering-shape',(#17,#99));
19ENDSEC;
20END-ISO-10303-21;