Skip to content

bug(platform): legal-hold and trash refusals lose their reason (English server text or a generic line), and Grant competence says "No members found" on a failed read #4840

Closed

Description

@yannickmonney

Problem

Three governance pages lose the reason for a refusal or a failed read. Paths are under services/platform/ at main acd5dbd10.

# Page Code What an admin sees
1 Legal hold actions app/features/settings/governance/legal-hold/legal-hold-errors.ts:57-115 maps forbidden, not_found, TARGET_NOT_IN_ORG and LEGAL_HOLD_RELEASE_NOT_PENDING. The backend sends FORBIDDEN, TARGET_NOT_FOUND, HOLD_NOT_FOUND, REQUEST_NOT_FOUND and REQUEST_NOT_PENDING (backend/domains/legal_holds/service.ts:191, :211, :320, :389, :393, :484), which fall to the default branch. That branch shows the server's message (:55) In every locale the English server sentence: "This request was already decided" when another admin decided a release first, "The user is not a member of this organization", or "Request not found". The localized texts written for these cases never show
2 Trash restore app/features/settings/governance/components/trash-page.tsx:211-223 passes any failure to mapGovernanceSaveError, which maps only ORG_FORBIDDEN (governance-save-errors.ts:26-40) Every other refusal, for example a restored contact whose email now belongs to another contact, or a row already gone, reads only "Couldn't restore — Couldn't restore this record.". The dialog stays open, so a retry repeats the failure with no hint
3 Competences › Grant app/features/settings/governance/competences/grant-competence-dialog.tsx:71, :131-144 builds the member options from members.data ?? [] and gives the picker no loading or error state (:234-252) While the member read loads, or after it fails, the picker says "No members found", with no Try again. This is the class of #4586

Expected

  • (1) Align the client codes with the backend (or the reverse), map every code to catalog text, and keep the server sentence out of the UI.
  • (2) Map the restore refusal codes. The contacts import already ships "A contact with this email already exists" (contacts:import.errorCodes.duplicate_email). Close or refresh the dialog when the row is gone.
  • (3) Pass the read state to the picker: loading while pending, an error with Try again on failure.
  • Regression:
    • a legal-hold-errors test per backend code, asserting no server sentence;
    • a trash test for a duplicate-email restore;
    • a grant-dialog test with a failed member read.

Severity and owner

Activity

  1. yannickmonney commented on Oct 12, 2026

    @yannickmonney
    ContributorAuthor

    Addendum at main 363c476b5 (Review A, TALE-358, 2026-10-12 12:15 Zurich occurrence; static reading).

    Governance policy saves refused for a non-admin show the raw code "FORBIDDEN".

    • The server: the governance policy write routes answer c.json({ error: 'FORBIDDEN' }, 403) with no message (backend/domains/governance/routes.ts:544, :631).
    • The client: editors such as Security monitoring's two-factor policy (app/features/settings/governance/components/two-factor-policy-editor.tsx:91-97) put failureDetail(error) under their title. For a code-only refusal, backendRefusalDetail returns the code itself (app/lib/backend/adapters.ts:313-321).
    • What the user sees: an admin demoted while the page was open gets "Couldn't save … — FORBIDDEN", in every locale.

    Expected: map FORBIDDEN (and ORG_FORBIDDEN) to the existing errors.saveForbidden sentence for all policy editors, not only those using mapGovernanceSaveError.

  2. yannickmonney commented on Oct 12, 2026

    @yannickmonney
    ContributorAuthor

    Addendum (Review A, TALE-358, 2026-10-12 20:15 Zurich occurrence): seven reason fields also show zod's English text. main c94f1fd84, paths under services/platform/app/features/settings/governance/.

    These reason fields cap their text with a bare .max(2000), with no message and no maxLength on the field:

    • legal hold: place-hold-dialog.tsx:179, request-release-dialog.tsx:45, reject-release-dialog.tsx:45 and close-matter-dialog.tsx:41;
    • data subject requests: file-request-dialog.tsx:108, cancel-dialog.tsx:43 and extend-deadline-dialog.tsx:56.

    The app sets no zod error map (zod 4.3.6), so pasting a long justification shows zod's default "Too big: expected string to have <=2000 characters" under the field, in English in every locale.

    upsert-matter-dialog.tsx already limits its fields with maxLength; these seven don't.

    Expected: give each .max(2000, t(…)) a localized message, such as the existing "at most {max} characters" pattern, and/or set maxLength={2000} with a character count.

    Regression: a dialog test in German that enters 2,001 characters. A German message shows. On c94f1fd84 the English zod text renders.

    This is static reading, verified at the cited lines. I didn't run it.

  3. yannickmonney commented on Oct 13, 2026

    @yannickmonney
    ContributorAuthor

    Addendum 2 (Review A, TALE-358, 2026-10-13 04:15 Zurich occurrence): two more English texts on data subject requests. main 715dc15ad.

    1. The request drawer prints stored English reasons and offers a Retry its own text rules out.

    • services/platform/app/features/settings/governance/data-subject-requests/request-detail-drawer.tsx:378-392 shows request.errorMessage verbatim under Error message. Only one legacy token is translated.
    • The stored values are English sentences built by the server:
      • "failed passes: …" and "held off by a legal hold: …" (backend/domains/erasure/service.ts:757-771, erasureReceiptError);
      • the watchdog's "Erasure timed out and was stopped by the watchdog. File a new request." (backend/core/governance/erasure_constants.ts:49-50, written by the watchdog with status = 'failed' at service.ts:2374-2376).
    • German and French admins read them in English, and the pass names are internal identifiers.
    • For the watchdog case, the drawer also offers Retry (canRetry includes failed, :208-211), while the stored sentence says to file a new request. The server refuses that Retry (service.ts:588, mapped to NOT_RETRIABLE).

    2. Approval races and refusals are shown as the server's English sentence.

    • The erasure approval buttons call approvals/mutations:updateApprovalStatus (erasure-approval-actions.tsx:31-32) and show mapDsrError(err, t).description (:53).
    • The approvals service refuses with upper-case codes: ALREADY_RESOLVED with "This approval is already {status}" when another admin decided first, FORBIDDEN with "Only org admins decide erasure approvals.", and NOT_FOUND (backend/domains/approvals/service.ts:104-108, :179, :194-199).
    • mapDsrError only knows the erasure service's lower-case forbidden and not_found (data-subject-requests-errors.ts:57, :67), so these fall through to the server's message (:45-48). The person reads English, including a raw status word such as "already approved".

    Expected:

    • Store reason codes (the failed passes, the held-off passes, watchdog_timeout) and render them through the catalog, with localized pass names.
    • Hide Retry when the reason isn't retriable, and offer "File a new request" instead.
    • Map ALREADY_RESOLVED, FORBIDDEN and NOT_FOUND from the approvals door to localized sentences, for example "Another admin already decided this request", and refresh the row.

    This is static reading, verified at the cited lines. I didn't run it.

  4. added
    agent-ready
    on Oct 29, 2026
  5. added a commit that references this issue on Oct 30, 2026
    96e1de9
  6. added a commit that references this issue on Oct 30, 2026
    3cea4ca
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readybug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions