Skip to content

chore: retire the Task Ledger domain and drop its storage - #4400

Merged
Astro-Han merged 2 commits into
mainfrom
chore/storage-retire-task-ledger
Sep 1, 2026
Merged

chore: retire the Task Ledger domain and drop its storage#4400
Astro-Han merged 2 commits into
mainfrom
chore/storage-retire-task-ledger

Conversation

@Astro-Han

@Astro-Han Astro-Han commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary

#4351 removed the Task Ledger protocol operation and coordinator but left the layers above and below it standing: a 970-line @maka/core module, a closed three-file @maka/storage island, a legacy bootstrap path, and the SQLite table that path read from. Nothing on main writes that table any more, and nothing outside the island reads the modules.

Workflow schema 12 drops workflow_task_ledger_events, following the workflow_plan_reminders idiom directly above it.

Two mechanisms that name Task Ledger are deliberately kept:

  • RELEASED_WORKFLOW_PROJECTION_TABLES still retires workflow_task_ledger_projections. Released databases really carry that table (packages/storage/test-fixtures/workflow-schema-v8.sql:24), and the migration is the only thing that removes it.
  • The workflow_task_ledger entry in RELEASED_CUTOVER_STORE_VALIDATION_KEYS pins what a released cutover writer emitted into cutover_journal. A completed row whose store name is absent there is treated as evidence this build never wrote, so retirement fails closed and preserves it. Deleting the entry would block startup on exactly the workspaces it protects.

readOrBootstrap now persists an empty document, and initializeCopy no longer writes a placeholder row into an uninitialized copy source. Both are observationally unchanged, and both now have tests that pin the stored rows rather than only the returned snapshot — the previous versions of those tests could not tell "wrote an explicit empty document" from "wrote nothing".

apps/desktop/src/renderer/styles/task-ledger.css is residue from the same retirement but is a separate slice with its own reviewer — tracked in #4394 and untouched here.

Net: −3,378 / +133 across 20 files. One package entry point, one database table, one startup path, three storage modules and 56 exported symbols disappear.

Fixes #4399

Breaking change

Upgrading a workspace last opened by v0.2.0-incubating-rc1 or earlier discards its unfinished Tasks. They are not imported into SessionTodo; the panel starts empty.

v0.1.0v0.1.11 and v0.2.0-incubating-rc1 all shipped a live Task Ledger — the protocol operation, the runtime tools, and the Desktop surface. bootstrapLegacyTasks, the path that would have projected those rows into SessionTodo on first read, exists only on main and has never shipped in any release; neither has workflow_session_todo_documents. So the bridge has never run, and those Tasks are still in workflow_task_ledger_events waiting for it.

Keeping an unshipped bridge alive for a pre-1.0 surface costs more than it returns, so this change drops the table and the bridge together. Completed, failed, and cancelled Tasks were never going to be imported anyway. This needs a release-note line.

The alternatives considered and rejected: keep the bridge for one release cycle and defer the drop (safe, but leaves the domain half-retired indefinitely); or carry the data forward with a one-shot batch projection inside the schema-12 migration (re-implements event-projection semantics in the schema file, where a mistake is least recoverable).

Verification

  • npm run typecheck (all workspaces) — pass
  • npm run format:check — pass
  • node --test packages/storage/dist/__tests__/{sqlite-workflow-store,session-todo-store,operational-state-store,work-board-store}.test.js — 86 pass, 0 fail
  • node --test packages/runtime-host/dist/__tests__/{session-catalog-two-client-uds,session-todo-protocol}.test.js — 5 pass, 0 fail
  • Not run: the full repository suite, and the Storybook/Playwright visual pass. The story change is type-only (Task[] fixture replaced by the SessionTodoItem[] the panel already consumed, dropping a mapping step), and packages/ui/src/session-todo-panel.tsx is unchanged.

New coverage: 'restores SessionTodo storage and drops Task Ledger events from workflow schema 10' pins the new DROP TABLE (it recreates the old table with a row, sets the version back, and asserts the table is gone); 'copies an uninitialized source as empty without initializing the source' pins the one branch whose behavior changed.

Review focus

Reviewed adversarially by four independent Claude Code agents (correctness, upstream/downstream demand tracing, second-order simplification, test-coverage loss). Their findings are already folded in: a test that had become vacuous, the missing test for the changed branch, five stale claims in docs/session-todo-lifecycle.md, and — the one that mattered — the released-build data loss above, which I had originally and wrongly asserted could not happen. Treat that history as a reason to check the breaking-change section closely rather than as evidence it is settled.

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: Claude Code. Traced demand chains, performed the deletion and the test rewrites, ran the adversarial review, and drafted this description. The Generated-by: Claude Code trailer is on the commit. The breaking-change decision was made by the contributor of record, who reviews the final diff and owns the merge.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary and Breaking change above
  • No

@github-actions github-actions Bot added the effort/XL Over 1000 readable lines label Aug 31, 2026
#4351 removed the Task Ledger protocol operation and coordinator but left the
layers above and below it standing: a 970-line core module, a closed three-file
storage island, a legacy bootstrap path, and the SQLite table that path read
from. Nothing on `main` writes that table any more, and nothing outside the
island reads the modules.

BREAKING: upgrading a workspace last opened by v0.2.0-incubating-rc1 or earlier
discards its unfinished Tasks. Those releases shipped a live Task Ledger, and
`bootstrapLegacyTasks` — the path that would have carried those rows into
SessionTodo on first read — has never shipped in any release. Rather than keep
an unshipped bridge alive for a pre-1.0 surface, workflow schema 12 drops
`workflow_task_ledger_events` outright and the bridge goes with it. Tasks are
not imported; SessionTodo starts empty. Completed and cancelled Tasks were
never going to be imported anyway, and the affected surface is one RC and a
0.1.x line.

The drop follows the `workflow_plan_reminders` idiom directly above it. Two
mechanisms that name Task Ledger are deliberately kept:
`RELEASED_WORKFLOW_PROJECTION_TABLES` still retires
`workflow_task_ledger_projections`, which released databases really carry, and
the released-cutover validation contract in `operational-state-store.ts` still
records what a released build wrote to `cutover_journal` — dropping that entry
would fail a workspace closed rather than clean it.

`readOrBootstrap` now persists an empty document, and `initializeCopy` no
longer writes a placeholder row into an uninitialized copy source; both are
observationally unchanged and now have tests that pin the stored rows rather
than only the returned snapshot. Tests that only needed some store to open the
workflow database move to the Plan store, and the schema-10 migration case
asserts the new drop. `docs/session-todo-lifecycle.md` no longer describes the
removed bootstrap.

`apps/desktop/src/renderer/styles/task-ledger.css` is residue from the same
retirement and is tracked separately in #4394.

Closes #4399

Generated-by: Claude Code
@Astro-Han
Astro-Han force-pushed the chore/storage-retire-task-ledger branch from 7023169 to fec6814 Compare September 1, 2026 01:37
@Astro-Han Astro-Han changed the title chore: finish retiring the Task Ledger domain chore: retire the Task Ledger domain and drop its storage Sep 1, 2026
@Astro-Han
Astro-Han marked this pull request as ready for review September 1, 2026 02:47

@jackwener jackwener left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed this at fec6814a01fc9df9f5dd21a9de1497bc44a93ea4. No P0, P1, P2, or P3.

#4351 removed the Task Ledger protocol and coordinator and left the rest standing: the 970-line core module, the three-file storage island, bootstrapLegacyTasks, and workflow_task_ledger_events. Nothing reachable on current main writes that table except the island this PR deletes. Workflow schema 12 drops the table the same way workflow_plan_reminders is dropped. That bump is required: a database already marked current and matching the target schema skips migrate, so leaving the version at 11 would keep the table.

The two names that must stay are still there. RELEASED_WORKFLOW_PROJECTION_TABLES still retires workflow_task_ledger_projections from databases that actually shipped it. The workflow_task_ledger cutover-journal key still pins what a released writer recorded; deleting it would fail closed on the workspaces it is meant to clean.

readOrBootstrap now persists an empty document on first read. initializeCopy no longer writes a placeholder into an uninitialized source. The new tests pin the stored rows, not only the returned snapshot, including a schema-10 database that still has events and no SessionTodo table.

The upgrade loss is real. v0.1.11 shipped a live Task Ledger and never shipped this bootstrap, so unfinished Tasks in that table are discarded instead of imported into SessionTodo. That is an intentional product decision, not a defect in the drop. It still needs a 0.2.0 release-note line. CSS class names and task-ledger.css are a separate slice (#4394).

Hosted test is green on this head. MERGEABLE. This is a refactor; I am not merging it.

简体中文

我审的是 fec6814a01fc9df9f5dd21a9de1497bc44a93ea4。没有 P0/P1/P2/P3。

#4351 拆掉协议层之后,核心模块、storage 孤岛、从未随版本发出的 bootstrap、以及 workflow_task_ledger_events 还在。当前 main 上除了这个死岛没有写入点。workflow schema 12 按 workflow_plan_reminders 的写法 DROP 这张表。版本号必须加:已经标成 current 且 schema 对得上的库会跳过 migrate,停在 11 就删不掉表。

该留的两处还在:released projection 退役,以及 cutover 校验合同。readOrBootstrap 首次读取会写入空文档;initializeCopy 不再给未初始化的源写占位行。测试钉的是库里的行,包括 schema 10 那条迁移。

v0.1.11 里还没做完的 Task 不会进 SessionTodo。这是产品取舍,不是实现缺陷。0.2.0 发行说明还要写这一行。CSS 走 #4394。hosted test 绿。这是重构,我不合入。


Automated review notice: This comment was posted by an automated review agent operated by WAWQAQ. It is not an independent human review and does not replace one.

@hqhq1025 hqhq1025 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed exact head fec6814a01fc9df9f5dd21a9de1497bc44a93ea4. I found no P0/P1 issue; one P2 release-note gap is attached inline.

The change removes the unreachable Task Ledger core/storage domain, deletes its package entry point and tests, advances workflow schema 11 to 12 to drop workflow_task_ledger_events, and makes SessionTodo initialize from its own empty/current document only. I traced the remaining production references, copy/purge behavior, released-schema migration, operational-state transaction, retained projection/cutover compatibility entries, and the clean merge result against current main (b9128e186e43333c287ec960d4a430661927f0fc).

Validation: clean npm 11 install; full build:test; full workspace typecheck; Core 745/745; Storage 1073/1073 with Node experimental warnings suppressed; focused SessionTodo/workflow migration 30/30; Runtime Host session/Todo 5/5; lint, format, ASF headers, and git diff --check. I also built and typechecked the synthetic merge tree against current main and reran the 30 storage plus 5 Runtime Host focused tests there. Exact-head hosted test, audit, label, and windows_recovery are green.

The unsuppressed Storage run has one failure because an unchanged subprocess test treats Node 22.22.1’s node:sqlite experimental warning as an error; the same test source is byte-identical to the merge base, the suite passes 1073/1073 with warnings suppressed, and hosted test is green. I did not run a real Desktop visual pass or upgrade a user-owned released database; the repository migration test recreates the released table shape with a row and confirms schema 12 drops it transactionally.

Review notice: This review was prepared by an automated review agent operated by hqhq1025 and is published at the direction of AstroHan, who has read these findings and is the human accountable for them.

Comment thread packages/storage/src/sqlite-workflow-schema.ts

@ARE404 ARE404 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed exact head fec6814a01fc9df9f5dd21a9de1497bc44a93ea4 (unchanged at review time). No P0/P1 — approving the code. CI is green at this head (test/audit/windows_recovery/label).

chore: retire the Task Ledger domain and drop its storage — removes the layers left standing after #4351 retired the Task Ledger protocol operation: the 970-line core module, the storage island, the legacy bootstrap path, and the workflow_task_ledger_events table (schema 11→12). Verified:

  • Reachability holds. No import of the removed modules survives anywhere in the live tree (core task-ledger, task-ledger-store, task-ledger-store-internal, task-ledger-authority and their tests all removed, zero residual non-test imports). The only remaining task-ledger strings are legacy CSS class names (e.g. session-todo-panel.tsx) plus the maka-task-ledger stylesheet residue, which the commit correctly tracks separately in #4394.
  • The intentionally-kept mechanisms are right. RELEASED_WORKFLOW_PROJECTION_TABLES still retires workflow_task_ledger_projections (a table released databases really carry), and operational-state-store.ts keeps the ['workflow_task_ledger', {sessions, events}] released-cutover contract — dropping it would fail-close a workspace rather than clean it. Both are as the commit message states.
  • Schema-12 drop is coherent and test-covered. workflow_task_ledger_events is dropped idempotently; the schema-10 migration test now asserts "restores SessionTodo storage and drops Task Ledger events" from the pre-12 shape. The readOrBootstrap→empty-document and initializeCopy no-longer-writes-placeholder changes are observationally unchanged and pinned by new storage-row assertions. package.json drops the ./task-ledger export; foreign-session.ts only removes a dangling doc reference.
  • The breaking change is deliberate and bounded. Unfinished Tasks from workspaces last opened on v0.1.x / v0.2.0-incubating-rc1 are discarded because the bootstrapLegacyTasks bridge never shipped. That is a documented, intentional trade on a pre-1.0 surface.

One open P2 to close before the release cut (not a code block): hqhq1025 flagged that CHANGELOG.md is unchanged even though this is an irreversible data-deleting migration on real user workspaces — a user-visible release note ("back up / finish Tasks before upgrading") should be added. The commit acknowledges the break needs a release-note line; please land that with the PR or before the cut. Code itself has no P0/P1.

@M4n5ter M4n5ter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed exact head fec6814a01fc9df9f5dd21a9de1497bc44a93ea4. I found no P0 or P1 issue; one P2 release-note gap is attached inline.

The implementation matches the stated retirement decision. The core package entry point and storage island have no remaining supported consumer; schema 12 removes the released event table before SessionTodo initializes; the projection-retirement and cutover-journal compatibility contracts that still protect released databases remain intact. A production-store probe upgraded a copy of the v0.1.6 operational database containing a valid pending Task event: the workflow scope advanced from schema 3 to 12, the Task table disappeared, and SessionTodo initialized empty. That confirms the data loss and its ordering. I am treating it as the explicitly accepted product change, not as an accidental implementation defect.

The change removes the domain authority, its event state, a package contract, three storage paths, and their dedicated test burden without adding a replacement authority or compatibility layer. Core, Storage, MCP, Runtime, Runtime Host, UI, Computer Use, and Desktop builds passed after workspace dependencies were built in order. The affected Storage tests passed 86/86, Runtime Host Session/Todo tests passed 5/5, the complete Desktop renderer build passed, and CLI/Desktop typechecks, formatting, and git diff --check passed. Exact-head hosted test, audit, label, and windows_recovery are green.

The merge against current main b9128e186e43333c287ec960d4a430661927f0fc is clean. Its only changed-file overlap is packages/core/package.json: main adds the independent workhub-creation-intent export, and the merge result preserves both that addition and this PR's removal. I did not merge this refactor.


Automated review notice: This comment was posted by an automated review agent operated by M4n5ter. It is not an independent human review and does not replace one.

Comment thread packages/storage/src/sqlite-workflow-schema.ts
Operational-state schema 12 drops `workflow_task_ledger_events` on first
open. Workspaces last opened by a released build that still wrote Tasks
lose that work permanently, and no shipped build ever bridged those rows
into SessionTodo, so the migration removes the only live copy.

Record the affected releases and the instruction to finish, export, or
back up outstanding Tasks before first opening this build, since after
the migration recovery needs a backup made in advance.

Generated-by: Claude Code
@Astro-Han
Astro-Han merged commit 3db83c2 into main Sep 1, 2026
3 checks passed
@Astro-Han
Astro-Han deleted the chore/storage-retire-task-ledger branch September 1, 2026 05:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/XL Over 1000 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore: finish retiring the Task Ledger domain

5 participants