refactor: remove dead runtime metrics helper module#381
Conversation
lib/runtime/metrics.ts is no longer imported anywhere in the runtime and its dedicated test only exercised that isolated dead code. Remove the unused module and orphan test to shrink maintenance surface without changing behavior.
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 15 minutes and 38 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
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. Comment |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Superseded by #387, which rebuilds the full open PR stack onto one reviewed integration branch. |
|
Closing in favor of #387. |
Problem
lib/runtime/metrics.tswas dead code.It was no longer imported anywhere in the runtime, and its dedicated test only exercised that isolated unused module.
Fix
Remove the unused module and its orphaned test.
Changes
lib/runtime/metrics.tstest/runtime-metrics.test.tsValidation
note: greptile review for oc-chatgpt-multi-auth. cite files like
lib/foo.ts:123. confirm regression tests + windows concurrency/token redaction coverage.Greptile Summary
this pr removes
lib/runtime/metrics.tsand its orphaned test after confirming zero imports remain in the codebase. all exported functions were already relocated in a prior refactor: retry-after parsing and header sanitization moved tolib/request/response-metadata.ts, failover mode and env-int parsing tolib/request/failover-config.ts, and theRuntimeMetricsshape inlined intoindex.ts. the new tests usevi.useFakeTimers()for deterministic time-sensitive assertions, which is an improvement over the deleted module's injectednowparameter pattern.lib/runtime/metrics.ts(127 lines) — genuinely dead, no remaining callers confirmed by greptest/runtime-metrics.test.ts(88 lines) — orphaned, fully superseded bytest/response-metadata.test.tsandtest/failover-config.test.tsConfidence Score: 5/5
safe to merge — pure dead-code deletion with zero callers remaining and full test suite passing
grep confirms no remaining imports of the deleted module anywhere in the codebase, all functions are live in their new homes with proper test coverage using fake timers, and the full 221-file / 3310-test suite passes cleanly. no windows filesystem or token safety risks.
no files require special attention
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A["lib/runtime/metrics.ts\n(deleted — dead code)"] A -->|"parseRetryAfterHintMs\nsanitizeResponseHeadersForLog\nclampRetryHintMs"| B["lib/request/response-metadata.ts\n(active, tested)"] A -->|"parseFailoverMode\nparseEnvInt"| C["lib/request/failover-config.ts\n(active, tested)"] A -->|"RuntimeMetrics type\ninitial object"| D["index.ts\n(inlined at lines 338–359)"] E["test/runtime-metrics.test.ts\n(deleted — orphaned)"] E -->|"replaced by"| F["test/response-metadata.test.ts\n(vi.useFakeTimers)"] E -->|"replaced by"| G["test/failover-config.test.ts"]Reviews (1): Last reviewed commit: "refactor: remove dead runtime metrics he..." | Re-trigger Greptile