Skip to content

Keep the task ID under the type's mapped property (tasknotes#2574) - #499

Open
callumalpass wants to merge 4 commits into
mainfrom
feat/2574-remappable-id
Open

callumalpass wants to merge 4 commits into
mainfrom
feat/2574-remappable-id

Conversation

@callumalpass

@callumalpass callumalpass commented Nov 17, 2026 •

Copy link
Copy Markdown
Owner

Companion to callumalpass/tasknotes#2576. A collection's task type can now map the tasknotes.task id field to another property, for example tasknote_id. The app read the ID through the model mapping, but always wrote the literal id key. With a remapped type, saving a task would have put a second ID in id and clobbered whatever the user keeps there.

Needs @tasknotes/model 0.3.1 (callumalpass/tasknotes-model#30), published to npm. With 0.3.1, resolveTaskNotesModelConfigFrom… reads implements[].fields.id into fieldMapping.id, and toUserField(mapping, "id") resolves it.

  • The catalog and lock pin 0.3.1 with its integrity hash.
  • Apart from this change, 0.3.1 is the same as 0.3.0.

Changes

  • TaskNotesTaskModel.writeFrontmatter writes the ID to the mapped property instead of id. This covers create, update, occurrences and every other write path.
  • summaryFields() indexes the mapped ID property instead of id.
  • Collections whose type uses id (all current ones) are unchanged.
  • Test in src/domain/tasknotes-model.test.ts. Release note in docs/releases/unreleased.md.

Not changed

  • The app has no field-mapping settings; the mapping comes from the type.
  • Custom-field reservation (task-configuration.ts, task-model-settings.tsx) and view read-only properties (view-mutation.ts) still reserve the literal id as well. That's consistent with how the app reserves every role name even when the role is remapped.
  • Reminder IDs and the mobileRevision handling are untouched.

Checks

Run through rpnpm against a locally packed build of the model branch, swapped in temporarily and not committed:

  • i18n:check, format:check, typecheck, lint, test:coverage (257 files), test:coverage:layers, test:conformance and build pass.
  • test:release: 410 passed, 2 failed. Both failures were the import-workspace guard rejecting the temporary file: dependency.
  • With the committed 0.3.1 pin, node --test scripts/import-workspace.node-test.mjs passes (7/7).
  • Not run: LAB or browser e2e.

A collection's task type can map the tasknotes.task id field to another
property (callumalpass/tasknotes#2574). Writes now use the mapped name
instead of always writing id, and the summary index reads it. Reading
already goes through the model mapping.

Requires @tasknotes/model 0.3.1.
@callumalpass
callumalpass marked this pull request as ready for review November 18, 2026 21:34
@callumalpass
callumalpass marked this pull request as draft November 18, 2026 21:35
@callumalpass
callumalpass marked this pull request as ready for review November 18, 2026 21:47

This branch has not been deployed

No deployments
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