Skip to content

fix(monitors): read USD prices written after the amount - #236

Open
chuiwenwei wants to merge 1 commit into
CopilotKit:mainfrom
chuiwenwei:fix/monitor-usd-suffix
Open

chuiwenwei wants to merge 1 commit into
CopilotKit:mainfrom
chuiwenwei:fix/monitor-usd-suffix

Conversation

@chuiwenwei

Copy link
Copy Markdown

What changed

A price_below watch only recognized $ or USD before the number ($9.99, USD 9.99). A page that writes 9.99 USD was treated as having no price, so the watch stayed silent on an explicit USD price.

matchesPrice now also matches the amount followed by USD, with the same comma/decimal grammar and the same threshold comparison as the prefix forms.

Verification

  • pnpm lint
  • pnpm typecheck
  • pnpm --dir apps/worker typecheck
  • pnpm build:server
  • pnpm test — 529 passing

New tests/monitor-usd-suffix.test.ts covers suffix, prefix, mixed prices, and a page that mentions USD without an amount.

Integration limits

None. No network or provider access is needed. Matching is still limited to explicit $/USD spellings; other currencies are unchanged.

A price watch only recognized "$9.99" and "USD 9.99". Pages that write the
currency after the amount, such as "9.99 USD", never matched even though the
price is explicit.

Match the trailing spelling too, keeping the existing comma and decimal rules.

Adds coverage for suffix, prefix and unrelated USD text.

This branch has not been deployed

No deployments
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