chore(validation): shared n_bootstrap type guards + honest_did inference-df consolidation - #804
Conversation
…solidation - Align HAD/dCDH/TROP/SyntheticDiD (jackknife lane included) and the two had_pretests floor sites onto utils.validate_n_bootstrap: type-blind values (bool ran as 1 replicate; floats floored through) now raise the shared message; every estimator floor and message unchanged. dCDH joins the v4 policy roster; floor-carrying estimators get a dedicated type-guard test class. M-081 ledger note prose + code_refs amended (no lifecycle change). - Consolidate honest_did's three duplicated inference-df precedence blocks onto aggregation.resolve_inference_df (df_survey now float-typed; fractional df_inference preserved); single-source oracle pins on the CS and dCDH branches; stale results_base docstring pointer updated.
Overall Assessment✅ Looks good Executive Summary
MethodologyNo findings. The affected methods are dCDH, HAD, SyntheticDiD, TROP, Stute pretests, and HonestDiD inference. No estimator equations, weights, SE formulas, or identification assumptions changed. Code QualityNo findings. PerformanceNo findings. MaintainabilityNo findings. Consolidating HonestDiD onto Tech DebtNo findings. The removed TODO rows are covered by the implemented validation and consolidation. SecurityNo findings. Documentation/TestsP3 — Bootstrap error-message compatibility is overstated
|
…se the shared message)
|
🔁 AI review rerun (requested by @igerber) Head SHA: Overall Assessment✅ Looks good Executive Summary
MethodologyNo findings. Affected methods: dCDH, HAD, SyntheticDiD, TROP, Stute pretests, and HonestDiD inference. Changes conform to Code QualityNo findings. PerformanceNo findings. MaintainabilityNo findings. Shared df resolution removes three duplicate implementations. Tech DebtNo findings. Completed work is removed from SecurityNo findings. Documentation/TestsNo findings. Changed Python files and the YAML ledger parse successfully. Runtime tests could not run because pytest and numerical dependencies are unavailable in the review environment. |
Summary
n_bootstraptype guards — align the estimators the M-081 sweep deliberately carved out ontoutils.validate_n_bootstrap, run BEFORE each retained floor:HeterogeneousAdoptionDiD(boolTruepreviously ran as 1 replicate),ChaisemartinDHaultfoeuille(bool + float passed the bare< 0check; the never-called_validate_invariantsmirror aligned too so the sites cannot drift),TROP(float2.5passed the>= 2floor),SyntheticDiD(guard now unconditional, closing the jackknife lane where bool/negative skipped even the floor; the pinnedjackknife + n_bootstrap=1behavior is unchanged), plus the twohad_pretests.pyfloor sites (stute_test,stute_joint_pretest— a float like999.5previously floored through tonp.empty(n_bootstrap)). Every estimator-specific floor and message is unchanged; all rejections verified by execution.M-081ledger note prose +code_refsamended in the same diff (no lifecycle change).honest_didinference-df consolidation — the three byte-identical precedence blocks (MPD/CS/dCDH branches) now call the sharedaggregation.resolve_inference_df(); same precedence (surveydf_survey→ replicate0.0sentinel →df_inferencefallback). Deliberate deltas:HonestDiDResults.df_surveyis float-typed, and a fractionaldf_inferenceis preserved instead ofint()-truncated. Theresults_base._resolve_scalar_df_surveysibling's stale docstring pointer updated (it must stay local — one-way import direction).Methodology references (required if estimator / math changes)
>= 2, SDiD>= 2unless jackknife, HAD>= 1, Stute>= 99— are unchanged, so no REGISTRY edit is needed)Validation
tests/test_v4_inference_policy.py'sVALIDATED_CLASSESroster (floor 0); newTestFloorEstimatorTypeGuardscovers TROP/SyntheticDiD (both lanes)/HAD —[1.5, True, None, -3]raise the shared message at init and viaset_paramswith rollback, floors and the jackknife exemption pinned intact;had_pretestsfloat/bool/None rejection tests beside both existing>= 99floor pins; honest_did single-source oracle pins on the CS branch (float-typed, survey fit) and the dCDH branch (non-survey None + a survey fit with finite df ==resolve_inference_df).Security / privacy