Skip to content

Make the task ID property remappable (#2574) - #2576

Merged
callumalpass merged 3 commits into
mainfrom
feat/2574-remappable-id
Nov 23, 2026
Merged

callumalpass merged 3 commits into
mainfrom
feat/2574-remappable-id

Conversation

@callumalpass

@callumalpass callumalpass commented Nov 17, 2026 •

Copy link
Copy Markdown
Owner

Closes #2574 when merged. The task ID property can now be remapped like the other task properties, for example to tasknote_id.

Requires @tasknotes/model 0.3.1 (callumalpass/tasknotes-model#30, published to npm). package.json and package-lock.json pin 0.3.1 with its integrity hash.

Changes

  • FieldMapping.id is optional and defaults to id. Settings saved without it keep using id, so existing vaults are unchanged.
  • Reading: tasks read their ID from the mapped property, through the model.
  • Writing:
    • Creation writes the new UUID to the mapped property.
    • Updates and note conversion reassert the ID on the mapped property, and customFrontmatter can't overwrite it.
    • With a remapped ID, a plain id in templates or custom frontmatter is left alone as ordinary data.
  • API: catalog.fields() reports the mapped frontmatterKey for id. getById and the HTTP/MCP lookups follow automatically because they use TaskInfo.id.
  • mdbase type:
    • A type's implements[].fields.id is read into the mapping.
    • On a settings write, the canonical type follows the mapping. On a rename, the existing ID generator, schema constraints and collection.unique rule move to the new property, and the old generator is removed.
    • A type that never had a stable ID still gets none.
  • Custom fields: user-field resolution reserves the mapped ID property rather than the literal id.
  • Settings: the ID appears as Task ID under Properties → Metadata & integration properties. The label is translated in all 10 catalogues.
  • Reminder object ids are untouched.
  • Docs updated (task properties, v4→v5 migration, JavaScript API), plus docs/releases/unreleased.md.

Not changed

  • mdbase.yaml id_field for existing collections. The model writes the mapped name for new collections, but the plugin doesn't rewrite mdbase.yaml when the mapping changes.
  • Remapping doesn't rename the property in existing notes, the same as the other properties.

Checks (local, against a packed build of the model branch)

  • npm run typecheck, npm run lint (incl. architecture conformance), npm run i18n:check, npm run docs:check and npm run build all pass.
  • jest: 6507 passed. This includes new tests/unit/issues/issue-2574-remappable-id.test.ts, an API catalog case and a type-rename case in mdbaseMeaning.test.ts. The COMPAT-02 case now generates from the mapping its type declares.
  • Isolated Obsidian: new e2e/issues/issue-2574-remappable-id.spec.ts passes. It remaps to tasknote_id, creates a task, finds it by ID and checks the settings label.
  • e2e/tasknotes.spec.ts: 109 passed, 1 failed.
    • The failure is "Filter Panel Exploration › should explore filter options in detail". Obsidian's "Secrets are stored without encryption" notice (no secret store under xvfb) covers the Bases Filter button.
    • It's an environment issue, not caused by this change.

Adds an id entry to the field mapping (default id) and uses it wherever
the stable ID is read or written: reading tasks, creation, conversion and
updates, the API field catalog, user-field reservation, and the canonical
mdbase type merge (which now follows the mapping and moves the existing
ID generator and uniqueness rule on rename). The settings page shows it
as Task ID under metadata properties. Reminder IDs are unchanged.

Requires @tasknotes/model 0.3.1.
@callumalpass
callumalpass marked this pull request as ready for review November 18, 2026 21:34
@callumalpass
callumalpass changed the base branch from v5 to main November 23, 2026 08:32
@callumalpass
callumalpass merged commit d6d8635 into main Nov 23, 2026
3 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.

[FR]: Is there a way to remap v5's id field?

1 participant