Skip to content

refactor: remove dead runtime metrics helper module#381

Closed
ndycode wants to merge 1 commit intomainfrom
fix/remove-runtime-metrics-dead-code
Closed

refactor: remove dead runtime metrics helper module#381
ndycode wants to merge 1 commit intomainfrom
fix/remove-runtime-metrics-dead-code

Conversation

@ndycode
Copy link
Copy Markdown
Owner

@ndycode ndycode commented Apr 6, 2026

Problem

lib/runtime/metrics.ts was 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

  • deleted lib/runtime/metrics.ts
  • deleted test/runtime-metrics.test.ts

Validation

npx vitest run test/runtime-live-sync.test.ts test/runtime-services.test.ts
Test Files  2 passed (2)
Tests      15 passed (15)

npx vitest run
Test Files  221 passed (221)
Tests      3310 passed (3310)

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.ts and 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 to lib/request/response-metadata.ts, failover mode and env-int parsing to lib/request/failover-config.ts, and the RuntimeMetrics shape inlined into index.ts. the new tests use vi.useFakeTimers() for deterministic time-sensitive assertions, which is an improvement over the deleted module's injected now parameter pattern.

  • deleted lib/runtime/metrics.ts (127 lines) — genuinely dead, no remaining callers confirmed by grep
  • deleted test/runtime-metrics.test.ts (88 lines) — orphaned, fully superseded by test/response-metadata.test.ts and test/failover-config.test.ts
  • all 221 test files / 3310 tests pass; no windows filesystem or token safety risks introduced

Confidence 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

Filename Overview
lib/runtime/metrics.ts deleted dead module — all exports already relocated to lib/request/ subdirectory with no remaining callers
test/runtime-metrics.test.ts deleted orphaned test — replaced by test/response-metadata.test.ts (vi.useFakeTimers) and test/failover-config.test.ts with improved coverage

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"]
Loading

Reviews (1): Last reviewed commit: "refactor: remove dead runtime metrics he..." | Re-trigger Greptile

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.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 6, 2026

Warning

Rate limit exceeded

@ndycode has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 15 minutes and 38 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: c4fc38b7-790c-46d3-8b14-fbb40d7e5b12

📥 Commits

Reviewing files that changed from the base of the PR and between 478f44c and 9ec4000.

📒 Files selected for processing (2)
  • lib/runtime/metrics.ts
  • test/runtime-metrics.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/remove-runtime-metrics-dead-code
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix/remove-runtime-metrics-dead-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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@ndycode
Copy link
Copy Markdown
Owner Author

ndycode commented Apr 6, 2026

Superseded by #387, which rebuilds the full open PR stack onto one reviewed integration branch.

@ndycode
Copy link
Copy Markdown
Owner Author

ndycode commented Apr 6, 2026

Closing in favor of #387.

@ndycode ndycode closed this Apr 6, 2026
@ndycode ndycode deleted the fix/remove-runtime-metrics-dead-code branch April 12, 2026 06:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant