Skip to content

feat(cues): add bulk_delete (cueapi #650 / cli #46 parity)#37

Merged
mikemolinet merged 1 commit into
mainfrom
feat/cues-bulk-delete
May 9, 2026
Merged

feat(cues): add bulk_delete (cueapi #650 / cli #46 parity)#37
mikemolinet merged 1 commit into
mainfrom
feat/cues-bulk-delete

Conversation

@mikemolinet
Copy link
Copy Markdown
Collaborator

Summary

Adds client.cues.bulk_delete(ids) to the SDK. Closes Backlog row cmousydyn (which was originally mistitled 'messages'; PM corrected to 'cues' during my pre-verify pass — see PR description note below).

What's added

  • cueapi/resources/cues.py: new bulk_delete(ids: List[str]) -> Dict[str, List[str]] method on CuesResource.
  • tests/test_cues_resource.py: new TestBulkDelete class with 7 tests (happy-path, with-skipped, header pin, empty-raises, over-100-raises, exactly-100-ok boundary, iterable-input).
  • CHANGELOG.md: [Unreleased] section with the new method's entry.

Behavior

result = client.cues.bulk_delete(["cue_abc", "cue_def", "cue_xyz"])
# → {"deleted": ["cue_abc", "cue_def"], "skipped": ["cue_xyz"]}

Wraps POST /v1/cues/bulk-delete with body {"ids": [...]}. Per-ID atomic, NOT batch atomic — IDs that don't exist OR aren't owned by the caller land in the skipped array (silent skip on miss; no info leak about other tenants' cues). Cascade FK handles executions + dispatch_outbox cleanup.

Sends X-Confirm-Destructive: true header automatically (server requires it for any bulk-destructive endpoint, mirrors agents-webhook-secret-regenerate + auth-key-regenerate).

Client-side validation (fail-fast):

  • Empty idsValueError("ids must contain at least one cue ID.")
  • 100 IDs → ValueError("Max 100 IDs per call; got <N>. Split into batches.")

Stats

  • 3 files changed (+143/-1).

Test plan

  • 11/11 tests pass in tests/test_cues_resource.py (4 pre-existing TestFire + 7 new TestBulkDelete)
  • Pyright import-noise diagnostics resolve when package is installed (verified via local pip install -e ".[dev]")
  • X-Confirm-Destructive header is sent on every call (pinned by test_bulk_delete_sends_confirm_destructive_header)
  • Boundary tested: exactly-100 IDs allowed; 101+ raises before any HTTP call (pinned by test_bulk_delete_exactly_100_ids_ok + test_bulk_delete_over_100_ids_raises)
  • No respx/integration tests added — matches existing TestFire pattern (MagicMock-based unit tests for SDK methods)

Note re: Backlog row title

Backlog row cmousydyn was originally titled "Parity port: bulk delete messages (#650) → cueapi-python + cueapi-mcp + cueapi-action". Pre-verify caught the mismatch (PR #650 is cues, not messages; cueapi-core has zero @router.delete on messages.py). PM patched the row title to 'cues' 2026-05-09 ~20:45Z and confirmed interpretation 1 (port the cues bulk-delete). This PR ships the cueapi-python piece; cueapi-mcp + cueapi-action follow as separate PRs in the same row.

Related

Closes

  • Closes (in part) cmousydyn000004lgs0drkbap — this PR ships the cueapi-python piece. Row stays in-progress until cueapi-mcp + cueapi-action also ship.

🤖 Generated with Claude Code

Adds `client.cues.bulk_delete(ids)` — wraps POST /v1/cues/bulk-delete.
Closes Backlog row cmousydyn (mistitled 'messages'; actually cues per
PR #650 + cli #46; PM corrected title 2026-05-09 ~20:45Z).

Returns {"deleted": [...], "skipped": [...]} — per-ID atomic, not
batch atomic. IDs that don't exist OR aren't owned by the caller
land in `skipped` (silent skip on miss; no info leak about other
tenants' cues).

Sends X-Confirm-Destructive: true header automatically (server
requires it for any bulk-destructive endpoint, mirrors the
agents-webhook-secret-regenerate + auth-key-regenerate pattern).

Client-side validation:
- Empty `ids` → ValueError "at least one cue ID"
- > 100 IDs → ValueError "Max 100" (matches server cap; fail-fast)

Tests: 7 new in TestBulkDelete class — happy path, with-skipped,
header pin, empty-raises, over-100-raises, exactly-100-ok boundary,
iterable-not-just-list. 11/11 pass in tests/test_cues_resource.py.

Parity context: cueapi-cli #46 shipped this as `cueapi bulk-delete`
on 2026-05-06. cueapi-mcp + cueapi-action ports follow as separate
PRs in the same Backlog row.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mikemolinet mikemolinet added auto-merge enhancement New feature or request labels May 9, 2026
@govindkavaturi-art govindkavaturi-art enabled auto-merge (squash) May 9, 2026 20:49
@mikemolinet mikemolinet merged commit 7e98ef4 into main May 9, 2026
4 checks passed
@mikemolinet mikemolinet deleted the feat/cues-bulk-delete branch May 9, 2026 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-merge enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant