Skip to content

fix(tests): use numeric id fixtures after zodBigintAsString was anchored - #1104

Merged
sung17 merged 1 commit into
mainfrom
fix/anchored-id-test-fixtures
Sep 6, 2026
Merged

fix(tests): use numeric id fixtures after zodBigintAsString was anchored#1104
sung17 merged 1 commit into
mainfrom
fix/anchored-id-test-fixtures

Conversation

@sung17

@sung17 sung17 commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

main is currently red. #1069 tightened zodBigintAsString from /\d+/ to /^\d+$/ in packages/utils/src/zod.ts. The old pattern was unanchored, so it matched any string merely containing a digit — "ws-1", "ci-1", "b1" all passed. Anchoring it is correct (createId() returns a numeric snowflake, so a real id is always all-digits), but two test files still carry the old-shaped fixtures and now fail validation.

#1069 did fix the fixtures it noticed (ads-campaign-wizard); these two were missed.

This PR is fixtures only — no production code changes.

Changes

  • apps/worker/__tests__/flow-import-handler.test.ts — flow step ids "b1"/"s1" → numeric. 9 tests were failing on flows.0.nodes.0.data.details.beforeStep.id.
  • packages/business/__tests__/ads-conversion-rule.service.test.tsworkspaceId, contactInboxId, integrationId / integration*Id and rule ids → numeric. 55 tests were failing. The ids embedded in the expected event dedup keys (rule-<ruleId>-inbox-<contactInboxId>-<date>) are updated to match, so those assertions still check the real derived value.

Ids that no schema validates (event-*, clid-*, wamid.*, the ImportRow id) are left as they are.

Test plan

  • pnpm --filter worker test — 200 files, 1949 tests
  • pnpm --filter @chatbotx.io/business test — 153 files, 1695 tests
  • pnpm --filter builder test — 407 files, 2726 tests
  • pnpm lint
  • pnpm --filter worker check-types, pnpm --filter @chatbotx.io/business check-types

#1069 changed `zodBigintAsString`'s pattern from `/\d+/` to `/^\d+$/`. The
old pattern matched any string merely *containing* a digit, so fixtures like
"ws-1" and "ci-1" passed validation despite never being shapes `createId()`
can produce. Anchoring it is correct — it just left two test files behind,
and `main` has been red since.

- flow-import-handler: flow step ids "b1"/"s1" -> numeric
- ads-conversion-rule.service: workspace, contact-inbox, integration and rule
  ids -> numeric, including the ids embedded in the expected event dedup keys

Fixtures only; no production code changes.
@github-actions github-actions Bot added the bug Something isn't working as expected label Sep 6, 2026
@sung17
sung17 merged commit 1f777ef into main Sep 6, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working as expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant