• Mohamed Aziz Mejri's avatar
    Aggregating logs accross sources and improving logs viewer (#1956) · cc811a40
    Mohamed Aziz Mejri 提交于
    <!-- This is an auto-generated description by cubic. -->
    ---
    ## Summary by cubic
    Aggregates logs from client console, network requests, and Supabase Edge
    Functions into one console with filters and virtualization for faster
    debugging. Improves the preview console UX with better filtering,
    auto-scroll, and “send to chat”.
    
    - **New Features**
    - Unified log stream: new appConsoleEntriesAtom and combined,
    time-sorted entries (client console, network requests, edge-function,
    build-time).
    - Client capture: injects console interceptor and a Service Worker to
    track fetch requests/responses/errors; forwarded via postMessage.
    - Supabase Edge Function logs: new IPC handler and admin client query;
    incremental polling via last timestamp; function name extracted for
    source filtering.
    - Console UI: level/type/source filters, log count, virtualized list
    with react-virtuoso, auto-scroll when near bottom, clear filters, and
    “send to chat” per entry.
    - Preview iframe: forwards console logs, network events, and
    build/runtime errors into unified logs with proper levels.
    
    - **Dependencies**
      - Added react-virtuoso.
    
    <sup>Written for commit c8390c5ef9ab2def1135052f04156368b2b9d5d0.
    Summary will update automatically on new commits.</sup>
    
    <!-- End of auto-generated description by cubic. -->
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    <!-- CURSOR_SUMMARY -->
    ---
    
    > [!NOTE]
    > Brings a unified, performant logs console and multi-source aggregation
    for easier debugging.
    > 
    > - Introduces `appConsoleEntriesAtom` and removes `appOutputAtom`;
    resets logs on app switch
    > - Captures client logs via injected `worker/dyad_logs.js` and forwards
    to parent; displays in `Console` with `ConsoleEntry` UI
    > - Intercepts network requests/responses/errors via Service Worker
    (`worker/dyad-sw.js`, registered by `dyad-sw-register.js`); proxy serves
    SW and injects scripts
    > - Adds Supabase Edge Function logs: IPC handler
    `supabase:get-edge-logs`, admin query `getSupabaseProjectLogs`, polling
    via `useSupabase.loadEdgeLogs`, and `lastLogTimestampAtom`; function
    name extracted for source tags
    > - Updates `PreviewIframe` to forward console/network events and
    runtime errors into unified log stream
    > - New console UI (`Console.tsx`, `ConsoleFilters.tsx`,
    `ConsoleEntry.tsx`) with level/type/source filters, auto-scroll, and
    list virtualization via `react-virtuoso` (disabled in E2E via
    `E2E_TEST_BUILD`)
    > - Adds "Send to chat" action per log and "Clear" filter control;
    increases CI timeout; adds e2e tests for logs, network, chat export, and
    filter clearing
    > - Exposes `E2E_TEST_BUILD` via `get-env-vars`; adds dependency
    `react-virtuoso`
    > 
    > <sup>Written by [Cursor
    Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
    0c10230f707c2e6f1968bad428b16fe1f56c039f. This will update automatically
    on new commits. Configure
    [here](https://cursor.com/dashboard?tab=bugbot).</sup>
    <!-- /CURSOR_SUMMARY -->
    cc811a40