Update project structure and configurations
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# Story 5.4: Multi-Variable Control
|
||||
|
||||
Status: in-progress
|
||||
Status: done
|
||||
|
||||
<!-- Note: Validation is optional. Run validate-create-story for quality check before dev-story. -->
|
||||
|
||||
@@ -232,3 +232,38 @@ z-ai/glm-5:free
|
||||
- [ ] **AC #4 Validation**: `test_multi_variable_control_with_real_components` is ignored - needs real thermodynamic components
|
||||
- [ ] **Configurable Epsilon**: `FINITE_DIFF_EPSILON` should be configurable via `InverseControlConfig`
|
||||
- [ ] **Real Thermodynamics**: Mock MIMO coefficients (10.0, 2.0) should be replaced with actual component physics when fluid backend integration is complete
|
||||
|
||||
### Review Findings (2026-04-25)
|
||||
|
||||
- [x] [Review][Defer] Calibration index detection uses fragile string matching — Decision: ajouter `calibration_type` explicite à `BoundedVariable` (Option B), mais nécessite mise à jour PRD/epics/stories + tous les composants. Différé: créer une story dédiée pour ce refactoring transverse. [system.rs:~379-390]
|
||||
- [x] [Review][Patch] Renommer `test_newton_raphson_reduces_residuals_for_mimo` pour refléter qu'il teste la structure, pas la convergence + ajouter des tests structurels supplémentaires. Decision: le test actuel ne vérifie pas la convergence réelle, renommer + ajouter tests Jacobian dense block et structure MIMO. [inverse_control.rs:~692-830] — Fixed 2026-04-26: renamed + 3 structural tests added
|
||||
- [x] [Review][Patch] `from_json_string` silently returns empty `System::new()` regardless of input — callers get `Ok(empty_system)` instead of an error. Should return an explicit "not yet implemented" error. [system.rs:~2083-2111] — Fixed 2026-04-26: returns DeserializationError
|
||||
- [x] [Review][Patch] `to_json_string` builds edges Vec then discards it (`edges: vec![]`) — topology is always serialized as empty, breaking round-trip. [system.rs:~2034-2061] — Fixed 2026-04-26: edges serialized, unique keys via registered names
|
||||
- [x] [Review][Patch] `compute_constraint_residuals` silently drops residuals when slice is too small, returns inflated count — solver sees stale zeros as satisfied constraints. [system.rs:~870-876] — Fixed 2026-04-26: assert! on slice length
|
||||
- [x] [Review][Patch] Potential panic: `compute_inverse_control_jacobian` indexes `control_mut[j]` without bounds check — if `control_values.len() < mapping_count()`, index out of bounds. [system.rs:~1080] — Fixed 2026-04-26: early return with error log
|
||||
- [x] [Review][Patch] Potential panic: `compute_inverse_control_jacobian` indexes `state_mut[col]` — if `state` slice is shorter than `total_state_len`, index out of bounds. [system.rs:~1053/1095] — Fixed 2026-04-26: debug_assert added
|
||||
- [x] [Review][Patch] Silent data loss: constraint referencing unregistered component produces `residual = 0.0` (measured defaults to target) — solver thinks constraint is satisfied when it isn't. [system.rs:~925-1010, 860-869] — Fixed 2026-04-26: fallback returns target + 1e6, error log
|
||||
- [x] [Review][Patch] NaN propagation: `extract_constraint_values_with_controls` propagates NaN from diverging solver without check — `clip_step` cannot recover. [system.rs:~947] — Fixed 2026-04-26: NaN check + skip insert
|
||||
- [x] [Review][Patch] `to_json_string` uses `component.signature()` as HashMap key — duplicate components with same signature lose data on serialization. [system.rs:~2048-2054] — Fixed 2026-04-26: uses registered component names as keys
|
||||
- [x] [Review][Patch] `test_newton_raphson_reduces_residuals_for_mimo` hardcodes 4-element state — would panic if components had non-zero `internal_state_len`. [inverse_control.rs:~747] — Fixed 2026-04-26: dynamic state_len sizing
|
||||
- [x] [Review][Patch] `set_finite_diff_epsilon` panics on non-positive epsilon and accepts `f64::INFINITY` — should validate finite range and return `Result`. [embedding.rs:~232] — Fixed 2026-04-26: validates (0, 1] range
|
||||
- [x] [Review][Patch] Redundant `|| id_str == "f_m"` after `ends_with("f_m")` — exact match is always covered by `ends_with`. Same for f_dp, f_ua, f_power, f_etav. [system.rs:~379-390] — Fixed 2026-04-26
|
||||
- [x] [Review][Defer] CircuitId type u8→u16 migration — intentional type unification with `entropyk_core`, validation exists in `add_component`. Deferred: pre-existing migration. [system.rs:~30, ~56]
|
||||
- [x] [Review][Defer] Performance: HashMap allocation per finite-difference evaluation — optimization opportunity, not a correctness bug. Deferred: can be addressed in performance pass.
|
||||
- [x] [Review][Defer] Performance: O(N·M·K) Jacobian complexity — acceptable for current constraint counts (2-3), documented. Deferred: revisit if scaling becomes an issue.
|
||||
- [x] [Review][Defer] `state_vector_len()` semantics changed from `2*edge_count` to `total_state_len` — intentional, internally consistent. Deferred: audit external callers separately.
|
||||
- [x] [Review][Defer] `std::any::type_name_of_val` potentially nightly-only — project compiles, likely stabilized or behind feature gate. Deferred: verify compilation target.
|
||||
- [x] [Review][Defer] Mock physics not isolated behind trait/feature flag — acknowledged technical debt, tracked in story. Deferred: architectural decision for fluid backend integration.
|
||||
- [x] [Review][Defer] Scope creep: Story 5.5 calibration, JSON serialization, energy balance code mixed in diff — already committed in batch. Deferred: track separately.
|
||||
- [x] [Review][Defer] `expect()` on trait object in `component()` — pre-existing pattern consistent with codebase. Deferred: not introduced by this story.
|
||||
- [x] [Review][Defer] AC#4 not testable — requires real thermodynamic components. Deferred: tracked in story, `#[ignore]` test placeholder exists.
|
||||
|
||||
### Review Findings (2026-04-26)
|
||||
|
||||
- [x] [Review][Patch] Fallback residual `target + 1e6` is not scale-aware — for large targets (e.g. pressure in Pa ~ 1e7), the 1e6 offset may not produce a residual large enough to prevent false convergence. Decision: retourner une erreur explicite au lieu du fallback (configuration invalide = bug appelant). [system.rs:~870] — Fixed 2026-04-26: returns ConstraintError::UnmeasuredConstraint
|
||||
- [x] [Review][Patch] `assert!` in production paths violates zero-panic policy — `set_finite_diff_epsilon` (embedding.rs:~232) and `compute_constraint_residuals` (system.rs:~875) use `assert!` which panics at runtime. Decision: convertir en `Result<_, ConstraintError>`. [embedding.rs:~232, system.rs:~875] — Fixed 2026-04-26: returns Result<_, ConstraintError>
|
||||
- [x] [Review][Patch] Destructuring bug in `test_mimo_cross_derivatives_have_consistent_signs` — `.filter(|&(col, _, _)| col >= control_offset)` names the first tuple element `col` but Jacobian entries are `(row, col, val)`, so it filters on row instead of column. Test silently passes without actually testing cross-derivatives. [inverse_control.rs:1081] — Fixed 2026-04-26: corrected filter to `|&(_, col, _)|`
|
||||
- [ ] [Review][Patch] Destructuring bug in `test_mimo_cross_derivatives_have_consistent_signs` — `.filter(|&(col, _, _)| col >= control_offset)` names the first tuple element `col` but Jacobian entries are `(row, col, val)`, so it filters on row instead of column. Test silently passes without actually testing cross-derivatives. [inverse_control.rs:1081]
|
||||
- [x] [Review][Defer] AC #3 gap — no actual Newton-Raphson solver loop for simultaneous multi-variable solving; only Jacobian infrastructure and mock step verification exist. Deferred: solver loop is in Story 4.2 scope.
|
||||
- [x] [Review][Defer] AC #4 integration validation — `test_multi_variable_control_with_real_components` remains `#[ignore]`. Deferred: requires real thermodynamic components.
|
||||
- [x] [Review][Defer] Hardcoded `1e-10` threshold in Jacobian entry filtering — `derivative.abs() > 1e-10` at system.rs:~1142 and ~1186 silently drops small-but-significant derivatives. Deferred: pre-existing, not introduced by this diff.
|
||||
|
||||
Reference in New Issue
Block a user