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.