Files
FESADev/phases/domain-model-foundation/step7.md
T
2026-06-08 16:40:04 +09:00

62 lines
2.0 KiB
Markdown

# Step 7: domain-invariants
## Read First
Read these files before editing:
- `/AGENTS.md`
- `/docs/AGENT_RULES.md`
- `/docs/ADR.md`
- `/docs/ARCHITECTURE.md`
- `/docs/implementation-plans/domain-model-foundation-implementation-plan.md`
- `/include/fesa/core/Domain.hpp`
- `/src/core/Domain.cpp`
- `/tests/core/domain_storage_test.cpp`
## Task
Add tests and small API cleanup to lock down `Domain` invariants.
Allowed files:
- Modify `/include/fesa/core/Domain.hpp`
- Modify `/src/core/Domain.cpp`
- Modify `/tests/core/domain_storage_test.cpp`
- Modify `/docs/implementation-plans/domain-model-foundation-implementation-plan.md` only if a test traceability table needs correction
Required invariants:
- `Domain` does not expose mutable references to stored objects.
- `Domain` has no equation id, displacement, residual, reaction, current time, iteration, sparse matrix, MKL, TBB, or HDF5 members.
- Retrieval does not create missing objects implicitly.
- Insert operations preserve input ids and ordering where the API promises ordering.
- Error types remain deterministic: duplicate ids use `std::invalid_argument`; missing required references use `std::invalid_argument`; direct missing lookup uses `std::out_of_range`.
## Tests To Write First
Write failing compile/runtime tests before API cleanup:
- A const `Domain` can retrieve model definitions.
- Missing direct lookup throws without changing counts.
- Failed insert due to missing reference does not change the relevant count.
- Existing node, element, material, property, set, BC, load, and step counts remain stable after failed inserts.
Run targeted CTest and verify RED before implementation.
## Acceptance Criteria
Run:
```powershell
cmake --build build/msvc-debug --config Debug
ctest --test-dir build/msvc-debug --output-on-failure -C Debug -R domain
python scripts/validate_workspace.py
```
Update `/phases/domain-model-foundation/index.json` step 7 with `completed`, `error`, or `blocked`.
## Do Not
- Do not add new solver features beyond invariant enforcement.
- Do not refactor unrelated files.