Skip to content

test: add unit tests for perf-metrics module#175

Merged
osolmaz merged 1 commit intoopenclaw:mainfrom
Bortlesboat:test-perf-metrics-coverage
Mar 27, 2026
Merged

test: add unit tests for perf-metrics module#175
osolmaz merged 1 commit intoopenclaw:mainfrom
Bortlesboat:test-perf-metrics-coverage

Conversation

@Bortlesboat
Copy link
Contributor

Summary

  • Add 12 unit tests covering all public exports of src/perf-metrics.ts
  • Functions tested: incrementPerfCounter, setPerfGauge, recordPerfDuration, measurePerf, startPerfTimer, getPerfMetricsSnapshot, resetPerfMetrics, formatPerfMetric
  • Includes edge cases: custom deltas, rounding to 3 decimal places, duration recording when the wrapped function throws

Test plan

  • All 12 new tests pass
  • oxlint, oxfmt, tsc --noEmit clean
  • No production code changes

Cover all public exports: incrementPerfCounter, setPerfGauge,
recordPerfDuration, measurePerf, startPerfTimer, getPerfMetricsSnapshot,
resetPerfMetrics, and formatPerfMetric. Includes edge cases for custom
deltas, rounding precision, and duration recording on thrown errors.
@osolmaz
Copy link
Contributor

osolmaz commented Mar 27, 2026

Triage result

Human attention: ⚠️ Required
Recommendation: 🏁 escalate to a human
Human decision needed: ready for human landing decision

Quick read

This PR is a narrow test-only change that adds unit coverage for src/perf-metrics.ts without changing production code. Targeted validation passed, Codex review found no blocking issues, CI is green, and the branch is conflict-free against origin/main.

Intent

Add focused unit tests for the perf-metrics helpers so the module's public API and edge cases are covered without changing runtime behavior.

Why

The underlying gap was missing direct coverage for perf-metrics behavior. The added tests cover all public exports, including counters, gauges, timing snapshots, reset behavior, formatting, custom deltas, rounding to 3 decimals, and duration recording when measurePerf throws.

Codex review

Normalized GitHub Codex review data for the current head is empty.
The stored local Codex review completed successfully and reported no correctness or stability issues.
No blocking findings remain.

CI/CD

Targeted feature validation passed on the PR branch with pnpm run build:test and node --test dist-test/test/perf-metrics.test.js.
Current CI state is green: the CI workflow completed successfully, required checks passed, and Docs was skipped as expected for this non-doc change.
Final conflict check is clean against origin/main.

Recommendation

This is ready for a human landing decision. The change is right-sized, validated, review-clean, and conflict-clean, so the next step is a maintainer decision on merge or land.

@osolmaz osolmaz self-assigned this Mar 27, 2026
@osolmaz osolmaz merged commit d63fa52 into openclaw:main Mar 27, 2026
8 checks passed
@osolmaz
Copy link
Contributor

osolmaz commented Mar 27, 2026

Landed via temp rebase onto main.\n\n- Gate: validation completed for this repo's change scope\n- Land commit: 1e18843\n- Merge commit: d63fa52\n\nThanks @Bortlesboat!

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.

2 participants