Skip to content

refactor: delete filters through the REST endpoint - #614

Merged
scottlovegrove merged 2 commits into
mainfrom
scottlovegrove/delete-filter-rest
Oct 23, 2026
Merged

scottlovegrove merged 2 commits into
mainfrom
scottlovegrove/delete-filter-rest

Conversation

@scottlovegrove

@scottlovegrove scottlovegrove commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

td filter delete now uses deleteFilter() from @doist/todoist-sdk 15.8.0 (bumped from 15.3.2), which calls the new REST DELETE /api/v1/filters/{id} endpoint, instead of the Sync filter_delete command. No behaviour change for users: the CLI's OAuth login already requests data:delete, so it never hit the 403 that the hosted MCP server did (Doist/Issues#21370). This keeps filter deletion consistent with the other delete commands and with the MCP server (Doist/todoist-mcp#634).

deleteFilter isn't in the read-only allowlist, so read-only mode still blocks it. Type check, lint/format and the full test suite (2252 passing) pass.

`td filter delete` used the Sync `filter_delete` command. Switch to
`deleteFilter()` from @doist/todoist-sdk 15.8.0, which calls the REST
`DELETE /api/v1/filters/{id}` endpoint, matching how the other delete
commands work.
@scottlovegrove scottlovegrove added the 👀 Show PR requires passing checks before merge and independent human review before or after merge. label Oct 23, 2026
@scottlovegrove scottlovegrove self-assigned this Oct 23, 2026

@doistbot doistbot left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

td filter delete now calls the SDK's REST deleteFilter() (bumped to 15.8.0) instead of the Sync filter_delete command, keeping filter deletion consistent with the other delete commands and the MCP server, with read-only mode still blocking it via the default-deny allowlist.

Few things worth tightening:

  • Add a colocated src/lib/api/filters.test.ts that verifies deleteFilter is called with the resolved ID through setupApiMock() (and that no Sync filter_delete command is sent) — the current command tests mock the wrapper, so a regression back to the sync path would slip through.
  • Stub deleteFilter: vi.fn() in createMockApi first, since the shared mock doesn't include the new SDK method.

I also included a few optional follow-up notes in the details below.

Optional follow-up notes (2)
  • P3 src/lib/api/filters.ts:87: createMockApi() in src/test-support/mock-api.ts doesn't stub deleteFilter, so the standard test mock cannot exercise this new code path (api.deleteFilter is not a function). Add deleteFilter: vi.fn() to the mock; the repo's add-command checklist calls for a bare vi.fn() stub for each mutation method.
  • P3 src/lib/api/filters.ts:87: deleteFilter is missing from API_SPINNER_MESSAGES in src/lib/api/core.ts. The previous api.sync path showed the 'Syncing...' spinner, but this REST call now runs without one, unlike deleteTask, deleteLabel, and deleteSection. Add deleteFilter: { text: 'Deleting filter...', color: 'yellow' } for consistency.

Share Feedback • Review Logs

Comment thread src/lib/api/filters.ts
Add a test that `deleteFilter` calls the SDK's REST `deleteFilter()`
and sends no Sync command, stub `deleteFilter` in the shared API mock,
and give it a "Deleting filter..." spinner like the other deletes.
@scottlovegrove scottlovegrove added 🚢 Ship PR requires passing checks before merge, but no independent human review. and removed 👀 Show PR requires passing checks before merge and independent human review before or after merge. labels Oct 23, 2026
@scottlovegrove
scottlovegrove merged commit f9b3ed9 into main Oct 23, 2026
7 checks passed
@scottlovegrove
scottlovegrove deleted the scottlovegrove/delete-filter-rest branch October 23, 2026 10:47
@doist-release-bot

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 5.8.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released 🚢 Ship PR requires passing checks before merge, but no independent human review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants