Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
8600dfa
fix(platform): name the refused field on every app-door 400
yannickmonney Sep 27, 2026
dd9a1ee
fix(platform): hold forms to the door's rules and show its reason
yannickmonney Sep 27, 2026
8665537
refactor(platform): keep the invalid-body code local to its reader
yannickmonney Sep 27, 2026
6529e7c
fix(platform): list at most twenty issues on an app-door refusal
yannickmonney Sep 27, 2026
25b1038
fix(platform): name every refused limit in task tools and doors
yannickmonney Sep 27, 2026
488e751
Merge remote-tracking branch 'origin/main' into fix/task-tools-name-e…
yannickmonney Sep 27, 2026
daeb430
fix(platform): close the reviewer edge cases after re-targeting
yannickmonney Sep 27, 2026
530aeed
fix(platform): keep a coded outage out of the agent's invalid_args
yannickmonney Sep 27, 2026
d97e7ae
fix(platform): refuse an empty task_create title with the domain sent…
yannickmonney Sep 27, 2026
7e676aa
fix(platform): name every task limit at the app door's schema
yannickmonney Sep 27, 2026
498ad02
fix(platform): keep caller values out of task refusal sentences
yannickmonney Sep 27, 2026
71a8cda
fix(platform): name the UTF-16 unit in the task REST caps and docs
yannickmonney Sep 27, 2026
4ebd46e
docs(platform): record the task refusal fixes in the automation register
yannickmonney Sep 27, 2026
300ad77
chore(platform): merge main into fix/task-tools-name-every-limit
yannickmonney Sep 27, 2026
f05a4e7
fix(platform): reconcile task refusal and date guards
yannickmonney Sep 27, 2026
744e3c4
chore(platform): merge main into app validation fix
yannickmonney Sep 27, 2026
f84bdec
chore(platform): preserve concurrent task tool branch update
yannickmonney Sep 27, 2026
ff6260c
chore(platform): integrate latest boundary changes
yannickmonney Sep 27, 2026
3ec8ecd
fix(platform): serialize erased reviewer handovers
yannickmonney Sep 27, 2026
9c0ded9
chore(platform): merge main into reviewer fixes
yannickmonney Sep 27, 2026
21ce2a4
fix(platform): hand on archived reviews quietly, never block erasure
yannickmonney Sep 27, 2026
eb2d5d2
fix(platform): list no reviewer until the project audience loads
yannickmonney Sep 27, 2026
717f7ff
test(manual): reach the reviewer refusal toast in PROJ-B9
yannickmonney Sep 27, 2026
809235a
chore(platform): merge main into field refusal fixes
yannickmonney Sep 27, 2026
f8be414
chore(platform): combine task limits and field refusals
yannickmonney Sep 27, 2026
4097fa0
test(platform): retain erasure handover races in Postgres
yannickmonney Sep 27, 2026
2c768f1
fix(platform): reconcile validation with task limit changes
yannickmonney Sep 27, 2026
4d2cf36
fix(platform): reconcile reviewer fixes with current main
yannickmonney Sep 27, 2026
066d510
fix(platform): combine reviewer and field validation changes
yannickmonney Sep 27, 2026
203742c
revert(platform): take the field refusal branch back out of this PR
yannickmonney Sep 28, 2026
58986ce
chore(platform): merge main into reviewer fixes
yannickmonney Sep 28, 2026
658b4f8
chore(platform): merge main into reviewer fixes
yannickmonney Sep 28, 2026
aa95295
docs(manual): recount reviewer branch suite inventory
yannickmonney Sep 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/de/platform/admin/governance/data-subject-requests.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Als Admin oder Inhaber bearbeitest du unter **Einstellungen > Richtlinien > Anfr

Die Löschung entfernt betroffene Daten endgültig; sie verschiebt sie nicht in den Papierkorb. Der Beleg erfasst Kategorien und Anzahlen, darunter Chats, Dokumente und Uploads, Einstellungen, Feedback, Benachrichtigungen, Nutzung und das Bereinigen von Personenkennungen im Audit-Protokoll.

Aufgaben, die die Person als **Reviewer** nennen, verlieren diese Zuweisung. Eine Prüfanfrage, die noch auf sie wartet, geht wie bei **Reviewer entfernen** an den Ersteller der Aufgabe oder des Projekts, und diese Person wird benachrichtigt. Bei einer archivierten Aufgabe geht die Prüfanfrage ohne Benachrichtigung weiter. Prüfentscheidungen, die die Person bereits getroffen hat, bleiben ohne ihren Namen erhalten.

## Vorher die Richtlinie prüfen

| Einstellung | Wirkung |
Expand Down
2 changes: 2 additions & 0 deletions docs/en/platform/admin/governance/data-subject-requests.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Use **Settings > Governance > Data subject requests** as an Admin or Owner to pr

Erasure permanently removes covered data; it is not a move to Trash. The receipt records the affected categories and counts, including chats, documents and uploads, preferences, feedback, notifications, usage, and audit-identifier scrubbing.

Tasks that name the person as **Reviewer** lose that designation. A task review still waiting on them moves to the task creator or project creator, as **Clear reviewer** does, and that person is notified. On an archived task the review moves without a notification. Review decisions the person already made stay on record without their name.

## Check the policy before filing

| Setting | Effect |
Expand Down
2 changes: 2 additions & 0 deletions docs/fr/platform/admin/governance/data-subject-requests.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ En tant qu’admin ou propriétaire, utilise **Paramètres > Gouvernance > Perso

L’effacement supprime définitivement les données couvertes ; il ne les déplace pas vers la corbeille. Le reçu indique les catégories et les nombres concernés : chats, documents et imports, préférences, retours, notifications, usage et nettoyage des identifiants personnels dans l’audit.

Les tâches qui désignent la personne comme **Relecteur** perdent cette désignation. Une demande de revue qui l’attend encore passe, comme avec **Retirer le relecteur**, à la personne qui a créé la tâche ou le projet, et celle-ci en est notifiée. Pour une tâche archivée, la demande passe sans notification. Les décisions de revue que la personne a déjà prises restent enregistrées sans son nom.

## Vérifier la règle avant le dépôt

| Réglage | Effet |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,13 @@ const members: AssignableActor[] = [
{ type: 'user', id: 'user-4', name: 'Dan', email: 'dan@example.com' },
];

/** Whether the project's audience has loaded (see `useAssignableActors`). */
let scopeReady = true;

vi.mock('../hooks/use-actor-directory', () => ({
useAssignableActors: () => ({
assignableMembers: members,
scopeReady,
currentUserId: 'user-2',
resolveActor: (_type: string, id: string) => ({
type: 'user',
Expand All @@ -54,6 +58,7 @@ vi.mock('../hooks/use-actor-directory', () => ({
describe('ReviewerPicker', () => {
beforeEach(() => {
vi.clearAllMocks();
scopeReady = true;
});

it('lists only members holding an editor-level role, current user first', async () => {
Expand All @@ -74,6 +79,30 @@ describe('ReviewerPicker', () => {
expect(screen.getByText('tasks.reviewer.editorsOnly')).toBeInTheDocument();
});

it('lists nobody until the project audience has loaded', async () => {
// Until then the members are org-wide, editors outside a team-restricted
// project included — the server would refuse any of them.
scopeReady = false;
const { user } = render(
<ReviewerPicker
organizationId="org-1"
projectId="project-1"
onChange={vi.fn()}
/>,
);

await user.click(
screen.getByRole('button', { name: 'tasks.fields.reviewer' }),
);

expect(screen.queryByText('Alex')).not.toBeInTheDocument();
expect(screen.queryByText('Bea')).not.toBeInTheDocument();
expect(screen.getByText('common.actions.loading')).toBeInTheDocument();
expect(
screen.queryByText('common.search.noResults'),
).not.toBeInTheDocument();
});

it('designates on select and clears via the footer action', async () => {
const onChange = vi.fn();
const first = render(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ import { AssigneeAvatar } from './assignee-avatar';
* machinery (transfer confirm, live-run cancel, agents/automations sections)
* applies here. Candidates are the project's members holding an editor-level
* org role — the same `EDITOR_ROLES` set the server enforces (Members can see
* review cards but cannot respond).
* review cards but cannot respond). Until the project's audience has loaded
* it lists nobody: the org-wide fallback the assignee picker lives with
* would offer editors outside a team-restricted project, whom the server
* refuses.
*
* When `disabled` (no edit permission) it renders the bare avatar with no menu.
*/
Expand All @@ -52,7 +55,7 @@ export function ReviewerPicker({
}) {
const { t } = useT('tasks');
const { t: tCommon } = useT('common');
const { assignableMembers, currentUserId, resolveActor } =
const { assignableMembers, currentUserId, resolveActor, scopeReady } =
useAssignableActors(organizationId, projectId);
const [open, setOpen] = useState(false);

Expand All @@ -61,6 +64,7 @@ export function ReviewerPicker({
const label = resolved?.name ?? t('reviewer.none');

const options = useMemo<SearchableSelectOption[]>(() => {
if (!scopeReady) return [];
const eligible = assignableMembers.filter(
(member) => member.role !== undefined && EDITOR_ROLES.has(member.role),
);
Expand All @@ -79,7 +83,7 @@ export function ReviewerPicker({
</Badge>
) : undefined,
}));
}, [assignableMembers, currentUserId, t]);
}, [assignableMembers, currentUserId, scopeReady, t]);

const reviewerIsCurrentUser =
reviewerUserId !== undefined &&
Expand Down Expand Up @@ -140,7 +144,11 @@ export function ReviewerPicker({
modal
trigger={trigger}
searchPlaceholder={t('reviewer.search')}
emptyText={tCommon('search.noResults')}
emptyText={
scopeReady
? tCommon('search.noResults')
: tCommon('actions.loading')
}
aria-label={t('fields.reviewer')}
optionAction={(opt) => (
<AssigneeAvatar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ import {
type TaskStatus,
} from '../lib/display';
import { reviewPolicyErrorMessage } from '../lib/review-policy-error';
import { reviewerRefusalMessage } from '../lib/reviewer-refusal';
import { subtaskProgress } from '../lib/subtasks';
import { AssigneeAvatar } from './assignee-avatar';
import { AssigneePicker } from './assignee-picker';
Expand Down Expand Up @@ -1169,7 +1170,9 @@ export function EditTaskBody({
}
// Setting In review → Done IS the review approve, so the org's
// review_policy can refuse the picker — surface WHY, not a generic error.
const reviewRefusal = reviewPolicyErrorMessage(error, t);
// So does a Reviewer the server refuses (the picker's list went stale).
const reviewRefusal =
reviewPolicyErrorMessage(error, t) ?? reviewerRefusalMessage(error, t);
if (reviewRefusal !== undefined) {
toast({ title: reviewRefusal, variant: 'destructive' });
return;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// @vitest-environment jsdom
import { renderHook } from '@testing-library/react';
import { describe, expect, it, vi } from 'vitest';
import { beforeEach, describe, expect, it, vi } from 'vitest';

import { useActorDirectory } from './use-actor-directory';
import { useActorDirectory, useAssignableActors } from './use-actor-directory';

// The directory serves members from the org roster and agents from the
// PROJECT's user-created instances (`projectAgents` rows): with a project the
Expand Down Expand Up @@ -54,8 +54,16 @@ vi.mock('@/app/features/projects/hooks/queries', () => ({
}),
}));

/** What `listAccessibleUserIds` answers — undefined while it loads. */
let accessScope: { orgWide: boolean; userIds: string[] } | undefined;

vi.mock('@/app/hooks/use-backend-query', () => ({
useBackendQuery: () => ({ data: undefined }),
useBackendQuery: (name: string, args: unknown) => ({
data:
name === 'projects/queries:listAccessibleUserIds' && args !== 'skip'
? accessScope
: undefined,
}),
}));

vi.mock('@/app/hooks/use-current-member-context', () => ({
Expand Down Expand Up @@ -143,3 +151,37 @@ describe('useActorDirectory — members + project-agent instances', () => {
expect(result.current.resolveAssigneeId('unknown-id')).toBe('unknown-id');
});
});

/**
* The candidate lists are narrowed to the project's audience, and say when
* that narrowing has happened: until it has, the members are org-wide, so a
* picker that must offer only who the server takes (the reviewer's) waits.
*/
describe('useAssignableActors — the project audience', () => {
beforeEach(() => {
accessScope = undefined;
});

it('drops members outside a team-restricted project', () => {
accessScope = { orgWide: false, userIds: ['user-1'] };
const { result } = renderHook(() => useAssignableActors('org-1', 'proj-1'));
expect(result.current.scopeReady).toBe(true);
expect(result.current.assignableMembers.map((m) => m.id)).toEqual([
'user-1',
]);
});

it('is not ready while the audience loads, and falls back to the whole org', () => {
const { result } = renderHook(() => useAssignableActors('org-1', 'proj-1'));
expect(result.current.scopeReady).toBe(false);
expect(result.current.assignableMembers.map((m) => m.id)).toEqual([
'user-1',
'user-2',
]);
});

it('is ready at once without a project — the org is the audience', () => {
const { result } = renderHook(() => useAssignableActors('org-1'));
expect(result.current.scopeReady).toBe(true);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,9 @@ export function useActorDirectory(organizationId: string, projectId?: string) {
* With no `projectId` members degrade to org-wide and agents to none — an
* agent exists only inside its project. While the access query is in flight,
* members fall back to org-wide; the backend guard is the real gate.
* `scopeReady` says whether that narrowing has happened, for a picker that
* must offer only who the server will take (the reviewer picker lists
* nobody until it is true).
*/
export function useAssignableActors(
organizationId: string,
Expand All @@ -325,6 +328,7 @@ export function useAssignableActors(
// Instances are project-curated by construction — the directory already
// scoped them to this project.
const assignableAgents = directory.agents;
const scopeReady = !projectId || scope.data !== undefined;

return { ...directory, assignableMembers, assignableAgents };
return { ...directory, assignableMembers, assignableAgents, scopeReady };
}
34 changes: 34 additions & 0 deletions services/platform/app/features/tasks/lib/reviewer-refusal.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { describe, expect, it } from 'vitest';

import { AppError } from '@/lib/shared/errors/app-error';

import { reviewerRefusalMessage } from './reviewer-refusal';

const t = (key: string) => `tasks.${key}`;

describe('reviewerRefusalMessage', () => {
it('explains a designee who cannot edit the project with the picker hint', () => {
expect(
reviewerRefusalMessage(
new AppError({ code: 'TASK_REVIEWER_NO_EDIT_ACCESS' }),
t,
),
).toBe('tasks.reviewer.editorsOnly');
});

it('explains a designee who is no longer a member the same way', () => {
expect(
reviewerRefusalMessage(
new AppError({ code: 'TASK_REVIEWER_INVALID' }),
t,
),
).toBe('tasks.reviewer.editorsOnly');
});

it('leaves every other failure to the caller', () => {
expect(
reviewerRefusalMessage(new AppError({ code: 'TASK_NOT_FOUND' }), t),
).toBeUndefined();
expect(reviewerRefusalMessage(new Error('offline'), t)).toBeUndefined();
});
});
21 changes: 21 additions & 0 deletions services/platform/app/features/tasks/lib/reviewer-refusal.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { backendErrorCode } from '@/lib/utils/backend-error';

/**
* Localized copy for a refused **Reviewer** designation: the server takes
* only a live member who can edit the project — the rule the review gate
* resolves by — and the picker offers only those, so a refusal means the
* list went stale (someone lost access while it was open). Says what the
* picker's own hint says instead of the generic error toast.
*/
export function reviewerRefusalMessage(
error: unknown,
t: (key: string) => string,
): string | undefined {
switch (backendErrorCode(error)) {
case 'TASK_REVIEWER_INVALID':
case 'TASK_REVIEWER_NO_EDIT_ACCESS':
return t('reviewer.editorsOnly');
default:
return undefined;
}
}
83 changes: 83 additions & 0 deletions services/platform/backend/domains/collab/service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ import { addJobInTx } from '../../jobs/enqueue.ts';
import { emitHintInTx } from '../../realtime/outbox.ts';
import type { CollabNotificationInput } from './service.ts';
import {
dismissReviewerAssignedNotifications,
dismissReviewRequestNotifications,
dismissTriggerPausedNotifications,
markAllNotificationsRead,
notifyTaskComment,
notifyTaskMentions,
notifyTaskReviewerAssigned,
notifyTaskReviewRequested,
notifyTriggerPaused,
writeCoalescedNotification,
} from './service.ts';
Expand Down Expand Up @@ -361,6 +363,87 @@ describe('the reviewer-designation heads-up (task_reviewer_assigned)', () => {
expect(calls).toEqual([]);
expect(vi.mocked(emitHintInTx)).not.toHaveBeenCalled();
});

it('a moved designation marks only the former designee’s unread heads-up on this task read, and hints them', async () => {
// Before the fix a change of reviewer ahead of In review left "You're
// the reviewer" ringing for the person it was taken from.
const { db, calls } = recordingDb((text) =>
text.startsWith('UPDATE app.user_notifications') ? [{ id: 'n-1' }] : [],
);
await expect(
dismissReviewerAssignedNotifications(db, {
organizationId: 'org-1',
taskId: 'task-1',
userId: 'u-recipient',
}),
).resolves.toBe(1);
const update = calls.find((call) =>
call.text.startsWith('UPDATE app.user_notifications'),
);
expect(update?.text).toContain('read = true');
expect(update?.text).toContain("type = 'task_reviewer_assigned'");
expect(update?.text).toContain('read = false');
expect(update?.values).toEqual(
expect.arrayContaining(['org-1', 'u-recipient', 'task-1']),
);
expect(vi.mocked(emitHintInTx)).toHaveBeenCalledTimes(1);
expect(vi.mocked(emitHintInTx)).toHaveBeenCalledWith(db, {
orgId: 'org-1',
userId: 'u-recipient',
entity: NOTIFICATION_HINT_ENTITY,
entityId: null,
});
});

it('a moved designation with no unread heads-up hints nobody', async () => {
const { db } = recordingDb(() => []);
await expect(
dismissReviewerAssignedNotifications(db, {
organizationId: 'org-1',
taskId: 'task-1',
userId: 'u-recipient',
}),
).resolves.toBe(0);
expect(vi.mocked(emitHintInTx)).not.toHaveBeenCalled();
});

it('a review handed over by no person (an erasure) asks impersonally, as the system', async () => {
const { db, calls } = recordingDb((text) =>
text.startsWith('INSERT INTO app.user_notifications')
? [{ id: 'n-request' }]
: [],
);
await notifyTaskReviewRequested(db, {
organizationId: 'org-1',
task: designation.task,
reviewerUserId: 'u-recipient',
approvalId: 'approval-1',
submitter: { kind: 'system' },
});
// No actor to name: nobody's display name is read.
expect(calls.some((call) => call.text.includes('FROM "user"'))).toBe(false);
const insert = calls.find((call) =>
call.text.startsWith('INSERT INTO app.user_notifications'),
);
expect(insert?.values).toEqual(
expect.arrayContaining([
'u-recipient',
'task_review_requested',
'taskReviewRequested',
'taskReviewRequestedBodyHuman',
'task_review',
'approval-1',
'system',
null,
]),
);
expect(insert?.values).toContainEqual({
taskId: 'task-1',
projectId: 'proj-1',
taskTitle: 'Ship the brief',
approvalId: 'approval-1',
});
});
});

describe('the mention bell, per surface', () => {
Expand Down
Loading
Loading