Skip to content

fix: ban unexplained @ts-ignore, full-jitter reconnect, and batched cache stats (#809 #810 #811) - #892

Merged
RUKAYAT-CODER merged 3 commits into
rinafcode:mainfrom
monique-7arch:fix/monique-ts-perf-809-810-811
Jul 27, 2026
Merged

fix: ban unexplained @ts-ignore, full-jitter reconnect, and batched cache stats (#809 #810 #811)#892
RUKAYAT-CODER merged 3 commits into
rinafcode:mainfrom
monique-7arch:fix/monique-ts-perf-809-810-811

Conversation

@monique-7arch

@monique-7arch monique-7arch commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Closes #809
Closes #810
Closes #811
Closes #809

Summary

Three fixes addressing TypeScript discipline, socket reconnect reliability under load, and response-interceptor performance.

#809 — Ban unexplained @ts-ignore comments
Added '@typescript-eslint/ban-ts-comment' to eslint.config.js with 'allow-with-description' for both @ts-ignore and @ts-expect-error. Both are still permitted when they include a minimum-10-character justification comment, so legitimate suppressions are not blocked — they just have to explain themselves. @ts-nocheck is fully banned (no exceptions). This closes the gap where a silent @ts-ignore could hide genuine type regressions from CI.

#810 — Full jitter for socket reconnect backoff
The previous jitter formula was delay × (0.9 + random × 0.2), which scatters reconnects only within ±10 % of a fixed delay. When a server restarts and many clients reconnect simultaneously, all delays cluster tightly in the same narrow window — a thundering herd that worsens the outage. Replaced with full jitter: Math.round(Math.random() × ceiling), which draws a uniformly random value across the entire backoff interval. This spreads reconnect attempts evenly over [0, ceiling] and eliminates correlated load spikes.

#811 — Batched cache statistics
The response interceptor previously recomputed cache hit-rate on every successful response. For apps issuing dozens of requests per minute this adds measurable JS-thread work on every round-trip. Replaced with a lightweight counter pair (_cacheStats.hits / misses) that is incremented per response (O(1)) and flushed to the logger on a 60-second setInterval. The flush resets counters and logs hit-rate, hit count, and total requests. A flushCacheStatsNow export lets callers (e.g. app-background handlers) trigger an immediate flush before the interval fires.

Files changed

@drips-wave

drips-wave Bot commented Jul 27, 2026

Copy link
Copy Markdown

@monique-7arch Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@RUKAYAT-CODER

Copy link
Copy Markdown
Contributor

Thank you for contributing to the project.

@RUKAYAT-CODER
RUKAYAT-CODER merged commit 66b198e into rinafcode:main Jul 27, 2026
1 of 13 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

2 participants