Skip to content

feat(ui): connect Lighthouse v2 to Cloud backend#11690

Draft
alejandrobailo wants to merge 19 commits into
masterfrom
feat/lighthouse-v2-cloud-ui
Draft

feat(ui): connect Lighthouse v2 to Cloud backend#11690
alejandrobailo wants to merge 19 commits into
masterfrom
feat/lighthouse-v2-cloud-ui

Conversation

@alejandrobailo

@alejandrobailo alejandrobailo commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Context

This PR consolidates the OSS UI side of the Lighthouse v2 migration. OSS keeps the current Lighthouse as v1, while Cloud routes can render Lighthouse v2 backed by the Django Cloud API.

Depends on Cloud backend PR: https://github.com/prowler-cloud/prowler-cloud/pull/4796

Description

  • Isolate legacy Lighthouse code under lighthouse-v1 namespaces and keep OSS behavior intact.
  • Add Lighthouse v2 types, JSON:API adapters, and Server Actions for Cloud config, providers/models, sessions, messages, streaming, and cancellation.
  • Add shadcn-based v2 configuration UI for providers, credentials, model selection, connection status, and business context.
  • Add v2 chat UI with historical sessions: list, search, open, create, rename, archive, prompt bootstrapping, SSE reducer, Stop handling, and 409/disconnect states.
  • Add Cloud-only Browse/Chat sidebar mode with chat history search and grouped sessions.
  • Keep the legacy /api/lighthouse/analyst route importing only v1 code.

Steps to review

  1. In OSS mode, verify /lighthouse, /lighthouse/config, findings CTA, and banners still use Lighthouse v1.
  2. In Cloud mode, verify /lighthouse/config and /lighthouse render v2 and route through ui/actions/lighthouse-v2.
  3. Review the EventSource flow and ensure generated stream URLs are not persisted or logged.
  4. Run:
pnpm --dir ui run healthcheck
pnpm --dir ui test:unit actions/lighthouse-v2/lighthouse-v2.adapter.test.ts lib/lighthouse-v2/event-reducer.test.ts

Checklist

Community Checklist
  • This feature/issue is listed in here or roadmap.prowler.com
  • Is it assigned to me, if not, request it via the issue/feature in here or Prowler Community Slack

SDK/CLI

  • Are there new checks included in this PR? No
    • If so, do we need to update permissions for the provider? Please review this carefully.

UI

  • All issue/task requirements work as expected on the UI
  • If this PR adds or updates npm dependencies, include package-health evidence (maintenance, popularity, known vulnerabilities, license, release age) and explain why existing/native alternatives are insufficient.
  • Screenshots/Video of the functionality flow (if applicable) - Mobile (X < 640px)
  • Screenshots/Video of the functionality flow (if applicable) - Table (640px > X < 1024px)
  • Screenshots/Video of the functionality flow (if applicable) - Desktop (X > 1024px)
  • Ensure new entries are added to CHANGELOG.md, if applicable.

API

  • All issue/task requirements work as expected on the API
  • Endpoint response output (if applicable)
  • EXPLAIN ANALYZE output for new/modified queries or indexes (if applicable)
  • Performance test results (if applicable)
  • Any other relevant evidence of the implementation (if applicable)
  • Verify if API specs need to be regenerated.
  • Check if version updates are required (e.g., specs, uv, etc.).
  • Ensure new entries are added to CHANGELOG.md, if applicable.

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: e3c816ac-298f-489b-8b4a-2757ff6f08aa

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/lighthouse-v2-cloud-ui

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

Conflict Markers Resolved

All conflict markers have been successfully resolved in this pull request.

@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

⚠️ Changes detected in the following folders without a corresponding update to the CHANGELOG.md:

  • ui

Please add an entry to the corresponding CHANGELOG.md file to maintain a clear history of changes.

@alejandrobailo alejandrobailo self-assigned this Jun 24, 2026
@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

🔒 Container Security Scan

Image: prowler-ui:9ae23fb
Last scan: 2026-06-25 19:02:20 UTC

✅ No Vulnerabilities Detected

The container image passed all security checks. No known CVEs were found.

📋 Resources:

Move actions/components/lib/types for lighthouse v2 into
app/(prowler)/lighthouse/_{actions,components,lib,types}, matching the
co-located feature architecture used by /alerts. Update importers
(page, settings, sidebar) and add an _actions barrel.

Scope AI Elements per version: keep the legacy primitives under
components/lighthouse-v1/ai-elements, and add clean v2 copies under
_components/ai-elements (no memo/useMemo, per React Compiler).
Add a same-origin Next.js route handler that reverse-proxies the Django
SSE stream, so the browser EventSource connects same-origin (no CORS)
and the access token stays server-side.

Drop the unused per-message stream URL and stop revalidating /lighthouse
on session create (the force-dynamic route would otherwise remount the
chat and tear down the EventSource).
Collapse the chain-of-thought by default with a pulsing Thinking header,
summarize tool calls as 'N tools called', and hide success outcomes.
Add a copy button and hover timestamps under each message (agent left,
user right).

Stream client: subscribe before POST without the open-event gate
(avoids a deadlock) and set the session URL with history.replaceState
instead of router.push (avoids remounting mid-stream).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant