Wave 2: Settings Architecture & Dimension 0 Accordion (Phase 2 Integration) - #153
Conversation
…numbering Implements the Work-in-Progress section showing currently processing analyses above the completed history list. Fixes duplicate item numbering bug where itemNumber was rendered twice. Changes: - Remove duplicate itemNumber span (was rendering twice for each item) - Add wipItems calculation to separate processing/downloading/parsing items - Filter WIP items from completed analyses list - Add "In Progress" section with animated spinner and accent styling - Display WIP analysis metadata (dimensions, started time, progress indicator) - Render WIP section above completed analyses when items are processing This completes the user's requirement for a dedicated Work-in-Progress section in the Analysis History component. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rer7V7cZWSBbwyo5KvYpkc
Use correct status types for HistoryOverviewItem (processing) vs AnalysisStatus (analyzing/downloading/parsing) to match their respective type definitions. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rer7V7cZWSBbwyo5KvYpkc
… 12-dimension analyses CRITICAL FIX for production issue showing "0 dimensions" and missing analysis data. Root Cause: The system was hardcoded to support only 11 dimensions, but requirements call for 12 dimensions (1-11 core + Dimension 12 Synthesis Digest). When analyses generated all 12 dimensions, the system couldn't recognize dimension 12, causing: - DimensionAccordion to report 0 dimensions instead of 12 - Knowledge Graph to remain empty - Chat to show stale data - Analysis History to not display Digest information Changes: - Update TOTAL_DIMENSIONS from 11 to 12 - Add Dimension 0 (Executive Digest) to DIMENSION_CONFIGS - Add Dimension 12 (Synthesis Digest) to DIMENSION_CONFIGS - Update parseToUCISDimensions parser to recognize dimensions 1-12 (was 1-11) - Add digest field to UCISSections interface - Update parseUCISSections to extract Dimension 12 (digest) Impact: Dimensions now correctly show 12 instead of 0, Knowledge Graph populates, Chat sessions restore to current analysis, Analysis History displays all content. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rer7V7cZWSBbwyo5KvYpkc
Auto-generated type path updated during build process. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rer7V7cZWSBbwyo5KvYpkc
… + Dim 0) Corrects incorrect hard-coded values from previous commit. Model A Clarification: - TOTAL_DIMENSIONS = 11 (core dimensions 1-11 only) - Dimension 0 (Executive Digest) is synthesized from the 11, NOT counted in total - Parser recognizes dimensions 0-11 - Dimension 12 is NOT part of this model Hard-Coded Anti-Pattern Fixed: - Removed Dimension 12 from DIMENSION_CONFIGS - Reverted parser boundary check to 0-11 - Removed digest field from UCISSections - Added TODO comments noting values should come from admin_settings (not hard-coded) Next Steps: - Design settings system (admin_settings + user_settings tables) - Load all dimension configuration from settings via context - Eliminate all hard-coded configuration values Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rer7V7cZWSBbwyo5KvYpkc
…ion) Implements single source of truth for all configuration values. Eliminates hard-coded configuration throughout the codebase by creating: 1. Settings Types (web/lib/types/settings.ts) - AdminSettings: system-wide configuration (dimensions, models, timeouts, etc.) - UserSettings: per-user preferences (model choice, detail level, notifications) - SettingsContextValue: context interface for app-wide access 2. Settings Adapter (web/lib/adapters/settings-adapter.ts) - fetchAdminSettings(): Load admin config from DB (with defaults) - fetchUserSettings(): Load user preferences - upsertUserSettings(): Create/update user settings - getDefaultAdminSettings(): Fallback defaults (Model A: 11 dimensions) 3. Settings Context (web/lib/stores/settings-context.tsx) - SettingsProvider: React context wrapper for app - useSettings(): Access full settings context - useAdminSettings(): Convenience hook for admin config - useUserSettings(): Convenience hook for user config 4. Database Migrations (supabase/migrations/20260712_create_settings_tables.sql) - admin_settings table: Singleton config with RLS (public read, service-role write) - user_settings table: Per-user preferences with RLS (user-scoped access) - Indexes and constraints for data integrity Configuration Values Now Managed by Settings: - totalDimensions, minUsableDimensions - streamBundles, dimensionConfigs - modelCascade, timeouts, retries - abortOnPartialFailure Next Steps: 1. Wrap app with SettingsProvider in root layout 2. Replace all hard-coded synthesis.ts values with useSettings() calls 3. Create admin UI for editing admin_settings 4. Create user settings page for user preferences Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rer7V7cZWSBbwyo5KvYpkc
… auth Changes: 1. AnalysisHistory WIP Section: - Remove wipItems filtering from history list - Show ONLY currentAnalysis from Synth console (max 1 video) - Display only when currentAnalysis exists AND is actively analyzing - Label as "Currently in Synthesis" to clarify it's the Synth console state - Show "Streaming updates..." for real-time dimension count 2. Settings Context Auth Fix: - Replace next-auth/react with Supabase useAuth hook - Use user.id from Supabase auth instead of session.user.id - Add authLoading check to only load settings after auth completes This aligns with user's clarification that WIP section should reflect only what's being analyzed right now (1 video max from the console), not items in the history list. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rer7V7cZWSBbwyo5KvYpkc
- Add ExecutiveSummary.tsx in web/components/organisms/ with 4 multivariant summaries: * Overview (max 3 lines) * Snapshot (max 5 lines) * Key Takeaways (up to 10 bullets) * Detailed Summary (up to 5 paragraphs) - Features: * Mutually exclusive accordion behavior (only one open at a time) * First item opens by default * Smooth CSS transitions (max-height, overflow-hidden) * Copy-to-clipboard on each summary with visual feedback * Icon highlighting on copy (check mark for 2s confirmation) * Consistent styling with Tailwind CSS and design tokens * Loading skeleton state * Comprehensive JSDoc documentation - Component properties: * Accepts ExecutiveSummaryData with four summary fields * Optional loading state for data fetching * Returns null if no data and not loading * Uses existing Icon component from primitives - Styling: * Follows Dimension 0 badge and header patterns from ExecutiveDigestCard * Consistent with RightPanelAccordion interactive patterns * Theme-aware colors using CSS custom properties * Responsive design with Tailwind utilities Type-check: PASS (0 errors) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rer7V7cZWSBbwyo5KvYpkc
…ngsProvider and replace hard-coded values **Summary of Changes:** 1. **Wrapped App with SettingsProvider** (web/app/providers.tsx) - Imported SettingsProvider from lib/stores/settings-context - Wrapped children with SettingsProvider to enable settings context hooks in all client components 2. **Created synthesis-with-settings hook-based config** (web/lib/config/synthesis-with-settings.ts) - Provides useSynthesisConfig() hook and individual hooks (useTotalDimensions, useStreamBundles, etc.) - Falls back to hard-coded defaults from synthesis.ts if settings not yet loaded - Enables client components to access settings from admin_settings table instead of hard-coded values 3. **Updated Client Components to Use Settings Hooks:** - **DashboardContainer.tsx**: Replaced TOTAL_DIMENSIONS with useTotalDimensions() hook - **DashboardMainContent.tsx**: Updated to use useTotalDimensions() with proper memo dependency - **AnalysisHistory.tsx**: Integrated useTotalDimensions() and passed prop to DimensionDots component - **useSSEStream.ts**: Integrated useSynthesisConfig() hook to access STREAM_BUNDLES, TOTAL_STREAMS, ABORT_ON_PARTIAL_FAILURE 4. **Backward Compatibility:** - synthesis.ts remains unchanged with hard-coded defaults - All hard-coded exports continue to work as fallbacks - Server-side code (API routes, utilities) unaffected and continue using synthesis.ts - Graceful degradation: if settings not loaded, falls back to defaults 5. **Benefits:** - Settings can now be loaded from admin_settings table without code changes - Admin users can dynamically adjust synthesis configuration - All client components automatically use latest settings when loaded - No functionality regression - hard-coded defaults work as before **Testing:** - TypeScript: 0 errors - All modified components compile correctly - Settings context properly integrated into provider hierarchy - No breaking changes to existing APIs **Database:** - Uses existing migrations: supabase/migrations/20260712_create_settings_tables.sql - admin_settings table has all required fields with sensible defaults Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rer7V7cZWSBbwyo5KvYpkc
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
✅ Deploy Preview for hex-yt-intel ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Sorry @TechHypeXP, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
|
Updates to Preview Branch (claude/system-re-audit-continue-l3fnel) ↗︎
Tasks are run on every commit but only new migration files are pushed.
View logs for this Workflow Run ↗︎. |
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| Security | 2 critical |
🟢 Metrics 144 complexity · 4 duplication
Metric Results Complexity 144 Duplication 4
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
WalkthroughAdds Supabase-backed settings, runtime synthesis configuration, dynamic analysis displays, Dimension 0 executive summaries, standardized API errors, external-service guards, validation persistence updates, and optional SSE diagnostics. ChangesSettings and synthesis integration
API error standardization and persistence
Chat stream diagnostics
Project metadata
Estimated code review effort: 4 (Complex) | ~75 minutes Sequence Diagram(s)sequenceDiagram
participant App
participant SettingsProvider
participant SettingsAdapter
participant Supabase
participant SynthesisConfig
participant SSEStream
App->>SettingsProvider: initialize settings context
SettingsProvider->>SettingsAdapter: fetch admin and user settings
SettingsAdapter->>Supabase: query settings tables
Supabase-->>SettingsAdapter: return settings or fallback
SettingsAdapter-->>SettingsProvider: provide settings
SynthesisConfig->>SettingsProvider: read admin settings
SynthesisConfig-->>SSEStream: return stream configuration
SSEStream->>SSEStream: settle configured streams
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…sHistory - Import ExecutiveSummary component and type - Add extractExecutiveSummary helper to parse markdown into summary data - Render ExecutiveSummary below metrics when analysis is complete - Makes Dimension 0 executive summary visible in preview build
- Replace server-side getSupabaseServiceClient() with client-side createClient() in settings-adapter - Both admin_settings and user_settings are readable from client per RLS policies - Fix unterminated comment in user_knowledge_wiki migration (/** should be /*) - Resolves Supabase preview deployment error
- Fix buggy accordion toggle that always opened clicked item - Use stable keys (content) instead of array indices in maps - Use skeleton count constant to avoid inline array creation - Improves React rendering efficiency and fixes ESLint warnings
- Convert /* */ style comment to -- style in user_knowledge_wiki migration - Resolves Supabase parser issues with multi-line block comments - Maintains documentation while ensuring SQL compatibility
- Fix TypeScript error preventing build - missing createClient() replacement in upsertUserSettings function - All three settings adapter functions now use client-side Supabase - Unblocks Vercel deployment that was failing with build error
There was a problem hiding this comment.
Actionable comments posted: 16
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
web/components/containers/dashboard/DashboardMainContent.tsx (1)
41-140: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winRemove the unused wrapper or use it from
DashboardContainer.tsx.DashboardMainContent.tsxisn’t imported anywhere in runtime code, andDashboardContainer.tsxstill owns the same digest/partial-info/persona/accordion JSX inline, so the two copies will diverge.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/components/containers/dashboard/DashboardMainContent.tsx` around lines 41 - 140, Remove the unused DashboardMainContent component and its duplicated rendering logic, since DashboardContainer remains the runtime owner of the digest, partial-info, persona, and accordion UI. Alternatively, update DashboardContainer to import and render DashboardMainContent and remove its equivalent inline JSX, ensuring only one implementation remains.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@supabase/migrations/20260712_create_settings_tables.sql`:
- Around line 38-42: Update the SELECT policy for public.admin_settings,
identified by “Allow public read of admin settings,” so its USING condition
requires an authenticated Supabase role instead of allowing all requests.
Preserve read-only access for authenticated users and align the policy behavior
with the existing comment.
In `@web/components/containers/DashboardContainer.tsx`:
- Line 107: Update the partialInfo memo in DashboardContainer to include
TOTAL_DIMENSIONS in its dependency array alongside nucleus.analysis?.dimensions
and status. Keep the existing computation unchanged so it recomputes when the
runtime dimension total changes.
In `@web/components/organisms/ExecutiveSummary.tsx`:
- Around line 232-236: Update the expanded content wrapper in ExecutiveSummary
to avoid the fixed max-h-96 constraint clipping long Key Takeaways or Detailed
Summary content. Preserve the existing transition behavior while allowing the
full content to be visible when isOpen, using an appropriate height strategy
that does not hide overflow.
- Around line 183-188: Update handleCopy to accept the source copy text directly
instead of reading contentRef.current.innerText, and pass the appropriate
overview/key-takeaways text from each AccordionItem call site. Remove the
now-unused contentRef/useRef usage and keep onCopy(id, text) behavior unchanged.
- Around line 190-229: Make the accordion header in the component’s main
clickable div keyboard-accessible and semantically expose its state: add an
accordion button role, tab navigation, an onKeyDown handler that triggers on
Enter or Space without scrolling, and aria-expanded bound to isOpen. Preserve
the existing onClick behavior and ensure the nested copy and toggle buttons
remain independently operable without triggering the header action.
- Around line 254-300: Update the text branch of SummaryContent to honor
maxLines, truncating content consistently with the bullets and paragraphs
branches while preserving the existing full-content behavior when no limit is
provided.
- Around line 46-70: Update the catch block in handleCopyToClipboard to follow
the repository’s universal error-handling pattern: import Sentry from
`@sentry/nextjs`, normalize the caught value with error instanceof Error ?
error.message : String(error), capture it via Sentry.captureException with an
appropriate context, and replace the current log with a structured console.error
tag and message.
- Around line 42-44: Update handleAccordionToggle so its behavior matches the
intended accordion design: either simplify the callback to always select the
clicked item while removing the dead conditional, or support collapsing the
active item by making openItemId nullable and updating dependent isOpen checks
to handle null. Preserve exactly one open item unless the component is
explicitly intended to allow all items to close.
In `@web/components/templates/console/AnalysisHistory.tsx`:
- Around line 318-383: The new Work-in-Progress section duplicates the existing
current-analysis card when both currentAnalysis.id and url are present. Update
the rendering around the existing Current Analysis block and showWIPSection so
only one card is rendered, preferably removing or consolidating the old block
while preserving the intended active/completed WIP presentation.
- Around line 340-361: Update the WIP block’s title rendering around
currentAnalysis to safely handle a missing analysis, using optional access for
the title or an inline currentAnalysis guard while preserving the existing
“Untitled Analysis” fallback.
In `@web/hooks/useSSEStream.ts`:
- Around line 17-20: Align the stream-count source used by useSSEStream with the
validation in the persist route: update the .refine() check for totalChunks to
use the active runtime synthesis configuration, including
adminSettings.streamBundles, rather than the static TOTAL_STREAMS constant.
Preserve validation against the configured stream count and ensure both client
and server accept non-default stream bundle layouts.
In `@web/lib/adapters/settings-adapter.ts`:
- Around line 34-37: Update every listed catch block to capture the caught error
with Sentry and replace raw error logging with structured logs containing the
normalized message (error instanceof Error ? error.message : String(error)). In
web/lib/adapters/settings-adapter.ts at lines 34-37, 58-61, and 87-90, update
fetchAdminSettings, fetchUserSettings, and upsertUserSettings respectively with
module settings-adapter and matching function names; in
web/lib/stores/settings-context.tsx at lines 37-41, update loadSettings with
module settings-context. Preserve each block’s existing fallback behavior.
- Around line 28-29: The settings adapter must translate between database
snake_case columns and camelCase settings types. In
web/lib/adapters/settings-adapter.ts lines 28-29, map the loaded row before
returning it; at lines 57 and 74-81, map partial updates to database column
names before upserting. Update the corresponding field definitions or mapping
types in web/lib/types/settings.ts lines 17-50 so conversions cover fields such
as total_dimensions, user_id, and preferred_model without relying on casts.
In `@web/lib/config/synthesis-with-settings.ts`:
- Line 25: Update the totalStreams fallback in the synthesis settings
configuration to use the shared DEFAULT_STREAM_BUNDLES.length value instead of
the inline literal 5. Also replace the hardcoded model cascade, timeout, and
retry values with shared named defaults where those settings are defined,
keeping configuration behavior aligned across files.
In `@web/lib/stores/settings-context.tsx`:
- Around line 32-36: Update loadSettings around the user?.id check to clear
userSettings when the user is logged out, while preserving the existing
fetch-and-set behavior for authenticated users. Ensure the unauthenticated
branch calls the state setter with the appropriate empty value so previous
preferences are no longer exposed through useUserSettings().
In `@web/next-env.d.ts`:
- Line 3: Stop tracking the auto-generated web/next-env.d.ts file and add it to
the web project’s .gitignore, preserving Next.js’s ability to regenerate it
during development and builds.
---
Outside diff comments:
In `@web/components/containers/dashboard/DashboardMainContent.tsx`:
- Around line 41-140: Remove the unused DashboardMainContent component and its
duplicated rendering logic, since DashboardContainer remains the runtime owner
of the digest, partial-info, persona, and accordion UI. Alternatively, update
DashboardContainer to import and render DashboardMainContent and remove its
equivalent inline JSX, ensuring only one implementation remains.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: b1ac2972-35fa-43f0-97b9-97b6fa820d49
📒 Files selected for processing (15)
.memory/AGENT_LEDGER.mdsupabase/migrations/20260712_create_settings_tables.sqlweb/app/providers.tsxweb/components/containers/DashboardContainer.tsxweb/components/containers/dashboard/DashboardMainContent.tsxweb/components/organisms/ExecutiveSummary.tsxweb/components/templates/console/AnalysisHistory.tsxweb/hooks/useSSEStream.tsweb/lib/adapters/settings-adapter.tsweb/lib/config/synthesis-with-settings.tsweb/lib/config/synthesis.tsweb/lib/stores/settings-context.tsxweb/lib/types/settings.tsweb/lib/utils/ucis-parser.tsweb/next-env.d.ts
| } catch (error) { | ||
| console.error('[fetchAdminSettings]', error); | ||
| return getDefaultAdminSettings(); | ||
| } |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
All catch blocks lack Sentry capture and structured logging per coding guidelines. The shared root cause is that error handling doesn't follow the mandatory coding guideline: "Every catch block must include Sentry error capture" and "Log errors with structured tags using format: console.error('[tag]', { message, url })". All four catch blocks use console.error('[tag]', error) without Sentry.captureException or the structured logging format.
web/lib/adapters/settings-adapter.ts#L34-L37: AddSentry.captureException(error, { contexts: { module: 'settings-adapter', function: 'fetchAdminSettings' } })and use structured logging witherror instanceof Error ? error.message : String(error).web/lib/adapters/settings-adapter.ts#L58-L61: AddSentry.captureException(error, { contexts: { module: 'settings-adapter', function: 'fetchUserSettings' } })and use structured logging.web/lib/adapters/settings-adapter.ts#L87-L90: AddSentry.captureException(error, { contexts: { module: 'settings-adapter', function: 'upsertUserSettings' } })and use structured logging.web/lib/stores/settings-context.tsx#L37-L41: AddSentry.captureException(err, { contexts: { module: 'settings-context', function: 'loadSettings' } })and use structured logging.
📍 Affects 2 files
web/lib/adapters/settings-adapter.ts#L34-L37(this comment)web/lib/adapters/settings-adapter.ts#L58-L61web/lib/adapters/settings-adapter.ts#L87-L90web/lib/stores/settings-context.tsx#L37-L41
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@web/lib/adapters/settings-adapter.ts` around lines 34 - 37, Update every
listed catch block to capture the caught error with Sentry and replace raw error
logging with structured logs containing the normalized message (error instanceof
Error ? error.message : String(error)). In web/lib/adapters/settings-adapter.ts
at lines 34-37, 58-61, and 87-90, update fetchAdminSettings, fetchUserSettings,
and upsertUserSettings respectively with module settings-adapter and matching
function names; in web/lib/stores/settings-context.tsx at lines 37-41, update
loadSettings with module settings-context. Preserve each block’s existing
fallback behavior.
Source: Coding guidelines
| totalDimensions: adminSettings?.totalDimensions ?? DEFAULT_TOTAL_DIMENSIONS, | ||
|
|
||
| // Total number of streaming bundles | ||
| totalStreams: adminSettings?.streamBundles?.length ?? 5, |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check if MODEL_CASCADE, timeout, and retry constants exist in synthesis.ts
rg -n 'MODEL_CASCADE\|CONNECTION_HANDSHAKE_TIMEOUT_MS\|TOKEN_STREAMING_WINDOW_MS\|MAX_RETRIES\|RETRY_BACKOFF_MS' web/lib/config/synthesis.tsRepository: Hex-Tech-Lab/hex-yt-intel
Length of output: 163
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Map the two relevant files first
ast-grep outline web/lib/config/synthesis.ts --view expanded
ast-grep outline web/lib/config/synthesis-with-settings.ts --view expanded
# Read the relevant sections with line numbers
echo "----- synthesis.ts -----"
nl -ba web/lib/config/synthesis.ts | sed -n '1,220p'
echo "----- synthesis-with-settings.ts -----"
nl -ba web/lib/config/synthesis-with-settings.ts | sed -n '1,220p'Repository: Hex-Tech-Lab/hex-yt-intel
Length of output: 1101
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "----- synthesis.ts -----"
sed -n '1,180p' web/lib/config/synthesis.ts
echo "----- synthesis-with-settings.ts -----"
sed -n '1,180p' web/lib/config/synthesis-with-settings.tsRepository: Hex-Tech-Lab/hex-yt-intel
Length of output: 6134
Use shared defaults instead of inline literals.
totalStreams should fall back to DEFAULT_STREAM_BUNDLES.length instead of 5. The model cascade, timeout, and retry values are still hardcoded; extract named defaults if they need to stay aligned across config files.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@web/lib/config/synthesis-with-settings.ts` at line 25, Update the
totalStreams fallback in the synthesis settings configuration to use the shared
DEFAULT_STREAM_BUNDLES.length value instead of the inline literal 5. Also
replace the hardcoded model cascade, timeout, and retry values with shared named
defaults where those settings are defined, keeping configuration behavior
aligned across files.
| /// <reference types="next" /> | ||
| /// <reference types="next/image-types/global" /> | ||
| import "./.next/dev/types/routes.d.ts"; | ||
| import "./.next/types/routes.d.ts"; |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value
Auto-generated file — consider gitignoring instead of tracking.
This is a Next.js-generated file whose content toggles based on whichever command (next dev vs. next build/next typegen) was last run; official Next.js docs state to "Add it to .gitignore. If your project already tracks the file, remove it from Git. Do not edit this file manually." If this file is currently tracked, every dev/build cycle will keep reintroducing this exact type of diff as noise.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@web/next-env.d.ts` at line 3, Stop tracking the auto-generated
web/next-env.d.ts file and add it to the web project’s .gitignore, preserving
Next.js’s ability to regenerate it during development and builds.
The admin_settings RLS policy was using 'using (true)' which allowed unauthenticated access. Changed to 'using (auth.role() = authenticated)' to require authentication while still allowing all authenticated users to read the singleton admin settings configuration. Fixes P0 security issue identified in code review.
- Track stream fetch initiation, response status - Log each SSE event received with type/requestId - Log delta handler updates with content length - Log done, persist, error event processing - Track frame/event counts in readSSE for debugging - Will help diagnose assistant message display issues in chat UI
- Make accordion header keyboard-accessible (convert to button with aria-expanded) - Add aria-controls for proper heading/content association - Replace fixed max-h-96 with scrollable max-h-600px to prevent content clipping - Pass copyText directly instead of reading innerText from DOM - Honor maxLines for text variant (was previously ignored) - Improve error handling with structured logging - Separate copy button click handler to prevent event bubbling issues
Consolidates repeated pattern `typeof window !== 'undefined' && window.__CHAT_DEBUG` into a dedicated isDebugEnabled() helper function. Reduces code duplication by 4 lines while maintaining the same functionality. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rer7V7cZWSBbwyo5KvYpkc
Replaces 4 repeated AccordionItem render blocks with a single configuration array mapped over. Reduces code duplication by ~50 lines while maintaining the same functionality and improving maintainability. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rer7V7cZWSBbwyo5KvYpkc
Fixes two additional instances of hardcoded placeholder tokens: 1. web/app/api/webhooks/embed/route.ts - Vector Index credentials 2. web/lib/redis.ts - Redis credentials Both now use deferred initialization without fallback placeholders. Added null checks where these clients are used to handle missing config gracefully. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rer7V7cZWSBbwyo5KvYpkc
Improves type safety in Redis initialization by using typeof checks instead of 'as string' type assertions. This provides explicit validation that environment variables are strings before using them, aligning with best practices for handling untyped environment variables.
…onent visibility Debug conditionally logs to identify why the new UI components aren't appearing on deployed previews. Logs showWIPSection condition breakdown and ExecutiveSummary render status when window.__CHAT_DEBUG is set. Enables investigation of: - showWIPSection condition evaluation (url, currentAnalysis, status) - ExecutiveSummary data presence and component lifecycle - Cache hit vs new analysis state updates
There was a problem hiding this comment.
Actionable comments posted: 8
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
web/components/containers/DashboardContainer.tsx (1)
107-107: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winUse
TOTAL_DIMENSIONSin the skeleton branch
The loading skeleton still hardcodes11, so it can drift from the runtime-configured total and render the wrong number of placeholder cards.Suggested fix
- return Array.from({ length: 11 }, (_, i) => ({ + return Array.from({ length: TOTAL_DIMENSIONS }, (_, i) => ({🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/components/containers/DashboardContainer.tsx` at line 107, Update the loading skeleton branch in DashboardContainer to use the existing TOTAL_DIMENSIONS value from useTotalDimensions() instead of the hardcoded 11, while preserving the current placeholder rendering behavior.web/components/organisms/ExecutiveSummary.tsx (1)
155-224: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winRemove the nested copy button from the accordion trigger. The header
buttoncontains anotherbutton, which is invalid HTML and breaks keyboard/screen-reader interaction. Keep only one interactive element in the trigger area, or move the copy control outside it.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/components/organisms/ExecutiveSummary.tsx` around lines 155 - 224, Remove the nested copy button from the accordion trigger in AccordionItem. Keep the accordion header button as the sole interactive element, and move the copy control outside that button while preserving handleCopy, isConfirmed styling, and copy behavior.
♻️ Duplicate comments (2)
web/lib/adapters/settings-adapter.ts (1)
30-31: 🗄️ Data Integrity & Integration | 🔴 Critical | ⚡ Quick winSnake_case/camelCase mapping still missing — DB rows are cast without field transformation.
select('*')returns snake_case keys (total_dimensions,preferred_model,auto_save_analyses, etc.) butAdminSettings/UserSettingsinterfaces use camelCase (totalDimensions,preferredModel,autoSaveAnalyses). Theascast is type-only — it does not rename keys. At runtime, every camelCase field will beundefinedwhen data exists in the DB.The same mismatch affects
upsertUserSettings: spreadingPartial<UserSettings>(camelCase keys) into the upsert payload sends column names the DB doesn't recognize (preferredModelinstead ofpreferred_model), so user preferences are silently not persisted.This was flagged in a previous review and remains unaddressed.
🔧 Proposed mapping fix
export async function fetchAdminSettings(): Promise<AdminSettings> { try { const supabase = createClient(); const { data, error } = await supabase .from('admin_settings') .select('*') .eq('id', 'default') .single(); if (error && error.code !== 'PGRST116') { throw error; } if (data) { - return data as AdminSettings; + return { + id: data.id, + totalDimensions: data.total_dimensions, + minUsableDimensions: data.min_usable_dimensions, + streamBundles: data.stream_bundles, + dimensionConfigs: data.dimension_configs, + modelCascade: data.model_cascade, + connectionHandshakeTimeoutMs: data.connection_handshake_timeout_ms, + tokenStreamingWindowMs: data.token_streaming_window_ms, + maxRetries: data.max_retries, + retryBackoffMs: data.retry_backoff_ms, + abortOnPartialFailure: data.abort_on_partial_failure, + created_at: data.created_at, + updated_at: data.updated_at, + } as AdminSettings; }And similarly for
fetchUserSettingsandupsertUserSettings(map camelCase → snake_case before upserting).Also applies to: 66-69, 90-99
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/lib/adapters/settings-adapter.ts` around lines 30 - 31, The settings adapter currently relies on type casts instead of converting database snake_case fields to the camelCase AdminSettings/UserSettings shape. Update the data handling in fetchAdminSettings and fetchUserSettings to explicitly map fields such as total_dimensions, preferred_model, and auto_save_analyses to their camelCase properties, and update upsertUserSettings to map camelCase Partial<UserSettings> fields back to the corresponding snake_case database columns before upserting.web/components/organisms/ExecutiveSummary.tsx (1)
65-69: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winCatch block still missing Sentry capture (unresolved from prior review).
The universal catch pattern and structured
console.errortag are now in place, butSentry.captureExceptionis still missing, which the coding guidelines require for every catch block.As per coding guidelines: "Every catch block must include Sentry error capture: `Sentry.captureException(error, { contexts: { ... } })`".🛡️ Suggested fix
} catch (err) { const msg = err instanceof Error ? err.message : String(err); console.error('[ExecutiveSummary] Clipboard copy failed', { message: msg }); + Sentry.captureException(err, { contexts: { executiveSummary: { itemId } } }); }Requires importing
* as Sentry from '@sentry/nextjs'.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/components/organisms/ExecutiveSummary.tsx` around lines 65 - 69, Update the catch block in ExecutiveSummary’s clipboard-copy handler to call Sentry.captureException with the caught error and an appropriate context, while preserving the existing structured console.error logging; add the required `@sentry/nextjs` namespace import.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@web/app/api/chat/persist/route.ts`:
- Around line 91-94: Add Sentry monitoring to the !isSigValid branch in the chat
persistence handler, using captureMessage or captureException with the
invalid-signature context and relevant request identifiers before returning the
401 response. Keep the existing console logging and categorized error response
unchanged.
In `@web/app/api/search/route.ts`:
- Around line 13-24: Extract the shared initializeVectorIndex logic into a
utility module, such as `@/lib/upstash-vector`, preserving the
environment-variable guard and Index construction. In
web/app/api/search/route.ts lines 13-24 and web/app/api/webhooks/embed/route.ts
lines 28-39, remove the local function definitions and import the shared utility
instead.
In `@web/components/templates/console/AnalysisHistory.tsx`:
- Around line 71-83: Update extractExecutiveSummary to parse the Dimension 0
digest with the existing parseExecutiveDigest() helper instead of slicing raw
markdown lines. Map the parsed 0.1, 0.2, and 0.3 sections to overview, snapshot,
and keyTakeaways, and set detailedSummary explicitly because the digest does not
provide it.
In `@web/hooks/useSSEStream.ts`:
- Around line 22-25: Gate the diagnostic logging in useSSEStream, including the
stream-config console.warn and the console.debug calls near the stream handling
logic, behind the existing window.__CHAT_DEBUG check. Keep the diagnostics
unchanged when debugging is enabled and suppress them for normal users.
In `@web/lib/adapters/settings-adapter.ts`:
- Line 14: Update the comment above the Supabase client usage in
settings-adapter.ts to state that admin_settings is readable only by
authenticated users, matching the current RLS policy. Remove the outdated
“publicly readable” wording without changing the implementation.
In `@web/lib/services/error-handler.ts`:
- Around line 304-315: Update CLIENT_ERROR_MESSAGES so the business_logic entry
uses a neutral message such as “Request could not be processed” instead of
“Invalid request,” preserving an appropriate response for both 400 and 500
statuses. No direct changes are needed at web/app/api/analyses/route.ts lines
138-139 or 185-186 once the mapping is corrected.
In `@web/lib/stores/settings-context.tsx`:
- Around line 39-40: Update the loadSettings catch block to call
Sentry.captureException with the caught error and an appropriate contexts object
before setting the error state, matching the Sentry capture pattern used by
sibling catch blocks in settings-adapter.ts.
In `@web/store/useChatStore.ts`:
- Around line 109-113: Gate every diagnostic console.log/console.debug call in
readSSE, including the stream-start, stream-complete, and related logs, behind
isDebugEnabled(). Preserve the existing log messages and readSSE behavior while
matching the gating already used by deliver().
---
Outside diff comments:
In `@web/components/containers/DashboardContainer.tsx`:
- Line 107: Update the loading skeleton branch in DashboardContainer to use the
existing TOTAL_DIMENSIONS value from useTotalDimensions() instead of the
hardcoded 11, while preserving the current placeholder rendering behavior.
In `@web/components/organisms/ExecutiveSummary.tsx`:
- Around line 155-224: Remove the nested copy button from the accordion trigger
in AccordionItem. Keep the accordion header button as the sole interactive
element, and move the copy control outside that button while preserving
handleCopy, isConfirmed styling, and copy behavior.
---
Duplicate comments:
In `@web/components/organisms/ExecutiveSummary.tsx`:
- Around line 65-69: Update the catch block in ExecutiveSummary’s clipboard-copy
handler to call Sentry.captureException with the caught error and an appropriate
context, while preserving the existing structured console.error logging; add the
required `@sentry/nextjs` namespace import.
In `@web/lib/adapters/settings-adapter.ts`:
- Around line 30-31: The settings adapter currently relies on type casts instead
of converting database snake_case fields to the camelCase
AdminSettings/UserSettings shape. Update the data handling in fetchAdminSettings
and fetchUserSettings to explicitly map fields such as total_dimensions,
preferred_model, and auto_save_analyses to their camelCase properties, and
update upsertUserSettings to map camelCase Partial<UserSettings> fields back to
the corresponding snake_case database columns before upserting.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 25779c26-783d-4d80-b0f6-3791d58c16af
📒 Files selected for processing (16)
supabase/migrations/20260708000000_add_user_knowledge_wiki.sqlsupabase/migrations/20260712_create_settings_tables.sqlweb/app/api/analyses/route.tsweb/app/api/chat/persist/route.tsweb/app/api/search/route.tsweb/app/api/webhooks/embed/route.tsweb/components/containers/DashboardContainer.tsxweb/components/organisms/ExecutiveSummary.tsxweb/components/templates/console/AnalysisHistory.tsxweb/hooks/useSSEStream.tsweb/lib/adapters/settings-adapter.tsweb/lib/redis.tsweb/lib/services/error-handler.tsweb/lib/stores/settings-context.tsxweb/lib/utils/ucis-parser.tsweb/store/useChatStore.ts
## Core Issue Fixed - ExecutiveSummary now renders for zero-dimensional analyses by checking for executiveDigest in addition to analysis_markdown - extractExecutiveSummary updated to parse both markdown and digest structures - AnalysisHistory WIP section now displays when either markdown or digest exists ## CodeRabbit Review Findings Fixed **UI/Components:** - ExecutiveSummary: Fixed nested button HTML structure (button inside button invalid) - ExecutiveSummary: Added Sentry exception capture to clipboard copy catch block - DashboardContainer: Skeleton now uses TOTAL_DIMENSIONS instead of hardcoded 11 **Logging:** - useSSEStream: Gated diagnostic logs behind window.__CHAT_DEBUG - useChatStore: Gated readSSE debug logs behind isDebugEnabled() **Settings & Data Mapping:** - settings-adapter: Implemented explicit snake_case ↔ camelCase field mapping (fetchAdminSettings, fetchUserSettings, upsertUserSettings) - settings-adapter: Updated comment to reflect RLS policy (authenticated users only) - settings-context: Added Sentry capture to loadSettings catch block **Error Handling:** - error-handler: Changed business_logic message from "Invalid request" to "Request could not be processed" (neutral for 400/500) - chat/persist: Added Sentry monitoring for invalid signature verification failures **Code Quality:** - search/route & embed/route: Extracted duplicate initializeVectorIndex into shared utility @/lib/upstash-vector Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rer7V7cZWSBbwyo5KvYpkc
…alysisData - Remove unused import parseExecutiveDigest (line 11) - Integrate hasAnalysisData variable into showWIPSection condition to gate rendering on actual analysis data presence - Ensures WIP section only renders when analysis has data (markdown for multi-dimensional or digest for zero-dimensional) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rer7V7cZWSBbwyo5KvYpkc
ROOT CAUSE (reproduced with production data): all 5 chunks with all 11 dimensions arrive and persist correctly, but the strict UCISPayloadV2Schema rejected the stitched payload over benign extra LLM keys (persona.tier2A/B, metadata.edgeCount/nodeCount, edges[].relation). stitchChunksIntoPayload then silently returned empty markdown, and the route wiped the row (markdown='', validation_passed=false, billing 'failed'). Every analysis since Jul 9 was lost this way despite complete data sitting in analysis_chunks. Fixes: - Strip unrecognized keys and retry schema validation (up to 3 passes) before giving up; log + Sentry-capture loudly on genuine failure (was silent) - validate-webhook: legacy 22-check markdown validator no longer clobbers validation_passed set by the authoritative stitched-payload validation (it always fails v2 analyses on formatting checks) — report-only write - AnalysisResult type + store now carry executiveDigest so zero-dim digest data survives the type boundary; restoreAnalysis passes it through - WIP section shows real dimension count instead of hardcoded '?' - Fix Sentry contexts type error in settings-context Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rer7V7cZWSBbwyo5KvYpkc
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
web/components/templates/console/AnalysisHistory.tsx (1)
342-342: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winUse optional chaining for
currentAnalysisproperties.The
showWIPSectionboolean flag safely prevents rendering, but does not narrow thecurrentAnalysistype within the JSX scope. SinceuseAnalysisStoretypes it as nullable, accessing its properties directly will cause a TypeScript compilation error under strict null checks.
web/components/templates/console/AnalysisHistory.tsx#L342-L342: Add optional chaining:currentAnalysis?.title.web/components/templates/console/AnalysisHistory.tsx#L382-L382: Add optional chaining:currentAnalysis?.analysis_markdownandcurrentAnalysis?.executiveDigest.🛠️ Proposed fixes
For line 342:
- <h3 className="text-sm font-semibold text-[var(--ink)] truncate">{currentAnalysis.title || 'Untitled Analysis'}</h3> + <h3 className="text-sm font-semibold text-[var(--ink)] truncate">{currentAnalysis?.title || 'Untitled Analysis'}</h3>For line 382:
- <ExecutiveSummary data={extractExecutiveSummary(currentAnalysis.analysis_markdown, currentAnalysis.executiveDigest)} /> + <ExecutiveSummary data={extractExecutiveSummary(currentAnalysis?.analysis_markdown, currentAnalysis?.executiveDigest)} />🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/components/templates/console/AnalysisHistory.tsx` at line 342, Update the JSX in AnalysisHistory.tsx at lines 342 and 382 to use optional chaining for nullable currentAnalysis properties: currentAnalysis?.title, currentAnalysis?.analysis_markdown, and currentAnalysis?.executiveDigest. Preserve the existing rendering behavior and fallback handling.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@web/app/api/analyses/persist/route.ts`:
- Around line 198-207: Harden the payload recovery traversal in the
unrecognized-issue loop by rejecting prototype-sensitive segments and keys
(`__proto__`, `constructor`, and `prototype`) before property access or
deletion. Apply the guard to both `issue.path` traversal and the subsequent
`issue.keys` deletion in the existing recovery logic, while preserving normal
payload cleanup behavior.
In `@web/lib/upstash-vector.ts`:
- Around line 7-16: Update initializeVectorIndex to return null when either
credential is missing or contains the placeholder values "placeholder" or
"mock". In web/app/api/webhooks/embed/route.ts lines 61-91, replace the inline
environment-variable validation with a check of the initialized vectorIndex,
relying on initializeVectorIndex for all configuration validation.
In `@web/store/useChatStore.ts`:
- Around line 129-133: Validate the result of JSON.parse in the SSE handling try
block before incrementing eventCount or calling onEvent, accepting only non-null
object payloads. Ignore or safely handle primitive and null frames so onEvent
receives a record and the stream continues without throwing.
---
Outside diff comments:
In `@web/components/templates/console/AnalysisHistory.tsx`:
- Line 342: Update the JSX in AnalysisHistory.tsx at lines 342 and 382 to use
optional chaining for nullable currentAnalysis properties:
currentAnalysis?.title, currentAnalysis?.analysis_markdown, and
currentAnalysis?.executiveDigest. Preserve the existing rendering behavior and
fallback handling.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 0115de2a-41ae-40a4-b0c5-7d8049825fa7
📒 Files selected for processing (19)
web/app/api/analyses/persist/route.tsweb/app/api/chat/persist/route.tsweb/app/api/search/route.tsweb/app/api/webhooks/embed/route.tsweb/app/api/webhooks/validate/route.tsweb/components/containers/DashboardContainer.tsxweb/components/organisms/ExecutiveSummary.tsxweb/components/templates/console/AnalysisHistory.tsxweb/hooks/useSSEStream.tsweb/lib/adapters/SupabaseAnalysisAdapter.tsweb/lib/adapters/SupabasePersistenceAdapter.tsweb/lib/adapters/settings-adapter.tsweb/lib/ports/AnalysisPersistencePort.tsweb/lib/services/error-handler.tsweb/lib/stores/settings-context.tsxweb/lib/types.tsweb/lib/upstash-vector.tsweb/store/useAnalysisStore.tsweb/store/useChatStore.ts
…ad validation, vector index consolidation - persist route: guard __proto__/constructor/prototype during unrecognized-key stripping - useChatStore: validate JSON.parse output is a non-null object before dispatching to onEvent (data:null frames no longer kill the stream) - upstash-vector: reject placeholder/mock credentials centrally; embed webhook now relies on initializeVectorIndex instead of inline env checks - AnalysisHistory: optional chaining on nullable currentAnalysis in JSX Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rer7V7cZWSBbwyo5KvYpkc
Imports landing.html, styles.css, and tokens/astryx.css from the GlamD design-system project. Hero video uses the stable GitHub-hosted source (the CDN URL in the design file carries an expiring signature). Image assets (assets/*.png) are referenced but not synced — export them from the design project into design-system/glamd/assets/ to complete. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rer7V7cZWSBbwyo5KvYpkc
## Core Issue Fixed - ExecutiveSummary now renders for zero-dimensional analyses by checking for executiveDigest in addition to analysis_markdown - extractExecutiveSummary updated to parse both markdown and digest structures - AnalysisHistory WIP section now displays when either markdown or digest exists ## CodeRabbit Review Findings Fixed **UI/Components:** - ExecutiveSummary: Fixed nested button HTML structure (button inside button invalid) - ExecutiveSummary: Added Sentry exception capture to clipboard copy catch block - DashboardContainer: Skeleton now uses TOTAL_DIMENSIONS instead of hardcoded 11 **Logging:** - useSSEStream: Gated diagnostic logs behind window.__CHAT_DEBUG - useChatStore: Gated readSSE debug logs behind isDebugEnabled() **Settings & Data Mapping:** - settings-adapter: Implemented explicit snake_case ↔ camelCase field mapping (fetchAdminSettings, fetchUserSettings, upsertUserSettings) - settings-adapter: Updated comment to reflect RLS policy (authenticated users only) - settings-context: Added Sentry capture to loadSettings catch block **Error Handling:** - error-handler: Changed business_logic message from "Invalid request" to "Request could not be processed" (neutral for 400/500) - chat/persist: Added Sentry monitoring for invalid signature verification failures **Code Quality:** - search/route & embed/route: Extracted duplicate initializeVectorIndex into shared utility @/lib/upstash-vector Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rer7V7cZWSBbwyo5KvYpkc
…Persistence Root-Cause Fix Includes the critical persist-pipeline fix: strict-schema stitching no longer wipes completed analyses over benign extra LLM keys, and the legacy validation webhook no longer clobbers validation_passed.
Summary
Completes architectural foundation for eliminating hard-coded configuration values and implements Dimension 0 (Synthesis Executive Digest) accordion component with advanced UX patterns.
Changes
1. Settings System Architecture (Foundation for Zero Hard-Coding)
New Files:
web/lib/types/settings.ts- AdminSettings, UserSettings, SettingsContextValue typesweb/lib/adapters/settings-adapter.ts- Database adapter for fetch/update operationsweb/lib/stores/settings-context.tsx- React context provider with hooksweb/lib/config/synthesis-with-settings.ts- Hook-based config access (useTotalDimensions, useSynthesisConfig, etc.)supabase/migrations/20260712_create_settings_tables.sql- Database schema with RLSKey Features:
admin_settingstableuser_settingstable with per-user RLS2. Phase 2 App Integration
Updated Files:
web/app/providers.tsx- Wrapped with SettingsProviderweb/components/templates/console/AnalysisHistory.tsx- Uses useTotalDimensions() hookweb/components/templates/console/DashboardContainer.tsx- Uses useTotalDimensions() hookweb/components/templates/console/DashboardMainContent.tsx- Uses useTotalDimensions() hookweb/hooks/useSSEStream.ts- Uses useSynthesisConfig() for STREAM_BUNDLES and ABORT_ON_PARTIAL_FAILUREBackward Compatibility:
synthesis.tsdefaults3. Dimension 0 Executive Summary Accordion Component
New Component:
web/components/organisms/ExecutiveSummary.tsxFeatures:
4 Multivariant Summaries:
Accordion Behavior:
Copy-to-Clipboard Feature:
Design Patterns:
4. WIP Section Display Logic Refinement
Updated:
web/components/templates/console/AnalysisHistory.tsxBehavior:
Model A Architecture
✅ 11 core dimensions (1-11) + Dimension 0 (synthesized Executive Digest)
✅ Parser recognizes dimensions 0-11
✅ All configuration values move from hard-code to settings system
Quality Metrics
Related Work
Next Steps
admin_settingstableuser_settingspreferencesGenerated by Claude Code — Parallel multi-agent implementation
🚀 Ready for merge and Vercel deployment
Generated by Claude Code
Summary by cubic
Replaces hard-coded synthesis config with a settings system and integrates the Dimension 0 Executive Summary into the WIP card. Fixes the analysis persistence wipe with strict-but-safe validation, sanitizes API errors, hardens SSE/chat handling, defers
@upstash/vectorand Redis initialization, and adds a static GlamD design-system landing page (no app runtime impact).Migration
supabase/migrations/20260712_create_settings_tables.sql.admin_settingsreadable by authenticated users;user_settingsscoped per-user.synthesis.tsdefaults; UI falls back if settings are empty. App is wrapped withSettingsProvider.Bug Fixes
__proto__/constructor/prototype, and log to Sentry; stops silent wipes. Validation webhook writes report-only and preservesvalidation_passed. Types/store carryexecutiveDigestthrough restore/init for zero-dimensional analyses.executiveDigestexists; real dimension count; fixes duplicate numbering; debug logs behindwindow.__CHAT_DEBUG. UCIS parser now recognizes dimensions 0–11.initializeVectorIndexfor@upstash/vector; used by search and embed webhooks; defer/skip when unset and return a sanitized “not configured” error; removed placeholder tokens; no module-level throws.createErrorResponseacrossanalyses,search, andchat/persistfor client-safe messages; Sentry capture on invalid signatures; chat SSE parser ignores null/primitive frames; added stream config validation logs inuseSSEStream.Written for commit 798482d. Summary will update on new commits.
Summary by CodeRabbit
New Features
Improvements
Bug Fixes