feat(quota): add soft-threshold quota-warning evaluator#8602
feat(quota): add soft-threshold quota-warning evaluator#8602jeffrey701 wants to merge 2 commits into
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8602 +/- ##
==========================================
- Coverage 92.55% 92.54% -0.01%
==========================================
Files 796 796
Lines 79874 79862 -12
Branches 24138 24139 +1
==========================================
- Hits 73924 73908 -16
Misses 4804 4804
- Partials 1146 1150 +4
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-25 02:27:00 UTC
Review summary Nits — 4 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionPartially addressed 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.
|
|
This repository reviews pull requests one-shot: the PR must be correct as originally opened. Pushing an additional commit closes it automatically instead of restarting review — open a fresh pull request with every fix included. |
What
Adds the pure soft-warning evaluator #7662 needs:
evaluateTenantQuotaWarning(
packages/loopover-engine/src/tenant-quota.ts) — the counterpart to the existing hardevaluateTenantQuota. TodayevaluateTenantQuota's per-dimensionremainingfigures arenever checked against any soft threshold; this reports the first dimension (same
compute→time→concurrency precedence as the hard check) whose headroom has fallen to or below
warnThresholdof its cap (default0.2⇒ ≤20% left / ≥80% consumed) — the pre-exhaustionband a "running low" notification fires in — or
nullwhen every bounded dimension is healthy.Scope note
This is the evaluation half. The notification-event-kind + delivery wiring must hook into the
same admission-check point #7647 adds to
src/queue/job-dispatch.ts(the issue is explicit:do not invent a separate call site). That call site does not exist until #7647 lands
(
evaluateTenantQuotais not yet called anywhere injob-dispatch.ts), so the firing is afollow-up on top of this evaluator rather than a second invented mechanism — the evaluator lands
independently and is structurally ready for that wiring.
Validation
test/unit/tenant-quota.test.ts(imports the engine source directly, so Codecovsees the coverage): healthy → no warn; first low dimension warned at the threshold; precedence
(time reported when compute healthy); an exhausted dimension not warned; a zero-cap dimension
skipped; a custom threshold honored. 100% branch coverage on the new function (verified via lcov).
npx vitest run test/unit/tenant-quota.test.ts→ 14/14 pass;@loopover/enginerebuilds clean.Closes #7662