Skip to content

Latest commit

 

History

History
169 lines (99 loc) · 5.44 KB

design-decisions.md

File metadata and controls

169 lines (99 loc) · 5.44 KB

Design Decisions

Engineering rationale for IFC Inspector — written for code reviewers, recruiters, and future maintainers.

Format inspired by Architecture Decision Records (ADR): context, decision, consequences.


ADR-001: Custom STEP parser instead of existing IFC libraries

Context. Rust IFC crates (ifc-rs, etc.) exist but pull large schema bindings, often with C dependencies. The primary use case is type and property inspection, not geometry.

Decision. Implement a focused STEP tokenizer and extract only coordination-relevant entities.

Consequences.

✅ Pros ❌ Cons
Zero C ABI / linking complexity Not a full IFC implementation
#![forbid(unsafe_code)] end-to-end Schema edge cases need manual handling
Portfolio demonstrates parser craft Geometry permanently out of scope
Binary stays small Must maintain attribute index knowledge

ADR-002: Type browser, not instance browser, as primary UX

Context. BIM coordinators ask “how many types of X?” before “where is instance #4521?” Revit, Navisworks, and Solibri default to 3D views — overkill for counting and property audits.

Decision. Three-panel dashboard: Levels → Categories → Types, with drill-down to instances.

Consequences.

  • Matches professional audit workflow
  • Instance browser is secondary (Type Detail → Enter)
  • Counts and filters are type-centric

ADR-003: Instance-centric model (single Instance map)

Context. Early versions stored parallel maps: element_to_storey, element_properties, instance_global_ids. Three maps = three merge policies and JSON leak risk.

Decision. One HashMap<u64, Instance> with all per-instance fields.

Consequences.

  • Simpler library API and export logic
  • Storey and property queries go through instances.get(id)
  • Categories still hold ElementType aggregates for the type browser

ADR-004: Query layer separate from UI

Context. Storey filtering logic originally lived in App methods called every frame from Ratatui — coupling UI to spatial topology.

Decision. model/query.rs with ProjectView — pure filtering over IfcProject.

Consequences.

  • Unit-testable without terminal
  • UI becomes thin: selection state + draw calls
  • Library users get same filter semantics as TUI

ADR-005: Export DTO instead of serializing internal model

Context. serde on IfcProject exposed internal STEP IDs, redundant maps, and empty legacy fields — bad for Power BI and public API stability.

Decision. ExportProject in export/dto.rs — explicit, documented JSON schema.

Consequences.

  • Stable external contract
  • Extra mapping step at export time (negligible cost)
  • CSV remains a separate, simpler format

ADR-006: Stable instance selection by ID, not list index

Context. Instance Browser sorts by elevation. Highlighting by display index broke when sort order differed from instance_ids vector order.

Decision. selected_instance_id: Option<u64> everywhere; sort is presentation-only.

Consequences.

  • Correct selection after sort
  • Slightly more lookup work (ID → position) — irrelevant at inspection scale

ADR-007: Untyped category for orphan instances

Context. Many real exports lack IfcRelDefinesByType for some elements. Hiding them produces falsely low counts.

Decision. Scan instance entities; unlinked ones → Untyped category with synthetic type names.

Consequences.

  • Honest totals for auditors
  • May expose data quality issues in upstream authoring — feature, not bug

ADR-008: Test fixture committed to repository

Context. Tests were previously archived; .gitignore excluded all *.ifc. Portfolio claim “custom parser” was unverifiable.

Decision. tests/fixtures/sample.ifc committed; gitignore allows !tests/fixtures/*.ifc only.

Consequences.

  • CI proves parser works without user-supplied models
  • Fixture must stay minimal (IP-clean, small)

ADR-009: Clippy pedantic + deny warnings

Context. Portfolio code should demonstrate Rust discipline, not just “compiles.”

Decision. Cargo.toml lints: clippy::all = deny, pedantic = warn, CI enforces -D warnings.

Consequences.

  • Higher bar for contributions
  • Justified allow entries documented in Cargo.toml (e.g. too_many_lines for parser match arms)

ADR-010: Explicit non-goals documented

Context. IFC tools often over-promise (“full IFC support”). Reviewers catch this quickly.

Decision. Document non-goals in IFC Domain and here.

Non-goals:

  • Geometry / visualization
  • IFC write path
  • Full schema coverage
  • Multi-line STEP records (for now)

Consequences.

  • Clear scope for contributors
  • Honest positioning in README and interviews

Rejected alternatives

Alternative Why rejected
Python + IfcOpenShell wrapper Hides parser work; heavy runtime; not portfolio Rust signal
Web viewer (Three.js + wasm) Different product; geometry-focused
Parse everything into generic JSON Loses type browser semantics; huge files
Runtime plugin system Over-engineering for v0.1 scope

Related docs