Skip to content

refactor(research): split partition_schema_mvp into modules by responsibility - #1141

Merged
DrunkOnJava merged 21 commits into
mainfrom
refactor/split-partition-schema-mvp
Oct 30, 2026
Merged

DrunkOnJava merged 21 commits into
mainfrom
refactor/split-partition-schema-mvp

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

Summary

Splits src/research/partition_schema_mvp.rs (12,553 lines) into 19 child modules by responsibility, under src/research/partition_schema_mvp/. The parent keeps the module doc, PartitionSchemaMvp, the recover_partition_schema_mvp orchestrator and the helpers every responsibility shares, and re-exports each child with pub use <child>::*, so every partition_schema_mvp::<item> path used in src/, tests/, probes/ and docs/ resolves as before. It is a pure move: bodies, doc comments, attributes and the relative order of items are unchanged.

Stacked on #1136 and #1139, both of which have since landed on main (squash commits f07614f and 580982d); this branch merged main, so only the split remains in the diff. It stays a draft until a Measure run on the head confirms the move is byte-identical.

Motivation

One of the repository-audit refactors Griffin chose on 2026-10-30: one 12.5k-line file held 175 constants and about 200 functions for a dozen unrelated responsibilities.

Changes

  • partition_schema_mvp.rs (1,130 lines): module doc, imports, PartitionSchemaMvp, recover_partition_schema_mvp, element_record_decoded, element_record_bbox, record_references, element_source_stream, partition_streams_largest_first, rect_openings_from_partitions, and the mod / pub use lines.
  • fields (933): all 175 constants.
  • types (961), parameters (282): type picks and names, system families, type functions; named parameters, IsExternal, phases created, serial numbers.
  • openings (765), curtain (399), materials (704), layers (292).
  • walls (728), wall_joins (453).
  • stairs (730), stair_bodies (1,111), framing (509), mep (750), rooms (289).
  • slabs (592), roofs (862), levels (511).
  • records (495), records_2023 (325): category and instance selection, host binding, design-option and nesting filters; the Revit 2023 record path.

The only edits to moved text:

  • pub(super) on the 148 private top-level items that left the parent (the file has no private struct fields or methods).
  • fields.rs has no use super::*;, since none of its constants names anything outside it. Five of its doc links named a function that now lives in another child, so they read [super::system_family], [super::attach_is_external], [super::bind_opening_hosts], [super::roof_slope_edge_fields] and [super::roof_slope_plate_offset_field].
  • The imports only one child uses moved into it (le_bytes into curtain and openings, partition_arc_walls / PartitionArcWall into levels, NameBucket / classify_name into materials, FRAC_PI_4 into walls), so the parent has no unused import.

Checked before pushing: every original non-blank line appears in the new files the same number of times, except the added pub(super) tokens, the mod / pub use / use super::*; / child //! lines, the five doc links and the moved imports; rustfmt +stable --edition 2024 --check passes on the parent and every child, and rustfmt's own changes (29 signatures rewrapped by the longer visibility prefix) differ from the unformatted output only in whitespace and trailing commas. Every partition_schema_mvp::<name> that code outside the module uses (src/, tests/, probes/, fuzz/, tools/) names a pub item; the non-pub names that remain are prose in docs and reports, as before.

Testing

Unit tests are banned in this repository. No local builds on this machine: CI is the compile gate.

  • tools/check-local.sh passes: not run here (no local compilation); CI passed is the gate
  • Verified end to end on real Revit files: a Measure run on the head must show byte-identical IFC hashes (-f base=main -f nordic=true -f r2025=true) before this leaves draft
  • Does not touch the IFC exporter's behaviour; the witness verdicts need no refresh
  • Not a performance change

Audit-honesty checklist

  • Docs name no moved line numbers: docs/support-matrix.json cites partition_schema_mvp::<item> module paths, which still resolve
  • No user-visible change, so no changelog fragment
  • No new limitation
  • No emojis, private paths or internal jargon

Legal and contribution hygiene

  • Apache-2.0
  • No Autodesk proprietary content
  • No new test fixtures

Breaking changes

None: the module's public items keep their paths.

…nd quantise helpers

dot, sub and cross move from ifc/body_geometry and native_parametric_surface, distance from native_symbol_cuts and native_parametric_mesh, and the shoelace area from geometry/recovery and ifc/from_decoded into the private vector_math module, with the expressions unchanged. polygon_area_sqft keeps its public path and calls the shared function. quantise is shared from partition_element_records.
native_index reads native_extensible_storage::guid_string instead of its own copy. The 22-digit alphabet is one constant in revit_global_ids, and derive_default_ifc_guid calls compress_ifc_guid, which computes the same string.
partition_level_records and partition_ifc_export_overrides use the memchr-backed copy in partition_element_records. All three returned None for an empty needle or a haystack shorter than the needle and the first match otherwise.
partition_arc_walls names a storey through element_record_storeys::elevation_storey_name instead of its own identical format.
…elpers

native_json holds element_id (u64 and signed forms), finite_triple and agree, read by native_column_joins, native_connectors, native_element_types, native_mullion_hosts, native_rendered_content, native_stairs, native_symbol_cuts, native_wall_types and native_walls. The readers that differ stay in place: native_walls' triple (no finiteness check), native_stairs' element_id (as_u64), native_family_forms' Option argument and native_saved_mesh's Result point.
…imits

The production walk, the partition MVP and the IFC export (twice) each ran scan_partition_arc_walls_with_limits over every Partitions stream. RevitFile now memoises the scan under its release and WalkerLimits, as it does the walk; the public function returns a copy of the memoised scan and the four internal readers share it.
… le_bytes

The partition readers, compression and basic_file_info read integers, floats and UTF-16 units at an offset with the same bounds as before and through the one le_bytes module. le_bytes gains i32_at and u16_units for the reads the existing helpers did not cover.
… index and document readers

The reads that were bounds-checked by a get or an ensure! before an infallible try_into now use u16_at and u32_at with the same error text, and the UTF-16 unit decodes use u16_units. The walker, ElemTable, partitions and ArcWall trailer readers take the same helpers where the surrounding function already returned None on a short buffer.
…roof_slopes read ElementIds through native_json
…ported

Four calls already on main read crate::le_bytes::*_at in files this branch now imports le_bytes into, which the workspace's unused_qualifications lint (an error under -D warnings) rejects.
The 75 research modules sat in src/ beside the stable ones and src/research.rs
reached them with a #[path] attribute each. They now live in src/research/,
declared as plain modules, so the directory says which files are outside the
semver promise. Module paths (crate::partition_schema_mvp, rvt::research::*)
are unchanged.

Current-state mentions of the moved files (the support matrix's evidence,
one probe, one scorer, CONTRIBUTING's probe step) name the new paths; reports,
dated notes and the changelog keep the paths they were written with.
…sibility

src/research/partition_schema_mvp.rs was 12,553 lines. It now keeps the
module doc, PartitionSchemaMvp, the recover_partition_schema_mvp
orchestrator and the helpers every responsibility shares (the element record
decoder and box, record references, the source stream, the partition
iterators), and re-exports nineteen children from
src/research/partition_schema_mvp/ with `pub use <child>::*`, so every
`partition_schema_mvp::<item>` path resolves as before.

- fields: all 175 constants
- types, parameters: type picks and names, system families, type
  functions; named parameters, IsExternal, phases, serial numbers
- openings, curtain, materials, layers
- walls, wall_joins: axes, arcs, tapers, profile openings, lengths, tee
  reaches, butt joins, join trims
- stairs, stair_bodies, framing, mep, rooms
- slabs, roofs, levels
- records, records_2023: category and instance selection, host binding,
  design-option and nesting filters; the Revit 2023 record path

It is a pure move: items keep their bodies, doc comments, attributes and
relative order. The only edits are `pub(super)` on the private items that
moved out of the parent (private fields and methods: none), five doc links
in constants that now reach their target through `super::`, and the imports
that only one child uses, which moved into that child. fields.rs has no
`use super::*`, since none of its constants names anything outside it.
…ion-schema-mvp

# Conflicts:
#	src/research/partition_schema_mvp.rs
…thout pub

parameters, records_2023 and stairs hold only items that were private, so their glob re-export has nothing public to carry and rustc's unused_imports rejects it under -D warnings. A plain use reaches the same items for the parent and its children.
@DrunkOnJava

Copy link
Copy Markdown
Owner Author

Self-review (owner). A pure move of src/research/partition_schema_mvp.rs (12,553 lines) into a 1,130-line parent and 19 children under src/research/partition_schema_mvp/, fields first. Each child holds one responsibility: types, parameters, openings, curtain, materials, layers, walls, wall joins, stairs, stair bodies, framing, MEP, rooms, slabs, roofs, levels, records and the 2023 record path. The parent pub uses every child that has public items, so every crate::partition_schema_mvp::X and rvt::research::partition_schema_mvp::X path still resolves.

Checked independently of the agent's line script, by token multiset of the original against the 20 new files (commas aside, since rustfmt rewrapped 29 signatures): no token of the original is missing. The only additions are 148 pub(super) on private items moved out of the parent, 19 mod lines, the use super::* and pub use lines, five doc links qualified with super::, and a one-line //! per child. Bodies, names and order within each item are unchanged.

Verification: CI passed on the head before the update-branch merge, with the same jobs running again now. Measure run 41047423569 (-f ref=826ed458 -f base=main -f nordic=true -f r2025=true -f scorers=none) found all 32 models' ifc.sha256 and diagnostics.json byte-identical to main. Nothing to fix.

@DrunkOnJava
DrunkOnJava marked this pull request as ready for review October 30, 2026 11:28
@DrunkOnJava
DrunkOnJava merged commit 38b181e into main Oct 30, 2026
28 checks passed
@DrunkOnJava
DrunkOnJava deleted the refactor/split-partition-schema-mvp branch October 30, 2026 11:28
DrunkOnJava added a commit that referenced this pull request Oct 30, 2026
…be unit-tested (#1149)

## Summary

One rustdoc line in `src/research/partition_schema_mvp/records.rs` said
`instances_from_records` was split out 'so the rule is unit-testable
without a corpus file'. #1126 deleted every `src` unit test, so the line
now just describes the function.

## Motivation

Found while removing the support matrix's citations of the deleted unit
tests (#1142). It waited for the split (#1141) so the two would not
conflict.

## Testing

N/A: one doc line. `rustfmt --check` passes.

## Audit-honesty checklist

- [x] No claim of tests that do not exist
- [x] No changelog fragment (no user-visible change)

## Breaking changes

None.
Repository owner deleted a comment from chatgpt-codex-connector Bot Oct 31, 2026
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