2.0 KiB
2.0 KiB
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.mdonly if a test traceability table needs correction
Required invariants:
Domaindoes not expose mutable references to stored objects.Domainhas 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 usestd::invalid_argument; direct missing lookup usesstd::out_of_range.
Tests To Write First
Write failing compile/runtime tests before API cleanup:
- A const
Domaincan 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:
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.