Repository navigation
fix: Settings low-severity gaps (custom-instructions parity, last-member refusal, Disconnect loading, dead ?section=apps, MCP name validation) (#2091) - #2132
Conversation
baf496e to
198bbba
Compare
Desk review — Settings low-severity gaps (#2091)Verdict: NOT READY — one blocking change required (test coverage for the new server-side MCP validation/uniqueness logic). The five fixes are implemented correctly and CI is green; the gap is a missing-tests one, not a correctness one. CI & tests
What's correct (verified)
BLOCKING — required before merge1. The new server-side MCP validation/uniqueness logic in
This is new error/edge logic with a data-integrity carve-out and no safety net. The repo already has a clean mock-ctx idiom for action handlers ( Non-blocking (recommend, not required for this PR)
NOT READY — CHANGES REQUIRED: add the missing action-level tests for the new MCP |
Desk Review — PR #2132 (issue #2091)Branch: CI state — confirmed via
|
🔴 Desk review verdict: NOT READY — CHANGES REQUIREDDesk review — NOT READY (1 blocking item)Thorough review of all five fixes. CI is green (40+ checks pass) and the changed-area tests pass locally ( 🔴 Blocking —
|
Desk Review — PR #2132 (issue #2091)Verdict: READY TO MERGE. All five itemized gaps are correctly closed; CI is fully green and the project's own tests pass. Verification performed
Per-item confirmation
Non-blocking observations (suggested follow-ups, not merge blockers)
None of the above affects correctness, so this does not block merge. |
5345ca8 to
6f4a710
Compare
larryro
left a comment
There was a problem hiding this comment.
Desk Review — PR #2132 · fix: Settings low-severity gaps (#2091)
VERDICT: READY TO MERGE. All five itemized gaps ([101], [102], [104], [105], [108]) are implemented correctly, minimally, and per the issue's stated remedy. CI is green and the project's own tests pass. Everything below the per-item section is a non-blocking observation or optional follow-up — none is a required change.
Reviewed by cloning the repo, checking out the head ref tale/xs705hg0qde0am4c2x32pnmnvx898chd, and reviewing the whole implementation around each changed line (not just the diff) in two rounds: breadth review across correctness/robustness/elegance/tests/boundaries, then independent re-verification of every load-bearing conclusion.
CI state — GREEN (confirmed via gh pr checks 2132)
Every required check passes: Type check, Lint, Format, Knip, Lint commits, Unit, UI, Migrations, Opengrep, Smoke test, Analyze (javascript-typescript + python), Build (platform/convex/db/controller/proxy/sandbox…), Storybook, all 16 Playwright (platform) shards + Playwright (web) + Playwright (docs), Validate images, Scan platform. The only non-pass rows are conditional skips (Trivy, Docs/Web container tests, fork-PR-only jobs) — no failures, nothing pending. mergeStateStatus: CLEAN, mergeable: MERGEABLE.
Tests run locally on the branch
- Backend (server project):
bunx vitest --run --project server mcp_servers messages→ 10 files, 82 tests passed. (Re-run--project server mcp_servers→ 7 files, 45 passed.) - UI (components):
bunx vitest --run --config vitest.ui.config.ts team-member-checklist integration-panel mcp-server-form→ 3 files, 15 tests passed. - i18n parity (enforce mode): 23/23 passed —
deandfrmatchen's keyset exactly; no missing/extra keys.
Per-item verdicts
[101] Custom-instructions illegal-char parity — CORRECT.
personalization-settings.tsx now imports CUSTOM_INSTRUCTIONS_ILLEGAL_RE / CUSTOM_INSTRUCTIONS_MAX_CHARS from the shared convex/user_memories/constants.ts (dropping the duplicated local 4000) and adds two Zod .refine()s: normalized-length ≤ 4000, and the illegal-char set with an empty-string carve-out. normalizeInstructions (CRLF→LF then lone-CR→LF) is byte-identical to the backend (user_preferences/mutations.ts:29-31). Verified client verdict == backend verdict across empty / embedded-LF (allowed) / CRLF / lone-CR / 4000 (accept) / 4001 (reject) / <tag> / backtick / tab \x09 / bell \x07 (all reject). Uses .refine not .transform, so the stored/submitted value and dirty tracking are untouched; the error surfaces inline via the Textarea errorMessage prop (prop exists, renders in a role="alert").
[102] Team-edit last-member silent refusal — CORRECT.
team-member-checklist.tsx gains enforceMinimumOne; the edit dialog passes it, the create dialog does not (create still permits 0 selected → current user auto-added). When exactly one member is selected, that member's Checkbox is disabled (Radix suppresses onCheckedChange) with a cursor-not-allowed label + title, and an explanatory settings.teams.lastMemberHint is shown. size <= 1 correctly mirrors the backend rejection at team_members/mutations.ts (throws when member page.length <= 1).
[104] Integration Disconnect loading state — CORRECT.
use-integration-manage.ts replaces const isSubmitting = false with real useState, set true at the start of handleDisconnect and false in a finally (symmetric on success and error; errors are caught → destructive toast, so the promise never rejects). integration-panel.tsx keeps the ConfirmDialog open (isLoading={manage.isSubmitting}) until handleDisconnect().finally(() => setConfirmDisconnect(false)) settles, then closes on both outcomes; the previously-dead footer spinner is now activated. Verified the confirm button is gated by isSubmitting/isLoading — not the busy aggregate — so feeding isSubmitting into busy (line 306) causes no deadlock; busy only disables the sheet's own footer/Delete buttons during the in-flight disconnect, which is the intended behavior.
[105] Dead ?section=apps param — CORRECT.
integrations.tsx narrows section to z.literal('mcp-servers').optional(). Confirmed beforeLoad only ever read 'mcp-servers', an 'apps' handler never existed in history, and a monorepo-wide search finds zero producers of ?section=apps (no in-app navigation emits section other than the redirect target). ?section=mcp-servers deep links still validate and redirect. This matches the issue's sanctioned remedy ("drop 'apps' from the enum").
[108] MCP server name slug + server-side validation — CORRECT.
New shared convex/mcp_servers/constants.ts (MCP_SERVER_NAME_RE = /^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/, MCP_SERVER_NAME_MAX_LENGTH = 64, validateMcpServerName) is imported by both the client form and the server actions, so validation cannot drift. The client form drops the name.length > 1 carve-out (single lowercase now correctly passes; single uppercase now correctly fails) and validates the trimmed value. Server create/update actions trim + validate + enforce per-org uniqueness via the new getIdByOrgAndName internal query (uses the existing by_org_name index on ['organizationId','name']). update derives the org scope from the server-side existing row (not client input) and excludes the row's own id (duplicateId !== id), so a no-op self-rename is allowed. ConvexError messages surface in the toast via convexErrorMessage. i18n keys nameTooLong ({max}) / nameInvalid added to all three locales; the old nameFormat key is cleanly removed (no orphan). Tests are revert-sensitive (duplicate-conflict, 'A' → invalid_format, self-rename-allowed, cross-server-collision).
Non-blocking observations (optional follow-ups — NOT required to merge)
-
[101] residual token-budget parity gap (out of this item's scope). The backend additionally rejects
estimateTokens(normalized) > 800(CUSTOM_INSTRUCTIONS_MAX_TOKENS), which the client does not mirror. Because ~4 chars/token (Latin) and ~1.5 chars/token (CJK), a value that is ≤ 4000 chars and legal can still exceed 800 tokens (roughly > 3200 Latin chars, or > ~1200 CJK chars), passing client validation but getting bounced server-side into a generic toast. Issue #2091 [101] names only the illegal-char rule + identical CRLF normalization (delivered), so this is not blocking — but a third.refineimportingestimateTokens/CUSTOM_INSTRUCTIONS_MAX_TOKENSwould complete the inline-feedback goal. (The raw-length character counter also displays un-normalized length — cosmetic.) -
[108] uniqueness check is best-effort (TOCTOU). The dup-check is a
runQueryin the Node action followed by a separaterunMutationinsert/patch; Convex has no unique-index constraint, so two concurrent same-name creates could both pass and both insert. Extremely unlikely for admin-only settings (double-click / two admins), and worst case is a duplicate row, not a crash. Consider moving the check into the transactional internalinsert/updatemutation in a follow-up to make it atomic. -
[108] pre-existing org-membership gap (not introduced by this PR).
create/update/remove/updateStatusverify authentication (getAuthUserIdentity) but not org membership;createtrusts the client-providedorganizationId. Verified this is unchanged frommain(no membership line was added or removed here) and it cannot be fixed within these Node actions (noctx.db). Worth a separate authorization-hardening task (add a membership check inside the internal mutations); out of scope for this PR. -
[102] minor polish. (a) The now-redundant silent guard
if (next.size <= 1) return prev;inteam-edit-dialog.tsx:90is unreachable via the UI (checkbox disabled) — either drop it or comment it as a defensive backstop. (b) The standalone hint renders wheneversize <= 1, so in the degenerate case of 0 selected (transient during load, or a sole member who left the org and no longer renders a row) the hint can show with nothing disabled. (c) The disabled-reason is conveyed only viatitle(notaria-describedby), and the axe test doesn't cover theenforceMinimumOnebranch. -
[105] behavioral nuance. A hand-crafted
?section=appsURL (which nothing produces) now hits the router's error boundary instead of silently rendering, becausevalidateSearchthrows on invalid search repo-wide. Unreachable in practice;z.literal('mcp-servers').optional().catch(undefined)would make stray values degrade silently if desired. -
Test nice-to-haves (none merge-blocking). No client test for the [101] Zod refines (the security-relevant backend rule is well-covered in
user_preferences/mutations.test.ts, so it can't silently regress); no test forupdatewithname === undefined(skip-guard); no direct test forgetIdByOrgAndName.
READY TO MERGE
- personalization [101]: client Zod schema mirrors the backend illegal-char
+ length rule (CRLF/lone-CR normalized to LF identically), surfaced inline
on the textarea via new personalization.errors.{tooLong,illegalChars} keys.
- teams [102]: disable + hint the sole-member checkbox instead of silently
refusing to uncheck it; gated to the edit flow so create is unaffected.
- integrations [104]: real isSubmitting drives the Disconnect loading state
and keeps the ConfirmDialog open until the action resolves.
- integrations route [105]: drop the dead ?section=apps search param.
- mcp servers [108]: shared name slug validation (MCP_SERVER_NAME_RE) +
per-org uniqueness on create/update; drop the name.length>1 client
carve-out; removed the now-orphaned mcpServers.form.validation.nameFormat
i18n key (superseded by nameInvalid).
Closes #2091
6f4a710 to
2fb7377
Compare
Resolves #2091. Addresses each itemized low-severity settings gap.
[101] Custom-instructions illegal-char parity
personalization-settings.tsxnow mirrors the backend rule (convex/user_preferences/mutations.ts): the client Zod schema canonicalizes CRLF/lone-CR → LF and rejects the same illegal characters + length cap, with the violation surfaced inline on the textarea (new i18n keyspersonalization.errors.tooLong/illegalChars). ReusesCUSTOM_INSTRUCTIONS_ILLEGAL_RE/CUSTOM_INSTRUCTIONS_MAX_CHARSfrom the shared constants (removed the duplicated local constant).[102] Team-edit last-member silent refusal
team-member-checklist.tsxnow disables the sole remaining member's checkbox and shows an explanatory hint (teams.lastMemberHint) instead of silently ignoring the click.[104] Integration Disconnect loading state
use-integration-manage.tsexposes a realisSubmittingstate that the disconnect flow drives;integration-panel.tsxkeeps the ConfirmDialog open (showing its loading state) until the disconnect resolves.[105] Dead
?section=appsparamintegrations.tsxsearch schema now accepts onlymcp-servers(the only value actually handled inbeforeLoad);appswas never read.[108] MCP server name slug + server-side validation
New shared
convex/mcp_servers/constants.ts(MCP_SERVER_NAME_RE,validateMcpServerName). The client form drops thename.length > 1carve-out (so single-char uppercase no longer slips through) and the create/update actions validate the slug and enforce per-org name uniqueness (newgetIdByOrgAndNameinternal query); the create error surfaces in the toast.Verification
bunx tsc --noEmit— cleanbunx oxlint(plain) on touched files — clean;oxfmt --check— cleanvitestserver:mcp_servers/constants.test.ts(new),public_mutations.test.ts,lib/i18n/messages.test.ts— passvitestui:mcp-server-form.test.tsx— pass