Repository navigation
Lane Five: typed MVP decoders + ArcWall partition path + tier1 corpus tests - #127
Conversation
Curate Apache-2.0 synthetic fixtures under corpus/tier1/ with license and known-count sidecars for levels/walls/floors/doors/windows, extend project_count_fixtures for fixture_metric inventories, and wire corpus-tier1 (always-on) plus corpus-tier2 (external magnetar) CI jobs. Co-authored-by: DrunkOnJava <[email protected]>
Co-authored-by: DrunkOnJava <[email protected]>
…e link Add a version-gated (Revit 2023/2024) filtered-tag scanner that emits neutral PartitionRecordCandidate records, expresses the existing ArcWall path, and joins recovered ElementIds to Global/ElemTable offsets (M3-03 / M3-04). Includes JSON probe example and tier1/corpus tests. Co-authored-by: DrunkOnJava <[email protected]>
Satisfy clippy::collapsible_if under -D warnings. Co-authored-by: DrunkOnJava <[email protected]>
Harden Level/Wall/Floor/Door/Window/Room/Material wrong-schema rejection and empty-input behavior; add ArcWall typed partition decoder with class/tag rejection; expose decoder_for_class/decode_typed; add tier1 corpus tests that exercise fixture payloads without inventing geometry. Co-authored-by: DrunkOnJava <[email protected]>
Co-authored-by: DrunkOnJava <[email protected]>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Partition scan loop overruns buffer
- Changed the inclusive loop bound from
buf.len().saturating_sub(3)tosaturating_sub(4)so the final offset never reads pastbuf[len - 1].
- Changed the inclusive loop bound from
Or push these changes by commenting:
@cursor push 49fac44cec
Preview (49fac44cec)
diff --git a/src/partition_scanner.rs b/src/partition_scanner.rs
--- a/src/partition_scanner.rs
+++ b/src/partition_scanner.rs
@@ -231,7 +231,7 @@
}
let mut out = Vec::new();
- let last = buf.len().saturating_sub(3);
+ let last = buf.len().saturating_sub(4);
for offset in 0..=last {
let tag = u16::from_le_bytes([buf[offset], buf[offset + 1]]);
if !tags.contains(&tag) {You can send follow-ups to the cloud agent here.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit aae5b7f. Configure here.
| // RE-14.2 record-prefix filter: bytes at +2/+3 must be zero. | ||
| if buf[offset + 2] != 0 || buf[offset + 3] != 0 { | ||
| continue; | ||
| } |
There was a problem hiding this comment.
Partition scan loop overruns buffer
High Severity
scan_partition_buffer walks 0..=buf.len() - 3 and then reads four bytes at each offset. The last start index is one past the valid range, so the tag/filter_pad read indexes buf[len] and panics on every partition of length 4 or more.
Reviewed by Cursor Bugbot for commit aae5b7f. Configure here.
Co-authored-by: DrunkOnJava <[email protected]>
## Summary Implements Lane Nine (M7-02 / M7-03): expose the decoded-model Python API with Lane Five typed MVP projections, add stable JSON schemas for those payloads, and mirror the surface with a `rvt-elements` CLI. Depends on Lane Five (`elements/typed-decoders`, PR #127) — this branch is based on that work (includes Lanes Three–Five). ## Motivation Downstream automation and the viewer need one Python/CLI contract for production decoded elements, class counts, export diagnostics, and IFC write modes. Lane Five’s typed views must be reachable from Python without inventing geometry on scaffold fixtures. ## Changes - `RevitFile.decoded_elements()` — adds optional `typed` MVP projection (Level/Wall/Floor/Door/Window/Room/Material) - `RevitFile.element_counts()` / `export_diagnostics()` / `write_ifc(mode=...)` — documented + stubbed; modes remain `scaffold` | `typed-no-geometry` | `geometry` | `strict` - `rvt.MVP_TYPED_CLASSES` constant for introspection - `rvt-elements` CLI — JSON dump of elements or `--counts` (same schemas as Python) - Schemas: `docs/schemas/decoded-elements.schema.json`, `docs/schemas/element-counts.schema.json` - Always-on Python tests on `corpus/tier1/` (no Autodesk samples required) ### Mode honesty | Mode | Behavior today | |------|----------------| | `scaffold` | Accepts spec-valid IFC envelope (default) | | `typed-no-geometry` | Requires validated typed elements | | `geometry` | Requires typed + geometry | | `strict` | Geometry + metadata/units/storeys + no warnings | On synthetic / scaffold-only fixtures, only `scaffold` typically succeeds until Lane 7 geometry recovery lands. Stronger modes raise `ValueError` rather than over-claiming. ### Corpus honesty Tier1 `gen-fixture` CFBs are scaffold-oriented. Production walker counts may be zero; tests assert API shape, schema validity, and mode gating — not invented element recovery. ## Testing - [x] `cargo test --release --lib elements::typed_json` — 3 passed - [x] `cargo test --release --test json_schema_contracts` — 3 passed (tier1 elements + counts schemas) - [x] `maturin develop` + `pytest tests/python/test_decoded_api.py` — 5 passed, 1 skipped (`jsonschema` optional) - [x] `cargo clippy -p rvt --all-targets -- -D warnings` - [x] `cargo clippy -p rvt-py --all-targets -- -D warnings` - [x] `cargo fmt --check` (via fmt before push) - [ ] Corpus Autodesk sample pytest (`test_rvt.py`) — skips without `RVT_SAMPLES_DIR` ## Audit-honesty checklist - [x] Mode docs do not claim geometry/strict success on scaffold fixtures - [x] Typed projection omitted (`null`) for non-MVP classes; ArcWall stays partition-path - [x] No Autodesk samples committed; `*.so` not committed - [x] Commit messages describe what/why ## Legal and contribution hygiene - [x] Apache-2.0 licensable - [x] No Autodesk proprietary / decompiled content - [x] Fixtures remain synthetic (`gen-fixture` / tier1) ## Breaking changes None. `decoded_elements()` entries gain an additive `typed` key (`null` or object). ## Related issues Refs M7-02 / M7-03 (TODO.md). Depends on #127 (Lane Five typed decoders). ## Python API signatures ```python rvt.MVP_TYPED_CLASSES: list[str] RevitFile.decoded_elements() -> list[dict] # id, class_name, byte_range, fields, typed RevitFile.element_counts() -> {"total": int, "by_class": dict[str, int]} RevitFile.export_diagnostics() -> dict RevitFile.export_diagnostics_json() -> str RevitFile.write_ifc(mode: str = "scaffold") -> str rvt.rvt_to_ifc(path, mode="scaffold") -> str ``` <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Large additive public API (CLI, Python, JSON schemas) and new always-on CI corpus gates; no auth or payment paths, but regressions would break downstream automation contracts. > > **Overview** > Adds a unified **decoded-model export surface** for automation: new **`rvt-elements`** binary dumps production-walker elements or **`--counts`** JSON aligned with **`RevitFile.decoded_elements()`** / **`element_counts()`**, including an optional Lane Five **`typed`** MVP projection (`Level`, `Wall`, `Floor`, `Door`, `Window`, `Room`, `Material`) via **`typed_json`** and **`MVP_TYPED_CLASSES`**. Stable contracts land in **`decoded-elements.schema.json`** and **`element-counts.schema.json`**, with tier1-backed schema tests and always-on Python tests on **`corpus/tier1/`**. > > **Corpus & CI:** Commits redistributable synthetic **`corpus/tier1/`** fixtures (license SHA256 checks, **`generate.sh`**, count manifests) and wires **`corpus-tier1`** / **`corpus-tier2`** jobs; **`.gitignore`** now allows **`corpus/**/*.rvt`**. **`project_count_fixtures`** supports tier1 **`fixture_metric`** class-instance oracles. > > **Decoder / partition work bundled here:** Generic **`partition_scanner`** (2023/2024), **`elements::arc_wall`**, **`decode_typed`**, gen-fixture field aliases (`m_height` → elevation/height), and related integration tests. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 0a685c6. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Cursor Agent <[email protected]> Co-authored-by: DrunkOnJava <[email protected]>
…ons) (#129) ## Summary Implements Lane Six (geometry recovery) on top of Lane Five typed decoders: fail-closed APIs for wall location curves, floor boundary loops, door/window host relationships, and level elevations. Depends on Lane Five (`elements/typed-decoders`, PR #127) — this branch includes that work (plus Lane Four scanner / Lane Three corpus). ## Motivation Lane 7 (IFC export modes) needs structured geometry inputs from typed Wall/Floor/Door/Window/Level views. Synthetic tier1 fixtures remain scaffold-oriented; recovery must be honest (`None` + diagnostics) rather than inventing coordinates. Refs #30 (M4-02), #31 (M4-03), #32 (M4-04), #33 (M4-05). ## Changes - `src/geometry/` — split primitives into `mod.rs`; add `recovery.rs` Lane Six surface - `RecoveryOutcome<T>` / `GeometryDiagnostic` — recovered vs absent with stable codes - Wall location curves: schema start/end floats, unresolved curve-handle diagnostic, ArcWall partition centerline - Floor boundary loops: sketch/boundary vector → plan polyline (area/degenerate gates) - Door/Window hosts: typed `host_id` (reject missing / `0`) - Level elevations: typed `elevation_feet` / gen-fixture `m_height` - `Wall` typed view: `location_curve_id`, `location_start`, `location_end` - `tests/geometry_recovery.rs` — tier1 honesty (no invented curves/loops/hosts; Level elevations recover) ### Recovery honesty | Path | Synthetic tier1 | When data is present | |------|-----------------|----------------------| | Wall location curve | `Absent` (`wall_location_curve_missing`) | Schema endpoints or ArcWall start/end | | Floor boundary | `Absent` (`floor_boundary_missing`) | Sketch/boundary float vectors (≥3 verts, non-zero area) | | Door/Window host | `Absent` (no host_id on scaffold) | Non-zero `host_id` | | Level elevation | **Recovered** from `m_height` | `m_elevation` / `m_height` | Bare `location_curve` ElementId without endpoints → `wall_location_curve_unresolved_handle` (fail closed). ## Testing - [x] `cargo test --release --lib geometry::` — 24 passed - [x] `cargo test --release --lib elements::wall::tests::wall_projects_location` — passed - [x] `cargo test --release --test geometry_recovery` — 1 passed (all tier1 fixtures) - [x] `cargo clippy --all-targets --all-features -- -D warnings` - [x] `cargo fmt --check` - [x] New / changed code has unit tests - [ ] `cargo test --all` (full suite; filtered modules above green) - [ ] N/A: IFC exporter byte-identical (no IFC emit changes in this PR) ## Audit-honesty checklist - [x] PR body documents synthetic vs recoverable paths; no invented geometry - [x] Limitations documented in-module (`recovery.rs` honesty contract) - [x] Commit messages describe what/why - [x] No emojis; no private paths - [x] No Autodesk samples committed - [ ] README/status.md not updated in this PR (API is additive; Lane 7 will wire IFC) ## Legal and contribution hygiene - [x] Apache-2.0 licensable - [x] No Autodesk proprietary / decompiled content - [x] Fixtures remain synthetic (`gen-fixture` / corpus/tier1) ## Breaking changes None for callers of existing primitives. `src/geometry.rs` → `src/geometry/` module directory (same `rvt::geometry` path). ## Related issues Refs #30 #31 #32 #33 (M4 geometry). Depends on #127 (Lane Five). Downstream: Lane 7 IFC export modes. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Broad additive changes to parsing, geometry, and CI corpus paths; tier-two depends on external clones but tier-one is always-on and could break PRs if fixture bytes drift. > > **Overview** > Adds **Lane Six** geometry recovery in `geometry/recovery.rs`: fail-closed `RecoveryOutcome` APIs for wall location curves (schema endpoints, unresolved curve handles, ArcWall partition centerlines), floor boundary loops from sketch vectors, door/window hosts, and level elevations. **`Wall`** gains optional location-curve fields; **`Level`** accepts gen-fixture **`m_height`** as elevation. > > Ships **Lane Five** plumbing: `decoder_for_class` / `decode_typed`, **`MVP_TYPED_CLASSES`**, partition-byte **`ArcWall`** decoder (separate from the schema registry), and a **`partition_scanner_json`** example. > > Introduces **`partition_scanner`** (Revit 2023–2024 only): filtered-tag partition candidates, confidence scoring, ArcWall alignment, and ElemTable linkage helpers; **`elem_table::link_partition_element_ids`** wraps the join. > > Adds **redistributable tier-one corpus** under `corpus/tier1/` (synthetic `.rvt`, license/fixture sidecars, `generate.sh`), **`.gitignore`** exceptions, **`corpus-tier1` / `corpus-tier2`** CI jobs (magnetar LFS for tier 2), tier-one count manifests with **`fixture_metric`**, and integration tests (`corpus_tier1_health`, `corpus_tier2_health`, `typed_decoders`, `geometry_recovery`, `partition_scanner`). Dev-deps **`sha2`** / **`hex`** verify license SHA256 on committed fixtures. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 4dcb7c0. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Cursor Agent <[email protected]> Co-authored-by: DrunkOnJava <[email protected]>
## Summary Implements Lane Seven (IFC quality) on top of Lane Six geometry recovery: `scaffold` / `typed-no-geometry` / `geometry` / `strict` now shape *emission* as well as post-export validation gates, HostObjAttr proxies stay out of production export, and diagnostics sidecars remain schema-shaped. Depends on Lane Six (`geometry/wall-floor`, PR #129) which includes typed decoders (#127). Aligns with Lane Nine (#128) forward-compatible mode names that fail closed for stronger modes. ## Motivation Quality modes previously acted mainly as validation gates on a single default export. Lane 7 makes mode content real where data allows: typed-only inventory without geometry claims, geometry attachment via Lane Six recovery when present, and strict fail-closed behavior without misleading proxies. Refs M5-01 / M5-02 / M5-04 (TODO.md). Downstream: Lane 8 viewer confidence UI. ## Changes - `src/ifc/export_content.rs` — content policy per quality mode; HostObjAttr/HostObject/Element/Symbol filter; Level → storey via elevation recovery; Wall curve / Floor boundary / Door·Window host attachment; geometry strip helper - `RvtDocExporter::export_with_diagnostics_mode_and_limits` — mode-aware emission - `rvt-ifc --mode` + Python `write_ifc(mode=...)` pass mode into export content - Default/scaffold never emits `HostObjAttr-*` proxies (diagnostic exporter unchanged) - Diagnostics sidecar unchanged schema (`docs/schemas/export-diagnostics.schema.json`); docs note content policy - `tests/ifc_export_modes.rs` — always-on tier1 coverage for all four modes + CLI ### Mode semantics | Mode | Emission | Gate | |------|----------|------| | `scaffold` | Framework + production elements; geometry when recovered; no HostObjAttr proxies | Always accepts valid envelope | | `typed-no-geometry` | Mapped/typed only; geometry fields stripped | Requires typed elements | | `geometry` | Mapped/typed; Lane Six curves/loops/hosts/elevations when present | Requires typed + geometry | | `strict` | Same as geometry | Typed + geometry + metadata/units/storeys + no warnings/unsupported | On synthetic / tier1 fixtures only `scaffold` succeeds — honest scaffold-only, no invented geometry. ## Testing - [x] `cargo test --release --lib ifc::export_content` — 6 passed - [x] `cargo test --release --lib ifc::` — 325 passed - [x] `cargo test --release --test ifc_export_modes` — 8 passed - [x] `cargo test --release --test ifc_synthetic_* --test rvt_ifc_diagnostics_cli --test walker_to_ifc_integration` — passed (corpus tests skip without samples) - [x] `cargo fmt --check` - [x] `cargo clippy --all-targets --all-features -- -D warnings` - [x] `cargo clippy -p rvt-py --all-targets -- -D warnings` - [x] Smoke: `gen-fixture` + `rvt-ifc --mode scaffold|typed-no-geometry|geometry|strict` — HostObjAttr absent; stronger modes fail closed with diagnostics ## Audit-honesty checklist - [x] Tier1/synthetic remain scaffold-only; no invented wall/floor geometry - [x] HostObjAttr proxies absent from default/scaffold; diagnostic path retained - [x] Mode docs do not claim geometry/strict success on scaffold fixtures - [x] No Autodesk samples committed - [x] Commit messages describe what/why ## Legal and contribution hygiene - [x] Apache-2.0 licensable - [x] No Autodesk proprietary / decompiled content - [x] Fixtures remain synthetic (`gen-fixture` / corpus/tier1) ## Breaking changes None for callers of `RvtDocExporter::export` (still scaffold content). New `export_with_*_mode_*` APIs are additive. CLI/Python `--mode` / `mode=` now also shapes content (typed-no-geometry strips geometry). ## Related issues Refs #37 (M5-01), #38-class HostObjAttr (M5-02), #40 (M5-04). Depends on #129 (Lane Six). Aligns with #128 (Lane Nine mode names). <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > IFC export behavior changes for non-scaffold modes and production element filtering; broader surface area (partition scanner version gates, committed binaries) but synthetic corpus and fail-closed validation limit blast radius. > > **Overview** > Adds a **two-tier test corpus** (in-repo Apache-2.0 synthetic `corpus/tier1/` plus optional CI-cloned magnetar tier 2), CI jobs `corpus-tier1` / `corpus-tier2`, SHA256 license checks, and known-count manifests—while allowing committed `.rvt` files under `corpus/` via `.gitignore` exceptions. > > Introduces **partition scanning** (`partition_scanner`), a typed **ArcWall** partition decoder, ElemTable linkage helpers, and a `partition_scanner_json` example for JSON diagnostics. > > Adds **Lane Six geometry recovery** (`geometry/recovery`) with fail-closed wall curves, floor boundaries, opening hosts, and level elevations; extends typed **Wall** / **Level** projection for `gen-fixture` fields (`m_height`, location endpoints) and centralizes MVP typed decode via `decode_typed` / `decoder_for_class`. > > Implements **Lane Seven IFC content policy** in `export_content`: `--mode` / Python `mode=` now drives emission (not just validation)—`typed-no-geometry` strips geometry, `geometry`/`strict` attach recovery when present, production export drops **HostObjAttr** proxies, and Levels become storeys from recovered elevations. `RvtDocExporter::export_with_diagnostics_mode_and_limits` wires CLI/Python through to export. > > New integration tests cover tier1 corpus health, geometry honesty on synthetics, and all four IFC export modes (including CLI strict fail-closed on tier1). > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 6eac930. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Cursor Agent <[email protected]> Co-authored-by: DrunkOnJava <[email protected]>
## Summary Implements Lane Five (typed decoders / M3-05): harden schema-driven Level, Wall, Floor, Door, Window, Room, and Material decoders with wrong-schema rejection and empty-input tests; add a typed ArcWall partition decoder with class/tag rejection; wire `decoder_for_class` / `decode_typed`; add always-on tier1 corpus tests. Depends on Lane Four (`partitions/generic-scanner`, PR #126) — this branch is based on that work (includes Lane Three corpus). ## Motivation Downstream lanes (geometry, IFC, Python) need a stable typed decode surface that fails closed on schema mismatches and exercises redistributable tier1 fixtures without inventing geometry from scaffold CFBs. ## Changes - `src/elements/arc_wall.rs` — typed `ArcWall` view + `decode_at` / `decode_candidate` with wrong-schema / wrong-tag / short-buffer rejection (partition path; **not** added to the 80-entry `all_decoders` registry — wire format is envelope-based) - `src/elements/mod.rs` — `MVP_TYPED_CLASSES`, `decoder_for_class`, `decode_typed` - Hardened unit tests: Level/Wall/Floor/Door/Window/Room empty-input + Window/WallType/FloorType wrong-schema; Level/Wall accept gen-fixture `m_height` - `zones::Room` type alias for `Zone` - `tests/typed_decoders.rs` — registry cross-reject + tier1 payload decode + inventory known counts + no ArcWall-standard false positives on synthetics ### Rejection behavior | Path | Rule | |------|------| | Schema-driven MVP | `schema.name` must equal decoder class or `Error::BasicFileInfo(... wrong schema ...)` | | ArcWall partition | class_name if present must be `ArcWall`; `class_tag` must be `0x0191`; core envelope gates unchanged | ### Corpus honesty Tier1 `gen-fixture` CFBs are scaffold-oriented. Tests assert inventory known counts, successful field walks, Level/Wall `m_height` → typed height/elevation, and **zero** ArcWall-standard partition hits — not full Revit semantic recovery. ## Testing - [x] `cargo test --release --lib elements::` — 205 passed - [x] `cargo test --release --lib elements::arc_wall` — 7 passed - [x] `cargo test --release --test typed_decoders` — 3 passed (all three tier1 fixtures) - [x] `cargo clippy --all-targets --all-features -- -D warnings` - [x] `cargo fmt --check` - [x] New / changed code has unit tests - [ ] `cargo test --all` (full suite; filtered modules above green) - [x] Element decoder: empty tolerance, wrong-schema, happy-path present for MVP set - [ ] N/A: IFC exporter / bench ## Audit-honesty checklist - [x] ArcWall kept out of the 80-decoder registry (documented); docs count unchanged - [x] Tier1 tests do not claim typed geometry from synthetic fixtures - [x] Commit messages describe what/why - [x] No emojis; no private paths - [x] No Autodesk samples committed ## Legal and contribution hygiene - [x] Apache-2.0 licensable - [x] No Autodesk proprietary / decompiled content - [x] Fixtures remain synthetic (`gen-fixture`) ## Breaking changes None. ## Related issues Refs M3-05 (TODO.md). Depends on #126 (Lane Four scanner) / #125 (Lane Three corpus). Downstream: Lane 6 (geometry), Lane 7 (IFC), Lane 9 (Python) should merge from this branch. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Expands public decode and partition-scan APIs and adds always-on CI over committed fixtures; behavior is version-gated and tests emphasize fail-closed rejection, but regressions could affect downstream geometry/IFC lanes. > > **Overview** > Adds **Lane Five (M3-05)** typed decode surface: `MVP_TYPED_CLASSES`, `decoder_for_class`, and `decode_typed` fail closed on schema name mismatches; Level/Wall map gen-fixture `m_height` to elevation/height. **ArcWall** gets a partition-byte decoder (`decode_at` / `decode_candidate`) outside the schema-driven `all_decoders` registry, with class/tag rejection. > > Introduces **`partition_scanner`** (2023/2024 version guard, `PartitionRecordCandidate`, confidence scoring, ElemTable linkage helpers) plus `examples/partition_scanner_json` and `elem_table::link_partition_element_ids`. > > **Corpus / CI (Lane Three):** commits Apache-2.0 synthetic `corpus/tier1/` fixtures with license + recipe sidecars; `.gitignore` allows `corpus/**/*.rvt`; new `corpus-tier1` and `corpus-tier2` jobs; tier1 health tests (SHA256, open/schema/inventory) and tier1 project-count manifests with `fixture_metric` class-instance oracles. `project_count_fixtures` resolves manifests by tier. > > Integration coverage: `tests/typed_decoders`, `tests/partition_scanner`, `corpus_tier1_health`, `corpus_tier2_health`. Dev-deps `sha2`/`hex` for fixture integrity checks. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 09b48b03d503c601348fddebbcf4ded1ae408e6c. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Cursor Agent <[email protected]> Co-authored-by: DrunkOnJava <[email protected]>
## Summary Implements Lane Nine (M7-02 / M7-03): expose the decoded-model Python API with Lane Five typed MVP projections, add stable JSON schemas for those payloads, and mirror the surface with a `rvt-elements` CLI. Depends on Lane Five (`elements/typed-decoders`, PR #127) — this branch is based on that work (includes Lanes Three–Five). ## Motivation Downstream automation and the viewer need one Python/CLI contract for production decoded elements, class counts, export diagnostics, and IFC write modes. Lane Five’s typed views must be reachable from Python without inventing geometry on scaffold fixtures. ## Changes - `RevitFile.decoded_elements()` — adds optional `typed` MVP projection (Level/Wall/Floor/Door/Window/Room/Material) - `RevitFile.element_counts()` / `export_diagnostics()` / `write_ifc(mode=...)` — documented + stubbed; modes remain `scaffold` | `typed-no-geometry` | `geometry` | `strict` - `rvt.MVP_TYPED_CLASSES` constant for introspection - `rvt-elements` CLI — JSON dump of elements or `--counts` (same schemas as Python) - Schemas: `docs/schemas/decoded-elements.schema.json`, `docs/schemas/element-counts.schema.json` - Always-on Python tests on `corpus/tier1/` (no Autodesk samples required) ### Mode honesty | Mode | Behavior today | |------|----------------| | `scaffold` | Accepts spec-valid IFC envelope (default) | | `typed-no-geometry` | Requires validated typed elements | | `geometry` | Requires typed + geometry | | `strict` | Geometry + metadata/units/storeys + no warnings | On synthetic / scaffold-only fixtures, only `scaffold` typically succeeds until Lane 7 geometry recovery lands. Stronger modes raise `ValueError` rather than over-claiming. ### Corpus honesty Tier1 `gen-fixture` CFBs are scaffold-oriented. Production walker counts may be zero; tests assert API shape, schema validity, and mode gating — not invented element recovery. ## Testing - [x] `cargo test --release --lib elements::typed_json` — 3 passed - [x] `cargo test --release --test json_schema_contracts` — 3 passed (tier1 elements + counts schemas) - [x] `maturin develop` + `pytest tests/python/test_decoded_api.py` — 5 passed, 1 skipped (`jsonschema` optional) - [x] `cargo clippy -p rvt --all-targets -- -D warnings` - [x] `cargo clippy -p rvt-py --all-targets -- -D warnings` - [x] `cargo fmt --check` (via fmt before push) - [ ] Corpus Autodesk sample pytest (`test_rvt.py`) — skips without `RVT_SAMPLES_DIR` ## Audit-honesty checklist - [x] Mode docs do not claim geometry/strict success on scaffold fixtures - [x] Typed projection omitted (`null`) for non-MVP classes; ArcWall stays partition-path - [x] No Autodesk samples committed; `*.so` not committed - [x] Commit messages describe what/why ## Legal and contribution hygiene - [x] Apache-2.0 licensable - [x] No Autodesk proprietary / decompiled content - [x] Fixtures remain synthetic (`gen-fixture` / tier1) ## Breaking changes None. `decoded_elements()` entries gain an additive `typed` key (`null` or object). ## Related issues Refs M7-02 / M7-03 (TODO.md). Depends on #127 (Lane Five typed decoders). ## Python API signatures ```python rvt.MVP_TYPED_CLASSES: list[str] RevitFile.decoded_elements() -> list[dict] # id, class_name, byte_range, fields, typed RevitFile.element_counts() -> {"total": int, "by_class": dict[str, int]} RevitFile.export_diagnostics() -> dict RevitFile.export_diagnostics_json() -> str RevitFile.write_ifc(mode: str = "scaffold") -> str rvt.rvt_to_ifc(path, mode="scaffold") -> str ``` <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Large additive public API (CLI, Python, JSON schemas) and new always-on CI corpus gates; no auth or payment paths, but regressions would break downstream automation contracts. > > **Overview** > Adds a unified **decoded-model export surface** for automation: new **`rvt-elements`** binary dumps production-walker elements or **`--counts`** JSON aligned with **`RevitFile.decoded_elements()`** / **`element_counts()`**, including an optional Lane Five **`typed`** MVP projection (`Level`, `Wall`, `Floor`, `Door`, `Window`, `Room`, `Material`) via **`typed_json`** and **`MVP_TYPED_CLASSES`**. Stable contracts land in **`decoded-elements.schema.json`** and **`element-counts.schema.json`**, with tier1-backed schema tests and always-on Python tests on **`corpus/tier1/`**. > > **Corpus & CI:** Commits redistributable synthetic **`corpus/tier1/`** fixtures (license SHA256 checks, **`generate.sh`**, count manifests) and wires **`corpus-tier1`** / **`corpus-tier2`** jobs; **`.gitignore`** now allows **`corpus/**/*.rvt`**. **`project_count_fixtures`** supports tier1 **`fixture_metric`** class-instance oracles. > > **Decoder / partition work bundled here:** Generic **`partition_scanner`** (2023/2024), **`elements::arc_wall`**, **`decode_typed`**, gen-fixture field aliases (`m_height` → elevation/height), and related integration tests. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 760917f0c2cfb066499a48fcfe7127d01f874494. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Cursor Agent <[email protected]> Co-authored-by: DrunkOnJava <[email protected]>
…ons) (#129) ## Summary Implements Lane Six (geometry recovery) on top of Lane Five typed decoders: fail-closed APIs for wall location curves, floor boundary loops, door/window host relationships, and level elevations. Depends on Lane Five (`elements/typed-decoders`, PR #127) — this branch includes that work (plus Lane Four scanner / Lane Three corpus). ## Motivation Lane 7 (IFC export modes) needs structured geometry inputs from typed Wall/Floor/Door/Window/Level views. Synthetic tier1 fixtures remain scaffold-oriented; recovery must be honest (`None` + diagnostics) rather than inventing coordinates. Refs #30 (M4-02), #31 (M4-03), #32 (M4-04), #33 (M4-05). ## Changes - `src/geometry/` — split primitives into `mod.rs`; add `recovery.rs` Lane Six surface - `RecoveryOutcome<T>` / `GeometryDiagnostic` — recovered vs absent with stable codes - Wall location curves: schema start/end floats, unresolved curve-handle diagnostic, ArcWall partition centerline - Floor boundary loops: sketch/boundary vector → plan polyline (area/degenerate gates) - Door/Window hosts: typed `host_id` (reject missing / `0`) - Level elevations: typed `elevation_feet` / gen-fixture `m_height` - `Wall` typed view: `location_curve_id`, `location_start`, `location_end` - `tests/geometry_recovery.rs` — tier1 honesty (no invented curves/loops/hosts; Level elevations recover) ### Recovery honesty | Path | Synthetic tier1 | When data is present | |------|-----------------|----------------------| | Wall location curve | `Absent` (`wall_location_curve_missing`) | Schema endpoints or ArcWall start/end | | Floor boundary | `Absent` (`floor_boundary_missing`) | Sketch/boundary float vectors (≥3 verts, non-zero area) | | Door/Window host | `Absent` (no host_id on scaffold) | Non-zero `host_id` | | Level elevation | **Recovered** from `m_height` | `m_elevation` / `m_height` | Bare `location_curve` ElementId without endpoints → `wall_location_curve_unresolved_handle` (fail closed). ## Testing - [x] `cargo test --release --lib geometry::` — 24 passed - [x] `cargo test --release --lib elements::wall::tests::wall_projects_location` — passed - [x] `cargo test --release --test geometry_recovery` — 1 passed (all tier1 fixtures) - [x] `cargo clippy --all-targets --all-features -- -D warnings` - [x] `cargo fmt --check` - [x] New / changed code has unit tests - [ ] `cargo test --all` (full suite; filtered modules above green) - [ ] N/A: IFC exporter byte-identical (no IFC emit changes in this PR) ## Audit-honesty checklist - [x] PR body documents synthetic vs recoverable paths; no invented geometry - [x] Limitations documented in-module (`recovery.rs` honesty contract) - [x] Commit messages describe what/why - [x] No emojis; no private paths - [x] No Autodesk samples committed - [ ] README/status.md not updated in this PR (API is additive; Lane 7 will wire IFC) ## Legal and contribution hygiene - [x] Apache-2.0 licensable - [x] No Autodesk proprietary / decompiled content - [x] Fixtures remain synthetic (`gen-fixture` / corpus/tier1) ## Breaking changes None for callers of existing primitives. `src/geometry.rs` → `src/geometry/` module directory (same `rvt::geometry` path). ## Related issues Refs #30 #31 #32 #33 (M4 geometry). Depends on #127 (Lane Five). Downstream: Lane 7 IFC export modes. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Broad additive changes to parsing, geometry, and CI corpus paths; tier-two depends on external clones but tier-one is always-on and could break PRs if fixture bytes drift. > > **Overview** > Adds **Lane Six** geometry recovery in `geometry/recovery.rs`: fail-closed `RecoveryOutcome` APIs for wall location curves (schema endpoints, unresolved curve handles, ArcWall partition centerlines), floor boundary loops from sketch vectors, door/window hosts, and level elevations. **`Wall`** gains optional location-curve fields; **`Level`** accepts gen-fixture **`m_height`** as elevation. > > Ships **Lane Five** plumbing: `decoder_for_class` / `decode_typed`, **`MVP_TYPED_CLASSES`**, partition-byte **`ArcWall`** decoder (separate from the schema registry), and a **`partition_scanner_json`** example. > > Introduces **`partition_scanner`** (Revit 2023–2024 only): filtered-tag partition candidates, confidence scoring, ArcWall alignment, and ElemTable linkage helpers; **`elem_table::link_partition_element_ids`** wraps the join. > > Adds **redistributable tier-one corpus** under `corpus/tier1/` (synthetic `.rvt`, license/fixture sidecars, `generate.sh`), **`.gitignore`** exceptions, **`corpus-tier1` / `corpus-tier2`** CI jobs (magnetar LFS for tier 2), tier-one count manifests with **`fixture_metric`**, and integration tests (`corpus_tier1_health`, `corpus_tier2_health`, `typed_decoders`, `geometry_recovery`, `partition_scanner`). Dev-deps **`sha2`** / **`hex`** verify license SHA256 on committed fixtures. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit c5bfa9fdc81d74797aa762016dcd26d7024dda49. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Cursor Agent <[email protected]> Co-authored-by: DrunkOnJava <[email protected]>
## Summary Implements Lane Seven (IFC quality) on top of Lane Six geometry recovery: `scaffold` / `typed-no-geometry` / `geometry` / `strict` now shape *emission* as well as post-export validation gates, HostObjAttr proxies stay out of production export, and diagnostics sidecars remain schema-shaped. Depends on Lane Six (`geometry/wall-floor`, PR #129) which includes typed decoders (#127). Aligns with Lane Nine (#128) forward-compatible mode names that fail closed for stronger modes. ## Motivation Quality modes previously acted mainly as validation gates on a single default export. Lane 7 makes mode content real where data allows: typed-only inventory without geometry claims, geometry attachment via Lane Six recovery when present, and strict fail-closed behavior without misleading proxies. Refs M5-01 / M5-02 / M5-04 (TODO.md). Downstream: Lane 8 viewer confidence UI. ## Changes - `src/ifc/export_content.rs` — content policy per quality mode; HostObjAttr/HostObject/Element/Symbol filter; Level → storey via elevation recovery; Wall curve / Floor boundary / Door·Window host attachment; geometry strip helper - `RvtDocExporter::export_with_diagnostics_mode_and_limits` — mode-aware emission - `rvt-ifc --mode` + Python `write_ifc(mode=...)` pass mode into export content - Default/scaffold never emits `HostObjAttr-*` proxies (diagnostic exporter unchanged) - Diagnostics sidecar unchanged schema (`docs/schemas/export-diagnostics.schema.json`); docs note content policy - `tests/ifc_export_modes.rs` — always-on tier1 coverage for all four modes + CLI ### Mode semantics | Mode | Emission | Gate | |------|----------|------| | `scaffold` | Framework + production elements; geometry when recovered; no HostObjAttr proxies | Always accepts valid envelope | | `typed-no-geometry` | Mapped/typed only; geometry fields stripped | Requires typed elements | | `geometry` | Mapped/typed; Lane Six curves/loops/hosts/elevations when present | Requires typed + geometry | | `strict` | Same as geometry | Typed + geometry + metadata/units/storeys + no warnings/unsupported | On synthetic / tier1 fixtures only `scaffold` succeeds — honest scaffold-only, no invented geometry. ## Testing - [x] `cargo test --release --lib ifc::export_content` — 6 passed - [x] `cargo test --release --lib ifc::` — 325 passed - [x] `cargo test --release --test ifc_export_modes` — 8 passed - [x] `cargo test --release --test ifc_synthetic_* --test rvt_ifc_diagnostics_cli --test walker_to_ifc_integration` — passed (corpus tests skip without samples) - [x] `cargo fmt --check` - [x] `cargo clippy --all-targets --all-features -- -D warnings` - [x] `cargo clippy -p rvt-py --all-targets -- -D warnings` - [x] Smoke: `gen-fixture` + `rvt-ifc --mode scaffold|typed-no-geometry|geometry|strict` — HostObjAttr absent; stronger modes fail closed with diagnostics ## Audit-honesty checklist - [x] Tier1/synthetic remain scaffold-only; no invented wall/floor geometry - [x] HostObjAttr proxies absent from default/scaffold; diagnostic path retained - [x] Mode docs do not claim geometry/strict success on scaffold fixtures - [x] No Autodesk samples committed - [x] Commit messages describe what/why ## Legal and contribution hygiene - [x] Apache-2.0 licensable - [x] No Autodesk proprietary / decompiled content - [x] Fixtures remain synthetic (`gen-fixture` / corpus/tier1) ## Breaking changes None for callers of `RvtDocExporter::export` (still scaffold content). New `export_with_*_mode_*` APIs are additive. CLI/Python `--mode` / `mode=` now also shapes content (typed-no-geometry strips geometry). ## Related issues Refs #37 (M5-01), #38-class HostObjAttr (M5-02), #40 (M5-04). Depends on #129 (Lane Six). Aligns with #128 (Lane Nine mode names). <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > IFC export behavior changes for non-scaffold modes and production element filtering; broader surface area (partition scanner version gates, committed binaries) but synthetic corpus and fail-closed validation limit blast radius. > > **Overview** > Adds a **two-tier test corpus** (in-repo Apache-2.0 synthetic `corpus/tier1/` plus optional CI-cloned magnetar tier 2), CI jobs `corpus-tier1` / `corpus-tier2`, SHA256 license checks, and known-count manifests—while allowing committed `.rvt` files under `corpus/` via `.gitignore` exceptions. > > Introduces **partition scanning** (`partition_scanner`), a typed **ArcWall** partition decoder, ElemTable linkage helpers, and a `partition_scanner_json` example for JSON diagnostics. > > Adds **Lane Six geometry recovery** (`geometry/recovery`) with fail-closed wall curves, floor boundaries, opening hosts, and level elevations; extends typed **Wall** / **Level** projection for `gen-fixture` fields (`m_height`, location endpoints) and centralizes MVP typed decode via `decode_typed` / `decoder_for_class`. > > Implements **Lane Seven IFC content policy** in `export_content`: `--mode` / Python `mode=` now drives emission (not just validation)—`typed-no-geometry` strips geometry, `geometry`/`strict` attach recovery when present, production export drops **HostObjAttr** proxies, and Levels become storeys from recovered elevations. `RvtDocExporter::export_with_diagnostics_mode_and_limits` wires CLI/Python through to export. > > New integration tests cover tier1 corpus health, geometry honesty on synthetics, and all four IFC export modes (including CLI strict fail-closed on tier1). > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit f1974e6705096145c37d515b16c39137ac1f4c25. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Cursor Agent <[email protected]> Co-authored-by: DrunkOnJava <[email protected]>



Summary
Implements Lane Five (typed decoders / M3-05): harden schema-driven Level, Wall, Floor, Door, Window, Room, and Material decoders with wrong-schema rejection and empty-input tests; add a typed ArcWall partition decoder with class/tag rejection; wire
decoder_for_class/decode_typed; add always-on tier1 corpus tests.Depends on Lane Four (
partitions/generic-scanner, PR #126) — this branch is based on that work (includes Lane Three corpus).Motivation
Downstream lanes (geometry, IFC, Python) need a stable typed decode surface that fails closed on schema mismatches and exercises redistributable tier1 fixtures without inventing geometry from scaffold CFBs.
Changes
src/elements/arc_wall.rs— typedArcWallview +decode_at/decode_candidatewith wrong-schema / wrong-tag / short-buffer rejection (partition path; not added to the 80-entryall_decodersregistry — wire format is envelope-based)src/elements/mod.rs—MVP_TYPED_CLASSES,decoder_for_class,decode_typedm_heightzones::Roomtype alias forZonetests/typed_decoders.rs— registry cross-reject + tier1 payload decode + inventory known counts + no ArcWall-standard false positives on syntheticsRejection behavior
schema.namemust equal decoder class orError::BasicFileInfo(... wrong schema ...)ArcWall;class_tagmust be0x0191; core envelope gates unchangedCorpus honesty
Tier1
gen-fixtureCFBs are scaffold-oriented. Tests assert inventory known counts, successful field walks, Level/Wallm_height→ typed height/elevation, and zero ArcWall-standard partition hits — not full Revit semantic recovery.Testing
cargo test --release --lib elements::— 205 passedcargo test --release --lib elements::arc_wall— 7 passedcargo test --release --test typed_decoders— 3 passed (all three tier1 fixtures)cargo clippy --all-targets --all-features -- -D warningscargo fmt --checkcargo test --all(full suite; filtered modules above green)Audit-honesty checklist
Legal and contribution hygiene
gen-fixture)Breaking changes
None.
Related issues
Refs M3-05 (TODO.md). Depends on #126 (Lane Four scanner) / #125 (Lane Three corpus).
Downstream: Lane 6 (geometry), Lane 7 (IFC), Lane 9 (Python) should merge from this branch.
Note
Medium Risk
Expands public decode and partition-scan APIs and adds always-on CI over committed fixtures; behavior is version-gated and tests emphasize fail-closed rejection, but regressions could affect downstream geometry/IFC lanes.
Overview
Adds Lane Five (M3-05) typed decode surface:
MVP_TYPED_CLASSES,decoder_for_class, anddecode_typedfail closed on schema name mismatches; Level/Wall map gen-fixturem_heightto elevation/height. ArcWall gets a partition-byte decoder (decode_at/decode_candidate) outside the schema-drivenall_decodersregistry, with class/tag rejection.Introduces
partition_scanner(2023/2024 version guard,PartitionRecordCandidate, confidence scoring, ElemTable linkage helpers) plusexamples/partition_scanner_jsonandelem_table::link_partition_element_ids.Corpus / CI (Lane Three): commits Apache-2.0 synthetic
corpus/tier1/fixtures with license + recipe sidecars;.gitignoreallowscorpus/**/*.rvt; newcorpus-tier1andcorpus-tier2jobs; tier1 health tests (SHA256, open/schema/inventory) and tier1 project-count manifests withfixture_metricclass-instance oracles.project_count_fixturesresolves manifests by tier.Integration coverage:
tests/typed_decoders,tests/partition_scanner,corpus_tier1_health,corpus_tier2_health. Dev-depssha2/hexfor fixture integrity checks.Reviewed by Cursor Bugbot for commit aae5b7f. Configure here.