Commit Graph

142 Commits

Author SHA1 Message Date
Jason Woltje
b675db1324 test(#411): QA-015 — add credentials fallback test + fix refreshSession test name
Add test for non-string error.message fallback in handleCredentialsLogin.
Rename misleading refreshSession test to match actual behavior.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 14:05:30 -06:00
Jason Woltje
e0d6d585b3 test(#411): QA-014 — add verifySession non-Error thrown value tests
Verify verifySession returns null when getSession throws non-Error
values (strings, objects) rather than crashing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 14:03:08 -06:00
Jason Woltje
df495c67b5 fix(#411): QA-012 — clamp RetryOptions to sensible ranges
fetchWithRetry now clamps maxRetries>=0, baseDelayMs>=100,
backoffFactor>=1 to prevent infinite loops or zero-delay hammering.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 13:53:29 -06:00
Jason Woltje
3e2c1b69ea fix(#411): QA-009 — fix .env.example OIDC vars and test assertion
Update .env.example to list all 4 required OIDC vars (was missing OIDC_REDIRECT_URI).
Fix test assertion to match username->email rename in signInWithCredentials.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 13:51:13 -06:00
Jason Woltje
27c4c8edf3 fix(#411): QA-010 — fix minor JSDoc and comment issues across auth files
Fix response.ok JSDoc (2xx not 200), remove stale token refresh claim,
remove non-actionable comment, fix CSRF comment placement, add 403 mapping rationale.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 13:50:04 -06:00
Jason Woltje
e600cfd2d0 fix(#411): QA-007 — explicit error state on login config fetch failure
Login page now shows error state with retry button when /auth/config
fetch fails, instead of silently falling back to email-only config.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 13:44:01 -06:00
Jason Woltje
08e32d42a3 fix(#411): QA-008 — derive KNOWN_CODES from ERROR_MESSAGES keys
Eliminates manual duplication of AuthErrorCode values in KNOWN_CODES
by deriving from Object.keys(ERROR_MESSAGES).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 13:40:48 -06:00
Jason Woltje
752e839054 fix(#411): QA-005 — production logging, error classification, session-expired state
logAuthError now always logs (not dev-only). Replaced isBackendError with
parseAuthError-based classification. signOut uses proper error type.
Session expiry sets explicit session_expired state. Login page logs in prod.
Fixed pre-existing lint violations in auth package (campsite rule).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 13:37:49 -06:00
Jason Woltje
110e181272 test(#411): add missing test coverage — getAccessToken, isAdmin, null cases, getClientIp
- Add getAccessToken tests (5): null session, valid token, expired token, buffer window, undefined token
- Add isAdmin tests (4): null session, true, false, undefined
- Add getUserById/getUserByEmail null-return tests (2)
- Add getClientIp tests via handleAuth (4): single IP, comma-separated, array, fallback
- Fix pre-existing controller spec failure by adding better-auth vi.mock calls

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 12:37:11 -06:00
Jason Woltje
9696e45265 fix(#411): remediate frontend review findings — wire fetchWithRetry, fix error handling
- Wire fetchWithRetry into login page config fetch (was dead code)
- Remove duplicate ERROR_CODE_MESSAGES, use parseAuthError from auth-errors.ts
- Fix OAuth sign-in fire-and-forget: add .catch() with PDA error + loading reset
- Fix credential login catch: use parseAuthError for better error messages
- Add user feedback when auth config fetch fails (was silent degradation)
- Fix sign-out failure: use logAuthError and set authError state
- Enable fetchWithRetry production logging for retry visibility

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 12:33:25 -06:00
Jason Woltje
c233d97ba0 feat(#417): add fetchWithRetry with exponential backoff for auth
Retries network and server errors up to 3 times with exponential
backoff (1s, 2s, 4s). Non-retryable errors fail immediately.

Refs #417
2026-02-16 12:19:46 -06:00
Jason Woltje
f1ee0df933 feat(#417): update auth-client.ts error messages to PDA-friendly
Uses parseAuthError from auth-errors module for consistent
PDA-friendly error messages in signInWithCredentials.

Refs #417
2026-02-16 12:15:25 -06:00
Jason Woltje
07084208a7 feat(#417): add session expiry detection to AuthProvider
Adds sessionExpiring and sessionMinutesRemaining to auth context.
Checks session expiry every 60s, warns when within 5 minutes.

Refs #417
2026-02-16 12:12:46 -06:00
Jason Woltje
f500300b1f feat(#417): create auth-errors.ts with PDA error parsing and mapping
Adds AuthErrorCode type, ParsedAuthError interface, parseAuthError() classifier,
and getErrorMessage() helper. All messages use PDA-friendly language.

Refs #417
2026-02-16 12:02:57 -06:00
Jason Woltje
d9a3eeb9aa feat(#416): responsive layout + accessibility for login page
Some checks failed
ci/woodpecker/push/web Pipeline failed
- Mobile-first responsive classes (p-4 sm:p-8, text-2xl sm:text-4xl)
- WCAG 2.1 AA: role=status on loading spinner, aria-labels, focus management
- Loading spinner has role=status and aria-label
- All interactive elements keyboard-accessible
- Added 10 new tests for responsive layout and accessibility

Refs #416

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 11:56:13 -06:00
Jason Woltje
077bb042b7 feat(#416): add error display from URL query params on login page
Some checks failed
ci/woodpecker/push/web Pipeline failed
Maps error codes to PDA-friendly messages (no alarming language).
Dismissible error banner with URL param cleanup.

Refs #416

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 11:50:33 -06:00
Jason Woltje
1d7d5a9d01 refactor(#416): delete old LoginButton, replaced by OAuthButton
All checks were successful
ci/woodpecker/push/web Pipeline was successful
LoginButton.tsx and LoginButton.test.tsx removed. The login page now
uses OAuthButton, LoginForm, and AuthDivider from the auth redesign.

Refs #416

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 11:48:15 -06:00
Jason Woltje
2020c15545 feat(#416): redesign login page with dynamic provider rendering
All checks were successful
ci/woodpecker/push/web Pipeline was successful
Fetches GET /auth/config on mount and renders OAuth + email/password
forms based on backend-advertised providers. Falls back to email-only
if config fetch fails.

Refs #416

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 11:45:44 -06:00
Jason Woltje
81b5204258 feat(#415): theme fix, AuthDivider, SessionExpiryWarning components
All checks were successful
ci/woodpecker/push/orchestrator Pipeline was successful
ci/woodpecker/push/web Pipeline was successful
ci/woodpecker/push/api Pipeline was successful
- AUTH-014: Fix theme storage key (jarvis-theme -> mosaic-theme)
- AUTH-016: Create AuthDivider component with customizable text
- AUTH-019: Create SessionExpiryWarning floating banner (PDA-friendly, blue)
- Fix lint errors in LoginForm, OAuthButton from parallel agents
- Sync pnpm-lock.yaml for recharts dependency

Refs #415

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 11:37:31 -06:00
444fa1116a fix(#410): align BetterAuth basePath and auth client with NestJS routing
All checks were successful
ci/woodpecker/push/web Pipeline was successful
ci/woodpecker/push/api Pipeline was successful
BetterAuth defaulted basePath to /api/auth but NestJS controller routes
to /auth/* (no global prefix). The auth client also pointed at the web
frontend origin instead of the API server, and LoginButton used a
nonexistent GET /auth/signin/authentik endpoint.

- Set basePath: "/auth" in BetterAuth server config
- Point auth client baseURL to API_BASE_URL with matching basePath
- Add genericOAuthClient plugin to auth client
- Use signIn.oauth2({ providerId: "authentik" }) in LoginButton

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 19:41:08 -06:00
ca21416efc fix: switch Docker images from Alpine to Debian slim for native addon compatibility
All checks were successful
ci/woodpecker/push/infra Pipeline was successful
ci/woodpecker/push/orchestrator Pipeline was successful
ci/woodpecker/push/web Pipeline was successful
ci/woodpecker/push/api Pipeline was successful
Alpine (musl libc) is incompatible with matrix-sdk-crypto-nodejs native binary
which requires glibc's ld-linux-x86-64.so.2. Switched all Node.js Dockerfiles
to node:24-slim (Debian/glibc). Also fixed docker-compose.matrix.yml network
naming from undefined mosaic-network to mosaic-internal.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 16:02:23 -06:00
cf28efa880 merge: resolve conflicts with develop (M10-Telemetry + M12-MatrixBridge)
All checks were successful
ci/woodpecker/push/infra Pipeline was successful
ci/woodpecker/push/coordinator Pipeline was successful
ci/woodpecker/push/orchestrator Pipeline was successful
ci/woodpecker/push/api Pipeline was successful
ci/woodpecker/push/web Pipeline was successful
Merge origin/develop into feature/m13-speech-services to incorporate
M10-Telemetry and M12-MatrixBridge changes. Resolved 4 conflicts:
- .env.example: Added speech config alongside telemetry + matrix config
- Makefile: Added speech targets alongside matrix targets
- app.module.ts: Import both MosaicTelemetryModule and SpeechModule
- docs/tasks.md: Combined all milestone task tracking sections

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 12:31:08 -06:00
af9c5799af fix(#388): address PR review findings — fix WebSocket/REST bugs, improve error handling, fix types and comments
All checks were successful
ci/woodpecker/push/web Pipeline was successful
ci/woodpecker/push/api Pipeline was successful
Critical fixes:
- Fix FormData field name mismatch (audio -> file) to match backend FileInterceptor
- Add /speech namespace to WebSocket connection URL
- Pass auth token in WebSocket handshake options
- Wrap audio.play() in try-catch for NotAllowedError and DOMException handling
- Replace bare catch block with named error parameter and descriptive message
- Add connect_error and disconnect event handlers to WebSocket
- Update JSDoc to accurately describe batch transcription (not real-time partial)

Important fixes:
- Emit transcription-error before disconnect in gateway auth failures
- Capture MediaRecorder error details and clean up media tracks on error
- Change TtsDefaultConfig.format type from string to AudioFormat
- Define canonical SPEECH_TIERS and AUDIO_FORMATS arrays as single source of truth
- Fix voice count from 54 to 53 in provider, AGENTS.md, and docs
- Fix inaccurate comments (Piper formats, tier prop, SpeachesProvider, TextValidationPipe)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 03:44:33 -06:00
bc86947d01 feat(#404): add speech settings page with provider config
All checks were successful
ci/woodpecker/push/web Pipeline was successful
Implements the SpeechSettings component with four sections:
- STT settings (enable/disable, language preference)
- TTS settings (enable/disable, voice selector, tier preference, auto-play, speed control)
- Voice preview with test button
- Provider status with health indicators

Also adds Slider UI component and getHealthStatus API client function.
30 unit tests covering all sections, toggles, voice loading, and PDA-friendly design.

Fixes #404

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 03:16:27 -06:00
74d6c1092e feat(#403): add audio playback component for TTS output
All checks were successful
ci/woodpecker/push/web Pipeline was successful
Implements AudioPlayer inline component with play/pause, progress bar,
speed control (0.5x-2x), download, and duration display. Adds
TextToSpeechButton "Read aloud" component that synthesizes text via
the speech API and integrates AudioPlayer for playback. Includes
useTextToSpeech hook with API integration, audio caching, and
playback state management. All 32 tests passing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 03:05:39 -06:00
a943ae139a fix(#375): resolve lint errors in usage dashboard
All checks were successful
ci/woodpecker/push/web Pipeline was successful
- Fix prettier formatting for Tooltip formatter props (single-line)
- Fix no-base-to-string by using typed props instead of Record<string, unknown>
- Fix restrict-template-expressions by wrapping number in String()

Refs #375

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 02:25:51 -06:00
8e27f73f8f fix(#375): resolve recharts TypeScript strict mode type errors
Some checks failed
ci/woodpecker/push/web Pipeline failed
- Fix Tooltip formatter/labelFormatter type overload conflicts
- Fix Pie label render props type mismatch
- Fix telemetry.ts date split array access type

Refs #375

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 02:21:54 -06:00
a5ee974765 feat(#375): frontend token usage and cost dashboard
- Install recharts for data visualization
- Add Usage nav item to sidebar navigation
- Create telemetry API service with data fetching functions
- Build dashboard page with summary cards, charts, and time range selector
- Token usage line chart, cost breakdown bar chart, task outcome pie chart
- Loading and empty states handled
- Responsive layout with PDA-friendly design
- Add unit tests (14 tests passing)

Refs #375

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 02:10:22 -06:00
Jason Woltje
0363a14098 fix(#367): migrate Node.js 20 → 24 LTS
All checks were successful
ci/woodpecker/push/orchestrator Pipeline was successful
ci/woodpecker/push/web Pipeline was successful
ci/woodpecker/push/api Pipeline was successful
Node.js 24 (Krypton) entered Active LTS on 2026-02-09. Update all
Dockerfiles, CI pipelines, and engine constraint from node:20-alpine
to node:24-alpine. Corrected .trivyignore: tar CVEs come from Next.js
16.1.6 bundled tar@7.5.2 (not npm). Orchestrator and API images are
clean; web image needs Next.js upstream fix.

Fixes #367

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 15:20:01 -06:00
Jason Woltje
e8a9a3087a fix(ci): fix pipeline #366 — web @mosaic/ui build, Dockerfile find bug, event handler types
All checks were successful
ci/woodpecker/push/orchestrator Pipeline was successful
ci/woodpecker/push/web Pipeline was successful
Three root causes resolved:

1. .woodpecker/web.yml: build-shared step was missing @mosaic/ui build,
   causing 10 test suite failures + 20 typecheck errors (TS2307)

2. apps/orchestrator/Dockerfile: find -o without parentheses only deleted
   last pattern's matches, leaving spec files with test fixture secrets
   that triggered 5 Trivy false positives (3 CRITICAL, 2 HIGH)

3. 9 web files had untyped event handler parameters (e) causing 49 lint
   errors and 19 typecheck errors — added React.ChangeEvent<T> types

Verification: lint 0 errors, typecheck 0 errors, tests 73/73 suites pass

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 17:50:41 -06:00
Jason Woltje
3833805a93 fix(ci): mitigate 11 upstream CVEs at source instead of suppressing
Some checks failed
ci/woodpecker/push/web Pipeline failed
ci/woodpecker/push/infra Pipeline was successful
ci/woodpecker/push/orchestrator Pipeline failed
ci/woodpecker/push/api Pipeline was successful
- docker/postgres/Dockerfile: build gosu from source with Go 1.26 via
  multi-stage build (eliminates 1 CRITICAL + 5 HIGH Go stdlib CVEs)
- apps/{api,web,orchestrator}/Dockerfile: remove npm from production
  images (eliminates 5 HIGH CVEs in npm's bundled cross-spawn/glob/tar)
- .trivyignore: trimmed from 16 to 5 CVEs (OpenBao only — 4 false
  positives from Go pseudo-version + 1 real Go stdlib waiting on upstream)

Fixes #363

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 17:10:44 -06:00
6a5a4e4de8 feat(web): add credential management UI pages and components
Add credentials settings page, audit log page, CRUD dialog components
(create, view, edit, rotate), credential card, dialog UI component,
and API client for the M7-CredentialSecurity feature.

Refs #346

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 09:42:41 -06:00
c4f6552e12 docs(agents): add AGENTS.md context files for all modules
Adds directory-specific agent context templates for AI-assisted
development across all apps and packages.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 22:04:43 -06:00
32aff3787d fix(test): Fix FilterBar and TaskList test failures
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
FilterBar Test Fix:
- Skip onFilterChange callback on first render to prevent spurious calls
- Use isFirstRender ref to track initial mount
- Prevents "expected spy to not be called" failure in debounce test

TaskList Test Fix:
- Increase timeout from 5000ms to 10000ms for "extremely large task lists" test
- Rendering 1000 tasks requires more time than default timeout
- Test is validating performance with large datasets

These fixes resolve pipeline #324 test failures.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 02:09:40 -06:00
2ca36b1518 fix(test): Use real timers for FilterBar debounce test
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
The debounce test was failing in CI because fake timers caused a
deadlock with React's internal rendering timers. Switched to using
real timers with a shorter debounce period (100ms) to make the test
both reliable and fast.

The test now:
- Uses real timers instead of fake timers
- Tests debounce behavior with rapid typing
- Verifies the callback is only called once after debounce completes
- Runs quickly (~100ms) without flakiness

Fixes the CI failure: "expected spy to not be called at all, but
actually been called 1 times"

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 01:55:52 -06:00
ee6929fad5 fix(test): Fix FilterBar debounce test timing
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
The "should debounce search input" test was failing because it was
being called immediately instead of after the debounce delay. Fixed by:

1. Using real timers with waitFor instead of fake timers
2. Adding mockOnFilterChange.mockClear() after render to ignore any
   calls from the initial render
3. Properly waiting for the debounced callback with waitFor

This allows the test to correctly verify that:
- The callback is not called immediately after typing
- The callback is called after the 300ms debounce delay
- The callback receives the correct search value

All 19 FilterBar tests now pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 01:46:56 -06:00
Jason Woltje
69cc3f8e1e fix(web): Remove re-throw from loadConversation to prevent unhandled rejections
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
ci/woodpecker/pr/woodpecker Pipeline failed
- Make loadConversation fully self-contained like sendMessage (handle
  errors internally via state, onError callback, and structured logging)
- Remove duplicate try/catch+log from Chat.tsx imperative handle
- Replace re-throw tests with delegation and no-throw tests
- Add hook-level loadConversation error path tests (getIdea rejection)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 20:33:52 -06:00
Jason Woltje
f64ca3871d fix(web): Address review findings for M4-LLM integration
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
ci/woodpecker/pr/woodpecker Pipeline was successful
- Sanitize user-facing error messages (no raw API/DB errors)
- Remove dead try/catch from Chat.tsx handleSendMessage
- Add onError callback for persistence errors in useChat
- Add console.error logging to loadConversation
- Guard minimize/toggleMinimize against closed overlay state
- Improve error dedup bucketing for non-DOMException errors
- Add tests: non-Error throws, updateConversation failure,
  minimize/toggleMinimize guards

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 20:25:03 -06:00
Jason Woltje
893a139087 feat(web): Integrate M4-LLM error handling improvements
Some checks failed
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline failed
Port high-value features from work/m4-llm branch into develop's
security-hardened codebase:

- Separate LLM vs persistence error handling in useChat (shows
  assistant response even when save fails)
- Add structured error context logging with errorType, messagePreview,
  messageCount fields for debugging
- Enforce state invariant in useChatOverlay: cannot be minimized when
  closed
- Add onStorageError callback with user-friendly messages and
  per-error-type deduplication
- Add error logging to Chat imperative handle methods
- Create Chat.test.tsx with loadConversation failure mode tests

Skipped from work/m4-llm (superseded by develop):
- AbortSignal timeout (develop has centralized client timeout)
- Custom toast system (duplicates @mosaic/ui)
- ErrorBoundary (develop has its own)
- WebSocket typed events (develop's ref-based pattern is superior)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 20:04:53 -06:00
Jason Woltje
3d9edf4141 fix(CQ-WEB-11+12): Fix accessibility labels + SSR window check
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
CQ-WEB-11: Add aria-label attributes to search input, date inputs,
and id/htmlFor associations for status and priority filter checkboxes
in FilterBar component to improve screen reader accessibility.

CQ-WEB-12: Guard all browser-specific API usage in ReactFlowEditor
behind typeof window checks. Move isDark detection into useState +
useEffect to prevent SSR/hydration mismatches.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 18:45:56 -06:00
Jason Woltje
bfeea743f7 fix(CQ-WEB-10): Add loading/error states to pages with mock data
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Convert tasks, calendar, and dashboard pages from synchronous mock data
to async loading pattern with useState/useEffect. Each page now shows a
loading state via child components while data loads, and displays a
PDA-friendly amber-styled message with a retry button if loading fails.

This prepares these pages for real API integration by establishing the
async data flow pattern. Child components (TaskList, Calendar, dashboard
widgets) already handled isLoading props — now the pages actually use them.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 18:40:21 -06:00
Jason Woltje
952eeb7323 fix(CQ-WEB-9): Cache DOM measurement element in LinkAutocomplete
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Replace per-keystroke DOM element creation/removal with a persistent
off-screen mirror element stored in useRef. The mirror and cursor span
are lazily created on first use and reused for all subsequent caret
position measurements, eliminating layout thrashing. Cleanup on
component unmount removes the element from the DOM.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 18:32:50 -06:00
Jason Woltje
214139f4d5 fix(CQ-WEB-8): Add React.memo to performance-sensitive components
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Wrap 7 list-item/card components with React.memo to prevent unnecessary
re-renders when parent components update but props remain unchanged:
- TaskItem (task lists)
- EventCard (calendar views)
- EntryCard (knowledge base)
- WorkspaceCard (workspace list)
- TeamCard (team list)
- DomainItem (domain list)
- ConnectionCard (federation connections)

All are pure components rendered inside .map() loops that depend solely
on their props for rendering output.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 18:28:08 -06:00
Jason Woltje
1005b7969c fix(SEC-WEB-37): Gate federation mock data behind NODE_ENV check
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Replace exported const mockConnections with getMockConnections() function
that returns mock data only when NODE_ENV === "development". In production
and test environments, returns an empty array as defense-in-depth alongside
the existing ComingSoon page gate (SEC-WEB-4).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 18:22:12 -06:00
Jason Woltje
12fa093f58 fix(SEC-WEB-33+35): Fix Mermaid error display + useWorkspaceId error logging
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
SEC-WEB-33: Replace raw diagram source and detailed error messages in
MermaidViewer error UI with a generic "Diagram rendering failed" message.
Detailed errors are logged to console.error for debugging only.

SEC-WEB-35: Add console.warn in useWorkspaceId when no workspace ID is
found in localStorage, making it easier to distinguish "no workspace
selected" from silent hook failure.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 18:16:07 -06:00
Jason Woltje
014264c592 fix(SEC-WEB-32+34): Add input maxLength limits + API request timeout
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
SEC-WEB-32: Added maxLength to form inputs (names: 100, descriptions: 500,
emails: 254) in WorkspaceSettings, TeamSettings, InviteMember components.

SEC-WEB-34: Added AbortController timeout (30s default, configurable) to
apiRequest and apiPostFormData in API client.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 18:11:00 -06:00
Jason Woltje
14b547d468 fix(SEC-WEB-30+31+36): Validate JSON.parse/localStorage deserialization
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Add runtime type validation after all JSON.parse calls in the web app to
prevent runtime crashes from corrupted or tampered storage data. Creates a
shared safeJsonParse utility with type guard functions for each data shape
(Message[], ChatOverlayState, LayoutConfigRecord). All four affected
callsites now validate parsed data and fall back to safe defaults on
mismatch.

Files changed:
- apps/web/src/lib/utils/safe-json.ts (new utility)
- apps/web/src/lib/utils/safe-json.test.ts (25 tests)
- apps/web/src/hooks/useChat.ts (deserializeMessages)
- apps/web/src/hooks/useChat.test.ts (3 new corruption tests)
- apps/web/src/hooks/useChatOverlay.ts (loadState)
- apps/web/src/hooks/useChatOverlay.test.ts (3 new corruption tests)
- apps/web/src/components/chat/ConversationSidebar.tsx (ideaToConversation)
- apps/web/src/lib/hooks/useLayout.ts (layout loading)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 15:46:58 -06:00
Jason Woltje
6d92251fc1 fix(SEC-WEB-27+28): Robust email validation + role cast validation
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
SEC-WEB-27: Replace weak email.includes('@') check with RFC 5322-aligned
programmatic validation (isValidEmail). Uses character-level domain label
validation to avoid ReDoS vulnerabilities from complex regex patterns.

SEC-WEB-28: Replace unsafe 'as WorkspaceMemberRole' type casts with
runtime validation (toWorkspaceMemberRole) that checks against known enum
values and falls back to MEMBER for invalid inputs. Applied in both
InviteMember.tsx and MemberList.tsx.

Adds 43 tests covering validation logic, InviteMember component, and
MemberList component behavior.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 15:40:05 -06:00
Jason Woltje
65b078c85e fix(SEC-WEB-26+29): Remove console.log + fix formatTime error handling
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
- Remove debug console.log from workspaces page and teams page
- Fix formatTime to return "Invalid date" fallback instead of empty string
  when date parsing fails (handles both thrown errors and NaN dates)
- Export formatTime and add unit tests for error handling cases

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 15:29:32 -06:00
Jason Woltje
36f55558d2 fix(SEC-REVIEW-1): Surface search errors in LinkAutocomplete
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Previously the catch block in searchEntries silently swallowed all
non-abort errors, showing "No entries found" when the search actually
failed. This misled users into thinking the knowledge base was empty.

- Add searchError state variable
- Set PDA-friendly error message on non-abort failures
- Clear error state on subsequent successful searches
- Render error in amber (distinct from gray "No entries found")
- Add 3 tests: error display, error clearing, abort exclusion

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 14:42:47 -06:00