Skip to content

fix(ifc): an export holding a number that is not finite is refused, not written as NaN or inf - #1559

Merged
DrunkOnJava merged 3 commits into
mainfrom
fix/step-writer-refuses-non-finite
Nov 9, 2026
Merged

DrunkOnJava merged 3 commits into
mainfrom
fix/step-writer-refuses-non-finite

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

Summary

The STEP writer formatted every REAL with {:.6}, so a non-finite f64 came out as NaN, inf or -inf. ISO 10303-21's REAL has no such form, and IfcOpenShell refuses the file. The streaming writer now refuses such a model: write_step_to and write_step_to_with_space_materials return an InvalidData error naming the first entity that holds one.

Every user-facing path goes through it:

  • rvt-ifc's streaming path, which already removes its .partial file on error and writes nothing.
  • rvt-ifc's --observation path, which used the text-returning writer.
  • The Python write_ifc.
  • The viewer's modelToIfcStep, whose model comes from JavaScript, where a NaN is easy to make.

The text-returning write_step functions keep their signatures, and their docs now say they write what they are given. Changing them to return Result would break the stable API.

The fuzz target no longer turns every NaN and infinity into 0.0 before the writer sees it (sanitize_float), so it now exercises this path. It accepts the refusal as an outcome. The target's own doc already listed NaN mishandling as a bug it hunts, and it could not find one.

No Revit file is known to carry a non-finite number this far: the decoders check finiteness in many places, and native graph values are JSON numbers, which cannot hold NaN. This is a check in depth, found by the second read's writer audit.

Testing

Unit tests are banned here apart from a few on a pure helper. holds_non_finite, the check on an entity's attribute list, reads no file, so it has seven failure-first tests in src/ifc/step_writer.rs, which CI's cargo test --profile ci --lib runs:

  • NaN, inf and -inf as attributes and inside a typed value
  • a last token with no delimiter after it
  • NaN and inf inside names, and a doubled quote
  • enumerations such as .INFORMATION. and finite numbers

Measure run 42547854549 (this head against main, every sample year, the office and R2025, scorers=none) checks that no export of a finite model moves: 92 of 92 ifc.sha256 are equal to main's.

@DrunkOnJava
DrunkOnJava marked this pull request as ready for review November 9, 2026 02:35
@DrunkOnJava
DrunkOnJava enabled auto-merge (squash) November 9, 2026 02:56
@DrunkOnJava
DrunkOnJava merged commit a036fed into main Nov 9, 2026
37 checks passed
@DrunkOnJava
DrunkOnJava deleted the fix/step-writer-refuses-non-finite branch November 9, 2026 02:57
@DrunkOnJava DrunkOnJava mentioned this pull request Nov 9, 2026
3 tasks done
DrunkOnJava added a commit that referenced this pull request Nov 9, 2026
## Summary

Release 0.16.0:
- Revit 2015 to 2023 projects: beams along their location lines (#1509,
RE-362), walls joined by their join lists and angled walls along their
lines (#1517, RE-364), `Phase Created` (#1521, RE-368), `Constraints`
Level parameters (#1522, RE-369), pipes with their type, cylinder and
ports (#1523, RE-370), and Revit 2015 files following the export phase
(#1332, RE-372).
- Revit 2026 and 2027 projects: beams, stair runs, tread landings and
sketch outlines (#1426, RE-341), and pipes, ports, door and window cuts
and the 2025 properties (#1454, RE-346). Revit 2025 beams, tread
landings and sketch arcs (#1440, RE-345); shaft cuts on 2024 only.
- Spaces: Areas of Revit 2025 to 2027 (#1428), `rac_advanced`'s Areas
from Revit's plan topology (#1261, #1434), `SpaceKind` on every
`IfcSpace` (#1437), and the room phase fallback (#1359).
- Doors and windows: Revit's placement axes (#1447, RE-347), a door in
no wall at its stored origin (#1494, RE-361), and both flips decoded
(#1357, RE-343).
- Values Revit's export writes: wall-cut openings (#1165, RE-338),
`FireRating` and `Manufacturer` (#1185, RE-354), cut column quantities
(#1203, RE-353), Furniture Systems (#1444, RE-352), and a plumbing
fixture that draws nothing left out (#1496, RE-363).
- Walls: hosts of embedded curtain walls from their saved mesh (#1385,
RE-340), profile-edited ends, bases and cut-outs (#1396, #1410, #1411,
#1473), previous location lines (#1475, RE-360), and floor voids tagged
as Revit tags them (#1408, RE-355).
- The writer: IFC4 EXPRESS rules held (#1430), non-finite numbers
refused (#1559); the diagnostics, elements CSV, viewer panels and MCP
server count and place what the IFC writes (#1327, #1417, #1422, #1424);
export memory restored (#1429).
- The viewer's saved parameters panel (#35, RE-207); the provenance
table's new sources (#1368, #1498); the native readers' speed-ups
(#1335); release tag preflight and attested wheels (#1457, #1466);
measured numbers named by model (#1192); Measure's semantic diff
(#1334).

## Changes

- Version 0.15.0 -> 0.16.0 in:
  - Cargo.toml;
  - rvt-py/Cargo.toml and its `=` pin;
  - rvt-mcp/Cargo.toml and its `=` pin;
  - rvt-wasm/Cargo.toml;
  - tools/stream_evidence/Cargo.toml;
  - viewer/package.json;
  - CITATION.cff (version and date);
  - Cargo.lock and fuzz/Cargo.lock.
- `python3 tools/release/changelog.py assemble`: 56 fragments go into
`[0.16.0]`, with an introduction, a "Not measured" paragraph, credits
and "Upgrading from 0.15".
- README: the latest release and the "Upgrading from" pointer.

## Testing

- **Measure 42555357168**, `main` at 9c66e9b against v0.15.0,
unfiltered with timing: the reference models, the BIM4LCA office, Revit
2025, Autodesk's samples of every release, the held-out models,
`rac_advanced`'s IFC2X3 pairs and BIMcollab, 118 exports (no families).
Every figure in the "Measured against 0.15.0" paragraph is from it:
  - 97 exports move and 21 do not;
- no property value or quantity goes from equal to different or missing
on any model;
  - the IFC4 rules check finds nothing on all 118;
  - the `same-project gates` check passes on 9c66e9b;
- time is 1.015 in total over 68 files, and peak memory 0.54 to 1.29
times 0.15.0's.
- Since 9c66e9b this branch adds only the version strings, the
changelog and the witness and fixture refresh.
- `python3 tools/ci/release_preflight.py check --event workflow_dispatch
--ref-type branch --ref-name checkout --sha HEAD` reads version 0.16.0
in every file. `changelog.py check` finds no fragment left, and
`measured_numbers.py` and `api-doc-ids.py` pass.
- **Witness and fixtures** come from this pull request's CI run
42555924918, on 4dac3e6.
- The changes are `witness_version`, the two verdict hashes and the
fixtures' version strings.
- Both rvt-rs observations also gain RE-354's one diagnostic note ("1
type text parameter(s) ... left out"), which the committed observations
had missed since #1185.
- Both verdicts replay PASS locally with CI's arguments, byte-identical
to the committed ones.
- **Release review** (rvtReview's second read) blocked on two
overclaims, and both are fixed:
- `IsExternal` on 2026 and 2027 walls, curtain walls, members and
plates;
  - the same-project check's reach.
It found two dropped caveats, also fixed: the beam rule's reach (#1514)
and #1489's two doors. Its two minor points were fixed too: the
non-finite refusal's scope and the wall-hosted origin.
- Checking the run myself added three corrections: the held-out pipe,
wall and beam counts on 2015 to 2023 (the notes had said none was
scored), Vitoria's 44 `InvertElevation` values counted apart, and the
pipe entry's matching claim.

## Audit-honesty checklist

- [x] The introduction keeps each entry's caveats and adds a "Not
measured" paragraph: the 2015 to 2023, 2026 and 2027 readers held to the
same project's other save, and 2015 to 2023 scored on held-out projects
only, as counts; the 2025 to 2027 and Snowdon Towers Areas checked
against no Revit export; the one-project Furniture Systems and wall end
order; the office-only thresholds; the door origin; the release workflow
checks first run by this tag.
- [x] No emojis, private paths or internal jargon.

## Legal and contribution hygiene

- [x] Apache-2.0; no Autodesk proprietary source, decompiled internals
or NDA'd SDK content.

## Breaking changes

Behaviour changes are listed under "Upgrading from 0.15": the
diagnostics' `building_elements` and `by_ifc_type` count only written
elements, door and window placements and their rotations move, Furniture
Systems change class, a space has no material association by default,
the room schedule gains a column, and a non-finite export is refused.
The stable API's changes are additions; `semver checks` in this pull
request's CI reports on them.

## Related issues

Refs #1190, #869, #1165, #1185, #1203, #1261, #1194, #1332, #1334,
#1335, #1357, #1359, #1368, #1385, #1396, #1408, #1410, #1411, #1417,
#1422, #1424, #1429, #1430, #1437, #1440, #1444, #1445, #1447, #1457,
#1465, #1466, #1473, #1475, #1492, #1494, #1496, #1498, #1559, #35,
#155, #156, #1158, #1192.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant