Skip to content

fix(frontend): surface AI provider-required state and field-level validation errors (#177, #180) - #213

Merged
parthrohit22 merged 1 commit into
Second-Origin:devfrom
parthrohit22:fix/177-180-frontend-honesty
Jul 27, 2026
Merged

fix(frontend): surface AI provider-required state and field-level validation errors (#177, #180)#213
parthrohit22 merged 1 commit into
Second-Origin:devfrom
parthrohit22:fix/177-180-frontend-honesty

Conversation

@parthrohit22

Copy link
Copy Markdown
Collaborator

Summary

Two frontend honesty/UX fixes in the AI Workspace surface: (1) when no AI provider is configured, the page now shows a prominent notice linking to Settings instead of only a weak footer hint, so the Preview surface is not misleading about being inert (#177); (2) validation errors from the API are no longer collapsed into a generic "Request validation failed" string — field-level details from 422 responses are surfaced to the user (#180).

Linked issue

Related to #177 (AI Workspace inert state) and #180 (validation error collapse). Closes #177 and #180.

Roadmap alignment

  • Roadmap §23 workstream this advances: W0 (Truth contract / honesty) + W4 (Product design / UX).
  • §28 market-fit criterion this moves toward: "Trusted output" — product surfaces must state their actual state and never imply capability they lack (no misleading inert surfaces).
  • Accepted evidence it is real: frontend lint clean, 176/176 vitest pass, build:frontend succeeds; the error box now renders getErrorDetail(...).details when present.

What changed

  • apps/frontend/src/shared/services/api/errors.ts: getErrorMessage and new getErrorDetail extract field-level details from 422 bodies (FastAPI loc/msg shape) and append them instead of collapsing.
  • apps/frontend/src/shared/services/api/index.ts: export getErrorDetail.
  • apps/frontend/src/features/ai/hooks/useAIWorkspace.ts: fetch /ai/config on mount to expose providerConfigured.
  • apps/frontend/src/app/pages/AIWorkspacePage.tsx: prominent amber "No AI provider configured → Settings" notice; error box renders structured field errors.
  • apps/frontend/src/features/ai/hooks/useAIWorkspace.test.tsx: mock getConfig for the new mount effect.

Acceptance criteria completed

  • Inert-without-provider state is explicitly shown (not just a footer hint).
  • Validation (422) errors show field-level detail, not a generic collapse.
  • Lint, vitest (176 passed), and frontend build all pass.
  • No fabricated/interactive-without-backing behaviour introduced.

Testing performed

npm run lint:frontend            # clean
npm --prefix apps/frontend run test   # 176 passed (33 files)
npm run build:frontend           # built in ~480ms

Screenshots

Not applicable (logic/state change; no new visual assets). The provider-required notice reuses existing PreviewBanner-compatible styling.

Security and data considerations

None (client-side error presentation only; no secrets, no new API surface).

Dependencies and blocked work

None.

Scope changes or remaining work

#177's literal "reads legacy context" claim was already corrected in prior UI copy (it states sealed-snapshot structural facts). This PR adds the missing explicit provider-required state. No scope added beyond #177/#180.

Contributor checklist

  • This PR targets dev
  • The branch was created from an up-to-date upstream/dev
  • This PR addresses one clearly scoped issue
  • This PR advances a §23 workstream toward a §28 market-fit criterion (Roadmap alignment filled)
  • Every acceptance criterion I claim as complete is actually complete
  • Relevant tests pass
  • Documentation is updated for any user-visible change
  • No secrets, credentials, local env files, or generated artifacts are included
  • No unrelated files were changed
  • Closing syntax (Closes) is used only because the issue is fully resolved
  • Dependencies and follow-up work are linked

…idation errors

- AIWorkspacePage now shows a prominent 'No AI provider configured'
  notice (links to Settings) instead of only a weak footer hint, so the
  surface is not misleading when it cannot run (issue Second-Origin#177).
- errors.ts getErrorMessage/getErrorDetail now surface field-level
  validation details from 422 bodies instead of collapsing to the generic
  'Request validation failed' message (issue Second-Origin#180).
- useAIWorkspace fetches /ai/config to expose providerConfigured; the
  workspace error box renders structured field errors.
- Test + lint green; build passes.

Note: Second-Origin#177's literal 'reads legacy context' claim was already corrected in
the UI copy (it now states sealed-snapshot structural facts); this PR adds
the missing explicit provider-required state.
@parthrohit22
parthrohit22 force-pushed the fix/177-180-frontend-honesty branch from 4b9343d to dc9fce9 Compare July 27, 2026 12:40
@parthrohit22
parthrohit22 merged commit 0a3f6c4 into Second-Origin:dev Jul 27, 2026
8 checks passed
@parthrohit22
parthrohit22 deleted the fix/177-180-frontend-honesty branch July 27, 2026 16:12
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.

bug: AI Workspace is inert without a provider and admits it reads legacy context, contradicting the sealed-snapshot model

1 participant