fix: use appId in runtime query by Flo4604 ยท Pull Request #5330 ยท unkeyed/unkey
๐ Walkthrough
Walkthrough
The changes remove a ClickHouse migration and add appId field support throughout the runtime logs query flow, including TRPC routers, database queries, type utilities, and schema definitions to enable application-scoped runtime log retrieval.
Changes
| Cohort / File(s) | Summary |
|---|---|
ClickHouse Migration Removal pkg/clickhouse/migrations/20260126133933.sql |
Deleted migration that created the runtime_logs_raw_v1 table with columns, indexes, partitioning, and TTL configuration. |
TRPC Router Updates web/apps/dashboard/lib/trpc/routers/deploy/deployment/runtime-logs.ts |
Added appId: deployment.appId to the logs query parameters in getDeploymentRuntimeLogs. |
Query Logic & Type Utilities web/apps/dashboard/lib/trpc/routers/deploy/runtime-logs/query.ts, web/apps/dashboard/lib/trpc/routers/deploy/runtime-logs/utils.ts |
Refactored workspace/environment resolution to use ctx.workspace.id directly, removed explicit workspace retrieval, added project existence check, refined environment selection with fallback logic, updated ClickHouse payload to include environmentId and appId, extended transformFilters return type to omit appId. |
Schema Definitions web/internal/clickhouse/src/runtime-logs.ts |
Added appId: z.string() as a required field to runtimeLogsRequestSchema, enabling app-level filtering in runtime logs queries. |
Estimated code review effort
๐ฏ 3 (Moderate) | โฑ๏ธ ~20 minutes
๐ฅ Pre-merge checks | โ 2 | โ 1
โ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | โ ๏ธ Warning | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. |
โ Passed checks (2 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | โ Passed | The title concisely describes the main change: adding appId to runtime log queries for improved filtering accuracy. |
| Description check | โ Passed | The description covers what the PR does, type of change, testing instructions, and checklist, though some required checklist items are unchecked. |
โ๏ธ Tip: You can configure your own custom pre-merge checks in the settings.
โจ Finishing Touches
- ๐ Generate docstrings (stacked PR)
- ๐ Generate docstrings (commit on current branch)
๐งช Generate unit tests (beta)
- Create PR with unit tests
- Post copyable unit tests in a comment
- Commit unit tests in branch
03-16-fix_use_appid_in_runtime_query
๐ Coding Plan
- Generate coding plan for human review comments
Comment @coderabbitai help to get the list of available commands and usage tips.