tasknotes-spec 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/00-overview.md +172 -0
  2. package/01-terminology.md +156 -0
  3. package/02-model-and-mapping.md +288 -0
  4. package/03-temporal-semantics.md +290 -0
  5. package/04-recurrence.md +398 -0
  6. package/05-operations.md +968 -0
  7. package/06-validation.md +267 -0
  8. package/07-conformance.md +292 -0
  9. package/08-compatibility-and-migrations.md +188 -0
  10. package/09-configuration.md +837 -0
  11. package/10-dependencies-and-reminders.md +266 -0
  12. package/11-links.md +373 -0
  13. package/CHANGELOG.md +25 -0
  14. package/README.md +80 -0
  15. package/conformance/README.md +31 -0
  16. package/conformance/adapters/mdbase-tasknotes.adapter.mjs +141 -0
  17. package/conformance/adapters/tasknotes-core/conformance.ts +2498 -0
  18. package/conformance/adapters/tasknotes-core/create-compat.ts +1 -0
  19. package/conformance/adapters/tasknotes-core/date.ts +12 -0
  20. package/conformance/adapters/tasknotes-core/field-mapping.ts +14 -0
  21. package/conformance/adapters/tasknotes-core/recurrence.ts +10 -0
  22. package/conformance/adapters/tasknotes-date-bridge.ts +20 -0
  23. package/conformance/adapters/tasknotes-runtime-bridge.ts +1107 -0
  24. package/conformance/adapters/tasknotes-runtime-obsidian-shim.ts +84 -0
  25. package/conformance/adapters/tasknotes-templating-bridge.ts +13 -0
  26. package/conformance/adapters/tasknotes.adapter.mjs +485 -0
  27. package/conformance/docs/ADAPTER_CONTRACT.md +245 -0
  28. package/conformance/docs/FIXTURE_FORMAT.md +247 -0
  29. package/conformance/docs/RUNNER_GUIDE.md +393 -0
  30. package/conformance/fixtures/config-schema.json +634 -0
  31. package/conformance/fixtures/config.json +18984 -0
  32. package/conformance/fixtures/conformance.json +444 -0
  33. package/conformance/fixtures/create-compat.json +18639 -0
  34. package/conformance/fixtures/date.json +25612 -0
  35. package/conformance/fixtures/dependencies.json +8647 -0
  36. package/conformance/fixtures/field-mapping.json +5406 -0
  37. package/conformance/fixtures/links.json +1127 -0
  38. package/conformance/fixtures/migrations.json +668 -0
  39. package/conformance/fixtures/operations.json +2761 -0
  40. package/conformance/fixtures/recurrence.json +22958 -0
  41. package/conformance/fixtures/reminders.json +13333 -0
  42. package/conformance/fixtures/templating.json +497 -0
  43. package/conformance/fixtures/validation.json +5308 -0
  44. package/conformance/lib/adapter-loader.mjs +23 -0
  45. package/conformance/lib/load-fixtures.mjs +43 -0
  46. package/conformance/lib/matchers.mjs +200 -0
  47. package/conformance/manifest.json +232 -0
  48. package/conformance/scripts/generate-fixtures.mjs +5239 -0
  49. package/conformance/scripts/package-fixtures.mjs +101 -0
  50. package/conformance/tests/coverage.test.mjs +213 -0
  51. package/conformance/tests/runner.test.mjs +102 -0
  52. package/conformance/tests/tasknotes-runtime-routing.test.mjs +64 -0
  53. package/package.json +49 -0
@@ -0,0 +1,188 @@
1
+ # 8. Compatibility and Migrations
2
+
3
+ ## 8.1 Purpose
4
+
5
+ This section defines how implementations transition from historical behavior to canonical specification behavior without silent data breakage.
6
+
7
+ ## 8.2 Compatibility modes
8
+
9
+ Implementations MAY support compatibility modes for legacy behavior.
10
+
11
+ If supported, compatibility modes MUST:
12
+
13
+ - be explicitly enabled or disabled,
14
+ - be discoverable through configuration or capability metadata,
15
+ - not be silently enabled by default in new collections.
16
+
17
+ ## 8.3 Migration expectations
18
+
19
+ When canonical behavior differs from historical behavior, implementations SHOULD provide:
20
+
21
+ 1. deterministic migration rules,
22
+ 2. dry-run preview support,
23
+ 3. rollback-safe workflow guidance.
24
+
25
+ ## 8.4 Alias normalization migration
26
+
27
+ For legacy key aliases, a migration SHOULD:
28
+
29
+ - read both canonical and alias keys,
30
+ - choose canonical value deterministically (recommended: canonical key precedence),
31
+ - rewrite persisted file using canonical keys,
32
+ - preserve unrelated unknown fields.
33
+
34
+ ### 8.4.1 Example
35
+
36
+ Before:
37
+
38
+ ```yaml
39
+ recurrenceAnchor: scheduled
40
+ recurrence_anchor: completion
41
+ ```
42
+
43
+ After normalization:
44
+
45
+ ```yaml
46
+ recurrenceAnchor: scheduled
47
+ ```
48
+
49
+ With warning:
50
+
51
+ - `alias_conflict_ignored`: alias value ignored because canonical key present.
52
+
53
+ ## 8.5 Temporal normalization migration
54
+
55
+ If historical writes include mixed datetime styles, migration SHOULD normalize to canonical UTC ISO `Z` for datetime roles while preserving date-only roles as dates.
56
+
57
+ Example:
58
+
59
+ Before:
60
+
61
+ ```yaml
62
+ dateCreated: 2026-02-20 10:00:00+00:00
63
+ ```
64
+
65
+ After:
66
+
67
+ ```yaml
68
+ dateCreated: 2026-02-20T10:00:00Z
69
+ ```
70
+
71
+ ## 8.6 Recurrence state migration
72
+
73
+ If historical data allows overlapping complete/skip dates, migration MUST resolve overlap deterministically.
74
+
75
+ Recommended resolution policy:
76
+
77
+ - if overlap exists, prefer most recent user action where recoverable,
78
+ - otherwise prefer `complete_instances` and remove overlapping skip entries,
79
+ - emit migration report for affected dates.
80
+
81
+ Policy choice MUST be documented.
82
+
83
+ ## 8.7 Materialized occurrence migration
84
+
85
+ When introducing materialized occurrence notes into an existing collection, implementations SHOULD avoid automatic bulk creation.
86
+ Recommended migration behavior:
87
+
88
+ - do not materialize historical or future occurrence notes unless explicitly requested;
89
+ - preserve existing parent `complete_instances` and `skipped_instances`;
90
+ - when importing existing per-occurrence task files, require deterministic parent/date matching before adding `recurrence_parent` and `occurrence_date`;
91
+ - when materialized occurrence state conflicts with parent instance lists, prefer the occurrence note for that date and report `occurrence_state_conflict`;
92
+ - provide a dry-run report before converting existing task files into materialized occurrence notes.
93
+
94
+ Migration tooling MUST NOT silently delete occurrence notes or parent recurring tasks.
95
+
96
+ ## 8.8 Dependency migration
97
+
98
+ When migrating legacy dependency data, implementations SHOULD:
99
+
100
+ - normalize dependency key names to mapped canonical key,
101
+ - ensure each entry has `uid` and canonical `reltype`,
102
+ - normalize legacy string/path references into configured canonical reference style,
103
+ - remove duplicate dependency entries by policy.
104
+
105
+ If historical data omits `reltype`, migration MAY apply `dependencies.default_reltype` and SHOULD report count of inferred values.
106
+
107
+ ## 8.9 Reminder migration
108
+
109
+ When migrating legacy reminder data, implementations SHOULD:
110
+
111
+ - normalize reminder key names,
112
+ - normalize `type` values to canonical enum (`absolute` or `relative`),
113
+ - normalize `relatedTo` values to canonical enum (`due` or `scheduled`),
114
+ - normalize `absoluteTime` to canonical UTC ISO `Z`,
115
+ - validate and normalize offsets to ISO 8601 duration syntax.
116
+
117
+ If reminder `id` values are missing, migration MAY generate IDs and MUST report generated count.
118
+
119
+ ## 8.10 Link migration
120
+
121
+ When migrating legacy link values, implementations SHOULD:
122
+
123
+ - normalize supported link syntaxes according to §11 parsing rules,
124
+ - preserve alias and anchor components where possible,
125
+ - normalize resolved targets into canonical write format by policy,
126
+ - detect and report ambiguous links instead of silently choosing non-deterministically.
127
+
128
+ ## 8.11 Divergence register
129
+
130
+ Implementations SHOULD maintain a divergence register with columns:
131
+
132
+ - section
133
+ - current behavior
134
+ - target canonical behavior
135
+ - migration strategy
136
+ - deprecation timeline
137
+
138
+ ## 8.12 Deprecation policy
139
+
140
+ For any behavior deprecated by the specification:
141
+
142
+ 1. announce deprecation in release notes,
143
+ 2. provide warning period,
144
+ 3. provide migration tooling where feasible,
145
+ 4. remove deprecated behavior only in a version aligned with compatibility commitments.
146
+
147
+ ## 8.13 Data safety requirements
148
+
149
+ Migrations MUST NOT:
150
+
151
+ - silently drop unknown fields,
152
+ - silently convert valid date-only fields to datetime,
153
+ - silently rewrite recurrence semantics without explicit policy,
154
+ - silently materialize occurrence notes outside explicit user/configured materialization policy,
155
+ - silently delete materialized occurrence notes during recurrence edits,
156
+ - silently drop unresolved dependency entries,
157
+ - silently rewrite link targets to different destinations without explicit policy,
158
+ - silently delete reminders unless explicitly requested.
159
+
160
+ ## 8.14 Suggested migration report format
161
+
162
+ ```yaml
163
+ spec_version_from: 0.1.0-draft
164
+ spec_version_to: 0.2.0-draft
165
+ files_scanned: 214
166
+ files_changed: 67
167
+ warnings:
168
+ alias_conflict_ignored: 3
169
+ instance_state_overlap_resolved: 2
170
+ occurrence_state_conflict: 1
171
+ unresolved_dependency_target: 4
172
+ changes:
173
+ normalized_datetime_fields: 41
174
+ alias_keys_removed: 29
175
+ instance_overlaps_fixed: 2
176
+ occurrence_state_conflicts: 1
177
+ inferred_dependency_reltype: 5
178
+ generated_reminder_ids: 8
179
+ normalized_link_targets: 14
180
+ ```
181
+
182
+ ## 8.15 Compatibility statement example
183
+
184
+ ```text
185
+ Compatibility mode: legacy-aliases=true, legacy-timeentry-duration=true
186
+ Planned removal: v2.0.0
187
+ Migration command: tasknotes migrate --normalize-frontmatter
188
+ ```