Repository navigation
feat(v4): PR 1 of the 4.0 cut - new-estimator results-contract conformance - #857
Conversation
…mance
Brings the estimators born after 3.9 onto the 4.0 results contract (spec
sections 5 and 6) before the removal waves start.
- LWDiDResults.summary()/print_summary() take alpha=None under the
family-wide M-146 guard (previously no alpha at all).
- LWDiDResults.to_dataframe(level=) / to_csv(level=) are aggregate-backed
on the shared schemas (+ rolling/estimation_method/vcov_type), default
"simple"; the 3.10 bespoke frame is gone (ledger behavior row M-153).
- LWDiDResults.pvalue / .ci alias properties deprecated (FutureWarning,
removed 5.0; ledger rows M-151/M-152) via deprecated_field_property,
which gains removed_in= so warning and docstring name the right release.
- DurationDiDResults.aggregate("simple") relays the stored quintet (df NaN).
- RDDensityTestResult.to_dict() added.
- Ledger: rows M-151..M-153 (group lwdid-results-contract), M-146 code_refs;
id snapshot/floor 135; naming guard tokens pvalue/ci (ambiguous lanes) +
allowlists; spec sections 3.1/5/9/11, migration guide, REGISTRY Notes,
llms-full, lwdid.rst updated; tests for every surface.
Overall assessment✅ Looks good — no actionable P0, P1, or P2 findings identified in the supplied diff. Executive summary
MethodologyNo findings. Cross-checked the affected semantics against
The documented contract choices require no corrective action. Code QualityNo findings. PerformanceNo findings. Added work is proportional to the exported result size; estimation paths remain unchanged. MaintainabilityNo findings. Shared schemas and the existing deprecation helper avoid duplicated contracts. Tech DebtNo new untracked limitation identified. Existing estimator limitations remain outside this diff. SecurityNo secrets or newly introduced unsafe behavior identified. Documentation/TestsNo findings requiring changes. The behavior changes include the required changelog fragment. Validation passed for Python syntax, changelog conventions, ledger/migration parity, new naming-token coverage, and isolated deprecation/serialization behavior. The numerical and pandas-backed pytest suites remain unverified in this environment. |
Summary
__version__stays 3.13.0. No estimation, weighting, or variance code changes.LWDiDResults.summary(alpha=None)/print_summary(alpha=None)join the family-wide summary-alpha guard (M-146, whosecode_refsnow include LWDiD): a value other than the fit-time alpha raises; the methods previously took noalphaat all.LWDiDResults.to_dataframe(level=)/to_csv(level=)are reshaped onto the shared results schema (new behavior row M-153,introduced_in: 4.0, done): eachlevelin{"simple", "group", "event_study"}returnsaggregate(level).to_dataframe()plus therolling/estimation_method/vcov_typecolumns; default"simple"(one headline row). The 3.10-3.13 bespoke frame is gone:term/cohort->label, the trailing"Overall"row ->level="simple",n_treated->n,n_obs/n_control->to_dict()only,ci_lower/ci_upper->conf_int_lower/conf_int_upper. Recorded as a Breaking Change in the fragment and the migration guide.LWDiDResults.pvalue/.ci(3.10-born duplicates ofp_value/conf_int, no reader anywhere in the repo) now emit aFutureWarningand are removed at 5.0 (new rows M-151/M-152,shimmed).diff_diff._deprecation.deprecated_field_propertygainsremoved_in=so the warning and the generated docstring name the row's release (existing callers unchanged).DurationDiDResults.aggregate("simple"): verbatim relay of the stored headline quintet (n = n_units,dfNaN - inference is bootstrap-only; nothing recomputed).RDDensityTestResult.to_dict(): JSON-serializable scalars with native casts (NaN inference passes through), the*_conventionalblockNoneunlessreport_all=True,bandwidthsnested only when estimated.lwdid-results-contract); id snapshot andROW_COUNT_FLOOR135; naming guard gainspvalue/citokens (ambiguous lanes) with allowlists for the independent same-named surfaces (RDPlot.__init__[ci],RandomizationResult.pvalue,SpecificationResult.pvalue, the lwdid-py mapping docstring). Spec sections 3.1/5/9/11, migration guide (appendix 113 rows, new orientation row, "Remaining 4.0 changes" + "Estimators added after 3.9" prose), REGISTRY Notes (LWDiD, DurationDiD, RDDensityTest),llms-full.txt, anddocs/api/lwdid.rst(to_dataframe(level="group")snippet) updated.Methodology references (required if estimator / math changes)
simplerelay copies stored inference (REGISTRY DurationDiD Note), the LWDiD frame reuses the existingaggregate()surfaces.cluster/variance semantics are untouched; the three REGISTRY**Note:**lines record API-contract decisions, not estimator deviations.Validation
tests/test_lwdid.py(newTestV4ResultsContract: alpha guard incl.alpha=0.0, everyto_dataframelevel and the unknown-level error,to_csv(level=), joint-NaN relay on a PSM fit, alias warnings/docstring/read-only),tests/test_duration_did.py(simplerelay bit-exact to the stored fields incl. NaNt_stat/df;n_bootstrap=0variant;groupnow the unsupported-type probe),tests/test_rddensity.py(to_dictround trip, manual-h/report_allshapes, degraded-inference NaN round trip),tests/test_v4_rename_mechanical.py(removed_inin warning and docstring),tests/test_v4_matrix.py/tests/test_naming_guard.py(snapshot, tokens, allowlists). Gate simulation unchanged: 0 / 1 / 118 problems at 3.13.0 / 3.14.0 / 4.0.0 (109 ids).Security / privacy
Changelog
changelog.d/20261018-v4-pr1-conformance.md