Skip to content

Use monotonic microsecond timing and 2x ratio for CLI alias timing guard - #20163

Merged
dhh merged 2 commits into
quattrofrom
fix/cli-alias-timing-test
Nov 25, 2026
Merged

dhh merged 2 commits into
quattrofrom
fix/cli-alias-timing-test

Conversation

@dhh

@dhh dhh commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #20132, which sped up full command-table loading in bin/omarchy ~5.5x (from ~260ms down to ~47ms).

With full-table loading now ~47ms vs ~11ms for alias dispatch (~4x true ratio), the existing guard in test/cli (alias_ms * 4 > full_ms timed via /proc/uptime's 10ms ticks) had almost zero margin and flaked on loaded CI runners whenever a ~12ms alias run quantized up to 20ms (20 * 4 > 50).

  • Monotonic microsecond timing: Replaces /proc/uptime 10ms quantization in test/cli (fastest_us) with Python's time.monotonic_ns() (5 runs, taking the fastest, with check=True), preserving immunity to NTP/timesyncd wall-clock steps in freshly booted CI VMs while eliminating 10ms rounding jitter.
  • 2x ratio threshold: Updates the assertion from alias_ms * 4 > full_ms to alias_us * 2 > full_us (alias dispatch must cost under half of full-table load), which still catches a regression back to full-table loading (~47ms vs ~47ms -> ~1x) immediately while staying flake-free on CI.
  • Docs: Updates docs/testing.md to match the new threshold and current timings.

Verification

  • ./test/cli passed 6/6 consecutive runs (10.7–12.4ms vs 43.8–46.8ms).
  • codex review --base origin/quattro approved with zero actionable regressions.

@greptile-apps

greptile-apps Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge, with no outstanding findings.

Summary

Updates the CLI timing guard to use monotonic microsecond measurements and require alias dispatch to take at most half as long as loading the full command table.

  • The CLI timing check measures alias dispatch more precisely and allows half the full-load time.

Reviews (2) · Last reviewed commit: "Use 2-space indentation in test/cli fast..." · Reviewed by Greptile

@greptile-apps

greptile-apps Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Low impact] The PR affects one CLI performance check and its documentation.

No behavioral defect was found, but the required two-space indentation must be applied before merging.

Findings

  1. P2 Indentation breaks repository style ▶

Summary

Updates the CLI timing guard to use monotonic microsecond measurements.

  • The CLI guard checks alias dispatch stays below half the full-table load.

Reviews (1) · Last reviewed commit: "Use monotonic microsecond timing and 2x ..." · Reviewed by Greptile

Comment thread test/cli Resolved
@dhh
dhh force-pushed the fix/cli-alias-timing-test branch from c2cd4eb to 42d9f0d Compare November 25, 2026 16:20
@dhh
dhh merged commit 81f25a5 into quattro Nov 25, 2026
5 checks passed
@dhh
dhh deleted the fix/cli-alias-timing-test branch November 25, 2026 16:22
cursor Bot pushed a commit to mark-groves/omarchy that referenced this pull request Nov 25, 2026
…ard (omacom#20163)

* Use monotonic microsecond timing and 2x ratio for CLI alias timing guard

* Use 2-space indentation in test/cli fastest_us Python block
@emirb emirb added this to the 4.6.0 milestone Dec 1, 2026
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