Skip to content

fix(platform): re-target the pending review when the reviewer changes - #3517

Merged
yannickmonney merged 1 commit into
mainfrom
fix/retarget-pending-task-review
Sep 27, 2026
Merged

yannickmonney merged 1 commit into
mainfrom
fix/retarget-pending-task-review

Conversation

@yannickmonney

@yannickmonney yannickmonney commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

What changed

A task review stamps metadata.requestedFor once, when it is minted (requestTaskReview), and a
later change of Reviewer never reached it. The board chip ("Waiting on {name}" / "Waiting on
you"), the Needs my review facet and the actionable request bell all read that field, so after
A → B mid-review the review stayed with A. B got only the non-actionable "You're the reviewer"
heads-up. The guide already promises that Reviewer "routes the notification and review queue".

  • backend/domains/tasks/reviews.ts: new retargetPendingTaskReview(tx, { task, actorUserId }).
    For each pending, workflow-free task_review row (the same set the status-leave close handles),
    it resolves the reviewer through the mint's own resolveReviewer chain. A new designee with
    project edit access takes the review; a clear hands it to the resolved default (human task
    creator → project creator), and a non-editor designee falls through the chain as at mint. When
    the reviewer changes, it rewrites requestedFor (guarded status = 'pending'), dismisses the
    previous reviewer's request bell and subscribes the new reviewer. It then sends them
    task_review_requested (actionable, so it e-mails) from the person who made the change, which
    means taking a review yourself rings nobody.
  • backend/domains/tasks/service.ts (updateTask): calls it in the same transaction as the
    reviewer_user_id write whenever the reviewer changes. A designee who now holds the open
    request is no longer also sent the heads-up. Both bells share the task:<id>:review collapse
    identity, so the heads-up used to rewrite the actionable request in place, turning it into a row
    that dismissReviewRequestNotifications can no longer clear.
  • Docs (EN/DE/FR, platform/projects/task-automation.md): one paragraph on handing a waiting
    review over and on Clear reviewer.
  • Manual layer: box PROJ-F32 (live two-session hand-over) plus its reference/automation.md row
    for the automated backend half.

No schema change, no new strings, no contract change: TaskReview.requestedFor is still "the
reviewer the request named".

How I verified it

  • bunx vitest run --project server backend/domains/tasks/ backend/rest/v1-tasks.review.test.ts backend/rest/v1-tasks.test.ts backend/domains/collab/ backend/domains/projects/routes.test.ts:
    33 files, 290 tests pass. New: reviews.retarget.test.ts (7 cases: hand-over, clear → creator,
    → project creator, nobody resolves, non-editor designee, no-op, decided or workflow-era rows
    untouched) and service.reviewer.test.ts (5 cases: the same-tx call with the updated task, the
    heads-up held back or sent, clear, unchanged reviewer).
  • bunx oxlint --type-aware --type-check backend/domains/tasks/ backend/integration-check.ts:
    clean. oxfmt --check repo-wide: clean. bun run lint:manual: ok. check-guide.ts on
    suites/projects.md: OK. Docs suite (services/docs, bunx vitest run): 34 files, 166 tests
    pass.
  • Real Postgres 16 (+ pgvector, no Docker), ITEST_LANES=checkTasksCollabIntegrity,checkReviewArc,
    two new checks driving the app doors (designate A → In review → designate B → clear):
    • With the fix: 30/31 pass, both new checks included.
    • Same lanes, fix stashed: 28/31. Both new checks fail exactly as the task describes: gate
      and chip still name A, A still "waits on" it, B holds only task_reviewer_assigned:unread, A
      keeps task_review_requested:unread, and a clear leaves it on A.
    • The one failure in both runs is the boot check "knowledge BM25 indexes verified", which needs
      ParadeDB pg_search; the local Postgres doesn't have it.
    • backend:integration is not a CI job, so this local run is the real-Postgres proof.

CI note: @tale/platform:test, :typecheck and :lint executed on this PR (cache miss, executing); the Unit log lists both new suites. @tale/docs:test was replayed from cache
because the repo-root docs/ tree it reads is not among its Turborepo inputs, so the local docs
run above is the proof for the three edited pages.

Left open (not in this change)

  • Erasure pseudonymizes a pending review's requestedFor to the erased sentinel instead of
    re-targeting it (backend/domains/erasure/service.ts, reviewDecisions pass).
  • Changing the reviewer before review still leaves the previous designee's unread heads-up bell.
  • The server accepts a non-editor designee (only org membership is checked). The gate then routes
    past them, as it does at mint.

A task review stamps `requestedFor` once, at mint, and a later change of
Reviewer never reached it: the board chip, "Needs my review" and the
actionable request bell stayed with the reviewer the review was taken
from, while the new designee got only the non-actionable heads-up.

updateTask now calls retargetPendingTaskReview in the same transaction as
the reviewer_user_id write. It resolves the open workflow-free review
through the mint's own chain (a clear lands on the task creator, then the
project creator), rewrites `requestedFor`, dismisses the previous
reviewer's request bell, subscribes the new reviewer and sends them the
request, asked by the person who made the change. A designee who holds the
open request is not also sent the heads-up, which shares its collapse
identity and would rewrite the actionable bell in place.

Covered by unit suites for the re-target and the updateTask wiring, and by
two real-Postgres checks in checkTasksCollabIntegrity; the task-automation
guide says so in EN/DE/FR and PROJ-F32 holds the live two-session check.
@yannickmonney
yannickmonney merged commit 9121a4a into main Sep 27, 2026
50 checks passed
@yannickmonney
yannickmonney deleted the fix/retarget-pending-task-review branch September 27, 2026 16:10
yannickmonney added a commit that referenced this pull request Sep 28, 2026
Three gaps left open by the reviewer re-target (#3517):

- Erasure stamped a review still waiting on the subject with the
  pseudonym, so it waited on nobody. The review pass now clears the
  designation first, hands each waiting review on through the chain a
  cleared designation takes (task creator, then project creator, the
  subject skipped in every slot) and rings the new reviewer as the
  system; only what still names the subject is pseudonymized after.
- Changing or clearing the reviewer before In review left the previous
  designee's unread "You're the reviewer" heads-up ringing; it is now
  marked read when the designation moves.
- A designee who cannot edit the project was stored and then routed
  past at mint. The designation is held to the same rule the gate
  resolves by (reviewerEligibility) and refused with 400
  TASK_REVIEWER_NO_EDIT_ACCESS; the task dialog names the refusal with
  the picker's own hint.

Manual boxes PROJ-F33, PROJ-F34 and PROJ-B9, their automation rows,
the error-code row, and the data subject request docs (EN/DE/FR).
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