Skip to content

fix(ifc): write IfcBoolean as .T. / .F. - #312

Merged
DrunkOnJava merged 1 commit into
mainfrom
fix/step-boolean-literal
Sep 23, 2026
Merged

DrunkOnJava merged 1 commit into
mainfrom
fix/step-boolean-literal

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Sep 23, 2026 •

Copy link
Copy Markdown
Owner

Summary

PropertyValue::Boolean wrote IFCBOOLEAN(.T) / IFCBOOLEAN(.F), missing the closing dot of an ISO 10303-21 enumeration. Every export with a boolean property was invalid IFC. It now writes .T. / .F., and CI validates real-project exports in full so this class of defect can't hide again.

Motivation

Running python -m ifcopenshell.validate on real exports turned up exactly one kind of error, An enumeration literal '' is not expected, on every IfcBoolean:

export errors before after
Revit_IFC5_Einhoven (ThicknessResolved) 24 0
2024_Core_Interior (ProfileResolved, LevelBindResolved, …) 2,400 0
RE1 Mechanical 96 0
Snowdon Towers Architectural (local) 9,349 0

The unit test pinned the malformed form. The IfcOpenShell CI job validates only the committed synthetic fixtures, which carry no boolean, and the real-project step only counted entities. The project's own blog post (docs/blog/2026-04-ifc4-exporter.md) documents the correct IFCBOOLEAN(.T.).

Changes

  • src/ifc/entities.rs: the enumeration's closing dot, and the unit test.
  • .github/workflows/ci.yml ("IfcOpenShell validates synthetic project"): a new step exports Core Interior and runs ifcopenshell.validate plus tools/ci/ifc_schema_arity.py on it and on the Einhoven export. Both report no issue with this fix; validation of Core takes about 1.5 s.
  • CHANGELOG.

Testing

  • cargo test --lib entities
  • ifcopenshell.validate (0.8.5) on the Einhoven and Core Interior exports: "No validation issues found"
  • tools/ci/ifc_schema_arity.py on both: passes (593 and 26,438 instances)

Breaking changes

None for readers that parse STEP correctly. A tool that matched the malformed .F) text would need to match .F.).

Related issues

None.


Note

Low Risk
Narrow writer formatting fix plus stronger CI validation; only consumers that matched the malformed .F) literal would need to accept .F.).

Overview
Boolean property values in IFC exports are now valid STEP. PropertyValue::Boolean previously wrote IFCBOOLEAN(.T) / IFCBOOLEAN(.F), omitting the closing dot required by ISO 10303-21 enumerations, so every export with boolean properties failed IfcOpenShell validation. Emission is corrected to IFCBOOLEAN(.T.) / IFCBOOLEAN(.F.), with unit tests and comments updated to match.

CI now full-schema-checks real exports that actually carry booleans. Synthetic fixtures have no IfcBoolean, so the defect only showed up on large real projects (e.g. thousands of flags on Core Interior). The IfcOpenShell job adds a step that exports 2024_Core_Interior, runs python -m ifcopenshell.validate on both Einhoven and Core Interior outputs, and runs ifc_schema_arity.py on those files. CHANGELOG records the fix.

Reviewed by Cursor Bugbot for commit bf550e2. Configure here.

PropertyValue::Boolean rendered IFCBOOLEAN(.T) and IFCBOOLEAN(.F),
missing the closing dot of an ISO 10303-21 enumeration, and its unit
test pinned the malformed form. Every export with a boolean property was
invalid IFC: IfcOpenShell's validator reported 2,400 errors on the Core
Interior export, 9,349 on Snowdon, and nothing else.

The committed fixtures carry no IfcBoolean, so the IfcOpenShell CI job
never saw one. It now also runs ifcopenshell.validate and the schema
arity check on the Einhoven and Core Interior exports; both report no
issue with this fix.
@cursor

cursor Bot commented Sep 23, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_47847ab8-812e-481e-9c56-a208fd1cb9f9)

@DrunkOnJava
DrunkOnJava merged commit 03b080e into main Sep 23, 2026
23 checks passed
@DrunkOnJava
DrunkOnJava deleted the fix/step-boolean-literal branch September 23, 2026 02:30
DrunkOnJava added a commit that referenced this pull request Sep 23, 2026
… (RE-34) (#313)

## Summary

Records in the second element-record prologue (RE-30) now get their
ElementId from the reference list and the frame order. The id is taken
only when the ordering forces it. Hidden-id hold-outs on five files make
**no wrong pick**, and Autodesk's Snowdon Towers architectural sample
goes from **80 exported elements to 4,245**.

## Motivation

On Snowdon (and on parts of the RE1 MEP models) most records carry no
ElementId at `+0x00`, so the fail-closed decode dropped them. RE-30
found the id is one slot of the record's reference list (§7) and that
records sit in ascending ElementId order (§8). The one-sided chain it
tried made 32 wrong picks, so nothing shipped (#295). Full report:
`reports/element-framing/RE-34-second-prologue-element-ids.md`.

## The rule

- For each partition: first-prologue records are fixed at their `+0x00`
id. A second-prologue placed instance (no container, placement
`0xffffef7f`, RE-33) may take any declared id in its reference list
after the leading slot.
- The longest strictly rising chain is found **twice**, with ties
resolved toward smaller and toward larger ids. A record gets an id only
when **both agree**.
- Ids named by ≥ 56 records across the file (Levels, types) are never
candidates.
- Floors, building pads and ceilings never get an id, because their list
names their sketch at id − 1 (Snowdon floor 1423899 next to sketch
1423898).

## Measurements

Hold-outs (every `+0x00` id hidden, then scored):

| file | correct | wrong |
|---|---:|---:|
| 2024_Core_Interior | 3,458 | **0** |
| Snowdon Towers Architectural (first-prologue records) | 445 | **0** |
| RE1 Architecture / Mechanical / Plumbing | 41 / 7 / 36 | **0** |

Zero wrong holds for context thresholds 48 to 64 (56 is the middle of
that band). Without the filter, the Core hold-out made 6 wrong picks,
each a Level or type id named by 66 to 260 records; no true own id is
named by more than 34.

End to end against Revit's exports, by `Tag`:

| file | exported before | after | not in Revit's export |
|---|---:|---:|---:|
| Snowdon Architectural (local) | 80 | 4,245 | 115 |
| Snowdon Structural (local) | 26 | 60 | — |
| RE1 Mechanical | 33 | 48 | 0 |
| RE1 Plumbing | 9 | 39 | 0 |
| RE1 Architecture / Core Interior | unchanged | unchanged | 0 |

The 115 on Snowdon were checked one by one. They are 45
specialty-equipment items, 47 panels and 15 fixtures whose reference
lists hold no exported element of that type, 7 bleacher-seating walls,
and the #309 slab. All are real elements Revit's exporter leaves out,
the same limitation the first-prologue path already has (#309), and none
is a wrong id for an exported element. Each carries an
`element_id_from_reference_order` provenance warning.

Readiness on Snowdon rises from 36% to 91%, and the unattributed count
drops from 4,886 to 684. Core Interior's IFC body is byte-identical and
its export time unchanged (2.75 s).

## Changes

- `src/partition_element_records.rs`:
- `framed_elements`, `context_element_ids` and
`assign_second_prologue_ids` (the double chain) with
`longest_rising_chain`;
- `compute_second_prologue_ids`, `decode_frame_as` and
`find_category_records_assigned`;
  - `SECOND_PROLOGUE_CONTEXT_REFERENCES` and `SKETCH_OWNING_CATEGORIES`;
  - the `PartitionElementRecord::id_from_reference_order` field;
  - the sweeps and the unattributed count use the assignment.
- `src/reader.rs`: `RevitFile::second_prologue_ids` memo.
- `src/partition_schema_mvp.rs`: `m_id_from_reference_order` field and
provenance warning.
- `tests/second_prologue_ids.rs` (Core hold-out, zero wrong),
`examples/probe_re34_holdout.rs`, and `tests/element_records_2025.rs`
(the RE1 MEP recall pins).
- The report, a RE-30 §9 addendum, README, docs/status.md,
docs/export-diagnostics.md, docs/support-matrix.json (new
`element-records-second-prologue-ids`, partial; RE-33 row corrected),
and CHANGELOG. RE-33's "zero false positives on four files" now reads
correctly as holding for records carrying their id at `+0x00`.

## Testing

- [x] `tools/check-local.sh --corpus --viewer` and `npm run
test:browser`
- [x] `cargo +1.85.0 check --profile ci --all-targets` and `cargo
+nightly check --manifest-path fuzz/Cargo.toml`
- [x] Browser viewer (ad hoc Playwright run, not committed): Snowdon
Architectural (94.7 MB) loads in 18 s within wasm32 memory, showing
"Geometry · 91%", 10 storeys, 4,185 elements with geometry and
"Incomplete model · 684 model element records could not be exported",
with no page error. Native peak RSS for its export is 1.77 GB, against
0.52 GB for Core Interior.
- [x] Unit tests for the chain, the tie fail-closed case, non-instance
frames, and assigned records decoding and dropping out of the
unattributed count
- [x] IfcOpenShell 0.8.5 `validate` on the Snowdon Architectural (84,077
instances), RE1 Mechanical and RE1 Plumbing exports of this branch
(rebased on #312): no validation issues. `tools/ci/ifc_schema_arity.py`
passes on them too.

## Audit-honesty checklist

- [x] The 115 Snowdon elements Revit omits are stated everywhere the
recall is, and the RE-33 claim is narrowed accordingly
- [x] The threshold is a measured band, not a proof; the report says
what lies outside it
- [x] No emojis, private paths or PII. Snowdon was measured locally and
is not committed.

## Legal and contribution hygiene

- [x] Apache-2.0; public byte observations and prior RE reports only
(`CLEANROOM.md`)

## Breaking changes

`PartitionElementRecord` gains `id_from_reference_order` (serde default
`false`). `element_record_without_element_id` counts fall on files with
second-prologue records, because assigned records are exported instead.

## Related issues

Refs #295 (resolved for all but sketch-owning categories), #309, #94,
#95.
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