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
๐ 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
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.