Skip to content

feat(operation): add operation list, view, wait, watch, and cancel - #24

Merged
purpshell merged 4 commits into
devfrom
feat/operation-commands
Sep 20, 2026
Merged

purpshell merged 4 commits into
devfrom
feat/operation-commands

Conversation

@purpshell

@purpshell purpshell commented Sep 19, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds polymorfa operation list|view|wait|watch|cancel and removes the README statements that operations are console-only.

  • operation list: filters are --status, --kind, --resource-type/--resource-id, --since, --until, and cursor pagination. --owner organization shows team and project operations; --owner project --project <id> shows one project.
  • operation view <id>
  • operation wait <id> [--timeout 300] chains server long-polls (?wait=30). Exit codes: 0 on success, 1 on failure or cancellation, 8 (action_required) when the timeout ends first.
  • operation watch <id> prints the current state and then each transition (afterSequence long-polls). With --json it prints one JSON document per change. Exit codes match wait.
  • operation cancel <id> needs confirmation (or --yes) and accepts --idempotency-key.

SDK dependency, and why I used an adapter. The CLI pins @polymorfa/sdk to github:polymorfa/sdks#94bfd09. Since sdks 4f54b26, the SDK repo root is a private workspace (polymorfa-sdks), so a git ref to any newer SDK commit won't install. @polymorfa/sdk also isn't on npm yet (404). So the CLI can't consume client.operations from polymorfa/sdks#280 yet. Instead, src/developer/operations.ts sends the same Platform requests through the pinned SDK's authenticated raw transport, with the same list/get/wait/cancel shape as the SDK resource. Once the SDK is consumable, the adapter should be replaced with session.client.operations. That's tracked as a follow-up.

Five-part assessment

Part Status Detail
API Updated upstream polymorfa/polymorfa#223 (merged first)
SDKs Updated in polymorfa/sdks#280 This PR doesn't consume the SDK change yet (see above).
CLI Updated Five new commands, README "Operations" section, three console-only statements removed
Docs Updated CLI README here; public docs in #223
Feature releases No flag Scope-gated. See the release record in #223.

Verification

  • tsc --noEmit, eslint, and prettier on the changed files
  • New test/commands/operations.test.ts (8 tests): org vs project routing, filters, long-poll query and request timeout, exit codes 0/1/8, watch transitions with afterSequence, cancel with the idempotency key, and refusal without --yes.
  • npm test locally: 18 pre-existing failures in api, auth, calls, calls-sockets, and listen. The same tests fail on a clean dev checkout on this machine. I'm relying on CI for those.

@coderabbitai

coderabbitai Bot commented Sep 19, 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 12 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 89 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: 3a406046-96ef-48de-ac49-5365ff39bcc6

📥 Commits

Reviewing files that changed from the base of the PR and between cc29c68 and ef55c1a.

📒 Files selected for processing (9)
  • README.md
  • src/commands/operation/cancel.ts
  • src/commands/operation/list.ts
  • src/commands/operation/view.ts
  • src/commands/operation/wait.ts
  • src/commands/operation/watch.ts
  • src/developer/operation-view.ts
  • src/developer/operations.ts
  • test/commands/operations.test.ts

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

@purpshell

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 19, 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.

@purpshell

Copy link
Copy Markdown
Member Author

Reviewed locally (the CodeRabbit bot is rate-limited on this org): coderabbit review --base dev plus a local code review.

Fixed since the first push:

  • src/commands/operation/shared.ts lived under the command directory, so oclif treated it as a command named operation:shared and emitted a warning on every config load. That warning landed in captured stderr and broke unrelated api, auth, calls, and listen assertions. The helpers moved to src/developer/operation-view.ts, and the whole suite passes (524 tests).
  • wait and watch now bound each long-poll by the remaining --timeout budget with an abort signal, return the last state they read when the budget ends, and validate maxWaitMs. A new test holds the request open and asserts the command still exits 8.

The branch is merged with dev.

@purpshell
purpshell merged commit a5195b4 into dev Sep 20, 2026
3 checks passed
@purpshell
purpshell deleted the feat/operation-commands branch September 20, 2026 14:34
purpshell added a commit that referenced this pull request Sep 22, 2026
Brings in the npm SDK prerelease pin (#16), operation commands (#24), doctor,
link/project, api fields and the Blacksmith CI runners.

package.json takes dev's exact pin, @polymorfa/sdk 0.1.0-dev.20260922102711,
plus jq-wasm, so it now matches dev's package-lock.json and npm ci resolves.
That prerelease lacks the campaign recipient, audience member and opt-out
settings methods, so typecheck still fails against it until sdks#285 is
published and this pin is bumped to the resulting exact version.

README keeps this branch's stop and recipients/audiences/opt-outs sections
and takes dev's pointer to the operation commands in place of the old
"operation inspection is console-only" line. oclif topics are the union.
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