Skip to content

feat(platform): let the REST door archive and restore a task - #3438

Merged
larryro merged 2 commits into
mainfrom
feat/rest-task-archive
Sep 20, 2026
Merged

larryro merged 2 commits into
mainfrom
feat/rest-task-archive

Conversation

@larryro

@larryro larryro commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Why

A mirror that opens a task per delivery (vatplus's desk worker does) had no way to retire the task a re-delivery or a cancellation superseded: the REST door could read a task's archivedAt but never set it, so the old task stayed live on the board next to its replacement, with its run still going.

What

  • PATCH /api/v1/projects/{id}/tasks/{taskId} with exactly { "archived": boolean } — the board's own archiveTask / restoreTask, run inside the serializable transaction after the project write check and the project-scoped task lookup. Idempotent both ways; answers the task as it now stands.
  • Contract 1.20.0: OpenAPI operation setTaskArchived, regenerated openapi.json + fingerprint.
  • Docs: new "Archive or restore a task" section in EN/DE/FR, and the "no verb for it" sentence under the start section now points at it.

Proof

  • bunx vitest --run --project server backend/rest/v1-tasks.test.ts scripts/openapi/spec.test.ts — 195 passed (9 new door cases: archive in tx, restore, idempotent, archived project 403, member 403, other project 404, three invalid bodies 400).
  • bunx tsc --noEmit, bunx oxlint --type-aware on the touched files — clean.
  • bun run --filter @tale/docs test — 166 passed.

A mirror that opens a task per delivery had no way to retire the task a
re-delivery or a cancellation superseded: the door could read a task's
`archivedAt` but never set it, so the old task stayed live on the board
next to its replacement.

Add `PATCH /api/v1/projects/{id}/tasks/{taskId}` taking exactly
`{ archived: boolean }`. It runs the board's own archive/restore
(`archiveTask` / `restoreTask`) inside the serializable transaction,
after the project write check (so `PROJECT_ARCHIVED` and `RBAC_FORBIDDEN`
refuse first) and the project-scoped task lookup (so another project's
task answers the opaque `TASK_NOT_FOUND`). Both directions are
idempotent, and the answer is the task as it now stands.

Contract 1.20.0; the OpenAPI document, the fingerprint and the three
API references carry the new verb.
The PATCH landed with contract 1.20.0, but the `Task.archivedAt` schema
description (and the payload comment behind it) still said the door had
no verb for archiving, so the published document contradicted its own
operation. Descriptions sit outside the contract fingerprint, which is
why no guard caught it.

Rewrite the sentence to name the toggle, retire the "cannot be archived"
half of the repo ledger entry (only the DELETE twin remains open, gated
the way the PATCH is so an archived task stays deletable), and register
the verb's owning specs in the manual layer's automation map.
@larryro
larryro merged commit 1e15c17 into main Sep 20, 2026
50 checks passed
@larryro
larryro deleted the feat/rest-task-archive branch September 20, 2026 17:12
larryro added a commit that referenced this pull request Sep 20, 2026
The CLI workflow on main (run 35525098046, after #3438) failed its
Windows build in config-source.test.ts: "a self-consistent changed
archive still cannot claim the original Git pack tree" took 5.7 s and
bun test's 5 s default killed it. The test builds the git release
fixture; Windows runners stall on git for seconds at a time, and Linux
and macOS finish the same test in well under a second.

1d1c532 raised the budget per file with `setDefaultTimeout(30_000)`,
but twelve test files that build the same fixture never got it, and
three of the four tests in this file carried a per-test 30 s while the
fourth did not. One rule instead of a per-file convention: the package
`test` script runs `bun test --timeout 30000`, and the workflow's unit
and smoke steps go through the script, so no test file has to remember
the budget and the local run matches CI.

Linux, tools/cli: 1218 pass, 19 skip, 1 fail — provision.test.ts binding
port 3005 against a running dev stack, the documented environmental red.
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