fix(docs): call Todoist API v1 directly in the Todoist example script - #1814
Conversation
The example relied on the Todoist plugin's internal api object, which no longer exposes getTasks/getProjects/getSections/closeTask, and Todoist's REST v2 API now returns 410 Gone. The script now calls https://api.todoist.com/api/v1 with a token from a QuickAdd secret setting, follows cursor pagination, and makes completing imported tasks an opt-out checkbox. Amp-Thread-ID: https://ampcode.com/threads/T-01a0df6d-45d0-75e7-8b10-3ce80c6ed75d Co-authored-by: Christian Bager Bach Houmann <christian@bagerbach.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 1 remain after this review. 📝 WalkthroughWalkthroughThe Todoist script now uses authenticated Todoist API v1 requests to retrieve paginated tasks, projects, and sections. It offers three import modes, formats task dates, and can complete imported tasks. The guide and tests cover the updated setup and import behavior. ChangesTodoist task import
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant QuickAdd
participant TodoistScript
participant TodoistAPI as Todoist API v1
QuickAdd->>TodoistScript: Choose import mode and tasks
TodoistScript->>TodoistAPI: Fetch tasks, projects, or sections
TodoistAPI-->>TodoistScript: Return requested data
TodoistScript-->>QuickAdd: Return formatted tasks
opt Completion enabled
TodoistScript->>TodoistAPI: Close selected tasks sequentially
end
Merge Risk: ⚪ Minimal · up to The Todoist import changes are ready to merge after normal checks; rejected tokens receive the intended error message. Security Architecture ReviewSecurity architecture risk: 🟡 Moderate · up to The new integration has useful token-storage and failure-handling controls, but it can complete Todoist tasks before their note content is saved. An interrupted import may therefore need manual recovery. Retained concerns
Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 35.71% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 2 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. A rabbit taps the token key, Comment |
Deploying quickadd with
|
| Latest commit: |
b0367ed
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://d6ea01ed.quickadd.pages.dev |
| Branch Preview URL: | https://fix-todoist-example-api-v1.quickadd.pages.dev |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7a559767e1
ℹ️ 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 a close POST fails after earlier tasks already completed, still return the formatted output with a notice so QuickAdd writes the note instead of dropping the capture. Covers Macroscope High and Codex P1 on #1814. Co-authored-by: Christian Bager Bach Houmann <christian@bagerbach.com>
Close each imported task independently instead of stopping at the first failed request, and report exactly how many are still open in Todoist. The capture still gets every imported task. Amp-Thread-ID: https://ampcode.com/threads/T-01a0df6d-45d0-75e7-8b10-3ce80c6ed75d Co-authored-by: Christian Bager Bach Houmann <christian@bagerbach.com>
Summary
The Fetch Tasks From Todoist example script no longer works:
app.plugins.plugins["todoist-sync-plugin"].api.getTasks()/getProjects()/getSections()/closeTask(). In the current Todoist plugin (2.6.0),plugin.apiis an internal wrapper, and none of those methods exist on it.410 Gone. Checked against a real account:GET /rest/v2/projects→ 410,GET /api/v1/projects→ 200.The script now calls the Todoist API v1 directly through
obsidian.requestUrl, so it no longer depends on another plugin's internals.secret(id: "todoist-api-token"), stored in Obsidian SecretStorage. Only asecretRefgoes intodata.json.GET /tasks,/projects,/sections, followingnext_cursorpagination withlimit=200, andPOST /tasks/{id}/close.SelectFromAllTasks,GetAllTasksFromProjectandGetAllTasksFromSectionare kept. The script also exportsentry, which asks which of the three to run.- [ ] <content> 📅 YYYY-MM-DD. Due dates for tasks with a fixed time zone (UTC…Zin v1) are converted to the local date.closeSelectedTaskscall". Recurring tasks are formatted before they are closed.forEach(async …)),GetAllTasksFromSectioncalledcloseSelectedTaskswithoutapp, selection matched by substring, and a cancelled section picker crashed.Docs page
The page now covers:
{{MACRO:Todoist::GetAllTasksFromProject}}instead of naming the macro commandScript::Export. A command namedScript::Exportdrills straight to the function, so the gear can't show the script's settings and the token can't be set.Todoist-GetAllTasksFromProject.png(which showed that::command naming) is replaced by a screenshot of the new settings. The#installation-videoanchor that other pages link to is kept, with a note that the video predates the token setting.Proof: real Obsidian 1.13.7, real Todoist account
Setup: an isolated e2e vault (
pnpm run start:e2e-obsidian) with made-up content. The token was entered through the real gear modal; afterwardsdata.jsonheld only{"__quickaddSecret":true,"secretRef":"quickadd-user-script-todoist-script-todoist-api-token"}.Todoist fixture: a temporary project "QuickAdd Demo (temporary)" with sections Errands and Reading, and 5 made-up tasks: date-only, no date, a fixed-time-zone datetime, and none. After each run, a SHA-256 fingerprint of every other project, section and task (IDs, names, content,
checked, due,updated_at) was compared with the pre-test fingerprint.quickadd:run … ui verify){{MACRO:Todoist::GetAllTasksFromSection}}→ Errands- [ ] Buy oat milk 📅 2031-01-15- [ ] Return library books{{MACRO:Todoist::SelectFromAllTasks}}→ 1 task ticked- [ ] Read chapter 3 of the demo novel 📅 2031-02-03(v1 returned2031-02-03T08:30:00Z){{MACRO:Todoist}}→ export picker →GetAllTasksFromProject, completion unticked in the gear UI- [ ] Water the plants 📅 2031-03-20- [ ] Plan picnic{{MACRO:Todoist::GetAllTasksFromProject}}, completion onNo tasks in 'QuickAdd Demo (temporary)'., QuickAddeffect: "unchanged"ok:false…Add your Todoist API token in the Todoist script's settings …ok:false,"error":"Todoist rejected the API token (HTTP 401). Check the token in the Todoist script's settings."Every successful run returned
"ok":true,"verified":true,"effect":"changed","file":"Todoist Inbox.md".Final commit re-run: after the review fixes, the fixture was recreated and
{{MACRO:Todoist::GetAllTasksFromProject}}was run again with the final script. The note received all 5 demo tasks with their due dates, all 5 were completed, and the other data fingerprint was unchanged.Cleanup: the temporary project was deleted after each session.
GET /api/v1/projects/<temp id>→404; a projects scan found 0 projects with that name; and the fingerprint of all other data matched the pre-test value (e102f21b05e0aeedbefore and after).Screenshots are from the throwaway vault. Pickers were filtered to the demo project before each capture, so no real account data appears.
{{MACRO:Todoist}})Resulting note. Newest captures are on top; the Water/Picnic pair appears twice because the first project run had completion off.
Tests
tests/examples/todoistScript.test.tsruns the script against a fake v1 server (2-item pages). It covers pagination, per-project and per-section filtering, duplicate task names, a close failing mid-batch, local conversion of UTC due dates (pinned toAsia/Tokyo, where 23:30Z is the next day), completion on and off, theentrypicker, and missing and rejected tokens.pnpm run test: 448 files, 5819 tests pass.pnpm run build-with-lintandpnpm run checkpass.main.jsis unchanged.pnpm run buildandpython3 scripts/check-links.py→ 0 problems across 52 pages. The rendered page was inspected locally.Release / migration impact
Docs and example only; no plugin code changes. Users of the old script need to download the new one and paste a Todoist API token in the script's settings. The Todoist plugin is no longer required.
Note
Call Todoist API v1 directly in the Todoist example script
createTodoist) that authenticates with a secret token and follows paginated list endpoints (page size 200)Macroscope summarized b0367ed.
Summary by CodeRabbit