feat: show matching dockerfiles by Flo4604 ยท Pull Request #5299 ยท unkeyed/unkey

No actionable comments were generated in the recent review. ๐ŸŽ‰

โ„น๏ธ Recent review info
โš™๏ธ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 86dea748-294f-4952-89b5-acdc7be922ed

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between ad87f01 and fff282d.

๐Ÿ“’ Files selected for processing (1)
  • web/apps/dashboard/app/(app)/[workspaceSlug]/projects/[projectId]/(overview)/settings/components/build-settings/use-repo-tree.ts
๐Ÿšง Files skipped from review as they are similar to previous changes (1)
  • web/apps/dashboard/app/(app)/[workspaceSlug]/projects/[projectId]/(overview)/settings/components/build-settings/use-repo-tree.ts

๐Ÿ“ Walkthrough

Walkthrough

Adds a repo-tree validation system and UI improvements: new useRepoTree hook fetches GitHub repo trees via TRPC; Combobox becomes creatable and is used in Dockerfile/root-directory settings with case-insensitive validation, suggestions, and contextual warnings; GitHub/TRPC and MySQL schema updated.

Changes

Cohort / File(s) Summary
Dockerfile Settings
web/apps/dashboard/app/(app)/[workspaceSlug]/projects/[projectId]/(overview)/settings/components/build-settings/dockerfile-settings.tsx
Replaces input with controlled FormCombobox; integrates useRepoTree (validateDockerfilePath, findDockerfileCaseMatch, getDockerfilesForContext); adds validation, case-match suggestion, memoized options, variant/warning UI, creatable handling, and uses setValue.
Root Directory Settings
web/apps/dashboard/app/(app)/[workspaceSlug]/projects/[projectId]/(overview)/settings/components/build-settings/root-directory-settings.tsx
Uses useRepoTree to validate root paths, offer case-insensitive suggestions, compute input variant and warningMessage, and wire actionable suggestion via setValue; updates dynamic description/validation before save.
Repository Tree Hook
web/apps/dashboard/app/(app)/[workspaceSlug]/projects/[projectId]/(overview)/settings/components/build-settings/use-repo-tree.ts
New useRepoTree() hook: fetches repo tree via TRPC, normalizes/resolve paths against dockerContext, builds case-insensitive lookup, and exposes validatePath, findCaseInsensitiveMatch, validateDockerfilePath, findDockerfileCaseMatch, getDockerfilesForContext.
Combobox UI
web/apps/dashboard/components/ui/combobox.tsx, web/apps/dashboard/components/ui/form-combobox.tsx
Adds creatable prop and local search state to Combobox (shows "Use """ for non-matching input), resets/clears search on close/select; forwards variant from FormCombobox to FormDescription.
GitHub client & TRPC
web/apps/dashboard/lib/github.ts, web/apps/dashboard/lib/trpc/routers/github.ts
repositoryTreeSchema gains optional truncated; getRepositoryTree returns { tree, truncated }; adds checkFileExists; TRPC exposes getRepoTree route, surfaces installationId/defaultBranch, and returns tree or null on truncation/error; truncated trees trigger targeted existence checks.
Database schema change
pkg/mysql/schema.sql
Alters unique constraint on cilium_network_policies: removes k8s_name from UNIQUE, changing from UNIQUE(deployment_id,region_id,k8s_name) to UNIQUE(deployment_id,region_id).

Sequence Diagram

sequenceDiagram
    participant User as User
    participant Settings as Settings Component
    participant Combobox as Combobox UI
    participant Hook as useRepoTree Hook
    participant TRPC as TRPC Router
    participant GitHub as GitHub API

    User->>Settings: Type Dockerfile/root path
    Settings->>Combobox: Render options / current value
    Settings->>Hook: validateDockerfilePath(path, dockerContext)
    Hook->>TRPC: query getRepoTree(projectId)
    TRPC->>GitHub: fetch repository tree (owner/repo, branch, installationId)
    GitHub-->>TRPC: return tree + truncated flag
    alt truncated
        TRPC->>GitHub: check specific file existence
        GitHub-->>TRPC: file exists? 
    end
    TRPC-->>Hook: return tree data / existence result
    Hook->>Hook: build case-insensitive map / find matches
    Hook-->>Settings: validation result (+ caseMatch / dockerfiles list)
    Settings->>Combobox: update options, variant, and warningMessage
    Combobox-->>User: display suggestions and creatable option
    User->>Combobox: select suggestion or custom value
    Combobox-->>Settings: emit selected value
    Settings->>Settings: call setValue(...) and update form state
Loading

Estimated code review effort

๐ŸŽฏ 4 (Complex) | โฑ๏ธ ~45 minutes

๐Ÿšฅ Pre-merge checks | โœ… 2 | โŒ 1

โŒ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage โš ๏ธ Warning Docstring coverage is 50.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 'feat: show matching dockerfiles' clearly and concisely summarizes the main enhancement: adding detection and display of matching Dockerfiles in the settings UI.
Description check โœ… Passed The description comprehensively covers the PR purpose, implementation details, testing instructions, and includes visual screenshots demonstrating the feature. It addresses all critical template sections including type of change and testing guidance.

โœ๏ธ 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-12-feat_show_matching_dockerfiles
๐Ÿ“ Coding Plan
  • Generate coding plan for human review comments

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