Skip to content

Normalize bounded read-tool limits consistently - #6

Open
vsolano9 wants to merge 1 commit into
AgentPostmortem:mainfrom
vsolano9:fix-4-normalize-limits
Open

Normalize bounded read-tool limits consistently#6
vsolano9 wants to merge 1 commit into
AgentPostmortem:mainfrom
vsolano9:fix-4-normalize-limits

Conversation

@vsolano9

Copy link
Copy Markdown

What & why

Current main already sends both shopify_orders and db_query through the same clampInt helper, so the issue’s 1000/-5/NaN examples are no longer raw at the connectors. The remaining hole is numeric fractions and infinities: 1.9 reaches both URLs unchanged, while positive/negative infinity become opposite bounds. This completes the existing centralized clamp contract.

Closes #4

Changes

  • default every non-finite limit, including both infinities, to 10
  • truncate finite fractional numbers before the existing 1–50 clamp
  • state the truncation/clamp behavior in both MCP input schemas
  • add connector-level tests that capture the real Shopify and PostgREST URLs and prove both tools receive the same normalized integer
  • expose the dependency-free suite through npm test

Validation

  • RED: both connectors emitted 1.9; positive infinity became 50 and negative infinity became 1
  • npm test — 10/10 pass; repeated successfully 20 consecutive times
  • Node 20 test run — 10/10 pass
  • npm run typecheck — pass
  • fresh npm ci — pass
  • npx wrangler deploy --dry-run — pass; no deployment
  • git diff --check — pass
  • production dependency audit — 0 findings; fresh install reports six existing development dependency advisories; no dependency or lockfile changes

Checklist

  • Focused change with a clear description
  • Ran format / lint / tests (repository provides typecheck and tests; both pass)
  • Updated docs or CHANGELOG if relevant (tool schemas now describe normalization)
  • Linked the related issue

Truncate finite numeric limits before applying the existing 1-50 clamp and route all non-finite values to the default. Document the behavior in both tool schemas and prove Shopify/database connectors receive identical normalized integers.
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.

limit is unvalidated, and the Shopify path does not clamp it at all

1 participant