Skip to content

Fix D8: match Clojure repful classification (rat > rdt)#2522

Open
jucor wants to merge 1 commit into
spr/edge/80eaa87cfrom
spr/edge/9ec28252
Open

Fix D8: match Clojure repful classification (rat > rdt)#2522
jucor wants to merge 1 commit into
spr/edge/80eaa87cfrom
spr/edge/9ec28252

Conversation

@jucor
Copy link
Copy Markdown
Collaborator

@jucor jucor commented Mar 30, 2026

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

  • 6 targeted D8 tests pass (rat>rdt, rat<rdt, equal, both negative, both zero, old-vs-new divergence case)
  • Full test suite passes (excluding DynamoDB/MinIO tests)
  • Private dataset tests pass (--include-local)
  • Golden snapshots re-recorded for all 7 datasets
  • 19/19 regression tests pass

🤖 Generated with Claude Code

Squashed commits

  • Journal: add review session entry (2026-03-17)

commit-id:9ec28252


Stack:


⚠️ Part of a stack created by spr. Do not merge manually using the UI - doing so may have unexpected results.

@jucor jucor changed the title Fix D8: match Clojure repful classification (rat > rdt) [Stack 15/17] Fix D8: match Clojure repful classification (rat > rdt) Mar 30, 2026
@jucor jucor force-pushed the spr/edge/9ec28252 branch from 581bff8 to 9077d18 Compare March 30, 2026 22:39
@jucor jucor force-pushed the spr/edge/80eaa87c branch from a19fe4a to cfd57d1 Compare March 30, 2026 22:39
@jucor jucor force-pushed the spr/edge/9ec28252 branch 2 times, most recently from 7f80704 to 8c7b7f7 Compare March 31, 2026 00:35
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Comment thread delphi/docs/CLJ-PARITY-FIXES-JOURNAL.md Outdated
## 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
@jucor jucor changed the title [Stack 15/17] Fix D8: match Clojure repful classification (rat > rdt) Fix D8: match Clojure repful classification (rat > rdt) May 19, 2026
@jucor jucor force-pushed the spr/edge/9ec28252 branch from 8c7b7f7 to c381171 Compare May 19, 2026 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants