Skip to content

LCORE-4606: Fixed quota handling in SQLite - #2874

Merged
tisnik merged 1 commit into
lightspeed-core:mainfrom
tisnik:lcore-4606-fixed-quota-handling-in-sqlite
Oct 9, 2026
Merged

tisnik merged 1 commit into
lightspeed-core:mainfrom
tisnik:lcore-4606-fixed-quota-handling-in-sqlite

Conversation

@tisnik

@tisnik tisnik commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Description

LCORE-4606: Fixed quota handling in SQLite

Type of change

  • Refactor
  • New feature
  • Bug fix
  • CVE fix
  • Optimization
  • Documentation Update
  • Configuration Update
  • Bump-up service version
  • Bump-up dependent library [pyproject.toml + uv.lock]
  • Bump-up dependent library [requirements.*.txt for Konflux]
  • Bump-up library or tool used for development (does not change the final image)
  • CI configuration change
  • Konflux configuration change
  • Unit tests improvement
  • Integration tests improvement
  • End to end tests improvement
  • Benchmarks improvement

Tools used to create PR

  • Assisted-by: N/A
  • Generated by: N/A

Related Tickets & Documents

  • Related Issue #LCORE-4606

Summary by CodeRabbit

  • Bug Fixes
    • Corrected how SQLite evaluates quota revocation times, improving consistency when determining whether a quota change is due.
    • Quota increases now occur only for positive increase values; zero or negative values no longer trigger an increase.

@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: lightspeed-core/lightspeed-stack/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 32179b48-8487-460b-8b66-dbe6853bab23
📥 Commits

Reviewing files that changed from the base of the PR and between d8eb7cf and 05da3b1.

📒 Files selected for processing (2)
  • src/quota/sql.py
  • src/runners/quota_scheduler.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout. (25)
  • GitHub Check: E2E: library / ci / mcp
  • GitHub Check: E2E: server / ci / tls
  • GitHub Check: E2E: library / ci / other
  • GitHub Check: E2E: server / ci / authorized
  • GitHub Check: E2E: library / ci / skills
  • GitHub Check: E2E: library / ci / shields
  • GitHub Check: E2E: server / ci / rbac
  • GitHub Check: E2E: library / ci / rbac
  • GitHub Check: E2E: server / ci / skills
  • GitHub Check: E2E: server / ci / shields
  • GitHub Check: E2E: library / ci / default
  • GitHub Check: E2E: server / ci / default
  • GitHub Check: E2E: server / ci / mcp
  • GitHub Check: E2E: library / ci / authorized
  • GitHub Check: E2E: server / ci / other
  • GitHub Check: Pylinter
  • GitHub Check: unit_tests (3.12)
  • GitHub Check: unit_tests (3.13)
  • GitHub Check: integration_tests (3.12)
  • GitHub Check: build-pr
  • GitHub Check: integration_tests (3.13)
  • GitHub Check: Red Hat Konflux / lightspeed-stack-0-8-e2e-tests / lightspeed-stack-0-8
  • GitHub Check: Red Hat Konflux / rag-content-0-8-e2e-tests / lightspeed-stack-0-8
  • GitHub Check: Red Hat Konflux / lightspeed-core-0-8-enterprise-contract / lightspeed-stack-0-8
  • GitHub Check: Konflux kflux-prd-rh02 / lightspeed-stack-0-8-on-pull-request
🔇 Additional comments (2)
src/runners/quota_scheduler.py (1)

220-221: LGTM!

Also applies to: 230-230

src/quota/sql.py (1)

41-41: LGTM!

Also applies to: 57-57


Walkthrough

The scheduler now skips quota increases when the configured amount is zero or negative. SQLite quota increase and reset statements apply the modifier to the revocation date and use an inclusive comparison with the current time.

Changes

Quota revocation

Layer / File(s) Summary
Quota revocation conditions
src/runners/quota_scheduler.py, src/quota/sql.py
The scheduler calls increase_quota only for positive values. SQLite increase and reset statements apply the supplied modifier to revoked_at and compare it with the current time using <=.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 05da3

Quota configuration and revocation-boundary behavior are supported by the inspected contracts; no actionable merge risk remains.

🚥 Pre-merge checks | ✅ 7
✅ Passed checks (7 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: fixing quota handling in SQLite.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Performance And Algorithmic Complexity ✅ Passed PASS. The diff adds no O(n^2) logic, N+1 access, loop-contained API/JSON/regex work, unbounded state, or list/pagination change. The SQLite predicates now apply datetime() to each matching row, but th…
Security And Secret Handling ✅ Passed Passed. The pull request changes only SQLite quota predicates and quota-update conditions. The SQLite SQL uses bound parameters (?) for the period, subject, and quota values; it does not concatenate…
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
✨ Simplify code
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@max-svistunov max-svistunov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, TYVM!

@tisnik
tisnik merged commit 892be5f into lightspeed-core:main Oct 9, 2026
40 of 41 checks passed
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.

2 participants