Repository navigation
refactor(sync): share one subscription renew window across sweep, operation, and health - #5217
Merged
Merged
Conversation
…ration, and health The renew guard was stated three times at 24h and enforced nowhere: DEFAULT_RENEW_BEFORE_MS in subscription-maintenance.service.ts decides whether maintainSubscription renews a channel, SUBSCRIPTION_RENEW_BEFORE_MS in app.ts selects which channels the subscription sweep enqueues, and HEALTH_SUBSCRIPTION_RENEW_BEFORE_MS in health-snapshot.service.ts counts renewSoon. Each comment claimed it matched the others; nothing made it so, and each site's tests assert against its own copy, so a divergence stays green. Export the owning constant and read it at all three sites, matching the sibling DEFAULT_PUSH_STAMP_HEAL_COOLDOWN_MS, which the adjacent sweep row already imports from the same module. Value unchanged at 24h, so behavior is identical. Also record this sweep's judgments in the tech-debt ledger. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HmwVQE9vu35agjjdcadkf6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Tech-debt sweep of the 9 merges that landed after the 2026-11-10 sweep (#5209 to #5216 plus #5177). One finding.
The push-channel renew window was stated three times as 24h and enforced nowhere. Each copy's comment claimed it matched the others, but nothing made it so:
subscription-maintenance.service.tsDEFAULT_RENEW_BEFORE_MSmaintainSubscriptionreports "current" and touches nothing when a channel has more than this much life leftapp.tsSUBSCRIPTION_RENEW_BEFORE_MSwindowMs: which resources get asubscriptionMaintainjob enqueuedhealth-snapshot.service.tsHEALTH_SUBSCRIPTION_RENEW_BEFORE_MSrenewSoonNo production code overrides
options.renewBeforeMs, so in production all three were the same number purely by hand-copy. The divergence is silent in both directions:renewSoonstops describing the set the sweep acts on, so the health dashboard misreports renewal pressure.Nothing catches it: each site's tests assert against its own copy, so all three suites stay green after a divergence.
Fix: export the owning constant and read it at all three sites. This matches the sibling
DEFAULT_PUSH_STAMP_HEAL_COOLDOWN_MS, whichapp.tsalready imports from the same module for the adjacentpushStampHealsweep row, one entry below the row that was hardcoding its copy. Value unchanged at 24h, so behavior is identical and the import is now the thing that keeps them in step.Also records this sweep's judgments in
.agents/skills/tech-debt-sweep/judged-fine.md, including the areas examined and deliberately left alone so the next sweep does not redo them:SYNC_TOKEN_UNSUPPORTED_RETRY_AFTER_MSbesideWATCH_UNSUPPORTED_RETRY_AFTER_MS(fix(sync): stabilize Google holiday calendars that reject sync tokens #5212): shared value today, independently tunable policies, already imported rather than restated as literalsAsyncTestGate/AsyncTestSignalwaitForTest(fix(ci): keep swift-packages under timeout with warm SPM cache #5216): a shared helper is about the size of the repeat, and the file is mid-changeVerify
bun run verify --strictPRE-EXISTING (environmental, not reachable by this diff):
test:sync's Mongo tier cannot start in this sandbox.mongodb-memory-serverfails to allocate a port (error: Failed to listen at ::fromgetFreePort, thenSyncMongoService is not connected). Baselined by hand because verify only auto-baselinestest:web,test:a11yandtest:e2e: with the working tree reset toorigin/main(0b2f185, zero modified files),bun test packages/sync/src/telemetry/health-snapshot.service.db.test.tsfails identically at0 pass / 2 fail, the same as on this branch. Nocompass.yamland nomongodin this environment.FLAKY: none.
Green locally on everything that can run here:
bun test:sync:fast(the non-Mongo tier, which covers the changed sweep wiring): 933 pass, 8 skip, 0 fail across 97 filesbun type-check,bun lint(all rules),bun knip(no unused files or exports, including after the export moved)CI decides the Mongo tier.
Generated by Claude Code