Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

### Fixed

- Generated mdbase task types accept floating scheduled and due times written by TaskNotes. Thanks to @iantierney for reporting (TaskNotes #2706).

## 0.3.2 - 2026-11-20

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion scripts/sync-tasknotes-pack.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const generatedPath = path.resolve(
"../src/generated/tasknotes-type-pack.json"
);
const source = await readFile(
path.join(contractsRoot, "dist/packs/tasknotes.task/0.3.0-rc.21.json"),
path.join(contractsRoot, "dist/packs/tasknotes.task/0.3.0-rc.22.json"),
"utf8"
);

Expand Down
15 changes: 10 additions & 5 deletions src/generated/tasknotes-type-pack.json

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions src/mdbase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export interface TaskNotesMdbaseTypePack {
export const TASKNOTES_MDBASE_TYPE_VERSION = 5;

/** Version of the generated definition bundle, independent of contract version. */
export const TASKNOTES_MDBASE_PACK_VERSION = "0.3.0-rc.21";
export const TASKNOTES_MDBASE_PACK_VERSION = "0.3.0-rc.22";
export const TASKNOTES_CONTRACT_DIGEST =
"sha256:c400ead6e218b715d86ad31125bb3d4b2e276817da6ba8065449fd0947b24d67";

Expand Down Expand Up @@ -1039,7 +1039,7 @@ export async function buildTaskNotesMdbaseTypePack(
[`contracts/tasknotes.task/${TASKNOTES_SPEC_VERSION}.md`, {
target: resources.paths.contract, document: resources.contractDocument,
}],
["types/tasknotes-task/6.md", {
["types/tasknotes-task/7.md", {
target: resources.paths.type, document: resources.typeDocument,
}],
[`schemas/tasknotes.task/${TASKNOTES_SPEC_VERSION}.schema.json`, {
Expand Down Expand Up @@ -1741,6 +1741,11 @@ function taskDateSchema(legacyCompatibility: boolean): Record<string, unknown> {
anyOf: [
dateSchema(legacyCompatibility),
dateTimeSchema(legacyCompatibility),
{
type: "string",
// TaskNotes also stores wall-clock times without a UTC offset.
pattern: "^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?$",
},
],
};
}
Expand Down
12 changes: 3 additions & 9 deletions src/starter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const TASKNOTES_STARTER_TYPE_VERSION = TASKNOTES_MDBASE_TYPE_VERSION;
* type's data keeps TASKNOTES_STARTER_TYPE_VERSION, so collections that already
* have that version do not see a conflicting version change on upgrade.
*/
export const TASKNOTES_STARTER_REVISION = 6;
export const TASKNOTES_STARTER_REVISION = 7;

/**
* The generator bookkeeping published in the first starter. Collections keep
Expand Down Expand Up @@ -143,14 +143,8 @@ export function buildTaskNotesStarterResources(
managed_fields: [...TASKNOTES_STARTER_MANAGED_FIELDS],
};
// One shared date schema, so due and scheduled cannot drift apart.
const taskDateSchema = {
anyOf: [
{ type: "string", format: "date" },
{ type: "string", format: "date-time" },
],
};
type.schema.value.properties[implementation.fields.due] = taskDateSchema;
type.schema.value.properties[implementation.fields.scheduled] = taskDateSchema;
const properties = type.schema.value.properties;
properties[implementation.fields.scheduled] = properties[implementation.fields.due];
implementation.binding.status = {
...implementation.binding.status,
skipped_values: ["cancelled"],
Expand Down
12 changes: 8 additions & 4 deletions test/mdbase.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,12 @@ test("builds one canonical TaskNotes and mdbase collection contract", () => {
{ type: "string", format: "date-time" },
],
};
assert.deepEqual(schema.properties.due, taskDateSchema);
assert.deepEqual(schema.properties.scheduled, taskDateSchema);
assert.deepEqual(schema.properties.due, schema.properties.scheduled);
assert.deepEqual(schema.properties.due.anyOf.slice(0, 2), taskDateSchema.anyOf);
const localTime = new RegExp(schema.properties.due.anyOf[2].pattern);
assert.match("2026-11-30T16:00", localTime);
assert.match("2026-11-30T16:00:59", localTime);
assert.doesNotMatch("2026-11-30T25:00", localTime);
assert.deepEqual(resources.taskSchema.properties.due, taskDateSchema);
assert.deepEqual(resources.taskSchema.properties.scheduled, taskDateSchema);
assert.deepEqual(type.collection.unique, [{ field: "id", scope: "type" }]);
Expand Down Expand Up @@ -136,11 +140,11 @@ test("packages the contract, implementation, and schemas as one digest-pinned ty
assert.equal(pack.manifest.kind, "mdbase.type-pack");
assert.equal(pack.manifest.id, "tasknotes.task");
assert.equal(pack.manifest.version, TASKNOTES_MDBASE_PACK_VERSION);
assert.equal(TASKNOTES_MDBASE_PACK_VERSION, "0.3.0-rc.21");
assert.equal(TASKNOTES_MDBASE_PACK_VERSION, "0.3.0-rc.22");
assert.equal(pack.manifest.resources.length, 14);
assert.deepEqual(
pack.manifest.resources.filter(({ source }) => [
"contracts/tasknotes.task/0.3.0-rc.6.md", "types/tasknotes-task/6.md",
"contracts/tasknotes.task/0.3.0-rc.6.md", "types/tasknotes-task/7.md",
"schemas/tasknotes.task/0.3.0-rc.6.schema.json", "schemas/tasknotes.task.binding/0.3.0-rc.6.schema.json",
].includes(source)).map(({ kind, mode, target }) => [kind, mode, target]),
[
Expand Down
12 changes: 6 additions & 6 deletions test/starter.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ import {
TASKNOTES_STARTER_TYPE_VERSION,
} from "../dist/esm/starter.js";

// The tasknotes.task 0.3.0-rc.21 pack in mdbase-contracts PR #23 (c50a6d0),
// vendored from dist/ in src/generated/tasknotes-type-pack.json. If the
// The tasknotes.task 0.3.0-rc.22 pack, vendored from the mdbase-contracts
// dist/ in src/generated/tasknotes-type-pack.json. If the
// starter changes, publish a new starter revision in mdbase-contracts and
// update these digests together; collections upgrade by merging against the
// previous starter, so an unintended change here reaches every collection.
const PUBLISHED_RC21_RESOURCES = {
const PUBLISHED_RC22_RESOURCES = {
"_mdbase/contracts/tasknotes.task.md": "sha256:ecadd00700e249940f4244aaa5b5985a96557d13340463ec491dfa5e89b032a4",
"_mdbase/contracts/tasknotes.task/0.3.0-rc.4.md": "sha256:91165b7664f936bba9289aca984e2638901db7fedf68642ab755e8d0b424e734",
"_mdbase/contracts/tasknotes.task/0.3.0-rc.3.md": "sha256:4761ee78615882170cae6e52590f98917f549bd89d852a0c40568583394d7264",
"_mdbase/contracts/tasknotes.task/0.3.0-rc.6.md": "sha256:3f4eb90782948ed68112ffcc99575911036020544cf501de3d2265b588b38456",
"_mdbase/types/task.md": "sha256:87e52c25b474a06283b29e2983ae4fc6e618fd1a4cbcc5856ff9a67328df605b",
"_mdbase/types/task.md": "sha256:83bfd806bfbda7b99f1eb057b26cf6e0fbc1db6958a0ed3e610f0b20ff9b7aef",
"_mdbase/_schemas/tasknotes/tasknotes-task.schema.json": "sha256:ac78a55f46669d6e8bd08d608b7c25338fec8ba7606dbf54ebd6b8d4e66b7035",
"_mdbase/_schemas/tasknotes/tasknotes-task-binding.schema.json": "sha256:4f8f3288f593ce06a04525697308173147ff957e7066f83d9a922468d06be659",
"_mdbase/schemas/mdbase.app-settings/1.0.0.schema.json": "sha256:f37ed43b57fe86465b5bb67216da71d6e351bc1b85bf55a20f95edf886f0749e",
Expand All @@ -31,10 +31,10 @@ const PUBLISHED_RC21_RESOURCES = {

test("the starter reproduces the published TaskNotes pack resource bytes", async () => {
const pack = await buildTaskNotesMdbaseTypePack(buildTaskNotesStarterResources());
assert.equal(pack.manifest.version, "0.3.0-rc.21");
assert.equal(pack.manifest.version, "0.3.0-rc.22");
assert.deepEqual(
Object.fromEntries(pack.manifest.resources.map((resource) => [resource.target, resource.digest])),
PUBLISHED_RC21_RESOURCES,
PUBLISHED_RC22_RESOURCES,
);
});

Expand Down
Loading