Skip to content

Add --phone-offline-start-day to webhook create and update - #82

Merged
purpshell merged 1 commit into
mainfrom
feat/webhook-phone-offline-start-day
Oct 18, 2026
Merged

purpshell merged 1 commit into
mainfrom
feat/webhook-phone-offline-start-day

Conversation

@purpshell

@purpshell purpshell commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds --phone-offline-start-day <7-13|off> to polymorfa webhook create and polymorfa webhook update (API contract polymorfa/polymorfa#631).

  • A day merges phoneOfflineStartDay into the JSON body. The API default is 10.
  • off removes session.phone_offline from eventTypes. On update, if --input supplies no event types, the CLI reads the saved ones with webhooks.retrieve first. Platform webhooks need at least one event type, so the CLI refuses off when no event would remain, with exit code 2 and no request.
  • webhook update accepts the flag without --input. With neither, it exits 2 before any request.
  • Values outside 7 to 13, decimals and other words are rejected while parsing flags, before the SDK is called.
  • webhook view shows Phone offline warning: from day N, off when unsubscribed, or not reported when the API doesn't return the field.
  • The README documents the flag. The pinned SDK prerelease doesn't type the field yet, so the CLI passes it through the JSON body and treats it as optional in the renderer.

Impact

Impact table

Area Updated / blocked Change or named blocker Paths / companion PRs / evidence
Commands Updated Flag on webhook create and webhook update; --input optional on update with the flag src/commands/webhook/create.ts, update.ts, src/developer/phone-offline.ts
Output Updated New webhook view row src/developer/render.ts
README Updated Example and rules README.md
API Blocked on polymorfa/polymorfa#631 The field needs the API deployed polymorfa/polymorfa#631
SDK pin Follows polymorfa/sdks#353 Bump @polymorfa/sdk to the first prerelease with the typed field, then drop the optional cast polymorfa/sdks#353

No impact table

Area Why there is no impact Supporting paths or evidence
Credentials and secrets No change to the signing-secret delivery path create.ts secret handling unchanged; existing tests pass
Other commands Only the webhook create, update and view paths change git diff --stat
JSON output envelope Same developerMutation and developerResponse envelopes Existing JSON-output tests pass

Verification

Tested at 50b95de.

  • npm run verify passes: prettier, eslint, typecheck, vitest (110 files, 1,051 tests), build, npm pack --dry-run, and npm audit with 0 vulnerabilities.
  • New tests cover: the day on create; updating only the day without --input; off removing the event from the saved list via webhooks.retrieve; refusing off when it would leave no event (exit 2, no update call); rejecting 6, 14, 9.5 and never before any SDK call; requiring --input or the flag (exit 2); and the webhook view row for subscribed, unsubscribed and unreported cases.
  • Not exercised: commands against a deployed API (needs polymorfa/polymorfa#631), and nightly staging acceptance.

Session provenance and UI evidence

  • Agent registration PR: existing purpshell-t3-claude registration in polymorfa/polymorfa.
  • Sanitized transcript checkpoint and evidence commit: blocked. pnpm agent:record capture fails for T3 thread cdeecc57-bc5b-483f-a725-030e5bf3dc69 (known T3 v2 gap).
  • Capture coverage/gaps and tested revision: no transcript; tested 50b95de; claude-opus-5-5.
  • UI screenshots: not applicable (CLI). Human output is covered by the render tests.

Rollout and rollback

  • Merge after polymorfa/polymorfa#631 and Type the webhook phone offline start day sdks#353. Bump the SDK pin when the prerelease is published.
  • The nightly prerelease requires staging acceptance; a stable release requires production acceptance.
  • Rollback: revert this PR. JSON bodies with the field still pass through.
  • Records: Notion feature. Release record in polymorfa/polymorfa#631. Linear blocked (not authorized).

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

Sets the first day (7-13) a webhook receives session.phone_offline, or
off to remove the event; update reads saved event types when the input
has none and refuses off when no event would remain. webhook view shows
the setting. API contract: polymorfa/polymorfa#631.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 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-10-17T17:45:15.281418Z 50b95de PR opened
🔒 Security Review ✅ Completed 2026-10-17T17:45:21.255936Z 50b95de PR opened
ℹ️ 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.

@coderabbitai

coderabbitai Bot commented Oct 17, 2026

Copy link
Copy Markdown

Warning

Review limit reached

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.

  • 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 38 minutes.

Check out review usage here.

View limit details

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

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Team
  • Run ID: 9d61f04e-47af-489a-ac3d-59176dff67d6
📥 Commits

Reviewing files that changed from the base of the PR and between 16596a6 and 50b95de.

📒 Files selected for processing: 7
  • README.md
  • src/commands/webhook/create.ts
  • src/commands/webhook/update.ts
  • src/developer/phone-offline.ts
  • src/developer/render.ts
  • test/commands/developer-webhooks.test.ts
  • test/developer/render.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@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: 50b95def09

ℹ️ 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".

if (eventTypes === undefined) {
throw new Error('Add eventTypes to the input before using off.')
}
const remaining = eventTypes.filter((event) => event !== PHONE_OFFLINE_EVENT)

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 Handle wildcard subscriptions when applying off

When a webhook's eventTypes contains the valid trailing-wildcard pattern session.*, filtering only the exact session.phone_offline string leaves that subscription unchanged, so --phone-offline-start-day off succeeds while the webhook continues receiving the warning event. Either rewrite wildcard subscriptions so they exclude this event or reject off with an actionable error when exclusion cannot be represented.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Not changed. Delivery matches subscriptions by exact event type (matchesSubscription uses events.includes(event.type), apps/api/packages/api/src/services/webhook-delivery.ts:600), so a stored session.* entry matches no event and the webhook does not receive session.phone_offline through it. Filtering the exact name is the complete opt-out.

Comment thread src/developer/render.ts
readonly eventTypes: readonly string[]
readonly phoneOfflineStartDay?: number
}): string {
if (!webhook.eventTypes.includes('session.phone_offline')) return 'off'

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 Recognize wildcard subscriptions in webhook view

For a webhook subscribed through session.*, this exact-membership check displays Phone offline warning: off even though the wildcard includes session.phone_offline. The renderer should apply the same trailing-wildcard matching semantics as event subscription handling before deciding that the warning is disabled.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Not changed, for the same reason: delivery has no wildcard matching, so a webhook subscribed only through session.* does not receive session.phone_offline and 'off' is the accurate display.

@purpshell
purpshell merged commit c21af71 into main Oct 18, 2026
2 checks passed
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