Repository navigation
ci(measure): add IfcOpenShell's EXPRESS rule check to each export's schema report - #1106
Merged
Merged
Conversation
…chema report IfcOpenShell's default validation finds nothing on any of Measure's 89 exports, so it tells no export from another (2026-10-29 practitioner sweep). schema.txt gains a rules: section from its check of the IFC4 schema's WHERE and global rules (ifcopenshell.express.rule_executor), the findings counted by kind. It reports and gates nothing. The rule executor imports pytest's assertion rewriter, so the hashed requirements gain pytest; every existing pin is unchanged.
1 task done
DrunkOnJava
enabled auto-merge (squash)
October 29, 2026 21:08
DrunkOnJava
added a commit
that referenced
this pull request
Oct 29, 2026
…ing IFC4's CorrectChangeAction rule (#1107) ## Summary Every rvt-rs export wrote `IFCOWNERHISTORY(...,$,.ADDED.,$,#user,#app,<time>)`: `ChangeAction` `.ADDED.` with no `LastModifiedDate`. IFC4's WHERE rule `IfcOwnerHistory.CorrectChangeAction` allows a change action without a last-modified date only when it is `NOTDEFINED` or `NOCHANGE`, and IfcOpenShell's EXPRESS rule check (#1106) reported it on every export it read. Revit's exports (Core Interior, RE1, puzzbobb's 2025 models) all write `.NOCHANGE.` with no last-modifying user or application, so rvt-rs now writes `IFCOWNERHISTORY(#user,#app,$,.NOCHANGE.,$,$,$,<time>)`. ## Changes - `src/ifc/step_writer.rs`: the one line. - `tests/fixtures/synthetic-project.ifc`, `synthetic-structural.ifc`: the same line, as `DUMP_IFC` would regenerate it. - `changelog.d/fixed/owner-history-change-action.md`. ## Testing Unit tests are banned in this repository: do not add them. - [x] Measure run 40954452674 with #1106's rules pass on this head (Core Interior, Einhoven, RE1 Architecture, R2025 01 and 13): results in a comment. Every export's bytes move by this line; entity counts do not. No change to what is exported.
DrunkOnJava
added a commit
that referenced
this pull request
Nov 5, 2026
…types, material associations (#1430) (#1432) ## Summary Brings the EXPRESS WHERE-rule findings Measure reports (#1106) to zero in the default export by fixing the three kinds of finding at the writer, keeps Revit's way of breaking one of them behind `rvt-ifc --revit-set-placement`, makes everything that lists a material follow the default export, and adds a CI gate so a finding cannot come back on a model CI holds. ## Motivation #1430. IfcOpenShell's default validation finds none of these, which is why no gate caught them. Findings on main, from Measure run 41988011289 (`rules:` section of each model's `schema.txt`): | Rule | Where | What was written | |---|---|---| | `IfcShapeRepresentation.CorrectItemsForType` | `rst_basic` 2024 (14), `rac_advanced` 2024 (2), Snowdon structural 2024 (10); #1426 carries it to 2026 and 2027 | an `IfcFixedReferenceSweptAreaSolid` (the sloped beam's body) under `SweptSolid` | | `CorrectPredefinedType` on `IfcAirTerminalType`, `IfcElectricApplianceType`, `IfcSpaceType` | BIM4LCA office as built and at permit, 1 each | `PredefinedType` `USERDEFINED` with no `ElementType` | | `IfcRelAssociatesMaterial.AllowedElements` | the same two files and both terrain files, 1 each | a material associated with an `IfcSpace` (the `Turning Free Space` instances: 42 on each office file, 2 on each terrain file) | ## Decision (Griffin, 2026-11-05, through the question tool: "Valid IFC4, Revit's behind flag") Revit's own office export breaks the second and third rules the same way. Measured with this check (IfcOpenShell 0.9.0.post1) on the BIM4LCA As-Built Revit IFC: 1,194 findings, among them `IfcAirTerminalType`, `IfcElectricApplianceType`, `IfcFurnitureType` and `IfcBuildingElementProxyType` with `USERDEFINED` and `ElementType` `$`, and on the terrain-concrete Revit IFC a material associated with 2 `IfcSpace` and 1 `IfcSpaceType`. So the default export is valid IFC4, and Revit's behaviour is behind the flag, the same split as the property sets (RE-235): - Default: a `USERDEFINED` type object writes its own name as `ElementType` (kept either way, per the decision) and an `IfcSpace` has no material association. - `rvt-ifc --revit-set-placement` (and the MCP server's `revit_set_placement`) keeps the material association Revit's export writes on an `IfcSpace`. **That output breaks `IfcRelAssociatesMaterial.AllowedElements`, as Revit's own export does** (42 spaces on each office file, 2 on each terrain file); the CLI help, `docs/supported-profile.md`, `docs/status.md`, `docs/validation-evidence.md`, `docs/evidence.md` and the fragment say so. The CI gate and Measure's `rules:` section read the default output. - `PredefinedType` stays `USERDEFINED` (type GlobalIds hash it); `ElementType` is a value Revit's export leaves `$`. - The sloped beam stays a fixed-reference sweep under `AdvancedSweptSolid`. Revit draws a beam as an `IfcExtrudedAreaSolid` under `SweptSolid` (checked on the 8 beams of one held-out model: counts only); redrawing it is a geometry change left out of this PR. ## Changes First commits (c4b6e86, dab7621): - `src/ifc/step_writer.rs`: `SolidShape::SweptPath` under `AdvancedSweptSolid`; a body of several solids takes the one `RepresentationType` IFC4 takes for all its items (`shared_representation_type`); a `USERDEFINED` type object writes its name in `ElementType`; `IfcSpace` material associations are left out by `write_step_with_options` and `write_step_to` and kept by the new `write_step_with_space_materials` and `write_step_to_with_space_materials` (additive entry points: `StepOptions` is unchanged, so no struct literal and no semver surface breaks). - `src/bin/rvt_ifc.rs`, `rvt-mcp/src/exports.rs`: `--revit-set-placement` / `revit_set_placement` pick the entry point. `rvt-mcp/src/args.rs` changes that option's description in the MCP contract, which the watcher's commit 00bd7dd carries into `docs/mcp-tools.json` and `.md`. - `tools/ci/ifc_validate_summary.py --gate FILE...`; the CI step; `tools/ci/scrub-holdout-results.sh` keeps `schema validate:` / `schema rules:` counts for held-out models. This push answers the second read: 1. **Union.** A tessellated item in a union of solids broke `IfcBooleanResult.FirstOperandClosed` and `SecondOperandClosed` (the face set records `Closed` as `$`). It is now written as the faceted brep of the same triangles (`emit_solid_shape`'s `operand`; the top-level mix decides this from `solid_kind` before writing, the nested compound and the explicit `BooleanResult` operands always). Checked with IfcOpenShell on hand-written STEP files: the union with the face set as the second operand, and as the first, finds one finding each; the same union with the face set marked closed, or written as the faceted brep (either position), finds none; extruded and tessellated items under `CSG` find `CorrectItemsForType`, under `SurfaceOrSolidModel` none. No current producer builds such a union, so no current output changes. 2. **Consumers.** `step_writer::associates_material` is the one decision; the writer, the elements CSV (`schedule_csv`, so `rvt-schedule`, Python's `schedule_csv()` and the viewer's download), the viewer's info panel, schedule and material count (`scene_graph`) and the viewer's material highlight (`main.ts`) list no material for an `IfcSpace`. There is no CSV under `--revit-set-placement`: `rvt-ifc` writes none and `rvt-schedule` has no such flag, so no schedule keeps a space's material. Left alone: the glTF colours (`gltf.rs`), because a colour on a space's mesh is a drawing choice and not an association; the MCP server and `rvt-py` list no material of their own. 3. **Option docs.** `ExportOptions::revit_set_placement` now says it places properties only, that the space material half is the writer's two entry points, that library, Python and wasm callers of `write_step` get the default, and why the two are not one setting: a setting both read would be a field of `StepOptions` (a struct callers construct by literal, so a new field is a semver break) or of the model, which would also take the material from the glTF and the viewer. 4. **Docs.** `docs/evidence.md` (the `--revit-set-placement` row), `docs/support-matrix.json` (`ifc-type-objects` and `ifc-material-layer-sets` notes; there is no capability of the flag itself), the fragment and this body now state the rule-breaking behaviour and the measured flag-on result; the stale comment at the representation maps (`SweptSolid / CSG / Brep`) is fixed. 5. **`%` in a message.** `json_logger.log` does `message % args`, so a finding on an instance whose string holds a `%` raised and ended the check. `literal_logger` takes a message without arguments as written. Reproduced on a hand-written file (an `IfcSpaceType` named `50 % Space %d %s` and a second violating type): the old logger raised `TypeError` after 1 finding; `--gate` reports both and exits 1; `--both` (Measure's path) writes both findings to its rules file. 6. **Gate position.** The step runs after the witness steps, with `if: ${{ !cancelled() }}`, so a gate failure never skips the observation export a REPLAY_DRIFT fix needs; it also gates the two witness exports. It fails on a file an earlier failed step did not write, which is red already. The gate exits 1 on Revit's terrain export (52 findings) and, with all three kinds, on a hand-written file (`CorrectItemsForType`, `CorrectPredefinedType`, `AllowedElements`, plus `WR11` and `WR41` the stub file adds). The three kinds occur on none of Core Interior, Einhoven and the four RE1 projects, which read 0 on `main` (run 41994889680 base side), so the gate would have passed those on `main`; the tier-1 and synthetic exports were not checked on `main`. The gate is a tripwire for the next regression, not proof that CI's own files had the old findings. 7. **`USERDEFINED`.** An occurrence with `.USERDEFINED.` and no `ObjectType` read is written without a `PredefinedType` (the writer invents no value); an unnamed `USERDEFINED` type states an empty `ElementType`. Neither occurs on a measured model (the rules check reads 0 on all 90 models whose export it checks), so no measured byte should move; Measure below checks that. 8. **Scrub.** The awk stops at `property sets:`, and prints `schema rules: not read` when the `rules:` section has no `findings` line (a timed-out check), and `schema validate: not read` / `schema rules: not read` for `unreadable:`. Run against hostile `schema.txt` inputs (names and ids in finding messages, fake `findings 0` lines, a rules section cut off, an unreadable file, a validation skipped for size): only counts and `Entity Entity.Rule` names leave, in 7 of 7 cases. - `probes/examples/probe_1430_space_materials.rs`: counts the model's spaces with a material and the CSV's space rows that list one (expected 0), and the other rows that list one. ## Testing Unit tests are banned: nothing added. `cargo fmt --all -- --check`, `python3 -m py_compile`, `actionlint` and `tools/release/changelog.py check` pass locally; nothing was compiled or run locally (CI and Measure are the build). Measured: - Run 41994889680 (code head c4b6e86, default output, `base=main`, `nordic`, `r2025`, `holdout`, `samples`): `rules:` reads `findings 0` on the 90 models whose export it checks; the 18 held-out models report `schema rules: findings 0` as counts; 3 samples over the 30 MB the schema step reads are not measured, as before. - Run 42002548557 (head f3c87e4, same flags), read by the main session: 104 of 111 exports byte-identical, 7 move (the four office files and the 2024 `rac_advanced`, `rst_basic` and Snowdon structural); 0 rule findings on every model checked; the held-out counts at 0 on all 18; the MCP server's answers equal on 1,258 lines. CI's gate printed `findings 0` on 13 files in 48 s on the CI run at f3c87e4. - Run 42002553349 (head f3c87e4, `ifc_flags=--revit-set-placement`, the two office files, `base=main`, `schema`, `psets_vs_ifc`, `element_materials_vs_ifc`): the rules check reads `findings 1` on each office file at the head (`IfcRelAssociatesMaterial.AllowedElements`, 42 spaces in its message) and `findings 4` at `main`; the property set and material outputs are the same at both. **This is the one flag-on export whose `rules:` section reads non-zero, and it is expected.** - `ifc.sha256`, `element_materials_vs_ifc` and every other output apart from `schema.txt` and `ifc.sha256` are the same at the two sides of run 41994889680 (diagnostics, timings, logs and MCP dump apart). Pending, on the head of this push (f5895a9): Measure run 42010709009, filtered, `base=main`, `nordic`, `samples` with `sample_years="2024 2024"`, `models="nordic-office-* core-interior re1-architecture"`, `scorers=schema`, `probe=probe_1430_space_materials`. `models` does not reach the samples, so the run has all 10 of the 2024 samples (the 3 that moved and 7 that did not; 3 of them skip the schema step for size and are still hashed), the four office files, Core Interior and RE1 Architecture. Its `ifc.sha256` should equal run 42002548557's head side on all of them (the 7 that moved at their moved bytes, the rest unchanged), which is what confirms the union, `USERDEFINED` occurrence and consumer changes move no export byte; for the `USERDEFINED` occurrence rule that means this: the 42 `Turning Free Space` spaces keep `.USERDEFINED.` because their `ObjectType` is `Family:Type` (the tagged-space scorer reads `ObjectType` equal on all 44), so only an occurrence with no `ObjectType` loses its `PredefinedType`, and the rules check reads 0 on every model where one would have shown. The probe prints, per model, the spaces the model holds a material for and the CSV's space rows that list one (expected 0); `main` has no such probe, so the base side skips it and shows no before count. Not measured at all: the elements CSV in the viewer's download; the viewer's panels and highlight (no browser run); the gate on the head of this push (it now reads 15 files, the 13 of the earlier shape and the two witness exports, so the 48 s above is for the old step shape); the 2026 and 2027 sample exports that #1426 will give their findings; and that the Rust and TypeScript of this push compile, which only CI says. **Final unfiltered Measure on this head, run 42010834977 (f5895a9, `base=main`, `nordic`, `r2025`, `holdout`, `samples`), read by the maintainer:** 104 of 111 exports are identical to main. The 7 that move are the four office files and the 2024 `rac_advanced`, `rst_basic` and Snowdon structural. The scorer diff is `schema.txt` on those 7 only. The `rules:` section reads `findings 0` on all 90 models it checks and on all 18 held-out models (counts). MCP consistency: 0 differ on 629 lines. The semantic check on this commit reads `pass: no semantic difference in 34 models`. It compares sampled dumps, and the space materials this PR removes are not in them, so that pass says nothing about those materials: the rules check and the file comparison do. Not measured: the 3 samples over the schema step's 30 MB cap, as before, and the viewer's panels in a browser. ## Audit-honesty checklist - Changelog fragment: `changelog.d/fixed/1430-express-rules.md`, with the figures read from the runs above and what is not measured. - New limitation: spaces carry no material in the default IFC, the elements CSV and the viewer's panels where Revit's export associates one; `--revit-set-placement` writes it into the IFC and then breaks `AllowedElements`. ## Breaking changes None. Two public functions are added to `ifc::step_writer`. The IFC text moves in three places only: `RepresentationType` of a sloped beam's body, `ElementType` of `USERDEFINED` type objects, and the material associations on `IfcSpace` (default output). The elements CSV's `material` cell is empty on `IFCSPACE` rows. ## Related issues Refs #1430
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
IfcOpenShell's default validation reports nothing on any of Measure's 89 exports (2026-10-29 practitioner sweep, baseline run 40927543524), so it tells no export from another. Each model's
schema.txtnow also has arules:section: IfcOpenShell's check of the IFC4 schema's WHERE and global rules (ifcopenshell.express.rule_executor), with the findings counted by kind, instance numbers replaced by#, most frequent first. It reports; it gates nothing (Measure's compare job diffs it between base and head like the rest ofschema.txt).The rule executor imports pytest's assertion rewriter (
from _pytest import assertion), sotools/ci/requirements-ifc.ingainspytestand the hashed lock adds pytest 9.2.0 and its dependencies. Every existing pin, IfcOpenShell's included, is unchanged.First result
Measure run 40953734973 (main ed337dd, Core Interior, Einhoven, RE1 Architecture, R2025 01 and 13): one finding on each,
IfcOwnerHistory.CorrectChangeAction: rvt-rs writesChangeAction.ADDED.with noLastModifiedDate, which the rule forbids. Revit's own exports write.NOCHANGE.. Fixed in #1107.Testing