fix(engine): inject nowMs for deterministic PR staleness classification - #8952
fix(engine): inject nowMs for deterministic PR staleness classification#8952jeffrey701 wants to merge 1 commit into
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
❌ 1 Tests Failed:
View the top 1 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
|
Caution 🛑 LoopOver review result - fixes requiredReview updated: 2026-07-26 14:35:18 UTC
Review summary Nits — 4 non-blocking
CI checks failing
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
|
LoopOver is closing this pull request on the maintainer's behalf (CI is failing (validate, validate-tests)). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed. |
What
pending-pr-scenarios.ts'sdaysSincecalledDate.now()directly, soclassifyOpenPullRequest's 14-day staleness split (merge_readyvsstale_likely_close) wasnon-deterministic — identical PR records classified differently purely based on when the function
ran, and the boundary was untestable without live time. The file's own header claims "pure
classification/detection logic," and its sibling modules (
opportunity-freshness.ts/opportunity-metadata.ts) already injectnowMs"so the miner engine stays pure and testable."Change
Add an optional
nowMstodaysSince(defaulting toDate.now()only at that call boundary) andthread it through
classifyOpenPullRequest's args. When a caller omits it, behavior is unchanged(the default fires); a caller can now inject a fixed clock for deterministic classification.
Validation
test/unit/pending-pr-scenarios.test.ts(imports the engine source, soCodecov grades it): with an injected
nowMs, an approved/passing PR at exactly 14 days oldclassifies
stale_likely_close, and one millisecond short of 14 days classifiesmerge_ready—pinning the exact boundary.
npx vitest run test/unit/pending-pr-scenarios.test.ts→ 19/19 pass; 100% line+branch coverage onevery changed line (both sides of the
nowMs = Date.now()default).Closes #8872