Skip to content

[pull] main from coder:main #102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions .claude/docs/DATABASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@

### Helper Scripts

| Script | Purpose |
|--------|---------|
| `./coderd/database/migrations/create_migration.sh "migration name"` | Creates new migration files |
| `./coderd/database/migrations/fix_migration_numbers.sh` | Renumbers migrations to avoid conflicts |
| `./coderd/database/migrations/create_fixture.sh "fixture name"` | Creates test fixtures for migrations |
| Script | Purpose |
|---------------------------------------------------------------------|-----------------------------------------|
| `./coderd/database/migrations/create_migration.sh "migration name"` | Creates new migration files |
| `./coderd/database/migrations/fix_migration_numbers.sh` | Renumbers migrations to avoid conflicts |
| `./coderd/database/migrations/create_fixture.sh "fixture name"` | Creates test fixtures for migrations |

### Database Query Organization

Expand Down Expand Up @@ -214,6 +214,5 @@ make lint
- [ ] Migration files exist (both up and down)
- [ ] `make gen` run after query changes
- [ ] Audit table updated for new fields
- [ ] In-memory database implementations updated
- [ ] Nullable fields use `sql.Null*` types
- [ ] Authorization context appropriate for endpoint type
1 change: 0 additions & 1 deletion .claude/docs/OAUTH2.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ Before completing OAuth2 or authentication feature work:
- [ ] Update RBAC permissions for new resources
- [ ] Add audit logging support if applicable
- [ ] Create database migrations with proper defaults
- [ ] Update in-memory database implementations
- [ ] Add comprehensive test coverage including edge cases
- [ ] Verify linting compliance
- [ ] Test both positive and negative scenarios
Expand Down
35 changes: 25 additions & 10 deletions .claude/docs/TROUBLESHOOTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,20 +116,33 @@ When facing multiple failing tests or complex integration issues:

### Useful Debug Commands

| Command | Purpose |
|---------|---------|
| `make lint` | Run all linters |
| `make gen` | Generate mocks, database queries |
| Command | Purpose |
|----------------------------------------------|---------------------------------------|
| `make lint` | Run all linters |
| `make gen` | Generate mocks, database queries |
| `go test -v ./path/to/package -run TestName` | Run specific test with verbose output |
| `go test -race ./...` | Run tests with race detector |
| `go test -race ./...` | Run tests with race detector |

### LSP Debugging

| Command | Purpose |
|---------|---------|
| `mcp__go-language-server__definition symbolName` | Find function definition |
| `mcp__go-language-server__references symbolName` | Find all references |
| `mcp__go-language-server__diagnostics filePath` | Check for compilation errors |
#### Go LSP (Backend)

| Command | Purpose |
|----------------------------------------------------|------------------------------|
| `mcp__go-language-server__definition symbolName` | Find function definition |
| `mcp__go-language-server__references symbolName` | Find all references |
| `mcp__go-language-server__diagnostics filePath` | Check for compilation errors |
| `mcp__go-language-server__hover filePath line col` | Get type information |

#### TypeScript LSP (Frontend)

| Command | Purpose |
|----------------------------------------------------------------------------|------------------------------------|
| `mcp__typescript-language-server__definition symbolName` | Find component/function definition |
| `mcp__typescript-language-server__references symbolName` | Find all component/type usages |
| `mcp__typescript-language-server__diagnostics filePath` | Check for TypeScript errors |
| `mcp__typescript-language-server__hover filePath line col` | Get type information |
| `mcp__typescript-language-server__rename_symbol filePath line col newName` | Rename across codebase |

## Common Error Messages

Expand Down Expand Up @@ -197,6 +210,8 @@ When facing multiple failing tests or complex integration issues:

- Check existing similar implementations in codebase
- Use LSP tools to understand code relationships
- For Go code: Use `mcp__go-language-server__*` commands
- For TypeScript/React code: Use `mcp__typescript-language-server__*` commands
- Read related test files for expected behavior

### External Resources
Expand Down
45 changes: 41 additions & 4 deletions .claude/docs/WORKFLOWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,11 @@

## Code Navigation and Investigation

### Using Go LSP Tools (STRONGLY RECOMMENDED)
### Using LSP Tools (STRONGLY RECOMMENDED)

**IMPORTANT**: Always use Go LSP tools for code navigation and understanding. These tools provide accurate, real-time analysis of the codebase and should be your first choice for code investigation.
**IMPORTANT**: Always use LSP tools for code navigation and understanding. These tools provide accurate, real-time analysis of the codebase and should be your first choice for code investigation.

#### Go LSP Tools (for backend code)

1. **Find function definitions** (USE THIS FREQUENTLY):
- `mcp__go-language-server__definition symbolName`
Expand All @@ -145,14 +147,49 @@
- `mcp__go-language-server__hover filePath line column`
- Get type information and documentation at specific positions

#### TypeScript LSP Tools (for frontend code in site/)

1. **Find component/function definitions** (USE THIS FREQUENTLY):
- `mcp__typescript-language-server__definition symbolName`
- Example: `mcp__typescript-language-server__definition LoginPage`
- Quickly navigate to React components, hooks, and utility functions

2. **Find symbol references** (ESSENTIAL FOR UNDERSTANDING IMPACT):
- `mcp__typescript-language-server__references symbolName`
- Locate all usages of components, types, or functions
- Critical for refactoring React components and understanding prop usage

3. **Get type information**:
- `mcp__typescript-language-server__hover filePath line column`
- Get TypeScript type information and JSDoc documentation

4. **Rename symbols safely**:
- `mcp__typescript-language-server__rename_symbol filePath line column newName`
- Rename components, props, or functions across the entire codebase

5. **Check for TypeScript errors**:
- `mcp__typescript-language-server__diagnostics filePath`
- Get compilation errors and warnings for a specific file

### Investigation Strategy (LSP-First Approach)

#### Backend Investigation (Go)

1. **Start with route registration** in `coderd/coderd.go` to understand API endpoints
2. **Use LSP `definition` lookup** to trace from route handlers to actual implementations
3. **Use LSP `references`** to understand how functions are called throughout the codebase
2. **Use Go LSP `definition` lookup** to trace from route handlers to actual implementations
3. **Use Go LSP `references`** to understand how functions are called throughout the codebase
4. **Follow the middleware chain** using LSP tools to understand request processing flow
5. **Check test files** for expected behavior and error patterns

#### Frontend Investigation (TypeScript/React)

1. **Start with route definitions** in `site/src/App.tsx` or router configuration
2. **Use TypeScript LSP `definition`** to navigate to React components and hooks
3. **Use TypeScript LSP `references`** to find all component usages and prop drilling
4. **Follow the component hierarchy** using LSP tools to understand data flow
5. **Check for TypeScript errors** with `diagnostics` before making changes
6. **Examine test files** (`.test.tsx`) for component behavior and expected props

## Troubleshooting Development Issues

### Common Issues
Expand Down
10 changes: 10 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,19 @@

### LSP Navigation (USE FIRST)

#### Go LSP (for backend code)

- **Find definitions**: `mcp__go-language-server__definition symbolName`
- **Find references**: `mcp__go-language-server__references symbolName`
- **Get type info**: `mcp__go-language-server__hover filePath line column`
- **Rename symbol**: `mcp__go-language-server__rename_symbol filePath line column newName`

#### TypeScript LSP (for frontend code in site/)

- **Find definitions**: `mcp__typescript-language-server__definition symbolName`
- **Find references**: `mcp__typescript-language-server__references symbolName`
- **Get type info**: `mcp__typescript-language-server__hover filePath line column`
- **Rename symbol**: `mcp__typescript-language-server__rename_symbol filePath line column newName`

### OAuth2 Error Handling

Expand Down
2 changes: 1 addition & 1 deletion examples/templates/gcp-vm-container/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ module "jetbrains_gateway" {
# See https://registry.terraform.io/modules/terraform-google-modules/container-vm
module "gce-container" {
source = "terraform-google-modules/container-vm/google"
version = "3.0.0"
version = "3.2.0"

container = {
image = "codercom/enterprise-base:ubuntu"
Expand Down
16 changes: 15 additions & 1 deletion site/CLAUDE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Frontend Development Guidelines

## TypeScript LSP Navigation (USE FIRST)

When investigating or editing TypeScript/React code, always use the TypeScript language server tools for accurate navigation:

- **Find component/function definitions**: `mcp__typescript-language-server__definition ComponentName`
- Example: `mcp__typescript-language-server__definition LoginPage`
- **Find all usages**: `mcp__typescript-language-server__references ComponentName`
- Example: `mcp__typescript-language-server__references useAuthenticate`
- **Get type information**: `mcp__typescript-language-server__hover site/src/pages/LoginPage.tsx 42 15`
- **Check for errors**: `mcp__typescript-language-server__diagnostics site/src/pages/LoginPage.tsx`
- **Rename symbols**: `mcp__typescript-language-server__rename_symbol site/src/components/Button.tsx 10 5 PrimaryButton`
- **Edit files**: `mcp__typescript-language-server__edit_file` for multi-line edits

## Bash commands

- `pnpm dev` - Start Vite development server
Expand Down Expand Up @@ -42,10 +55,11 @@

## Workflow

- Be sure to typecheck when youre done making a series of code changes
- Be sure to typecheck when you're done making a series of code changes
- Prefer running single tests, and not the whole test suite, for performance
- Some e2e tests require a license from the user to execute
- Use pnpm format before creating a PR
- **ALWAYS use TypeScript LSP tools first** when investigating code - don't manually search files

## Pre-PR Checklist

Expand Down
4 changes: 4 additions & 0 deletions site/static/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 1 addition & 43 deletions site/static/oauth2allow.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,49 +110,7 @@
<img class="app-icon" src="{{ .AppIcon }}" />
<div class="connect-symbol">+</div>
{{end}}
<svg
class="coder-svg"
viewBox="0 0 36 36"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<g clip-path="url(#clip0_1094_2915)">
<path
d="M32.9812 15.9039C32.326 15.9039 31.8894 15.5197 31.8894 14.7311V10.202C31.8894 7.31059 30.6982 5.71326 27.6211 5.71326H26.1917V8.76638H26.6285C27.8394 8.76638 28.4152 9.43363 28.4152 10.6266V14.63C28.4152 16.3689 28.9313 17.0766 30.0629 17.4405C28.9313 17.7843 28.4152 18.5122 28.4152 20.251C28.4152 21.2418 28.4152 22.2325 28.4152 23.2233C28.4152 24.0523 28.4152 24.8611 28.1968 25.69C27.9784 26.4584 27.6211 27.1863 27.1248 27.8131C26.8468 28.1771 26.5292 28.4803 26.1719 28.7635V29.1678H27.6012C30.6784 29.1678 31.8696 27.5705 31.8696 24.6791V20.1499C31.8696 19.3411 32.2863 18.9772 32.9614 18.9772H33.7754V15.924H32.9812V15.9039Z"
fill="white"
/>
<path
d="M23.2539 10.3239H18.8466C18.7473 10.3239 18.668 10.243 18.668 10.1419V9.79819C18.668 9.69707 18.7473 9.61621 18.8466 9.61621H23.2737C23.373 9.61621 23.4524 9.69707 23.4524 9.79819V10.1419C23.4524 10.243 23.3531 10.3239 23.2539 10.3239Z"
fill="white"
/>
<path
d="M24.0081 14.6911H20.792C20.6927 14.6911 20.6133 14.6102 20.6133 14.5091V14.1654C20.6133 14.0643 20.6927 13.9834 20.792 13.9834H24.0081C24.1074 13.9834 24.1867 14.0643 24.1867 14.1654V14.5091C24.1867 14.59 24.1074 14.6911 24.0081 14.6911Z"
fill="white"
/>
<path
d="M25.2788 12.5075H18.8466C18.7473 12.5075 18.668 12.4266 18.668 12.3255V11.9818C18.668 11.8807 18.7473 11.7998 18.8466 11.7998H25.2589C25.3582 11.7998 25.4376 11.8807 25.4376 11.9818V12.3255C25.4376 12.4064 25.3781 12.5075 25.2788 12.5075Z"
fill="white"
/>
<path
d="M13.7463 11.3141C14.183 11.3141 14.6198 11.3545 15.0367 11.4556V10.6266C15.0367 9.45384 15.6323 8.76638 16.8234 8.76638H17.2602V5.71326H15.8308C12.7536 5.71326 11.5625 7.31059 11.5625 10.202V11.6982C12.2573 11.4556 12.9919 11.3141 13.7463 11.3141Z"
fill="white"
/>
<path
d="M26.6312 22.313C26.3135 19.7451 24.368 17.6018 21.8666 17.1166C21.1718 16.9751 20.4769 16.9548 19.8019 17.0761C19.7821 17.0761 19.7821 17.0559 19.7622 17.0559C18.6703 14.7307 16.3278 13.194 13.7866 13.194C11.2455 13.194 8.92278 14.6902 7.811 17.0155C7.79115 17.0155 7.79115 17.0357 7.77131 17.0357C7.05664 16.9548 6.34193 16.9952 5.62723 17.1772C3.16553 17.7838 1.29939 19.8866 0.961901 22.4342C0.922196 22.6971 0.902344 22.9599 0.902344 23.2026C0.902344 23.9709 1.41851 24.6786 2.1729 24.7797C3.10597 24.9213 3.91992 24.1933 3.90007 23.2633C3.90007 23.1217 3.90007 22.9599 3.91992 22.8184C4.07875 21.5244 5.05151 20.4326 6.32206 20.1292C6.71913 20.0281 7.11618 20.0079 7.49337 20.0686C8.70438 20.2304 9.89551 19.6035 10.4117 18.5117C10.7889 17.7029 11.3845 16.9952 12.1786 16.611C13.052 16.1864 14.0447 16.1258 14.958 16.4493C15.9108 16.793 16.6255 17.5209 17.0623 18.4308C17.5189 19.3205 17.7372 19.9473 18.7101 20.0686C19.1071 20.1292 20.2188 20.109 20.6357 20.0888C21.4497 20.0888 22.2637 20.3719 22.8394 20.9582C23.2165 21.3626 23.4945 21.8681 23.6136 22.4342C23.7923 23.3441 23.5739 24.254 23.0379 24.9414C22.6606 25.4267 22.1445 25.7907 21.5688 25.9524C21.2908 26.0333 21.0129 26.0535 20.735 26.0535C20.5762 26.0535 20.3578 26.0535 20.0997 26.0535C19.3057 26.0535 17.6182 26.0535 16.3476 26.0535C15.4741 26.0535 14.7792 25.3459 14.7792 24.4562V21.4637V18.5319C14.7792 18.2893 14.5807 18.0871 14.3425 18.0871H13.727C12.516 18.1073 11.5433 19.4823 11.5433 20.938C11.5433 22.3938 11.5433 26.2558 11.5433 26.2558C11.5433 27.8329 12.794 29.1067 14.3425 29.1067C14.3425 29.1067 21.2313 29.0864 21.3306 29.0864C22.9187 28.9247 24.3879 28.0957 25.3804 26.8219C26.3731 25.5885 26.8297 23.9709 26.6312 22.313Z"
fill="white"
/>
</g>
<defs>
<clipPath id="clip0_1094_2915">
<rect
width="33.0769"
height="23.4545"
fill="white"
transform="translate(0.902344 5.71326)"
/>
</clipPath>
</defs>
</svg>
<img class="coder-svg" src="/logo.svg" alt="Coder" />
</div>
<h1>Authorize {{ .AppName }}</h1>
<p>
Expand Down
Loading