184 lines
17 KiB
Markdown
184 lines
17 KiB
Markdown
# Step 2: Consistent→lumped 질량과 deterministic 조립
|
|
|
|
> **과거 실행 기록:** 아래 지시·소유 경로는 당시 계획이며 현재 실행 입력이 아니다.
|
|
> 원문은 Git `858e87b`에서 확인한다. 문서 링크는 통합된 기록으로 연결하며 새 작업은
|
|
> [현재 문서 안내](../../docs/README.md)와 기능 PRD를 따른다.
|
|
|
|
> **현재 실행 계약(r2):** 모든 configure/build/CTest는 `mfe-workspace-msvc-ninja-debug`를 사용한다.
|
|
> MSVC x64 Debug, 동일 Ninja graph의 manual/registered 검증과 `CMAKE_BUILD_PARALLEL_LEVEL=1`을 유지한다.
|
|
> 과거 `.harness/build` VS 명령과 public preset 명령은 이 Step의 실행 명령을 대체하지 않는다.
|
|
> Targets/regex/필수 test identity·owned_paths·수치 계약은 그대로다. [E10.2/E11](../../docs/mitc4-shell-feast-eigen/development-notes.md#실패와-재발-방지)을 적용한다.
|
|
> 긴 도구 호출은 **결과 전체**를 전달한다. `session_id`가 있으면 `write_stdin`으로 종료까지 이어받고,
|
|
> functions가 running cell을 반환했을 때만 해당 `cell_id`로 `functions.wait`를 사용한다.
|
|
> `r.output`만 비었다고 같은 명령을 다시 실행하지 않는다. 통과한 focused 검증은 새 변경/실패 없이 반복하지 않는다.
|
|
> Executor가 이미 만든 top/current control dirty 상태는 보호 snapshot이며 구현 소유권 위반으로 단정하지 않는다.
|
|
> 선택 Step의 result fields만 반환하고 timestamps/history/다른 metadata는 변경하지 않는다.
|
|
> 이미 GREEN인 source를 RED를 만들기 위해 되돌리지 않는다. 새로운 production 변경에는 원래 test-first 계약을 적용한다.
|
|
|
|
- Feature ID: `mitc4-shell-feast-eigen`
|
|
- Plan owner: `implementation-planning-agent`
|
|
- Execution owner: `implementation-agent`
|
|
- Input contract revision: `r2`
|
|
- Phase: `mitc4-shell-feast-eigen`
|
|
- Dependency: 동일 phase의 Step 1 completed
|
|
- Requirement IDs: `FEM-REQ-MITC4-EIGEN-003`, `FEM-REQ-MITC4-EIGEN-004`, `FEM-REQ-MITC4-EIGEN-005`, `FEM-REQ-MITC4-EIGEN-006`, `FEM-REQ-MITC4-EIGEN-007`, `FEM-REQ-MITC4-EIGEN-011`, `FEM-REQ-MITC4-EIGEN-014`, `FEM-REQ-MITC4-EIGEN-018`, `FEM-REQ-MITC4-EIGEN-026`
|
|
- Logical cases: `MFE-C01`, `MFE-C02`, `MFE-C03`, `MFE-C04`, `MFE-C05`, `MFE-C06`, `MFE-C07`, `MFE-C11`, `MFE-C20`
|
|
- I/O obligations: `IO-T02`, `IO-T04`, `IO-T11`
|
|
|
|
## 필수 입력과 계약
|
|
|
|
Feature 폴더는 `docs/mitc4-shell-feast-eigen/`다. 아래 current r2 입력을 읽고 기존 완료 Step 코드와 evidence를 대조한다. 연결된 upstream contract는 read-only다.
|
|
|
|
- [AGENTS.md](../../AGENTS.md)
|
|
- [docs/SOLVER_AGENT_DESIGN.md](../../docs/SOLVER_AGENT_DESIGN.md)
|
|
- [docs/FEATURE_DOCUMENTATION.md](../../docs/FEATURE_DOCUMENTATION.md)
|
|
- [docs/PRD.md](../../docs/PRD.md)
|
|
- [docs/ARCHITECTURE.md](../../docs/ARCHITECTURE.md)
|
|
- [docs/ADR.md](../../docs/ADR.md)
|
|
- [docs/CODINGSTYLE.md](../../docs/CODINGSTYLE.md)
|
|
- [docs/TOLERANCE.md](../../docs/TOLERANCE.md)
|
|
- [.codex/skills/fem-implementation-tdd/SKILL.md](../../.codex/skills/fem-implementation-tdd/SKILL.md)
|
|
- [.agents/skills/harness/SKILL.md](../../.agents/skills/harness/SKILL.md)
|
|
- [.codex/agents/implementation-agent.toml](../../.codex/agents/implementation-agent.toml)
|
|
- [docs/mitc4-shell-feast-eigen/FEATURED_AGENTS.md](../../docs/mitc4-shell-feast-eigen/FEATURED_AGENTS.md)
|
|
- [docs/mitc4-shell-feast-eigen/PRD.md](../../docs/mitc4-shell-feast-eigen/PRD.md)
|
|
- [docs/mitc4-shell-feast-eigen/ADR.md](../../docs/mitc4-shell-feast-eigen/ADR.md)
|
|
- [docs/mitc4-shell-feast-eigen/coordination.md](../../docs/mitc4-shell-feast-eigen/development-notes.md#실패와-재발-방지)
|
|
- [docs/mitc4-shell-feast-eigen/requirements.md](../../docs/mitc4-shell-feast-eigen/requirements.md#requirements)
|
|
- [docs/mitc4-shell-feast-eigen/requirements-evidence.md](../../docs/mitc4-shell-feast-eigen/requirements.md#requirements-evidence)
|
|
- [docs/mitc4-shell-feast-eigen/research.md](../../docs/mitc4-shell-feast-eigen/research.md#research)
|
|
- [docs/mitc4-shell-feast-eigen/research-evidence.md](../../docs/mitc4-shell-feast-eigen/research.md#research-evidence)
|
|
- [docs/mitc4-shell-feast-eigen/formulation.md](../../docs/mitc4-shell-feast-eigen/formulation.md#formulation)
|
|
- [docs/mitc4-shell-feast-eigen/formulation-mass.md](../../docs/mitc4-shell-feast-eigen/formulation.md#formulation-mass)
|
|
- [docs/mitc4-shell-feast-eigen/formulation-eigen.md](../../docs/mitc4-shell-feast-eigen/formulation.md#formulation-eigen)
|
|
- [docs/mitc4-shell-feast-eigen/formulation-verification.md](../../docs/mitc4-shell-feast-eigen/formulation.md#formulation-verification)
|
|
- [docs/mitc4-shell-feast-eigen/formulation-stabilization.md](../../docs/mitc4-shell-feast-eigen/formulation.md#formulation-stabilization)
|
|
- [docs/mitc4-shell-feast-eigen/numerical-review.md](../../docs/mitc4-shell-feast-eigen/numerical-review.md#numerical-review)
|
|
- [docs/mitc4-shell-feast-eigen/numerical-review-evidence.md](../../docs/mitc4-shell-feast-eigen/numerical-review.md#numerical-review-evidence)
|
|
- [docs/mitc4-shell-feast-eigen/numerical-review-controls.md](../../docs/mitc4-shell-feast-eigen/numerical-review.md#numerical-review-controls)
|
|
- [docs/mitc4-shell-feast-eigen/numerical-review-cases.md](../../docs/mitc4-shell-feast-eigen/numerical-review.md#numerical-review-cases)
|
|
- [docs/mitc4-shell-feast-eigen/reference-model.md](../../docs/mitc4-shell-feast-eigen/reference-model.md)
|
|
- [docs/mitc4-shell-feast-eigen/io.md](../../docs/mitc4-shell-feast-eigen/io.md#io)
|
|
- [docs/mitc4-shell-feast-eigen/io-input.md](../../docs/mitc4-shell-feast-eigen/io.md#io-input)
|
|
- [docs/mitc4-shell-feast-eigen/io-schema.md](../../docs/mitc4-shell-feast-eigen/io.md#io-schema)
|
|
- [docs/mitc4-shell-feast-eigen/io-mapping.md](../../docs/mitc4-shell-feast-eigen/io.md#io-mapping)
|
|
- [docs/mitc4-shell-feast-eigen/implementation-plan.md](../../docs/mitc4-shell-feast-eigen/development-notes.md#실패와-재발-방지)
|
|
- [docs/mitc4-shell-feast-eigen/implementation-environment.md](../../docs/mitc4-shell-feast-eigen/development-notes.md#실패와-재발-방지)
|
|
- [docs/mitc4-shell-feast-eigen/implementation-interfaces.md](../../docs/mitc4-shell-feast-eigen/development-notes.md#실패와-재발-방지)
|
|
- [docs/mitc4-shell-feast-eigen/implementation-verification.md](../../docs/mitc4-shell-feast-eigen/development-notes.md#실패와-재발-방지)
|
|
|
|
이 Step의 직접 계약: [formulation-mass.md](../../docs/mitc4-shell-feast-eigen/formulation.md#formulation-mass), [numerical-review-evidence.md#독립-mass-oracle](../../docs/mitc4-shell-feast-eigen/numerical-review.md#numerical-review-evidence--독립-mass-oracle), [numerical-review-controls.md#c2-matrix-mass-stabilization와-reduction](../../docs/mitc4-shell-feast-eigen/numerical-review.md#numerical-review-controls--c2-matrix-mass-stabilization와-reduction), [formulation-mass.md#m4-계산된-consistent-moment에서-nodal-block-유도](../../docs/mitc4-shell-feast-eigen/formulation.md#formulation-mass--m4-계산된-consistent-moment에서-nodal-block-유도), [formulation-mass.md#m5-보존되는-양과-근사되는-양](../../docs/mitc4-shell-feast-eigen/formulation.md#formulation-mass--m5-보존되는-양과-근사되는-양), [formulation-eigen.md#e1-조립-단위-scaling과-실제-global-제약](../../docs/mitc4-shell-feast-eigen/formulation.md#formulation-eigen--e1-조립-단위-scaling과-실제-global-제약).
|
|
논리 case의 전체 parameter/threshold/음성 inventory는 NR 원문과 [verification mapping](../../docs/mitc4-shell-feast-eigen/development-notes.md#실패와-재발-방지)을 함께 적용한다.
|
|
|
|
## Owned paths
|
|
|
|
다음 목록은 phase index `owned_paths`와 exact equality를 유지한다. 목록 밖 파일이 필요하면 보존하고 Coordinator에 반환한다. 다른 agent도 같은 worktree를 사용하므로 타인 변경을 되돌리지 않는다.
|
|
|
|
```json
|
|
[
|
|
"include/fesa/elements/mitc4_shell.h",
|
|
"src/fesa/elements/mitc4_shell_mass.cpp",
|
|
"tests/unit/elements/mitc4_shell_test.cpp",
|
|
"tests/unit/elements/mitc4_shell_mass_test.cpp",
|
|
"src/fesa/CMakeLists.txt",
|
|
"tests/CMakeLists.txt",
|
|
"include/fesa/elements/element_factory.h",
|
|
"src/fesa/elements/element_factory.cpp",
|
|
"include/fesa/assembly/shell_mass_assembler.h",
|
|
"src/fesa/assembly/shell_mass_assembler.cpp",
|
|
"tests/unit/elements/element_factory_test.cpp",
|
|
"tests/unit/assembly/shell_mass_assembler_test.cpp",
|
|
"docs/mitc4-shell-feast-eigen/implementation-step2-evidence.md"
|
|
]
|
|
```
|
|
|
|
## 같은 session의 behavior별 TDD
|
|
|
|
각 소단위는 아래 순서로 RED→observed failure→minimal GREEN→focused VERIFY를 완료한다. 마지막 소단위 뒤 full VERIFY를 한 번 수행하고 등록 Stop의 정상 전체검증도 받는다. Missing API의 정확한 compile/link failure는 RED일 수 있으나 configure/dependency 오류는 RED가 아니다. 이미 통과한 test를 새 RED라고 보고하지 않는다.
|
|
|
|
### 1. 27점 consistent scalar moments와 물리 관성
|
|
|
|
Symbols: `Mitc4ConsistentMass; Mitc4Shell::ConsistentMass(double density); fixed 3x3x3 mass quadrature`.
|
|
|
|
**RED:** Flat4x2 rho3 t1/2의 exact C0/C1/C2, 24-matrix energy 및 physical20 positive rank/null을 검사해 API 부재 failure를 관찰한다. Rational warped/director-varying fixture는 NR의 exact coefficient/row oracle를 test-local 독립 polynomial integration 또는 5-point direct particle integration으로 구성한다. Production ShapeFunctions/EvaluateGeometry 재호출 oracle는 금지한다. 강제 C1=0/2-point/flat C2 mutation은 오류를 검출해야 한다.
|
|
|
|
**Minimal GREEN:** Mitc4Shell의 기존 geometry evaluator를 같은 sign/원형상으로 27점에 적용하는 member 구현을 새 cpp에 둔다. M5의 C0/C1/C2 snapshot과 consistent24를 먼저 완성·검증해 반환한다. Quadrature loop 순서/finite/positive geometry와 rho 검사는 계약대로 한다. 5/6을 mass에 곱하거나 곡면 odd coupling을 생략하지 않는다. Lumped/FEAST/global dense MC는 이 단계에 넣지 않는다.
|
|
|
|
**Focused VERIFY:** 아래 regex 중 해당 suite를 먼저 discovery하여 tests>0을 확인하고 같은 test를 재실행한다. Exact exit와 실패 이유를 behavior별로 기록한다.
|
|
|
|
### 2. Moment 유도 lumping과 deterministic nodal 조립
|
|
|
|
Symbols: `Mitc4LumpedMass; DeriveLumpedMass(consistent snapshot, directors); ElementFactory::CreateMitc4Shell; ShellMassAssembler::Assemble`.
|
|
|
|
**RED:** C1/C2 symmetric perturbation을 consistent snapshot에 주어 derived block도 독립 integral대로 변하는지 먼저 실패시킨다. m/h/j positivity·central variance·rank5·drill null·spatial centroid와 Jensen work를 검사한다. m=1,2,4 grid의 velocity(x,0,0)에서 MC work4/3, difference8/(3m²)를 독립 기대값으로 사용한다. Two-rho/t patch의 source/scatter 및 parallel scheduling permutations를 검사한다.
|
|
|
|
**Minimal GREEN:** M6/M7의 scalar moment row-sum으로 nodal6 blocks를 만든다. 원 snapshot을 덮어쓰지 않는다. Typed factory 생성 경계에서 generic Element 생성과 동일 검증·runtime layout을 재사용하고 solver consumer의 downcast/type switch를 추가하지 않는다. Mass assembler는 DOF owner의 scatter로 index-owned contributions를 stable source order로 reduce한다. K는 기존 SparseAssembler/ElementView 경로를 재사용한다. Source/section/material별 rho·t 및 nodal incident kd 합을 보존한다.
|
|
|
|
**Focused VERIFY:** 아래 regex 중 해당 suite를 먼저 discovery하여 tests>0을 확인하고 같은 test를 재실행한다. Exact exit와 실패 이유를 behavior별로 기록한다.
|
|
|
|
## Focused 명령
|
|
|
|
Workspace root의 PowerShell에서 실행한다. 초기 missing API RED라면 build의 expected failure를 기록하고 production 구현 후 같은 명령을 다시 실행한다.
|
|
|
|
```powershell
|
|
$env:CMAKE_BUILD_PARALLEL_LEVEL = '1'
|
|
cmake --preset mfe-workspace-msvc-ninja-debug
|
|
cmake --build --preset mfe-workspace-msvc-ninja-debug --target fesa_tests
|
|
ctest --preset mfe-workspace-msvc-ninja-debug -R '^(Mitc4ShellMass|Mitc4ShellKinematics|Mitc4ShellKernel|ElementFactory|ShellMassAssembler|SparseAssembler)\.' --show-only=json-v1
|
|
ctest --preset mfe-workspace-msvc-ninja-debug -R '^(Mitc4ShellMass|Mitc4ShellKinematics|Mitc4ShellKernel|ElementFactory|ShellMassAssembler|SparseAssembler)\.' --output-on-failure
|
|
```
|
|
|
|
Configure exit는 항상0이어야 한다. GREEN에서는 위 모든 exit0, discovered selected tests>0, failures0이어야 한다. 각 호출의 `$LASTEXITCODE`를 즉시 기록하고 실패 뒤 후속 명령으로 덮어쓰지 않는다.
|
|
|
|
|
|
### 필수 신규 test discovery inventory
|
|
|
|
- `Mitc4ShellMass.MfeC01FlatMomentOracle`
|
|
- `Mitc4ShellMass.MfeC02CurvedParticleOracle`
|
|
- `Mitc4ShellMass.MfeC03DerivedSnapshotAndJensen`
|
|
- `ShellMassAssembler.MfeC04RefinementEnergy`
|
|
- `Mitc4ShellMass.MfeC05RotatedMassAndCentroid`
|
|
- `ShellMassAssembler.MfeC06SourceAndParallelOrder`
|
|
- `Mitc4ShellMass.MfeC07InvalidMassGeometry`
|
|
|
|
위 이름 모두를 focused 및 full discovery JSON의 `tests[].name`에서 확인한다. Parameterized 전개가 필요하면 원 obligation→실제 discovered 이름을 evidence에 명시하고 모든 전개 case를 실행한다. 단지 selected count>0이거나 기존 suite만 존재하는 것은 실패다. V2의 해당 독립 oracle/mutation과 이 Step의 behavior assertions를 실제 구현해 각 결과를 기록한다.
|
|
|
|
## Full VERIFY
|
|
|
|
현재 backend는 local user preset `mfe-workspace-msvc-ninja-debug`/MSVC x64 Debug다. 이 Step의 명령을 직접 실행하며 local config/preset과 다른 graph로 fallback하지 않는다.
|
|
|
|
```powershell
|
|
$env:CMAKE_BUILD_PARALLEL_LEVEL = '1'
|
|
cmake --preset mfe-workspace-msvc-ninja-debug
|
|
if ($LASTEXITCODE -ne 0) { throw 'configure failed' }
|
|
cmake --build --preset mfe-workspace-msvc-ninja-debug
|
|
if ($LASTEXITCODE -ne 0) { throw 'build failed' }
|
|
ctest --preset mfe-workspace-msvc-ninja-debug --show-only=json-v1
|
|
if ($LASTEXITCODE -ne 0) { throw 'discovery failed' }
|
|
ctest --preset mfe-workspace-msvc-ninja-debug --output-on-failure
|
|
if ($LASTEXITCODE -ne 0) { throw 'full CTest failed' }
|
|
$mfePython = Join-Path (Get-Location).Path '.harness/build/mitc4-eigen-evidence/prep/classifier-correction/pytest-venv/Scripts/python.exe'
|
|
$mfePytestCache = Join-Path (Get-Location).Path '.harness/build/mitc4-eigen-evidence/prep/classifier-correction/pytest-cache'
|
|
$mfePytestBase = Join-Path (Get-Location).Path ('.harness/build/p-' + [guid]::NewGuid().ToString('N').Substring(0,8))
|
|
if ($mfePytestBase.Length -gt 80 -or (Test-Path -LiteralPath $mfePytestBase)) { throw 'Fresh short pytest basetemp required' }
|
|
& $mfePython -B -X utf8 -m pytest -v -rs -o "cache_dir=$mfePytestCache" "--basetemp=$mfePytestBase"
|
|
if ($LASTEXITCODE -ne 0) { throw 'full pytest failed' }
|
|
```
|
|
|
|
전체 discovery의 test count와 실제 실행 count를 대조하고 skipped/missing/unobserved를 성공으로 합치지 않는다. 기존 target의 `/W4 /WX`를 유지하고 새 compiler/link warning0을 확인한다. 등록 Stop의 전체 검증은 그대로 수행되며 수동 hook 실행·state/reentry 조작으로 대체하지 않는다. Step 2에서 영향받는 C++ binary가 바뀌면 기존 reference helper의 cache 재사용 여부와 실제 solve 호출을 구분한다. 최종 fresh portfolio의 권위는 Step 7이다.
|
|
|
|
## Evidence와 종료
|
|
|
|
- `docs/mitc4-shell-feast-eigen/implementation-step2-evidence.md`
|
|
|
|
이 Step의 evidence에는 Feature/owner/r2, exact owned changed paths, RED→GREEN 명령·actual exits·기간·핵심 수치, focused/full counts, MSVC/x64/Debug/dependency/runtime selection, warning 수, upstream case/requirement 연결, 미실행 및 residual risk를 기록한다. Raw logs는 Git ignored `.harness/build/mitc4-eigen-evidence/step2/`에 보존한다. 각 CTest 호출 직후 해당 `Testing/Temporary/LastTest.log`를 고유 RED/focused/full 이름으로 복사하여 이후 Stop 로그와 섞지 않는다. Binary/reference/result hash와 run freshness는 적용되는 경우 기록한다.
|
|
|
|
|
|
보고서 작성 시점에는 마지막 registered Stop/Codex exit가 아직 발생하지 않을 수 있다. Implementation은 실제 완료된 manual 검증과 미관찰 Stop을 구분하고 미래 성공을 선기록하지 않는다. `completed` payload는 그 자체로 Stop 성공 증거가 아니다. Executor 종료 뒤 Coordinator가 raw output·등록 Hook evidence·actual exit를 management 문서에서 사후 감사한다. Specialist 보고서 본문은 Coordinator가 대신 수정하지 않는다.
|
|
|
|
Manual AC가 성공하면 Executor가 허용한 `phases/mitc4-shell-feast-eigen/index.json`의 **현재 Step 2만** `status=completed`와 비어 있지 않은 `summary`를 기록한다. 구현/검증 실패는 `error/error_message`, 환경·필수 준비 차단은 `blocked/blocked_reason`이다. `owned_paths`, 이름/번호, 다른 Step/top index, timestamp, attempt_history는 수정하지 않는다. `step2-output.json`은 Executor 생성 기록이며 ignored 상태를 유지한다. 마지막 응답은 공통 handoff envelope다. Phase 전체 또는 workflow gate의 자기 승인은 하지 않는다.
|
|
|
|
## 제외와 중단 조건
|
|
|
|
Physics/formulation/I/O/tolerance/원본 reference·기존 feature 보고서 변경, 외부 solver, spectrum fitting, eigen 외부 vector/frequency/stress gate, sparse rank cutoff, sandbox 확대, retry-budget 변경, Git branch/commit/push/tag/release는 소유 범위 밖이다. 명백한 구현 결함은 이 exact scope 안에서 최소 수정한다. 계약 결함은 정확한 owner로 `return-upstream`, 실행 환경 실패는 actual command/exit와 함께 Coordinator로 반환한다. 동일 실패를 transport timeout으로 가장하거나 evidence를 지우고 재실행하지 않는다.
|