Skip to content

Commit 84d7572

Browse files
igerberclaude
andcommitted
Final P3 cleanup: remove unreachable TWFE conley auto-cluster + fix resolve_vcov_type docstring
Address two P3 documentation/maintenance findings from CI Codex review of PR #411 R-final: - twfe.py:234-240: an `elif self.vcov_type == "conley"` branch in the cluster-resolution chain disabled the auto-cluster default for Conley. Unreachable behind the unconditional Conley reject at twfe.py:146-163. Removed. - linalg.py::resolve_vcov_type docstring: the "Rules" section and Returns docstring listed only `{"classical", "hc1", "hc2", "hc2_bm"}`, omitting `"conley"` even though `_VALID_VCOV_TYPES` includes it and the runtime path already accepts it. Updated both surfaces; the source of truth pointer (`_VALID_VCOV_TYPES`) is now named explicitly so future enum additions don't need a docstring sweep. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent af246a1 commit 84d7572

2 files changed

Lines changed: 4 additions & 10 deletions

File tree

diff_diff/linalg.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,8 +1112,9 @@ def resolve_vcov_type(
11121112
11131113
- If ``vcov_type`` is ``None``: map ``robust=True`` to ``"hc1"`` and
11141114
``robust=False`` to ``"classical"``.
1115-
- If ``vcov_type`` is supplied: it must be one of
1116-
``{"classical", "hc1", "hc2", "hc2_bm"}``.
1115+
- If ``vcov_type`` is supplied: it must be one of the values in the
1116+
module-level ``_VALID_VCOV_TYPES`` set, namely
1117+
``{"classical", "hc1", "hc2", "hc2_bm", "conley"}``.
11171118
- If ``robust=False`` is supplied together with a non-``"classical"`` ``vcov_type``,
11181119
raise ``ValueError`` - the combination is ambiguous.
11191120
@@ -1127,7 +1128,7 @@ def resolve_vcov_type(
11271128
Returns
11281129
-------
11291130
str
1130-
One of ``"classical"``, ``"hc1"``, ``"hc2"``, ``"hc2_bm"``.
1131+
One of ``"classical"``, ``"hc1"``, ``"hc2"``, ``"hc2_bm"``, ``"conley"``.
11311132
11321133
Raises
11331134
------

diff_diff/twfe.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -231,13 +231,6 @@ def fit( # type: ignore[override]
231231
# Explicit classical + analytical inference: drop the auto-cluster
232232
# so the validator doesn't reject ``cluster_ids + classical``.
233233
cluster_var = None
234-
elif self.vcov_type == "conley":
235-
# Conley + TWFE: disable the auto-cluster default. Conley + cluster
236-
# is deferred to Phase 2; the user wants spatial-HAC at the unit
237-
# level via the kernel, not cluster-robust at the unit level. The
238-
# explicit-cluster case is rejected upstream; reaching here means
239-
# cluster=None.
240-
cluster_var = None
241234
else:
242235
cluster_var = unit
243236

0 commit comments

Comments
 (0)