# Step 21: Domain Mapper Modules

## 담당 역할과 필수 스킬

- 담당 역할: `implementation-agent`
- 필수 스킬: `harness`, `fesa-cpp-msvc-tdd`
- 이 Step만 `RED -> observed failure -> minimal GREEN -> focused/full VERIFY`로 수행한다.

## 읽어야 할 파일

- `/AGENTS.md`
- `/docs/CODINGSTYLE.md`
- `/docs/ARCHITECTURE.md`
- `/docs/ADR.md`
- `/docs/linear-static-3d-euler-beam/io.md`
- `/docs/linear-static-mitc4-shell/io.md`
- `/docs/cpp-object-oriented-modular-refactoring/implementation-plan.md`
- Step 11 SourceTargetResolver
- Step 12–14 semantic hierarchy/Domain files
- Step 18–19 Load and BoundaryCondition files
- `/include/fesa/io/abaqus/domain_mapper.h`
- `/src/fesa/io/abaqus/domain_mapper.cpp`
- `/tests/unit/io/abaqus/domain_mapper_test.cpp`
- `/src/fesa/CMakeLists.txt`, `/tests/CMakeLists.txt`
- `/phases/cpp-object-oriented-modular-refactoring/index.json`
- `/phases/cpp-object-oriented-modular-refactoring/step21.md`

## 작업

Requirement `R-MODULE-001`의 mapper split을 구현한다.

1. `/tests/unit/io/abaqus/domain_mapping_components_test.cpp`를 먼저 추가한다.
   `C-MODULE-001` exercises component seams with valid and invalid syntax records and verifies
   topology, material/property, step/load/BC candidate content plus exact stable diagnostic order.
2. Missing private component headers causes RED compile failure.
3. Keep public facade
   `Result<Domain> AbaqusDomainMapper::Map(const ParsedInput& input) const` in
   `domain_mapper.h`. Candidate private modules under `/src/fesa/io/abaqus/`:

```text
domain_mapping_context.h        shared candidate state, source locations and diagnostics
topology_mapper.h/.cpp          nodes, elements, sets, identity instances
material_property_mapper.h/.cpp current isotropic material and beam/shell section assignments
step_definition_mapper.h/.cpp   one STATIC step, concentrated loads, prescribed displacement
domain_builder.h/.cpp           final cross-reference validation and atomic Domain construction
```

4. Private methods consume syntax/semantic candidate references and return `Status`; no component
   commits to public Domain before final validation.
5. Preserve allowlist warnings, B31 rejection, S4/S4R common FESA-MITC4 mapping, set namespace,
   source identity, declaration order and every existing diagnostic code/message/source location.
6. Reduce `domain_mapper.cpp` to orchestration. Do not add a registry or public parser plugin API.

## Acceptance Criteria

```powershell
cmake --build .harness/build --config Debug --target fesa_unit_tests
ctest --test-dir .harness/build -C Debug `
  -R "InpDomainMapping|DomainMappingComponents|SourceTargetResolver" --output-on-failure
$componentFiles = @(
  "src/fesa/io/abaqus/domain_mapping_context.h",
  "src/fesa/io/abaqus/topology_mapper.cpp",
  "src/fesa/io/abaqus/material_property_mapper.cpp",
  "src/fesa/io/abaqus/step_definition_mapper.cpp",
  "src/fesa/io/abaqus/domain_builder.cpp"
)
foreach ($componentFile in $componentFiles) {
  if (-not (Test-Path -LiteralPath $componentFile -PathType Leaf)) {
    throw "Missing mapper component: $componentFile"
  }
}
rg -n "TopologyMapper|MaterialPropertyMapper|StepDefinitionMapper|DomainBuilder" `
  src/fesa/io/abaqus/domain_mapper.cpp
& "C:/Program Files/LLVM/bin/clang-format.exe" --dry-run --Werror `
  (rg --files src/fesa/io/abaqus -g "*.h" -g "*.cpp") `
  tests/unit/io/abaqus/domain_mapper_test.cpp `
  tests/unit/io/abaqus/domain_mapping_components_test.cpp
cmake --build .harness/build --config Debug
ctest --test-dir .harness/build -C Debug --show-only=json-v1
ctest --test-dir .harness/build -C Debug --output-on-failure
```

## 검증 및 상태 갱신

- RED missing components, component/facade diagnostics, facade wiring and full CTest를 summary에 기록한다.
- Diagnostic/order/semantic mapping regression is `error`.
- 성공 시 현재 Step만 `completed`로 갱신한다.
- timestamp, retry, commit, advancement는 Executor 소유다.

## 금지사항

- Abaqus keyword subset or unsupported behavior를 넓히지 마라.
- Failed candidate를 partial Domain에 commit하지 마라.
- Reference input을 mapper refactor에 맞춰 변경하지 마라.
- 직접 commit하거나 hook script를 수동 실행하지 마라.
