Fix D8: match Clojure repful classification (rat > rdt)#2522
Open
jucor wants to merge 1 commit into
Open
Conversation
This was referenced Mar 30, 2026
581bff8 to
9077d18
Compare
a19fe4a to
cfd57d1
Compare
7f80704 to
8c7b7f7
Compare
ballPointPenguin
approved these changes
Apr 26, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the Clojure-parity fixes journal entry for the D8 “repful classification” work, adding a detailed PR 7 write-up plus an additional review session note and a PR14 readability guideline.
Changes:
- Adds a new “PR 7: Fix D8 — Finalize Comment Stats Logic” section with TDD steps, rationale, and claimed code/test impacts.
- Adds a “Review Session (2026-03-17)” entry plus an additional “PR 14 readability goal” note in the future-sessions section.
- Updates the “What’s Next” item under PR 6.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+566
to
+571
| ### Changes | ||
| - `repness.py`: `finalize_cmt_stats()` — replaced 3-branch threshold logic with `rat > rdt` | ||
| - `repness.py`: Vectorized repful in `compute_group_comment_stats_df()` — replaced `np.select` | ||
| with `np.where(rat > rdt, 'agree', 'disagree')` | ||
| - `test_discrepancy_fixes.py`: Expanded `TestD8FinalizeStats` from 2 to 7 tests (5 formula + | ||
| 1 blob xfail + edge cases for equal/negative/zero rat/rdt) |
## Summary
Simplifies the repful ("representative for agree or disagree?") classification
to match Clojure's `finalize-cmt-stats` (repness.clj:175-177).
**Before (Python):** 3-branch conditional:
1. `pa > 0.5 AND ra > 1.0` → agree
2. `pd > 0.5 AND rd > 1.0` → disagree
3. Fallback: whichever metric is higher
**After (Clojure):** `rat > rdt` → agree, else disagree.
The old thresholds were redundant — `rat` and `rdt` (two-proportion z-scores)
already encode whether the group's agree/disagree rate is significantly higher
than other groups. The simple comparison is both correct and clearer.
## Changes
- `repness.py`: `finalize_cmt_stats()` — 3-branch logic → `rat > rdt`
- `repness.py`: Vectorized — `np.select` with conditions → `np.where(rat > rdt)`
- `test_discrepancy_fixes.py`: Expanded from 2 to 6 tests (including edge cases:
equal rat/rdt, both negative, both zero)
- Golden snapshots re-recorded (repful direction changes for some comments)
## Test plan
- [x] 6 targeted D8 tests pass (rat>rdt, rat<rdt, equal, both negative, both zero, old-vs-new divergence case)
- [x] Full test suite passes (excluding DynamoDB/MinIO tests)
- [x] Private dataset tests pass (--include-local)
- [x] Golden snapshots re-recorded for all 7 datasets
- [x] 19/19 regression tests pass
🤖 Generated with [Claude Code](https://claude.com/claude-code)
## Squashed commits
- Journal: add review session entry (2026-03-17)
commit-id:9ec28252
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Simplifies the repful ("representative for agree or disagree?") classification
to match Clojure's
finalize-cmt-stats(repness.clj:175-177).Before (Python): 3-branch conditional:
pa > 0.5 AND ra > 1.0→ agreepd > 0.5 AND rd > 1.0→ disagreeAfter (Clojure):
rat > rdt→ agree, else disagree.The old thresholds were redundant —
ratandrdt(two-proportion z-scores)already encode whether the group's agree/disagree rate is significantly higher
than other groups. The simple comparison is both correct and clearer.
Changes
repness.py:finalize_cmt_stats()— 3-branch logic →rat > rdtrepness.py: Vectorized —np.selectwith conditions →np.where(rat > rdt)test_discrepancy_fixes.py: Expanded from 2 to 6 tests (including edge cases:equal rat/rdt, both negative, both zero)
Test plan
🤖 Generated with Claude Code
Squashed commits
commit-id:9ec28252
Stack: