# ifc-material implementation plan
Status: IFC4 MaterialResource read/query/authoring and geometry cross-proof implemented.
Last updated: 2026-09-01
This is task state, not ambient context. Follow `AGENTS.md`; claim one task ID,
record blockers/decisions under it, and check it off only with evidence.
## Established boundary
Borrowed semantic projections for materials, layers, profiles, constituents, and their usage/assignment.
## Planned file map
These paths own the implemented borrowed views. Extend the named owner and
expose public symbols only through an intentional parent re-export.
- `src/material/definition.rs`: IfcMaterial identity
- `src/material/properties.rs`: material property relationships
- `src/layer/definition.rs`: identity, material link, metadata, and authored thickness
- `src/layer/set.rs`: ordered layer sets
- `src/layer/usage.rs`: semantic association to a layer set only
- `src/profile/definition.rs`: material/name/description/priority/category
- `src/profile/set.rs`: ordered profile sets
- `src/profile/usage.rs`: semantic association to a profile set only
- `src/constituent/definition.rs`: constituent semantics
- `src/constituent/set.rs`: set membership
- `src/usage/assignment.rs`: RelAssociatesMaterial view
- `src/usage/resolution.rs`: bounded association resolution
- `src/material/relationships.rs`: lists, classification links, and resource relationships
## Active implementation: IFC4 MaterialResource
Goal: provide application-facing, borrowed, codec-independent views for every
IFC4 ADD2 TC1 declaration in MaterialResource, including assignment resolution,
material property sets, all 18 entities, four declared types, and
`IfcMlsTotalThickness`.
Decision: material owns authored MaterialResource data; geometry owns geometric
interpretation and lowering. Unknown or malformed values stay explicit.
## Work queue
- [x] `MAT-SPEC` - pin the normative declaration and slot inventory in executable tests
- Evidence: IFC4 declaration matrix covers 18 entities, four types, and one function.
- [x] `MAT-BASE` - implement material identity, relationships, lists, and properties
- Evidence: focused unit/property/fixture tests, isolated build, and crate clippy.
- [x] `MAT-LAYER` - implement layer composition and authored usage fields
- Evidence: focused unit/property/fixture tests, isolated build, and crate clippy.
- [x] `MAT-PROFILE` - implement profile composition and authored usage fields
- Evidence: focused unit/property/fixture tests, isolated build, and crate clippy.
- [x] `MAT-CONST` - implement constituents and fraction validation
- Evidence: focused unit/property/fixture tests, isolated build, and crate clippy.
- [x] `MAT-ASSIGN` - resolve product/type material associations deterministically
- Evidence: focused unit/property/fixture tests, isolated build, and crate clippy.
- [x] `MAT-PSET` - join `IfcMaterialProperties` instances to the 14 official PSD templates
- Evidence: exact-name/entity applicability plus explicit category-policy tests through the `ifc` facade.
- [x] `MAT-MUT` - transactional authoring for material identity, layer composition, and product assignment
- Evidence: 4 authoring tests, 3/3 guard mutations killed, crate clippy, and full IFC gate.
- [x] `MAT-CROSS` - prove material and geometry projections join by EntityId without duplicate slot ownership
- Evidence: `openbim-ifc/tests/material_geometry_join.rs` projects one `IfcMaterialProfileWithOffsets` through both public facades, preserving the same record ID, profile ID, offsets, and model cardinality under `material,geometry-select`.
## Completion log
Append concise entries as `TASK-ID - proof command/result - material decision`.
Do not paste long logs or move standing invariants out of `AGENTS.md`.
- `MAT-SPEC`..`MAT-ASSIGN` - all-feature crate tests and IFC STEP facade fixture pass.
- `MAT-PSET` - facade tests pin all 14 material PSDs and exact-name lookup.
- Review hardening - strict aggregate/required-slot decoding, bounded typed wrappers,
finite thickness sums, duplicate type-relation ambiguity, and exact IFC4 type-target validation.
- `MAT-MUT` - `cargo test -p ifc-material`, 3/3 authoring guard mutations, and `scripts/gate.sh` - staged IFC4 material/layer/set/product assignment records remain atomically committed by `ifc-model::Transaction`.
- `MAT-CROSS` - `cargo +1.88.0 test -p openbim-ifc --no-default-features --features material,geometry-select --test material_geometry_join` and matching strict Clippy pass - semantic and geometry-input views borrow one `IfcMaterialProfileWithOffsets` record and join by `EntityId`.