Repository navigation
fix(platform): refuse comment and dependency writes on archived tasks - #4219
Conversation
The REST comment door refused an archived task with TASK_ARCHIVED, but the app's comment create, edit and delete and its dependency add and remove only checked the project's archive, so a stale client still changed an archived task's discussion and dependency graph (#3589). - comments: a person's comment, and every edit or delete, now passes assertTaskNotArchived after the access checks and before any write. A run's own report still lands, like its status park. - dependencies: adding refuses an archived task at either end; removing refuses when the blocked task is archived, and still drops an archived blocker from an active task. - getTask answers canComment false for an archived task or project, so the composer and the comment actions follow the doors. Proof: unit tests and the checkArchivedTaskWrites lane (app and REST doors on real Postgres), red on main and green here. Docs (en/de/fr), TASK-B40 and the manual registers say what an archived task allows. Closes #3589
ACCEPT — independent review, TALE-542 / TALE-135 / #3589Exact reviewed head: No blocking finding against TALE-135's acceptance criteria:
Evidence reviewed: PR diff and author checkpoint/evidence on TALE-135, including the reported throwaway Postgres run of Unrun proof: no fresh local Postgres integration run, browser/manual |
|
TALE-565 register-only merge repair: merged origin/main New head: Interdiff: only the register merge (verified with Hosted CI is queued; no rerun or cancellation requested. No PR merge, review verdict or card move. Agent #2 owns exact-head verification and merge once CI is green. |
What changed
The REST comment door refused an archived task with
403 TASK_ARCHIVED. The app's comment create, edit and delete, and its dependency add and remove, only checked the project's archive, so a stale client still changed an archived task's discussion and dependency graph (#3589). The app task read also answeredcanComment: truefor every readable task, so the app still showed the composer and the Edit/Delete actions on an archived task.All of these now go through the same archived-task gate,
assertTaskNotArchived, in the domain. It runs after the access checks and before any write.comments.ts)appendTaskComment, so the app door, the REST door's backstop and the REST ask-answer mirror) refusesTASK_ARCHIVEDwhen the task is archived.assertCommentModifiable) refuses it too, for the author and for an admin moderating.service.ts)addTaskDependencyrefuses when either end is archived. The board offers neither, and an archived blocker's status no longer moves, so a new edge from it would block for good.removeTaskDependencyrefuses when the blocked task is archived, since the edge is that task's record.openTaskBlockerIdsstill counts an archived, open blocker.getTask):canCommentis nowfalsefor an archived task or an archived project, the two states every comment door refuses. The composer and the comment actions already follow this flag, so the app no longer offers verbs the server refuses. No frontend change was needed.Decisions a reviewer may want to challenge
task_commenttool, the workflowtask.commentstep, ask mirrors and retractions, and the overdue nudge still write to a task that was archived under them. Archiving cancels no run, and the sibling trusted writers (agentUpdateTaskStatusTrusted, outputs, priority) ignore the archive too. Refusing the completion report would roll back the whole settle, and the run would hang until the watchdog. Whether archiving should stop live work, or machine lanes should refuse too, is a separate product decision. A unit test pins today's behaviour ("still takes the report of a run working the task").TASK_ARCHIVEDwith 400, as it already does for title, status, move, assign, reviewer, repeat and start. The REST door answers 403. Both refuse with the same code, anderror-codes.mdrecords the split as before.canCommentnow also reflects an archived project. The server already refused those comments withPROJECT_ARCHIVED, so the composer it showed there was a dead end of the same kind.Sweep
docs/{en,de,fr}/platform/projects/tasks.mdsays what an archived task allows. The REST reference already documents403 TASK_ARCHIVEDfor comments, and REST behaviour is unchanged.TASK-B40(the hidden composer and a stale tab's toast);automation.mdrow for the server half;error-codes.mdrow for the app door's 400.failureDetail, as the other archived-task refusals do.How I verified it
Exact head
61a03dfea, basemain9b7463b70.Unit, red on
main, then green. I copied the final test files onto amaintree.main9b7463bcomments.archived.test.ts+service.archived.test.tscanCommentread fail, every control passesRelated suites:
backend/domains/tasks/,rest/v1-tasks*,rest/v1-automations.asks,connectors/task-store,automations/store.terminal-asks,core/tasks/mentionsanddomains/sandbox, 92 files.archivedAt(real rows always carry it,nullor a number) or a./service.tsmock without the gate.Real Postgres, both HTTP doors. I ran the new harness lane
checkArchivedTaskWriteson a throwaway local Postgres 16 + pgvector withITEST_LANES=checkArchivedTaskWrites. It drives:updated_at, activity, audit rows and edges.main+ lane only200/none ×3; REST403/TASK_ARCHIVED; title control400/TASK_ARCHIVED; the task changed (activity 3→6, audit 3→8, message replaced);canComment=true400/TASK_ARCHIVED ×4; REST403/TASK_ARCHIVED; nothing changed;canCommentarchived/active =false/true200,400/TASK_DEPENDENCY_CYCLE(the first add had landed),200; edges changed400/TASK_ARCHIVED ×3; edges unchangedThe only other FAIL in both local runs is the boot check
knowledge BM25 indexes verified at boot, which needspg_search. The local cluster doesn't have it; CI'stale-dbimage does.Gates on the changed files.
oxlint --type-aware: 0 diagnostics.oxfmt --check: clean.tsc --noEmit: exit 0. It covered the changed files plusroutes.ts,v1-tasks.tsandintegration-check.ts.bun run lint:manual: ok.check-guide.ts suites/tasks.md: OK.Not run here: the full platform suite, a whole-workspace
tsc, browser/E2E, and the fullbackend:integrationrun. CI runs those. I didn't drive the hidden composer in a browser (TASK-B40is manual).Closes #3589