Skip to content

refactor(settings): use the model package's task type editor - #403

Merged
callumalpass merged 4 commits into
mainfrom
refactor/model-type-editor
Nov 10, 2026
Merged

callumalpass merged 4 commits into
mainfrom
refactor/model-type-editor

Conversation

@callumalpass

@callumalpass callumalpass commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

Why

#399 added an app-side editor for a task type's statuses, priorities and custom fields (src/domain/task-type-vocabulary.ts). The Obsidian plugin has its own way of writing the same parts of the type, and @tasknotes/model had a third. callumalpass/tasknotes-model#26 makes the model's patchTaskNotesMdbaseTypeSettings the one editor; this moves the app onto it.

What changes

  • src/domain/task-type-vocabulary.ts and its test are deleted. Validation, the in-use check, value and key generation and the type rewrite come from @tasknotes/model/mdbase.
  • TaskModelSettingsPatch no longer has a vocabulary wrapper: statuses, priorities and userFields sit beside the defaults, as in the model's patch, and go to the type in one call.
  • task-configuration.ts loses its own status, priority and occurrence resolvers. They existed for camel-case spellings in early bindings, which the model now reads.
  • When a settings save writes the type, the type is also reconciled: if a hand edit left the schema and the binding listing different statuses or priorities, both end up with the union. A save that would not have written the type still does not.

Behaviour people can notice

  • A status or priority that only the type's schema allows now appears in the app (labelled from its value) instead of being hidden.

  • A custom field's name set in the Obsidian plugin is shown in the app once the plugin has written it to the type, and the reverse.

  • Fixes a defect shipped in feat(settings): edit statuses, priorities and custom fields #399: editing statuses rewrote the status condition of every allOf rule in the type's schema, so a rule a collection wrote itself (for example "an open task needs a scheduled date") was overwritten with the completed statuses. Only the rule that requires the completion date is rewritten now.

Nothing else in the interface changes; no copy is added or removed.

Before merging

  • @tasknotes/model is pinned to 0.3.0-rc.21 from npm (published from tasknotes-model#26). The vendored build used while it was unpublished is removed; the registry tarball has the same integrity hash.
  • main is merged in (through perf(startup): show tasks ~0.3 s sooner after ready #405).
  • Merging to main deploys to production.

Testing

  • rpnpm test: 247 files, 1,975 tests pass on the repinned branch with main merged in, including a new repository test for the reconcile-on-save case.
  • rpnpm run typecheck, rpnpm run lint (0 errors; the warnings are in files this does not touch), pnpm i18n:check, pnpm format:check.
  • e2e/demo.spec.ts "a status and a custom field added in Settings reach the task editor" passes.
  • Not tested against a LAB or real collection.

The app carried its own editor for a task type's statuses, priorities and
custom fields, and a second reader for early binding spellings. Both now
live in @tasknotes/model (0.3.0-rc.21), shared with the Obsidian plugin.

A settings save that writes the type also leaves it with one vocabulary
when a hand edit made its schema and binding disagree.
Editing statuses no longer rewrites a schema rule the collection wrote
itself; only the rule that requires a completion date follows the
completed statuses.
@callumalpass
callumalpass marked this pull request as ready for review November 10, 2026 23:42
@callumalpass
callumalpass merged commit 5bffe33 into main Nov 10, 2026
6 checks passed
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