You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(export): pad the attributes a newer schema appended in the Rust converter (#3271) (#3273)
`convertStepLine` has padded the trailing optional attributes newer schemas
ADD since #1416 -- `PredefinedType` on IfcWall / IfcBeam / IfcOpeningElement,
IfcMaterial's Description and Category, 61 more. Its Rust port never got the
fix, and the Rust port is what `exportStep` runs, so
`ifc-lite export --format step --schema IFC4` on an IFC2X3 source wrote
entities a positional attribute short -- invalid under the FILE_SCHEMA it
declares, which is what #1416 was reported for.
The tables were not the problem: the three entity-rename maps and the IFC2X3
attribute-count map diff byte-for-byte against their TypeScript twins over all
3 + 23 + 36 + 30 entries. The missing piece is the algorithm.
Padding is only safe where the source schema's positional attribute NAME list
is a strict PREFIX of the target's. IfcMaterialProperties goes from [Material]
to [Name, Description, Properties, Material]; a trailing `$` there shoves the
material reference into the Name slot. Rust has no per-schema attribute table
to test that against -- the generated `IfcType` is IFC4X3 alone -- so
`schema_pad` carries the strict-prefix pairs derived from the same generated
buildingSMART tables the TypeScript side reads at run time.
Neither half is trusted to have stayed in step with the other. Both now run
their own converter over one shared fixture
(`rust/export/tests/fixtures/schema_upconvert_sweep.json`), following the
`rooted_type_parity.rs` precedent. WHICH rows that fixture must hold is
re-derived from `schema_pad`'s own tables rather than floored by a count: a
count survives dropping the rows that matter, and stays silent on a type added
to the tables with no row to pin it. A negative control covers the direction
the positive rows cannot -- deleting the strict-prefix restriction and padding
every short line passes all 134 padded rows and fails
`a_reordered_attribute_list_is_never_padded`.
`schema_convert.rs`'s inline test module moves to `schema_convert_tests.rs`
via the `#[path]` convention (`schema_helpers.rs`, `georef.rs`) so the module
stays under the 400-line ratchet.
Refs #3271
Pad the attributes a newer schema appended when the Rust STEP converter upgrades a file.
6
+
7
+
`convertStepLine` in `packages/export` has padded the trailing optional attributes newer schemas ADD since #1416 — `PredefinedType` on `IfcWall` / `IfcBeam` / `IfcOpeningElement`, `IfcMaterial`'s `Description` and `Category`, and 61 more. Its Rust port never got the fix, and the Rust port is what `exportStep` runs, so `ifc-lite export --format step --schema IFC4` on an IFC2X3 source wrote entities one or more positional attributes short. That is an invalid IFC4 file, and strict readers reject it. Verbatim, before:
Padding applies only where the source schema's positional attribute NAME list is a strict PREFIX of the target's — the same restriction the TypeScript half enforces at run time. Entities that reorder or insert mid-list (`IfcMaterialProperties` goes from `[Material]` to `[Name, Description, Properties, Material]`) are left untouched, because a trailing `$` there would shove existing values into the wrong and type-invalid slots.
20
+
21
+
The two implementations are now pinned to one shared fixture, `rust/export/tests/fixtures/schema_upconvert_sweep.json`, whose rows are derived from the generated buildingSMART attribute tables and which NAMES every padded type rather than counting them — a count floor stays silent exactly when a row is dropped.
0 commit comments