fix(engine): treat an Infinity WIP cap as uncapped, not collapsed to 0 (#8861) - #8945
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
portfolio/queue.ts's finiteNonNegativeInt returned 0 for any non-finite value, so nextEligibleItems with globalWipCap: Infinity returned [] -- the opposite of 'uncapped' -- contradicting the codebase's own Infinity=uncapped convention (portfolio-queue-cli.ts). normalizePortfolioCaps in portfolio-queue-manager.ts (which feeds that engine call) performed the identical collapse. Both now preserve an explicit Infinity as uncapped while still coercing finite/absent values exactly as before. Tests: nextEligibleItems with an Infinity cap returns the eligible items (was []); normalizePortfolioCaps preserves Infinity; the prior test that pinned the buggy Infinity->[] behavior is updated to a genuine 0 cap.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8945 +/- ##
=======================================
Coverage 93.86% 93.86%
=======================================
Files 805 805
Lines 80243 80244 +1
Branches 24319 24319
=======================================
+ Hits 75321 75322 +1
Misses 3561 3561
Partials 1361 1361
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-26 14:19:29 UTC
Review summary Nits — 3 non-blocking
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. Decision record
🟩 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.
|
Problem
Closes #8861.
packages/loopover-engine/src/portfolio/queue.ts'sfiniteNonNegativeIntreturned0for any non-finite value, sonextEligibleItemswithglobalWipCap: Infinityreturned[]— the opposite of "uncapped." This contradicts the codebase's own convention (portfolio-queue-cli.ts: "Unset dimensions stay genuinely uncapped (Infinity), not silently defaulted").normalizePortfolioCapsinportfolio-queue-manager.ts— which feeds that engine call — performed the identical collapse.Fix
Both
finiteNonNegativeIntandnormalizePortfolioCapsnow preserve an explicitInfinityas "uncapped" while still coercing finite/absent values exactly as before (truncate, floor at 0, non-finite→0). Downstream the cap is used only inslice(0, cap)andcount < capcomparisons, whereInfinitycorrectly means no limit (the selection loop still breaks when items are exhausted).Tests
nextEligibleItemswith anInfinitycap returns the eligible items (was[]); the prior test that pinned the buggyInfinity → []behavior is updated to a genuine0cap.normalizePortfolioCapspreservesInfinityand still coerces finite/negative values.Reverting either fix fails its test.
git diff --checkclean.