Todo sync groundwork: provider, Vikunja adapter, extract/match #70
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/51-todo-sync"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Refs #51
Draft: groundwork only. The design (docs/todo-sync.md) is still waiting on Jeremy, so this has none of the schema, workers, settings or UI. It holds the parts the design fixes either way (D2, D3, D9):
docs/todo-sync.md: the design, plus the Vikunja calls as checked on a real 2.8.0.RmAnalyzer.Todos.Provider: the behaviour the sync engine will use (check_credentials,list_projects,create_task,complete_task,reopen_task,delete_task, optionalchanges_since), plain maps with string ids, andProvider.module/1by name. Tests getTodos.FakeProviderthrough config.Todos.Providers.Vikunja: API v2 with Req. Create isPOST /projects/{id}/tasks?format=markdown. Done and reopen send a merge-patchPATCH /tasks/{id}with onlydone, and 304 counts as ok. Delete isDELETE /tasks/{id}, and 404 counts as already gone. Project lists page untiltotal_pages, treat nullitemsas empty, and leave out archived projects. Each call logs its method, path, host, ids, status and ms, never the token. Ids are path-escaped.Todos.Extract: walks the MDEx task list for every task item in order, nested ones included. Each gets its text, ticked or not, ordinal, section heading, and a struck flag (the whole item in~~ ~~). Plain bullets and empty boxes are skipped.Todos.Match: normalizes text (NFKC, case, Markdown marks,[?]/[illegible], punctuation). Then it pairs one to one in three passes: exact, then jaro >= 0.85, then the same ordinal and section with jaro >= 0.6. Text under 6 characters only pairs exactly. Ties go to the same section, then the nearest ordinal.Checked
mix precommit: 1136 tests, 0 failures.mix test --include live_vikunjaagainst a real Vikunja 2.8.0: create, done twice (200 then 304), reopen, delete twice (204 then 404), and a bad token (401). Seetest/rm_analyzer/todos/providers/vikunja_live_test.exsfor how to run it.Found on 2.8.0: v2
DELETEmoves a task to the trash, where it can be restored for 30 days. It isn't permanent. The adapter never purges.Added (
6ad5487)docs/todo-sync.mdreplaced with Haystack's revision: Nye's final check C1–C8 (page_checked kept apart from provider state, moves followed by hash only when the old page is gone and the hash is unique, mass-removal hold only for more than 1 task) and the trash/restore notes (D17).restore_task/2on the Provider, for the Status page's Undo. Vikunja:POST /tasks/{id}/restore, logged like the others. 200 restores it, 409 (not in the trash) counts as ok, 404 (purged or past 30 days) is an error. A 401/403 says the token needs the tasks restore permission: tokens made with only create/update/delete get a 401 here, so the doc's permission list now includes it.todos: 1Oban queue.mix precommit: 1142 tests, 0 failures. The live test now also deletes, restores (twice) and re-deletes a task, and checks an unknown task can't be restored.Fixed (
3438a5b)list_projects/1leaves out Vikunja's pseudo projects (saved filters, Favorites; ids below 1).Matchpairs tasks whose text normalises to "" ([illegible], emoji-only) on the same raw text, or the same ordinal and section, so they aren't deleted and recreated.Added (
5e64a9b)docs/todo-sync.mdreplaced with Haystack's latest revision: Methods.template(D21), in-page write-back (D20/D22, W1–W5), and Nye's N1 (only items with empty raw text drop on pages with our boxes) and N2 (lasso fallback only when our stroke ids are missing).delete_task/2now gives the "project is archived" message on a 412, like create/complete/reopen/restore.match_test.exsandproviders/vikunja_test.exs.mix precommit: 1146 tests, 0 failures.WIP: Todo sync groundwork: provider, Vikunja adapter, extract/matchto Todo sync groundwork: provider, Vikunja adapter, extract/match