diff --git a/AGENTS.md b/AGENTS.md index f932284..83c3280 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -118,3 +118,7 @@ Linux CI installs only the required Xvfb/Openbox dependencies, with bounded netw Editor archive actions share one pending promise through final modal cleanup. Other modal transitions wait for it; archive cleanup bypasses its own wait. Preserve failure cleanup, duplicate-request handling, and the delayed-archive Electron regression. App settings save responses reconcile against the submitted snapshot: preserve newer renderer edits while accepting server-generated values for unchanged fields. Keep the deferred-save regression in `test:app-settings` and Smart Actions Electron coverage aligned. + +## Card move metadata — 1.7.8 + +`lib/archive.js` records cross-list move activity and normalizes destination Signboard properties in one atomic card write. Desktop drag/drop and move-to-top must not follow it with a second metadata write. Same-list drag reorders leave card contents unchanged. Preserve body/custom fields and the atomic-failure regression in `test:archive`; filtered-drag Electron tests assert both `status` and `signboard_list` before opening the editor. diff --git a/CODEX.md b/CODEX.md index 5ccc0a2..7f8b9ce 100644 --- a/CODEX.md +++ b/CODEX.md @@ -157,3 +157,7 @@ Linux CI installs only the required Xvfb/Openbox dependencies, with bounded netw Editor archive actions share one pending promise through final modal cleanup. Other modal transitions wait for it; archive cleanup bypasses its own wait. Preserve failure cleanup, duplicate-request handling, and the delayed-archive Electron regression. App settings save responses reconcile against the submitted snapshot: preserve newer renderer edits while accepting server-generated values for unchanged fields. Keep the deferred-save regression in `test:app-settings` and Smart Actions Electron coverage aligned. + +## Card move metadata — 1.7.8 + +`lib/archive.js` records cross-list move activity and normalizes destination Signboard properties in one atomic card write. Desktop drag/drop and move-to-top must not follow it with a second metadata write. Same-list drag reorders leave card contents unchanged. Preserve body/custom fields and the atomic-failure regression in `test:archive`; filtered-drag Electron tests assert both `status` and `signboard_list` before opening the editor. diff --git a/config/build-info.json b/config/build-info.json index 349e5f5..d1e92e9 100644 --- a/config/build-info.json +++ b/config/build-info.json @@ -1,11 +1,11 @@ { "schemaVersion": 1, - "version": "1.7.7", - "buildId": "20261111.4", + "version": "1.7.8", + "buildId": "20261120.1", "channel": "release", - "builtAt": "2026-11-11T15:09:58.648Z", - "sourceFingerprint": "b36621c24a6fb0f9bc164088203fd26e85788b45b56635f99c8d75588cf6f5b9", + "builtAt": "2026-11-20T09:20:39.136Z", + "sourceFingerprint": "3de83b023a4a0a600a5fb60bac620a8c6461c49006225ddcfc47ba8cf5dac30b", "sourceFileCount": 177, - "commit": "b971c0a6c2d2876e739d1438815cea929bb8dc8d", + "commit": "b70b112c850688ebef15a9e2865032818b324cf6", "dirty": true } diff --git a/docs/README.md b/docs/README.md index 4bce119..20d8c8f 100644 --- a/docs/README.md +++ b/docs/README.md @@ -32,3 +32,5 @@ Public contributor docs describe reusable development practices. Machine access The CLI and MCP support archiving/restoration, filtered card queries, list renaming, board settings updates, board rename/move/duplication, and persisted card/list ordering. See the [operation matrix and examples](./automation.md). List insertion and left/right moves preserve existing names when a rename fails, with bounded retries and rollback. See [list recovery](./using-signboard.md#move-lists) for recovery messages and retained new lists. + +Card moves between lists save the move activity and destination `status` / `signboard_list` properties together, including drag-and-drop. Notes, labels, dates, and custom properties are preserved. diff --git a/docs/codex/FILE_STRUCTURE.md b/docs/codex/FILE_STRUCTURE.md index 07ea685..8afdc5d 100644 --- a/docs/codex/FILE_STRUCTURE.md +++ b/docs/codex/FILE_STRUCTURE.md @@ -81,7 +81,7 @@ This map focuses on source and operational files. Large generated/vendor folders - `lib/omarchyTheme.js` - Canonical Omarchy active-theme path resolution, restricted TOML palette parsing, contrast-safe token derivation, and read status. - `lib/releaseArtifactValidation.js` - Debian/ar and Pacman archive recognition, minimum release-artifact sizing, and SHA-512 helpers shared by runtime download checks and release validation. - `lib/cardOrdering.js` - Shared transactional ordering helpers used by main-process/MCP restore and move flows to insert a card at the top, reorder cards in a list, perform stable due-date ordering, and reorder list directories while staging only changed entries and rolling back on failures. -- `lib/archive.js` - Archive/archive-list filesystem operations plus archive listing/detail/restore helpers and legacy archive fallback handling. +- `lib/archive.js` - Atomic cross-list move activity plus destination metadata, archive/archive-list filesystem operations plus archive listing/detail/restore helpers and legacy archive fallback handling. - `lib/boardLabels.js` - Board-level label/theme/workflow/External Published Calendar inclusion settings read/write/defaults/filter helpers (`board-settings.md`) plus legacy app-setting extraction for migration. - `lib/boardDuplication.js` - Board folder duplication helper used by desktop Settings; copies board contents, assigns fresh copied-card IDs, refreshes copied Signboard metadata, rewrites internal `signboard://open-card` references, rewrites copied local linked-object paths, and resets copied managed Base state. - `lib/appSettings.js` - App-wide tooltip/notification/appearance-source/Quick Add global shortcut/AI assistance and External Published Calendar JSON persistence under Electron `userData`, delegating defaults and normalization to `shared/appSettingsSchema.js`. @@ -120,7 +120,7 @@ This map focuses on source and operational files. Large generated/vendor folders - `scripts/test-release-artifact-validation.js` - Valid, malformed, incomplete, and file-backed Debian/Pacman archive inspection assertions. - `scripts/test-packaging-config.js` - Required electron-builder runtime-source glob validation, including `bin/**` and `shared/**`. - `scripts/test-packaged-app-launch.js` - Isolated packaged-app smoke test that requires the packaged main process and renderer bridge to load before macOS distribution builds succeed. -- `scripts/test-archive.js` - Archive metadata, archive-browser data, restore flow, empty archived-list cleanup, and legacy archive fallback assertions. +- `scripts/test-archive.js` - Single-write move metadata, failed-write preservation, archive metadata, archive-browser data, restore flow, empty archived-list cleanup, and legacy archive fallback assertions. - `scripts/test-due-notifications.js` - Due-notification assertions for task due item collection and notification body formatting. - `scripts/test-external-published-calendar.js` - External Published Calendar assertions for ICS generation, completed-list skipping, checked-task skipping, and board opt-out. - `scripts/test-import-trello.js` - Trello importer assertions for order, label reuse, archive routing, and metadata preservation. diff --git a/docs/codex/PROJECT_CONTEXT.md b/docs/codex/PROJECT_CONTEXT.md index f3ac6cb..400683e 100644 --- a/docs/codex/PROJECT_CONTEXT.md +++ b/docs/codex/PROJECT_CONTEXT.md @@ -666,3 +666,7 @@ Linux CI installs only the required Xvfb/Openbox dependencies, with bounded netw Editor archive actions share one pending promise through final modal cleanup. Other modal transitions wait for it; archive cleanup bypasses its own wait. Preserve failure cleanup, duplicate-request handling, and the delayed-archive Electron regression. App settings save responses reconcile against the submitted snapshot: preserve newer renderer edits while accepting server-generated values for unchanged fields. Keep the deferred-save regression in `test:app-settings` and Smart Actions Electron coverage aligned. + +## Card move metadata — 1.7.8 + +`lib/archive.js` records cross-list move activity and normalizes destination Signboard properties in one atomic card write. Desktop drag/drop and move-to-top must not follow it with a second metadata write. Same-list drag reorders leave card contents unchanged. Preserve body/custom fields and the atomic-failure regression in `test:archive`; filtered-drag Electron tests assert both `status` and `signboard_list` before opening the editor. diff --git a/docs/using-signboard.md b/docs/using-signboard.md index 7729728..c2fb597 100644 --- a/docs/using-signboard.md +++ b/docs/using-signboard.md @@ -534,3 +534,5 @@ The CLI and MCP support archiving/restoration, filtered card queries, list renam List folder names remove Windows-invalid punctuation throughout the name, including after periods; for example, `Release 1.7: QA` becomes `Release 1.7 QA`. Board and list names can be renamed by changing only their capitalization. Planner filter menus scroll when needed so every label and Clear filters remain reachable in smaller windows. + +Card moves between lists save the move activity and destination `status` / `signboard_list` properties together, including drag-and-drop. Notes, labels, dates, and custom properties are preserved. diff --git a/lib/archive.js b/lib/archive.js index d08d77c..2a66ff1 100644 --- a/lib/archive.js +++ b/lib/archive.js @@ -4,6 +4,7 @@ const boardLabels = require('./boardLabels'); const cardFrontmatter = require('./cardFrontmatter'); const { insertCardFileAtTop } = require('./cardOrdering'); const { atomicWriteFile } = require('./atomicFile'); +const { normalizeSignboardCardFrontmatter } = require('./obsidianIntegration'); const { clearCardArchiveState, formatActivityTimestamp, @@ -955,12 +956,19 @@ async function recordCardListMove(boardRoot, cardPath, fromListPath, toListPath) const toList = getListContextFromPath(normalizedToListPath); const movedAt = formatActivityTimestamp(); - await mutateCard(normalizedCardPath, (frontmatter) => applyCardListMove(frontmatter, { - movedAt, - fromListDirectoryName: fromList.directoryName, - fromListDisplayName: fromList.displayName, - toListDirectoryName: toList.directoryName, - toListDisplayName: toList.displayName, + // Commit the destination properties with the move event. A separate metadata + // write leaves a stale intermediate version visible to sync clients and can + // fail after the move event has already been persisted. + await mutateCard(normalizedCardPath, (frontmatter) => normalizeSignboardCardFrontmatter({ + boardRoot: normalizedBoardRoot, + cardPath: normalizedCardPath, + frontmatter: applyCardListMove(frontmatter, { + movedAt, + fromListDirectoryName: fromList.directoryName, + fromListDisplayName: fromList.displayName, + toListDirectoryName: toList.directoryName, + toListDisplayName: toList.displayName, + }), })); return { diff --git a/main.js b/main.js index 7991599..3eb60e3 100644 --- a/main.js +++ b/main.js @@ -4601,7 +4601,6 @@ ipcMain.handle('board-call', async (event, payload = {}) => { if (sourceListPath !== targetListPath) { movedAcrossLists = true; await recordCardListMove(boardRoot, cardEntry.cardPath, sourceListPath, targetListPath); - await refreshCardSignboardMetadata(boardRoot, cardEntry.cardPath); } } @@ -4688,9 +4687,10 @@ ipcMain.handle('board-call', async (event, payload = {}) => { if (sourceListPath !== targetListPath) { await recordCardListMove(boardRoot, movedCardPath, sourceListPath, targetListPath); + } else { + await refreshCardSignboardMetadata(boardRoot, movedCardPath); } - await refreshCardSignboardMetadata(boardRoot, movedCardPath); await autoSyncManagedObsidianBaseForBoard(boardRoot); return { diff --git a/package-lock.json b/package-lock.json index 34ad720..bf3c2fa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "signboard", - "version": "1.7.7", + "version": "1.7.8", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "signboard", - "version": "1.7.7", + "version": "1.7.8", "license": "MIT", "dependencies": { "electron-updater": "^6.8.3", diff --git a/package.json b/package.json index 6eaca35..4c47d8f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "signboard", "productName": "Signboard", - "version": "1.7.7", + "version": "1.7.8", "description": "A fast, local-first Kanban board for Markdown files.", "homepage": "https://github.com/cdevroe/signboard", "repository": { diff --git a/readme.md b/readme.md index 6db4557..63e7910 100644 --- a/readme.md +++ b/readme.md @@ -412,3 +412,5 @@ Signboard includes the following open source libraries: The CLI and MCP support archiving/restoration, filtered card queries, list renaming, board settings updates, board rename/move/duplication, and persisted card/list ordering. See the [operation matrix and examples](./docs/automation.md). List insertion and left/right moves preserve existing names when a rename fails, with bounded retries and rollback. See [list recovery](docs/using-signboard.md#move-lists) for recovery messages and retained new lists. + +Card moves between lists save the move activity and destination `status` / `signboard_list` properties together, including drag-and-drop. Notes, labels, dates, and custom properties are preserved. diff --git a/scripts/test-archive.js b/scripts/test-archive.js index b2595d7..8d85397 100644 --- a/scripts/test-archive.js +++ b/scripts/test-archive.js @@ -219,15 +219,60 @@ async function testRecordCardListMoveAppendsLifecycleEvent(root) { await fs.mkdir(doingList, { recursive: true }); const cardPath = path.join(doingList, '000-track-progress-stock.md'); - await writeCard(cardPath, { title: 'Track progress' }, 'Update the thread'); - - const moved = await recordCardListMove(boardRoot, cardPath, todoList, doingList); + await writeCard(cardPath, { + title: 'Track progress', status: 'To-do', signboard_list: 'To-do', + due: '2026-12-01', labels: ['work'], custom: 'Keep me', + }, 'Update the thread'); + + // A sync client can observe every atomic replacement. No committed move + // event may still describe the source list, even before a later refresh. + const originalWrite = cardFrontmatter.writeCard; + let writes = 0; + let moved; + cardFrontmatter.writeCard = async (file, card) => { + await originalWrite(file, card); + writes += 1; + const saved = await cardFrontmatter.readCard(file); + assert.strictEqual(saved.frontmatter.status, 'Doing'); + assert.strictEqual(saved.frontmatter.signboard_list, 'Doing'); + }; + try { + moved = await recordCardListMove(boardRoot, cardPath, todoList, doingList); + } finally { + cardFrontmatter.writeCard = originalWrite; + } + assert.strictEqual(writes, 1, 'Save lifecycle and destination metadata together'); assert.strictEqual(moved.moved, true); const movedCard = await cardFrontmatter.readCard(cardPath); assert.deepStrictEqual(getActivityTypes(movedCard.frontmatter), ['moved-list']); assert.strictEqual(movedCard.frontmatter.activity[0].fromListDisplayName, 'To-do'); assert.strictEqual(movedCard.frontmatter.activity[0].toListDisplayName, 'Doing'); + assert.strictEqual(movedCard.frontmatter.status, 'Doing'); + assert.strictEqual(movedCard.frontmatter.signboard_list, 'Doing'); + assert.strictEqual(movedCard.frontmatter.signboard_board, 'Archive Move Metadata Board'); + assert.strictEqual(movedCard.frontmatter.custom, 'Keep me'); + assert.strictEqual(movedCard.frontmatter.due, '2026-12-01'); + assert.deepStrictEqual(movedCard.frontmatter.labels, ['work']); + assert.strictEqual(movedCard.body, 'Update the thread'); + + const before = await fs.readFile(cardPath, 'utf8'); + assert.strictEqual((await recordCardListMove(boardRoot, cardPath, doingList, doingList)).moved, false); + assert.strictEqual(await fs.readFile(cardPath, 'utf8'), before, 'Same-list reorders do not rewrite metadata'); + + // A failed atomic replacement must not commit just the lifecycle event. + const originalRename = fs.rename; + fs.rename = async (from, to) => { + if (to === cardPath && from.endsWith('.tmp')) throw new Error('Simulated sync-client file lock'); + return originalRename(from, to); + }; + try { + await assert.rejects(recordCardListMove(boardRoot, cardPath, todoList, doingList), /Simulated sync-client file lock/); + } finally { + fs.rename = originalRename; + } + assert.strictEqual(await fs.readFile(cardPath, 'utf8'), before); + assert.deepStrictEqual(await fs.readdir(doingList), [path.basename(cardPath)], 'Failed writes clean up temporary files'); } async function main() { diff --git a/tests/playwright/signboard-smoke.spec.js b/tests/playwright/signboard-smoke.spec.js index fe16a1f..29fab01 100644 --- a/tests/playwright/signboard-smoke.spec.js +++ b/tests/playwright/signboard-smoke.spec.js @@ -1551,7 +1551,10 @@ for (const filterMode of ['label', 'date', 'search']) { ['003-hidden-last-Hd002.md', 'Hidden last', false], ]) { await cardFrontmatter.writeCard(path.join(todo, file), { - frontmatter: { title, ...(visible ? { labels: ['launch'], due: today } : {}) }, + frontmatter: { + title, status: 'To-do', signboard_list: 'To-do', custom: 'Preserve on move', + ...(visible ? { labels: ['launch'], due: today } : {}), + }, body: `Original body for ${title}.`, }); } @@ -1603,9 +1606,18 @@ for (const filterMode of ['label', 'date', 'search']) { await expect.poll(async () => (await fs.readdir(doing)).filter((name) => name.endsWith('.md')).length).toBe(2); await expect.poll(async () => { const cardPath = await moved.getAttribute('data-path'); - try { return (await cardFrontmatter.readCard(cardPath)).frontmatter.signboard_list; } - catch { return ''; } - }).toBe('Doing'); + try { + const { frontmatter, body } = await cardFrontmatter.readCard(cardPath); + return { + status: frontmatter.status, list: frontmatter.signboard_list, + moves: (frontmatter.activity || []).filter((event) => event.type === 'moved-list').length, + custom: frontmatter.custom, body: body.trim(), + }; + } catch { return null; } + }).toEqual({ + status: 'Doing', list: 'Doing', moves: 1, + custom: 'Preserve on move', body: 'Original body for Release followup.', + }); expect(await source.evaluate((element) => element === window.filteredDragSource)).toBe(true); expect(await page.locator('.list').evaluateAll((lists) => lists.map((list) => list.dataset.path))).toEqual(listPaths); expect((await fs.readdir(boardRoot)).filter((name) => /^\d+-/.test(name)).sort())