Skip to content

feat(sdk): trigger test events for Test numbers - #271

Open
purpshell wants to merge 1 commit into
devfrom
codex/cli-trigger
Open

purpshell wants to merge 1 commit into
devfrom
codex/cli-trigger

Conversation

@purpshell

@purpshell purpshell commented Sep 18, 2026

Copy link
Copy Markdown
Member

Adds the TypeScript SDK for test events on Test numbers (polymorfa/polymorfa#203). Contracts are synced from that PR's branch at 3d20ec3f6d326f74fb6d2e90b92402ccd3b9ac14. This is a coordinated dependency that isn't on monorepo dev yet; re-sync to the merge commit before release.

  • MessagingClient.testing.triggerEvent(projectId, { session, event, overrides?, fromSession? }){ event, session, delivery, eventId, source }
  • MessagingClient.testing.listEventFixtures(projectId)
  • Typed fixture names: TestEventFixture and the runtime TEST_EVENT_FIXTURES (message.received, message.ack, message.failed, call.received, call.missed, call.ended, session.status, template.status, bansafe.enforcement, bansafe.risk_changed). Also TestEventOverrides, TriggerTestEventRequest/Response, TestEventFixtureInfo.
  • Client tokens are refused before transport, like the other testing methods. Real-session refusal surfaces as PolymorfaValidationError and the per-project limit as PolymorfaRateLimitError.

Contract reconciliation

  • 2 new operations, covered.
  • 165 fingerprints refreshed. The only change behind them is three new PublicError/PlatformAccessPublicError codes (connection_limit, call_claimed, call_not_ringing), which the SDK doesn't enumerate. I verified this by recomputing with the old error schemas substituted: the fingerprints then match the previous ledger.
  • Not claimed here: the unified Calls revision on monorepo dev changed 6 VoIP and 2 project operations (reported changed), added 5 Calls operations (ledger missing, with a reason) and removed 4 VoIP operations (removed). These belong to feat(calls)!: unified call clients, SIP trunks and call settings #262. check:coverage --strict passes, but the report is not gap-free: 290 covered, 5 missing, 103 excluded, 8 changed.

Five-part check

Part Status Notes
API Unaffected here Implemented in polymorfa/polymorfa#203; this PR consumes that contract.
SDKs Updated TypeScript server SDK. There are no other language SDKs in this repository.
CLI Updated separately The polymorfa/cli draft PR adds polymorfa trigger on top of these methods.
Docs Updated packages/typescript/README.md (Trigger test events), CHANGELOG.md, contracts/README.md. The public Mintlify guide in #203 uses client.testing.triggerEvent.
Feature releases Unaffected here The API gates on the existing test-numbers beta. The SDK method doesn't grant access.

Verification

  • test/testing-events.test.ts (5 tests): request shape and encoding, fixture listing, 400 → PolymorfaValidationError, 429 → PolymorfaRateLimitError, client-token refusal before transport.
  • These all pass: npm run format:check, lint, typecheck, check:coverage, check:names, build, build:workspaces, and npm test (74 files, 497 tests). The coverage tests were updated for the new revision and assert that only /messaging/voip/* removals remain unresolved.
  • Not exercised: a live HTTP call against a deployed API.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@coderabbitai

coderabbitai Bot commented Sep 18, 2026

Copy link
Copy Markdown

Warning

Review limit reached

  • Ask an admin to enable usage-based reviews

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Next included review available in 46 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 76 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

The included review limit has been reached and this organization has disabled usage-based review continuation. Wait for reviews to reset or ask a billing admin to change After included review limits.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 9903217e-22e7-4675-a702-bcdb0133aafa

📥 Commits

Reviewing files that changed from the base of the PR and between 8803f05 and aa87c9d.

📒 Files selected for processing (13)
  • CHANGELOG.md
  • contracts/README.md
  • contracts/coverage.json
  • contracts/openapi.messaging.json
  • contracts/openapi.platform.json
  • contracts/source.json
  • packages/typescript/README.md
  • packages/typescript/src/index.ts
  • packages/typescript/src/messaging/onboarding.ts
  • packages/typescript/src/messaging/testing-configuration.ts
  • packages/typescript/test/coverage-reconciliation.test.ts
  • packages/typescript/test/coverage.test.ts
  • packages/typescript/test/testing-events.test.ts

Comment @coderabbitai help to get the list of available commands.

@purpshell

Copy link
Copy Markdown
Member Author

@coderabbitai review

@purpshell

Copy link
Copy Markdown
Member Author

@codex review

@coderabbitai

coderabbitai Bot commented Sep 18, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 18, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-18T12:56:14.106719Z aa87c9d Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: aa87c9d00a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

"session.status",
"template.status",
"bansafe.enforcement",
"bansafe.risk_changed",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Type the risk-change webhook emitted by this fixture

When bansafe.risk_changed is triggered, the resulting webhook cannot be handled as a known event: it is absent from KNOWN_WEBHOOK_EVENT_TYPES and WebhookPayloadMap, so constructWebhookEvent classifies it as UnknownWebhookEvent and isEvent(event, "bansafe.risk_changed") does not type-check. Add the corresponding webhook event and payload typing alongside exposing this fixture.

Useful? React with 👍 / 👎.

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