fix(settings): cap review-nag cooldown#2634
Conversation
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-03 01:05:05 UTC
⏸️ Suggested Action - Manual Review
Review summary Nits — 6 non-blocking
Review context
Contributor next steps
Signal definitions
🟩 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 Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2634 +/- ##
=======================================
Coverage 96.09% 96.09%
=======================================
Files 237 237
Lines 26472 26478 +6
Branches 9602 9603 +1
=======================================
+ Hits 25438 25444 +6
Misses 425 425
Partials 609 609
🚀 New features to boost your workflow:
|
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
gittensory-ui | aa061ba | Commit Preview URL Branch Preview URL |
Jul 03 2026, 12:51 AM |
84a8306 to
d2d484e
Compare
… import focus-manifest.ts is part of the UI package's typechecked closure (its transitive deps get walked by apps/gittensory-ui's own tsc run). Importing MAX_REVIEW_NAG_COOLDOWN_DAYS from settings/agent-actions.ts pulled that module's own import of github/commands.ts -> utils/crypto.ts into the UI build for the first time, exposing a pre-existing latent Uint8Array<ArrayBufferLike>/BufferSource type mismatch in crypto.ts that the UI's tsc had never previously reached. Duplicates the small constant locally in focus-manifest.ts instead of importing it, keeping db/repositories.ts's own import from agent-actions.ts (never part of the UI closure) unaffected. Also rebases the branch's merge commit into a linear rebase onto current main.
…y exercise the guard Gate review: the original regression test seeded an oversized reviewNagCooldownDays through upsertRepositorySettings, but both upsertRepositorySettings and getRepositorySettings already clamp that field on write AND read -- so the value read back inside resolveRepositorySettings was never actually oversized by the time maybeThrottleReviewNagPing saw it. The test could pass even with processors.ts's own Math.min(reviewNagCooldownDays, MAX_REVIEW_NAG_COOLDOWN_DAYS) guard removed entirely. Mocks resolveRepositorySettings directly (bypassing the DB/yml clamp layers entirely, not just the write-time one) to actually deliver an oversized value to the function under test, then proves the guard's effect behaviorally: three prior pings 400 days old fall outside the CORRECTLY capped 365-day window (no cooldown applied), whereas an uncapped "1-billion-day" window would count them and trip the threshold. Confirmed by mutation-testing: removing the Math.min throws a real RangeError (Invalid time value) building the Date.
d2d484e to
aa061ba
Compare
Motivation
reviewNagCooldownDaysfrom overflowingDatearithmetic and throwingRangeErrorduringissue_commentwebhook processing by bounding the operational lookback window.Description
MAX_REVIEW_NAG_COOLDOWN_DAYS = 365insrc/settings/agent-actions.tsand use it as the system-wide cap.src/signals/focus-manifest.tsso.gittensory.ymlentries above the cap are ignored.normalizeReviewNagCooldownDaysinsrc/db/repositories.tsto clamp persisted and DB-resolved values to the cap while preserving other normalization semantics.sinceIsoDate insrc/queue/processors.tssoissue_commenthandling cannot throw even if an oversized value reaches the processor.src/openapi/schemas.tsand.gittensory.yml.exampleto document/enforce the 365-day maximum and regenerate the UI OpenAPI artifact (apps/gittensory-ui/public/openapi.json).test/unit/focus-manifest.test.ts,test/unit/data-spine.test.ts, andtest/unit/queue.test.ts).Testing
npm run typecheckand it succeeded.npm run ui:openapiand validated withnpm run ui:openapi:check, both succeeding andapps/gittensory-ui/public/openapi.jsonupdated.npx vitest run test/unit/focus-manifest.test.ts -t "review-nag cooldown settings",npx vitest run test/unit/data-spine.test.ts -t "persists and reads", andnpx vitest run test/unit/queue.test.ts -t "oversized review-nag cooldown", and the new/affected tests passed.queue.test.tsfile in this container hit existing long-running sweep timeouts unrelated to this fix, so a targeted test invocation was used to validate the regression;npm audit --audit-level=moderatecould not complete here due to the registry audit endpoint returning403 Forbidden.Codex Task