Skip to content

fix(test): repoint the cadence-signal seed helper from review_targets to pull_requests - #9097

Merged
JSONbored merged 1 commit into
mainfrom
fix/reputation-cadence-test-table
Jul 26, 2026
Merged

fix(test): repoint the cadence-signal seed helper from review_targets to pull_requests#9097
JSONbored merged 1 commit into
mainfrom
fix/reputation-cadence-test-table

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Problem

main is currently broken for every subsequent PR: test/unit/reputation-wiring.test.ts > shouldSkipAiForReputation (helper) > submission-cadence signal (#4514) > FLAG-ON: true for a machine-paced submitter even though every submission itself looks fine (quality-neutral) fails with expected false to be true.

Root cause

#9041 (merged as c25fa1ef7) correctly repointed getSubmitterCadence's query from review_targets (frozen since the 2026-06-22 self-host cutover — it stopped receiving writes, so the machine-paced signal was silently inert in production) to the live pull_requests ledger.

That PR updated its own new test (test/unit/submitter-reputation.test.ts) to assert the query shape, but missed a sibling: test/unit/reputation-wiring.test.ts's local seedReviewTarget helper (scoped inside the "submission-cadence signal (#4514)" describe block) still inserts rows into review_targets. Since the code now reads pull_requests, that seed produces zero matching rows regardless of what's inserted — getSubmitterCadence always resolves {count: 0, medianGapMs: null}, so isMachinePacedCadence can never return true. The sibling "false for a human pace" test passed vacuously (right answer for the wrong reason); the "true for machine-paced" test asserts true and correctly fails.

Fix

Renamed the local helper to seedCadencePullRequest and repointed it at pull_requests (repo_full_name + author_login, matching the real query). The module-level seedReviewTarget (line 20, used elsewhere in this same file for the quality/burst signal — a separate code path #9041 did not touch) is untouched.

Validation

  • npx vitest run test/unit/reputation-wiring.test.ts — 36/36 passed (was 1 failed / 35 passed).
  • tsc --noEmit --incremental false clean.
  • Diff is a single file, test-only.

… to pull_requests

#9041 repointed getSubmitterCadence's query from review_targets (frozen since the
2026-06-22 self-host cutover) to the live pull_requests ledger, but the local
seedReviewTarget helper inside "submission-cadence signal (#4514)" still inserted
into review_targets -- so its own test seeded a table the code no longer reads,
making "FLAG-ON: true for a machine-paced submitter" fail on main for everyone
(cadence always resolves to 0 samples against the real query).

Renamed to seedCadencePullRequest and repointed at pull_requests
(repo_full_name/author_login, matching the real query shape) so the test again
exercises the code path it names. The module-level seedReviewTarget (used
elsewhere in this file for the separate quality/burst signal, which #9041 did not
change) is untouched.
@JSONbored JSONbored self-assigned this Jul 26, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@JSONbored
JSONbored merged commit 3c1173e into main Jul 26, 2026
2 checks passed
@JSONbored
JSONbored deleted the fix/reputation-cadence-test-table branch July 26, 2026 17:24
@codecov

codecov Bot commented Jul 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.66%. Comparing base (de430a0) to head (6924db0).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9097      +/-   ##
==========================================
+ Coverage   90.56%   92.66%   +2.10%     
==========================================
  Files          96      810     +714     
  Lines       22490    80600   +58110     
  Branches     3884    24454   +20570     
==========================================
+ Hits        20367    74686   +54319     
- Misses       1945     4840    +2895     
- Partials      178     1074     +896     
Flag Coverage Δ
backend 93.47% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.
see 714 files with indirect coverage changes

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.

1 participant