Commit 03532fc
Address CI AI review round 2: mass-point guard, rank check, R parity
P1 #1 (methodology): mse_optimal_bandwidth now rejects Design 1
mass-point designs. When boundary > 0 and the modal fraction at
d.min() exceeds the REGISTRY-specified 2% threshold, raise
NotImplementedError pointing to the 2SLS sample-average estimator
per de Chaisemartin et al. (2026) Section 3.2.4. Design 1' with
untreated units at d=0 (boundary=0) is still accepted per Garrett
et al. (2020) application precedent.
P1 #2 (code quality): qrXXinv now catches np.linalg.LinAlgError from
Cholesky and re-raises as ValueError with a targeted message naming
the failing dimension and suggesting remediation. Duplicate-support
windows or other rank-deficient designs now fail with a clear error
instead of leaking LinAlgError out of the port.
P3 (tests): Added TestStageDiagnosticsParity::test_R_parity covering
all four stages. Previously only V/B1/B2 were pinned; R (BWreg) was
only trivially checked for stage_d1 (scale=0 -> R=0). Now stage_b
and stage_h R values are explicitly parity-tested at 1% against R
nprobust.
New behavioral tests:
- test_mass_point_design_rejected: 10% mass at 0.1 -> NotImplementedError
- test_continuous_near_d_lower_accepted: uniform(0.1, 1.0) passes
- test_untreated_at_zero_accepted: 15% at d=0 with boundary=0 passes
- test_rank_deficient_design_raises_valueerror: rank-1 X -> ValueError
- R parity on all four stages across 3 DGPs (12 new parametrized cases)
169 tests pass (up from 153).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 5799d42 commit 03532fc
3 files changed
Lines changed: 116 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
125 | 133 | | |
126 | 134 | | |
127 | | - | |
128 | | - | |
129 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
130 | 148 | | |
131 | 149 | | |
132 | 150 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
633 | 633 | | |
634 | 634 | | |
635 | 635 | | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
636 | 666 | | |
637 | 667 | | |
638 | 668 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
119 | 138 | | |
120 | 139 | | |
121 | 140 | | |
| |||
303 | 322 | | |
304 | 323 | | |
305 | 324 | | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
306 | 372 | | |
307 | 373 | | |
308 | 374 | | |
| |||
0 commit comments