fix(scheduling): rotate audit requests across the daily quota #18

Merged
KofTwentyTwo merged 1 commits from fix/audit-quota-rotation into develop 2026-10-19 11:44:10 +00:00
KofTwentyTwo commented 2026-10-19 11:41:56 +00:00 (Migrated from github.com)

When the daily allowance is smaller than the sitemap's page/device pairs, scheduled audits now prioritize pairs never queued before, then those queued least recently. Previously each day's audit could spend its allowance on the same first pages. Rotation reads persisted run history and excludes SKIPPED_QUOTA rows, so skipped pairs retain their priority across days and recreated services.

Key-page schedules, full audits, and manual requests continue sharing the existing configured daily allowance. Open pairs still merge; manual selection keeps its requested order. The host can set withMaxRunsPerDay(300) to reserve headroom below the default 500 limit. This change supplies rotation; host adoption and release remain separate.

Refs KofTwentyTwo/Website-Backend#165. Keep that issue open until both the 300-run host cap and this rotation are released and adopted.

Validation: mvnw -B -o verify passed, 58 tests, zero failures/errors, one skipped; JaCoCo gate passed. Regression coverage checks an odd cap of three across six page/device pairs on two days, repeated scheduling and ignored quota-skipped history, key-only selection, and a manual request plus daily key/full schedules across recreated services sharing the persisted history. git diff --check passed.

AI-assisted implementation and review by OpenAI GPT-6. No release or deployment included.

When the daily allowance is smaller than the sitemap's page/device pairs, scheduled audits now prioritize pairs never queued before, then those queued least recently. Previously each day's audit could spend its allowance on the same first pages. Rotation reads persisted run history and excludes SKIPPED_QUOTA rows, so skipped pairs retain their priority across days and recreated services. Key-page schedules, full audits, and manual requests continue sharing the existing configured daily allowance. Open pairs still merge; manual selection keeps its requested order. The host can set `withMaxRunsPerDay(300)` to reserve headroom below the default 500 limit. This change supplies rotation; host adoption and release remain separate. Refs KofTwentyTwo/Website-Backend#165. Keep that issue open until both the 300-run host cap and this rotation are released and adopted. Validation: `mvnw -B -o verify` passed, 58 tests, zero failures/errors, one skipped; JaCoCo gate passed. Regression coverage checks an odd cap of three across six page/device pairs on two days, repeated scheduling and ignored quota-skipped history, key-only selection, and a manual request plus daily key/full schedules across recreated services sharing the persisted history. `git diff --check` passed. AI-assisted implementation and review by OpenAI GPT-6. No release or deployment included.
Sign in to join this conversation.