Skip to content

refactor: extract magic-number timeouts into named constants#474

Merged
koichimurakami merged 1 commit into
developfrom
refactor/agent-magic-number-constants
Jun 25, 2026
Merged

refactor: extract magic-number timeouts into named constants#474
koichimurakami merged 1 commit into
developfrom
refactor/agent-magic-number-constants

Conversation

@koichimurakami

Copy link
Copy Markdown
Contributor

Summary

Refactor loop (iteration 1). Replace hard-coded timeout/delay literals in the agent with named constants. Values unchanged — behavior-invariant.

Changes

  • browser-local-server.ts / vscode-tunnel-websocket.ts: reference the already-defined SELECTOR_TIMEOUT_NAVIGATION_MS (30000) / SELECTOR_TIMEOUT_SINGLE_MS (10000) instead of literals (the constants existed but weren't referenced here)
  • db-query.ts: new DB_CONNECT_TIMEOUT_MS (10000) for MySQL connectTimeout / PG connectionTimeoutMillis
  • browser.ts: new BROWSER_SESSION_RETRY_DELAY_MS (500)
  • vscode-server.ts: new STARTUP_HEALTH_POLL_MS (500) for startup health-check polling

Deliberately left untouched: the Math.min(params.waitForTimeout, 10000) input-clamp (a different concept — upper bound on caller input, not a selector timeout).

Tests

  • Full suite green (4409 tests), coverage thresholds (95/90/95/95) held
  • Pinned-value tests added for each new constant
  • code-reviewer: value-drift none, concept mapping correct, 0 findings

🤖 Generated with Claude Code

Replace hard-coded timeout/delay literals with named constants.
Values are unchanged (behavior-invariant).

- browser-local-server / vscode-tunnel-websocket: reference existing
  SELECTOR_TIMEOUT_NAVIGATION_MS (30000) / SELECTOR_TIMEOUT_SINGLE_MS (10000)
- db-query: new DB_CONNECT_TIMEOUT_MS (10000) for MySQL/PG connect timeouts
- browser: new BROWSER_SESSION_RETRY_DELAY_MS (500)
- vscode-server: new STARTUP_HEALTH_POLL_MS (500) for health-check polling

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@koichimurakami koichimurakami merged commit 4072172 into develop Jun 25, 2026
3 checks passed
@koichimurakami koichimurakami deleted the refactor/agent-magic-number-constants branch June 25, 2026 03:55
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