Files
supabase/apps/studio/data/logs
6612073428 feat(studio): add bounded request correlation queries (#50840)
Add tested query support for correlating logs by request and execution
IDs across API Gateway, Auth, Storage, and Edge Functions. Queries are
source-scoped, time-bounded, and limited to 200 rows, with at most one
additional lookup to follow a newly discovered execution ID.

This data-only layer introduces no UI or automatic requests. The
Timeline tab consumes its query options in #50836. Overview and request
correlation share a cached source-and-attributes lookup, including
concurrent requests. Cancelling a timeline preserves any shared overview
lookup. The new query is exercised through MSW without mocking React
Query hooks.

### How to test

This is a data-only PR. From the repository root, run:

```sh
pnpm --filter studio exec vitest run components/interfaces/UnifiedLogs/UnifiedLogs.queries.test.ts data/logs/unified-log-request-timeline-query.test.ts
```

The tests exercise source-scoped IDs, SQL escaping, time/row limits,
missing IDs, failed requests, the additional execution-ID lookup,
attribute-cache reuse in both navigation orders and concurrently, and
cancellation through MSW.

### Validation

- Synced with master; verified head
`a60bcf0565e0e3477779665660e871eec2edd2c8`.
- Focused unit/MSW baseline and shuffled seed 5084028: 121 tests across
seven files passed with retries disabled. Independent shuffled run, seed
5084029: 117 tests across six files passed.
- Correlation, shared lookup/cache, cancellation, and the 400-second
function boundary are covered. Behavioral mutation checks detect
shared-lookup cancellation and a shortened execution window.
- Matching studio-staging preview smoke check passed for existing
grouped overview attributes and complete copied Raw JSON metadata.
- All four unit-test shards, all four E2E shards, typecheck, formatting,
lint ratchet, knip, and Studio Docker build passed on this head.
- Independent review found no actionable issues; no unresolved review
threads.

### Stack

Based on the logs table building blocks stack, which merges first:
#50953 → #50954 → #50955 → #50957 → #50958 → #52281. Then merge in
order:

1. #50835 — grouped log overviews and raw JSON
2. #50840 — request correlation queries
3. #50836 — request timeline UI and folding
4. #50841 — shared Auth user details
5. #50837 — log user correlation and Auth activity

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Jordi Enric <jordi.err@gmail.com>
2026-10-28 14:41:49 +01:00
..