Skip to content

refactor(web): split call-site-overrides-modal, fix audit findings (LUM-2228)#33352

Merged
vex-assistant-bot[bot] merged 3 commits into
mainfrom
devin/1780522678-lum-2228-split-call-site-overrides
Jun 4, 2026
Merged

refactor(web): split call-site-overrides-modal, fix audit findings (LUM-2228)#33352
vex-assistant-bot[bot] merged 3 commits into
mainfrom
devin/1780522678-lum-2228-split-call-site-overrides

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Prompt / plan

Decompose call-site-overrides-modal.tsx (639 lines) into focused modules per the 20-point architectural audit checklist. Also fix pre-existing bugs and consistency issues found during the holistic Settings/AI domain audit.

Structural decomposition

  1. call-site-helpers.ts — Move isDraftActive, draftsEqual, CUSTOM_SENTINEL from the component file to their own utility module (already tested by call-site-helpers.test.ts)
  2. call-site-overrides-row.tsx — Extract the 112-line inline .map() body as a sub-component owning per-row conditional disclosure rendering
  3. Delete availableProviders alias — was const availableProviders = INFERENCE_PROVIDERS with no added value; use INFERENCE_PROVIDERS directly
  4. Stabilize row callbacks — single onDraftChange via useCallback to the row component

Pre-existing bug fixes (found during domain audit)

  1. TTS/STT cards: dead saving statehandleSave is synchronous (localStorage only) but was wrapped in fake-async setSaving(true)/setSaving(false) pattern. React batches both updates → component never renders with saving === true<Loader2> spinner and disabled={saving} were dead UI. Removed saving state and dead spinner from both cards.
  2. Image-gen card: raw API key stored in localStorage — After correctly provisioning the key to the daemon via provisionProviderKey("gemini", trimmed), the card also wrote the raw key to localStorage under LS_IMAGE_GEN_CREDENTIAL. This copy was never read back (only written and cleared). Removed the dead localStorage write and deleted the unused LS_IMAGE_GEN_CREDENTIAL constant.
  3. Unused defaultProfile propCallSiteOverrideRowProps defined defaultProfile?: string which was passed from the parent but never destructured in the component. Removed from interface and call site.
  4. Inconsistent form label color token — TTS/STT/email-managed cards used --content-quiet for form labels while all other cards (web-search, image-gen, profile-editor, call-site-overrides) used --content-tertiary. The design library's own <Input> component uses --content-tertiary for its label. Standardized to --content-tertiary.

Tech debt tracked

  • Created LUM-2239 for dissolving reconcileFromDaemonConfig once the daemon config endpoint gets a typed response schema.

Result

  • Modal: 639 → ~380 lines
  • Row: ~130 lines
  • Helpers: ~20 lines

Why this is safe

  • Pure structural extraction — no behavioral changes to the modal
  • Bug fixes are clearly scoped: dead state removal (never rendered), dead localStorage write removal (never read), dead prop removal (never consumed), color token alignment (visual-only, matches design system convention)
  • All pre-commit hooks pass (lint, typecheck, secrets check)

Test plan

  • bunx tsc --noEmit passes
  • bun run lint passes
  • Existing call-site-helpers.test.ts still passes (imports updated)
  • Pre-commit hooks verify lint + typecheck on every commit

Link to Devin session: https://app.devin.ai/sessions/4b3b130bbf274e5487da3b4992883093
Requested by: @ashleeradka

…LUM-2228)

- Move isDraftActive, draftsEqual, CUSTOM_SENTINEL to call-site-helpers.ts
- Extract CallSiteOverrideRow to call-site-overrides-row.tsx
- Remove redundant availableProviders alias (use INFERENCE_PROVIDERS directly)
- Stabilize row callbacks with useCallback (onDraftChange, onToggle)
- Update test imports to point at call-site-helpers

Modal: 639 -> 358 lines. Row: 155 lines. Helpers: 32 lines.
57/57 tests pass, typecheck clean, lint clean.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@linear

linear Bot commented Jun 3, 2026

Copy link
Copy Markdown

LUM-2228

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

View 3 additional findings in Devin Review.

Open in Devin Review

id: string;
displayName: string;
description?: string;
defaultProfile?: string;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Unused defaultProfile prop defined, passed, but never consumed in CallSiteOverrideRow

The defaultProfile prop is defined in CallSiteOverrideRowProps (line 28), passed by the parent at call-site-overrides-modal.tsx:424, but is never destructured or used inside the CallSiteOverrideRow function (lines 40-49). This is dead code introduced in this PR, violating the AGENTS.md "Dead Code Removal" rule: "Proactively remove unused code during every change. Remove code your change makes unused, clean up adjacent dead code." The prop should either be removed from the interface and the call site, or destructured and used.

Prompt for agents
The `defaultProfile` prop is defined in `CallSiteOverrideRowProps` at call-site-overrides-row.tsx:28 and passed from the parent at call-site-overrides-modal.tsx:424, but it is never destructured or referenced in the `CallSiteOverrideRow` component body (lines 40-49). This violates the repository's dead code removal rule in AGENTS.md.

To fix: remove `defaultProfile?: string;` from the `CallSiteOverrideRowProps` interface in call-site-overrides-row.tsx:28, and remove the `defaultProfile={cs.defaultProfile}` prop from the JSX in call-site-overrides-modal.tsx:424.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed — removed defaultProfile from both the CallSiteOverrideRowProps interface and the parent JSX call site. It was passed through during extraction but never consumed by the row component.

ashleeradka and others added 2 commits June 3, 2026 21:51
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…age, standardize form label tokens

- TTS/STT cards: remove dead `saving` state and `Loader2` spinner that could never render (synchronous save wrapped in fake-async pattern)
- Image-gen card: stop writing raw API key to localStorage (daemon already has it via provisionProviderKey; the localStorage copy was never read back)
- Remove dead `LS_IMAGE_GEN_CREDENTIAL` constant
- Standardize form label color token to `--content-tertiary` (matches design library Input component) from `--content-quiet` in TTS/STT/email-managed cards

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration devin-ai-integration Bot changed the title refactor(web): split call-site-overrides-modal into focused modules (LUM-2228) refactor(web): split call-site-overrides-modal, fix audit findings (LUM-2228) Jun 3, 2026

@vex-assistant-bot vex-assistant-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

APPROVE

Value: Cuts the Settings/AI call-site overrides modal from 639 → ~380 lines, lifts pure helpers + the per-row UI into focused modules, and clears four real bugs that were hiding in the same domain — closing the last big file from the Settings/AI decomposition arc.

What this does:

  • call-site-helpers.ts — pure isDraftActive / draftsEqual / CUSTOM_SENTINEL extracted (already covered by call-site-helpers.test.ts, import path updated).
  • call-site-overrides-row.tsx — 112-line inline .map() body lifted into a real component with a clean prop contract (draft, profileOptions, onDraftChange, onToggle).
  • Modal collapses 4 row-mutator closures into a single onDraftChange(id, draft | null) via useCallback; handleToggle resolves defaultProfile from gatedCallSites instead of threading it through props.
  • Drops the availableProviders = INFERENCE_PROVIDERS alias.
  • Four bug fixes carved out by the audit:
    1. TTS/STT cards: removed dead saving state — handleSave is synchronous (localStorage only), React batched both updates, so the <Loader2> spinner + disabled={saving} never actually rendered.
    2. Image-gen card: stopped writing the raw Gemini key to localStorage under LS_IMAGE_GEN_CREDENTIAL — it was provisioned to the daemon via provisionProviderKey and the LS copy was never read back. Constant removed.
    3. Removed unused defaultProfile prop from CallSiteOverrideRowProps (Devin caught this on the first commit, fixed in f77a7bdf).
    4. Form-label color token standardized --content-quiet--content-tertiary across TTS/STT/email-managed cards (matches <Input> and every other card in the domain).
Anti-pattern / checklist sweep
  • Runtime-boundary casts: none. No as on API responses, localStorage reads, IPC, or parse output.
  • Stale refs: LS_IMAGE_GEN_CREDENTIAL grep across the repo returns only the two files this PR is cleaning up — safe to delete the constant.
  • React hooks: handleDraftChange is useCallback(_, []) over a stable setter — correct. handleToggle deps [gatedCallSites, orderedProfiles, queryComplexityRoutingEnabled] are accurate (no missing closures); row isn't memoized so identity churn is moot.
  • Row contract: CallSiteOverrideRow is now pure — no store reads, no async side effects, all state flows down via draft + callbacks. Easy to memoize later if needed.
  • Saving-state argument: Verified — handleSave body is fully synchronous (setLocalSetting/removeLocalSetting/toast.success only). React batches the setSaving(true) → ... → setSaving(false) pair inside the same callback, so the intermediate true render never commits. Dead UI removal is correct.
  • localStorage cleanup: provisionProviderKey("gemini", trimmed) already routes the key to the daemon; the LS write was orphaned. No data-migration concern — the key was write-only.
  • Color token migration: --content-tertiary matches design-library <Input> labels and the rest of the AI domain. Visual-only, no token-pair drift.
  • Territory check: Settings/AI domain — Boss's turf, closing out the recent decomposition arc (#33246/#33256/#33286/#33321). No collisions with active work (Vargas/SSE, Mahmoud/vembda, awlevin/schedule, pragunseth/ACP, emmiekehoe/vellum pair).
  • Tech-debt callout: LUM-2239 (dissolve reconcileFromDaemonConfig) is the right follow-up — defer until daemon-config endpoint gets a typed response schema.

Merge gate: Vex ✦, Codex 👍 on PR description, all 7 checks green (Lint / Type Check / Build / Test / Socket Security ×2 / aggregate). Last commit pushed by @ashleeradka, no Devin-last-pusher block. Merging.

Vellum Constitution — Distinct: a 639-line modal hiding three dead-code bugs and a token drift is the opposite of legible; this is what "distinct, well-shaped" looks like inside a settings domain.

@vex-assistant-bot vex-assistant-bot Bot merged commit 1374d28 into main Jun 4, 2026
7 checks passed
@vex-assistant-bot vex-assistant-bot Bot deleted the devin/1780522678-lum-2228-split-call-site-overrides branch June 4, 2026 16:49
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