]> Piment Noir Git Repositories - freqai-strategies.git/commitdiff
docs(ReforceXY): update tests documentation
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Wed, 24 Dec 2025 22:53:18 +0000 (23:53 +0100)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Wed, 24 Dec 2025 22:53:18 +0000 (23:53 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
ReforceXY/reward_space_analysis/tests/README.md
ReforceXY/reward_space_analysis/tests/components/test_reward_components.py
ReforceXY/reward_space_analysis/tests/integration/test_reward_calculation.py
ReforceXY/reward_space_analysis/tests/pbrs/test_pbrs.py
ReforceXY/reward_space_analysis/tests/statistics/test_statistics.py

index 486fb158123863038b214311f00e8c0b3331f4b6..71645e7bfd19d6bdd75ed13deaa79389ce88af23 100644 (file)
@@ -175,31 +175,31 @@ Columns:
 - Notes: Clarifications (sub-modes, extensions, non-owning references elsewhere,
   line clusters for multi-path coverage).
 
-| ID                                           | Category    | Description                                                                         | Owning File                               | Notes                                                                                                                       |
-| -------------------------------------------- | ----------- | ----------------------------------------------------------------------------------- | ----------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
-| report-abs-shaping-line-091                  | integration | Abs Σ Shaping Reward line present & formatted                                       | integration/test_report_formatting.py:4   | Module docstring; primary test at line 84. PBRS report may render line; formatting owned here (core assertion lines 84–103) |
-| report-additives-deterministic-092           | components  | Additives deterministic report section                                              | components/test_additives.py:4            | Integration/PBRS may reference outcome non-owning                                                                           |
-| robustness-decomposition-integrity-101       | robustness  | Single active core component equals total reward under mutually exclusive scenarios | robustness/test_robustness.py:36          | Scenarios: idle, hold, exit, invalid; non-owning refs integration/test_reward_calculation.py                                |
-| robustness-exit-mode-fallback-102            | robustness  | Unknown exit_attenuation_mode falls back to linear w/ warning                       | robustness/test_robustness.py:525         | Comment line (function at :526)                                                                                             |
-| robustness-negative-grace-clamp-103          | robustness  | Negative exit_plateau_grace clamps to 0.0 w/ warning                                | robustness/test_robustness.py:555         |                                                                                                                             |
-| robustness-invalid-power-tau-104             | robustness  | Invalid power tau falls back alpha=1.0 w/ warning                                   | robustness/test_robustness.py:592         |                                                                                                                             |
-| robustness-near-zero-half-life-105           | robustness  | Near-zero half life yields no attenuation (factor≈base)                             | robustness/test_robustness.py:621         |                                                                                                                             |
-| pbrs-canonical-exit-semantic-106             | pbrs        | Canonical exit uses shaping=-prev_potential and next_potential=0.0                  | pbrs/test_pbrs.py:449                     | Uses stored potential across steps; no drift correction applied                                                             |
-| pbrs-canonical-near-zero-report-116          | pbrs        | Canonical near-zero cumulative shaping classification                               | pbrs/test_pbrs.py:748                     | Full report classification                                                                                                  |
-| statistics-partial-deps-skip-107             | statistics  | skip_partial_dependence => empty PD structures                                      | statistics/test_statistics.py:28          | Docstring line                                                                                                              |
-| helpers-duplicate-rows-drop-108              | helpers     | Duplicate rows dropped w/ warning counting removals                                 | helpers/test_utilities.py:26              | Docstring line                                                                                                              |
-| helpers-missing-cols-fill-109                | helpers     | Missing required columns filled with NaN + single warning                           | helpers/test_utilities.py:50              | Docstring line                                                                                                              |
-| statistics-binned-stats-min-edges-110        | statistics  | <2 bin edges raises ValueError                                                      | statistics/test_statistics.py:45          | Docstring line                                                                                                              |
-| statistics-constant-cols-exclusion-111       | statistics  | Constant columns excluded & listed                                                  | statistics/test_statistics.py:57          | Docstring line                                                                                                              |
-| statistics-degenerate-distribution-shift-112 | statistics  | Degenerate dist: zero shift metrics & KS p=1.0                                      | statistics/test_statistics.py:74          | Docstring line                                                                                                              |
-| statistics-constant-dist-widened-ci-113a     | statistics  | Non-strict: widened CI with warning                                                 | statistics/test_statistics.py:533         | Test docstring labels "Invariant 113 (non-strict)"                                                                          |
-| statistics-constant-dist-strict-omit-113b    | statistics  | Strict: omit metrics (no widened CI)                                                | statistics/test_statistics.py:565         | Test docstring labels "Invariant 113 (strict)"                                                                              |
-| statistics-fallback-diagnostics-115          | statistics  | Fallback diagnostics constant distribution (qq_r2=1.0 etc.)                         | statistics/test_statistics.py:190         | Docstring line                                                                                                              |
-| robustness-exit-pnl-only-117                 | robustness  | Only exit actions have non-zero PnL                                                 | robustness/test_robustness.py:126         | Newly assigned ID                                                                                                           |
-| pbrs-absence-shift-placeholder-118           | pbrs        | Placeholder shift line present (absence displayed)                                  | pbrs/test_pbrs.py:979                     | Ensures placeholder appears when shaping shift absent                                                                       |
-| components-pbrs-breakdown-fields-119         | components  | PBRS breakdown fields finite and mathematically aligned                             | components/test_reward_components.py:454  | Tests base_reward, pbrs_delta, invariance_correction fields and their alignment                                             |
-| integration-pbrs-metrics-section-120         | integration | PBRS Metrics section present in report with tracing metrics                         | integration/test_report_formatting.py:156 | Verifies PBRS Metrics (Tracing) subsection rendering in statistical_analysis.md                                             |
-| cli-pbrs-csv-columns-121                     | cli         | PBRS columns in reward_samples.csv when shaping enabled                             | cli/test_cli_params_and_csv.py:240        | Ensures reward_base, reward_pbrs_delta, reward_invariance_correction columns exist and contain finite values                |
+| ID                                           | Category    | Description                                                                         | Owning File                               | Notes                                                                                                        |
+| -------------------------------------------- | ----------- | ----------------------------------------------------------------------------------- | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
+| report-abs-shaping-line-091                  | integration | Abs Σ Shaping Reward line present & formatted                                       | integration/test_report_formatting.py:4   | Module docstring; primary test at line 95. PBRS report may render line; formatting owned here                |
+| report-additives-deterministic-092           | components  | Additives deterministic report section                                              | components/test_additives.py:4            | Integration/PBRS may reference outcome non-owning                                                            |
+| robustness-decomposition-integrity-101       | robustness  | Single active core component equals total reward under mutually exclusive scenarios | robustness/test_robustness.py:43          | Scenarios: idle, hold, exit, invalid; non-owning refs integration/test_reward_calculation.py                 |
+| robustness-exit-mode-fallback-102            | robustness  | Unknown exit_attenuation_mode falls back to linear w/ warning                       | robustness/test_robustness.py:660         | Comment line (function at :661)                                                                              |
+| robustness-negative-grace-clamp-103          | robustness  | Negative exit_plateau_grace clamps to 0.0 w/ warning                                | robustness/test_robustness.py:702         |                                                                                                              |
+| robustness-invalid-power-tau-104             | robustness  | Invalid power tau falls back alpha=1.0 w/ warning                                   | robustness/test_robustness.py:753         |                                                                                                              |
+| robustness-near-zero-half-life-105           | robustness  | Near-zero half life yields no attenuation (factor≈base)                             | robustness/test_robustness.py:798         |                                                                                                              |
+| pbrs-canonical-exit-semantic-106             | pbrs        | Canonical exit uses shaping=-prev_potential and next_potential=0.0                  | pbrs/test_pbrs.py:372                     | Uses stored potential across steps; no drift correction applied                                              |
+| pbrs-canonical-near-zero-report-116          | pbrs        | Canonical near-zero cumulative shaping classification                               | pbrs/test_pbrs.py:1214                    | Full report classification                                                                                   |
+| statistics-partial-deps-skip-107             | statistics  | skip_partial_dependence => empty PD structures                                      | statistics/test_statistics.py:42          | Docstring line                                                                                               |
+| helpers-duplicate-rows-drop-108              | helpers     | Duplicate rows dropped w/ warning counting removals                                 | helpers/test_utilities.py:27              | Docstring line                                                                                               |
+| helpers-missing-cols-fill-109                | helpers     | Missing required columns filled with NaN + single warning                           | helpers/test_utilities.py:51              | Docstring line                                                                                               |
+| statistics-binned-stats-min-edges-110        | statistics  | <2 bin edges raises ValueError                                                      | statistics/test_statistics.py:57          | Docstring line                                                                                               |
+| statistics-constant-cols-exclusion-111       | statistics  | Constant columns excluded & listed                                                  | statistics/test_statistics.py:68          | Docstring line                                                                                               |
+| statistics-degenerate-distribution-shift-112 | statistics  | Degenerate dist: zero shift metrics & KS p=1.0                                      | statistics/test_statistics.py:84          | Docstring line                                                                                               |
+| statistics-constant-dist-widened-ci-113a     | statistics  | Non-strict: widened CI with warning                                                 | statistics/test_statistics.py:543         | Test docstring labels "Invariant 113 (non-strict)"                                                           |
+| statistics-constant-dist-strict-omit-113b    | statistics  | Strict: omit metrics (no widened CI)                                                | statistics/test_statistics.py:575         | Test docstring labels "Invariant 113 (strict)"                                                               |
+| statistics-fallback-diagnostics-115          | statistics  | Fallback diagnostics constant distribution (qq_r2=1.0 etc.)                         | statistics/test_statistics.py:190         | Docstring line                                                                                               |
+| robustness-exit-pnl-only-117                 | robustness  | Only exit actions have non-zero PnL                                                 | robustness/test_robustness.py:127         | Comment line                                                                                                 |
+| pbrs-absence-shift-placeholder-118           | pbrs        | Placeholder shift line present (absence displayed)                                  | pbrs/test_pbrs.py:1514                    | Ensures placeholder appears when shaping shift absent                                                        |
+| components-pbrs-breakdown-fields-119         | components  | PBRS breakdown fields finite and mathematically aligned                             | components/test_reward_components.py:696  | Tests base_reward, pbrs_delta, invariance_correction fields and their alignment                              |
+| integration-pbrs-metrics-section-120         | integration | PBRS Metrics section present in report with tracing metrics                         | integration/test_report_formatting.py:160 | Verifies PBRS Metrics (Tracing) subsection rendering in statistical_analysis.md                              |
+| cli-pbrs-csv-columns-121                     | cli         | PBRS columns in reward_samples.csv when shaping enabled                             | cli/test_cli_params_and_csv.py:238        | Ensures reward_base, reward_pbrs_delta, reward_invariance_correction columns exist and contain finite values |
 
 ### Non-Owning Smoke / Reference Checks
 
@@ -214,15 +214,15 @@ Table tracks approximate line ranges and source ownership:
 
 | File                                   | Lines (approx) | References                                               | Ownership Source                                                    |
 | -------------------------------------- | -------------- | -------------------------------------------------------- | ------------------------------------------------------------------- |
-| integration/test_reward_calculation.py | 15-22          | Decomposition identity (sum components)                  | robustness/test_robustness.py:36                                    |
-| components/test_reward_components.py   | 212-242        | Exit factor finiteness & plateau behavior                | robustness/test_robustness.py:156+                                  |
-| pbrs/test_pbrs.py                      | 591-630        | Canonical vs non-canonical classification formatting     | robustness/test_robustness.py:36, robustness/test_robustness.py:126 |
-| pbrs/test_pbrs.py                      | 616,624,799    | Abs Σ Shaping Reward line formatting                     | integration/test_report_formatting.py:84-103                        |
-| pbrs/test_pbrs.py                      | 742-806        | Canonical near-zero cumulative shaping classification    | robustness/test_robustness.py:36                                    |
-| pbrs/test_pbrs.py                      | 807-860        | Canonical warning classification (Σ shaping > tolerance) | robustness/test_robustness.py:36                                    |
-| pbrs/test_pbrs.py                      | 861-915        | Non-canonical full report reason aggregation             | robustness/test_robustness.py:36                                    |
-| pbrs/test_pbrs.py                      | 916-969        | Non-canonical mode-only reason (additives disabled)      | robustness/test_robustness.py:36                                    |
-| statistics/test_statistics.py          | 292            | Mean decomposition consistency                           | robustness/test_robustness.py:36                                    |
+| integration/test_reward_calculation.py | 35             | Decomposition identity (sum components)                  | robustness/test_robustness.py:43                                    |
+| components/test_reward_components.py   | 472            | Exit factor finiteness & plateau behavior                | robustness/test_robustness.py:43+                                   |
+| pbrs/test_pbrs.py                      | 1048           | Canonical vs non-canonical classification formatting     | robustness/test_robustness.py:43, robustness/test_robustness.py:127 |
+| pbrs/test_pbrs.py                      | 1213,1283,1406 | Abs Σ Shaping Reward line formatting                     | integration/test_report_formatting.py:95                            |
+| pbrs/test_pbrs.py                      | 1213           | Canonical near-zero cumulative shaping classification    | robustness/test_robustness.py:43                                    |
+| pbrs/test_pbrs.py                      | 1283           | Canonical warning classification (Σ shaping > tolerance) | robustness/test_robustness.py:43                                    |
+| pbrs/test_pbrs.py                      | 1406           | Non-canonical full report reason aggregation             | robustness/test_robustness.py:43                                    |
+| pbrs/test_pbrs.py                      | 1460           | Non-canonical mode-only reason (additives disabled)      | robustness/test_robustness.py:43                                    |
+| statistics/test_statistics.py          | 296            | Mean decomposition consistency                           | robustness/test_robustness.py:43                                    |
 
 ### Deprecated / Reserved IDs
 
index 9275625addf29b4e476d6ea3d6022c28866a8e80..416a3912678fe56d1867a9dc3123b14997ef535d 100644 (file)
@@ -469,7 +469,7 @@ class TestRewardComponents(RewardSpaceTestBase):
     def test_exit_factor_calculation(self):
         """Exit factor calculation smoke test across attenuation modes.
 
-        Non-owning smoke test; ownership: robustness/test_robustness.py:35
+        Non-owning smoke test; ownership: robustness/test_robustness.py:43
 
         Verifies:
         - Exit factors are finite and positive (linear, power modes)
index cf536114663d7994885ac75eee04e753ce8d0dc9..01e80d7d02342c190def2aec1554f17d1f4fbf90 100644 (file)
@@ -32,7 +32,7 @@ class TestRewardCalculation(RewardSpaceTestBase):
     ):
         """Smoke: each primary component activates in a representative scenario.
 
-        # Non-owning smoke; ownership: robustness/test_robustness.py:35 (robustness-decomposition-integrity-101)
+        # Non-owning smoke; ownership: robustness/test_robustness.py:43 (robustness-decomposition-integrity-101)
         Detailed progressive / boundary / proportional invariants are NOT asserted here.
         We only check sign / non-zero activation plus total decomposition identity.
         """
index c861270cd4035f624cbe65eda69b3662c6f57c28..caede000edf17f24ebed65ca76e3158b5f785d35 100644 (file)
@@ -1045,7 +1045,7 @@ class TestPBRS(RewardSpaceTestBase):
 
     # ---------------- Report classification / formatting ---------------- #
 
-    # Non-owning smoke; ownership: robustness/test_robustness.py:35 (robustness-decomposition-integrity-101), robustness/test_robustness.py:125 (robustness-exit-pnl-only-117)
+    # Non-owning smoke; ownership: robustness/test_robustness.py:43 (robustness-decomposition-integrity-101), robustness/test_robustness.py:127 (robustness-exit-pnl-only-117)
     @pytest.mark.smoke
     def test_pbrs_non_canonical_report_generation(self):
         """Synthetic invariance section: Non-canonical classification formatting."""
@@ -1210,7 +1210,7 @@ class TestPBRS(RewardSpaceTestBase):
             f"Expected non-zero shaping (got {shaping_sum})",
         )
 
-    # Non-owning smoke; ownership: robustness/test_robustness.py:35 (robustness-decomposition-integrity-101)
+    # Non-owning smoke; ownership: robustness/test_robustness.py:43 (robustness-decomposition-integrity-101)
     # Owns invariant: pbrs-canonical-near-zero-report-116
     @pytest.mark.smoke
     def test_pbrs_canonical_near_zero_report(self):
@@ -1280,7 +1280,7 @@ class TestPBRS(RewardSpaceTestBase):
             )
         self.assertIn("max|correction|≈0", content)
 
-    # Non-owning smoke; ownership: robustness/test_robustness.py:35 (robustness-decomposition-integrity-101)
+    # Non-owning smoke; ownership: robustness/test_robustness.py:43 (robustness-decomposition-integrity-101)
     @pytest.mark.smoke
     def test_pbrs_canonical_suppresses_additives_in_report(self):
         """Canonical exit mode suppresses additives for classification.
@@ -1403,7 +1403,7 @@ class TestPBRS(RewardSpaceTestBase):
         expected_corr_fragment = f"{max_abs_corr:.6e}"
         self.assertIn(expected_corr_fragment, content)
 
-    # Non-owning smoke; ownership: robustness/test_robustness.py:35 (robustness-decomposition-integrity-101)
+    # Non-owning smoke; ownership: robustness/test_robustness.py:43 (robustness-decomposition-integrity-101)
     @pytest.mark.smoke
     def test_pbrs_non_canonical_full_report_reason_aggregation(self):
         """Full report: Non-canonical classification aggregates mode + additives reasons."""
@@ -1457,7 +1457,7 @@ class TestPBRS(RewardSpaceTestBase):
         )
         self.assertIn("exit_potential_mode='progressive_release'", content)
 
-    # Non-owning smoke; ownership: robustness/test_robustness.py:35 (robustness-decomposition-integrity-101)
+    # Non-owning smoke; ownership: robustness/test_robustness.py:43 (robustness-decomposition-integrity-101)
     @pytest.mark.smoke
     def test_pbrs_non_canonical_mode_only_reason(self):
         """Non-canonical exit mode with additives disabled -> reason excludes additive list."""
index 2e1d830bd75cbbfdbe1b872992b89f83e4f5f7f7..41e9899d3b7d4a3280c95d0de293c97fab3d01bd 100644 (file)
@@ -293,7 +293,7 @@ class TestStatistics(RewardSpaceTestBase):
                     f"Expected near-zero divergence after equal scaling (k={k}, v={v})",
                 )
 
-    # Non-owning smoke; ownership: robustness/test_robustness.py:35 (robustness-decomposition-integrity-101)
+    # Non-owning smoke; ownership: robustness/test_robustness.py:43 (robustness-decomposition-integrity-101)
     @pytest.mark.smoke
     def test_stats_mean_decomposition_consistency(self):
         """Batch mean additivity."""