Skip to content

refactor(gateway): explicit boolean comparison in webhook timestamp check#700

Open
marcusrbrown wants to merge 1 commit into
mainfrom
fix/hmac-strict-boolean
Open

refactor(gateway): explicit boolean comparison in webhook timestamp check#700
marcusrbrown wants to merge 1 commit into
mainfrom
fix/hmac-strict-boolean

Conversation

@marcusrbrown
Copy link
Copy Markdown
Collaborator

Aligns checkTimestamp in the gateway HMAC module with the project's strict-boolean convention — Number.isFinite(parsedMs) === false instead of !Number.isFinite(parsedMs). No behavior change; the two forms are equivalent. refactor scope so it doesn't trigger a release on its own.

Align checkTimestamp with the project's strict-boolean convention
(`Number.isFinite(parsedMs) === false` rather than negation). No behavior
change.
@marcusrbrown marcusrbrown requested a review from fro-bot as a code owner May 30, 2026 06:33
@fro-bot fro-bot added the agent: working Agent is currently working on this label May 30, 2026
Copy link
Copy Markdown
Owner

@fro-bot fro-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: PASS

This is a one-line, behavior-preserving refactor: !Number.isFinite(parsedMs)Number.isFinite(parsedMs) === false in checkTimestamp (packages/gateway/src/http/hmac.ts:76).

I verified:

  • Behavioral equivalence. Number.isFinite always returns a real boolean, and parsedMs is typed number (from Date.parse). === false and ! are identical here with no coercion subtlety. The NaN / unparseable branch returns the same {ok: false, reason: 'timestamp_expired'}.
  • Convention claim holds. The strict-boolean style is pervasive in this package (90+ === true/=== false matches), including the structurally identical Number.isFinite(httpPort) === false at config.ts:327. The change genuinely aligns with house style rather than introducing a one-off.
  • Test coverage exists. hmac.test.ts already exercises the touched branch — unparseable timestamp describe block (garbage string and empty string both assert timestamp_expired), plus the in-window / boundary / expired cases. No new behavior to test.
  • Commit scope. refactor scope correctly avoids triggering a release, matching the PR description's intent.

Blocking issues

None

Non-blocking concerns

None — the explicit form is marginally more verbose but is the established package convention, so it's the right call here.

Missing tests

None — no behavior changed; the affected branch is already covered.

Risk assessment (LOW): No behavior change to a pure, well-tested function. No public API surface change (signature and return shape identical). Blast radius is a single conditional inside one function; regression likelihood is effectively nil and there is no new security exposure on the auth path.


Run Summary
Field Value
Event pull_request
Repository fro-bot/agent
Run ID 26676988757
Cache hit
Session ses_1886847a7ffepR5mGe63aA68fE

@fro-bot fro-bot removed the agent: working Agent is currently working on this label May 30, 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