Skip to content

Commit cc4c218

Browse files
authored
Merge branch 'main' into cj/dogfood-license
2 parents 2a92d9d + 2ea807f commit cc4c218

File tree

523 files changed

+4964
-2383
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

523 files changed

+4964
-2383
lines changed

.editorconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,11 @@ indent_size = 2
1818
[coderd/database/dump.sql]
1919
indent_style = space
2020
indent_size = 4
21+
22+
[coderd/database/queries/*.sql]
23+
indent_style = tab
24+
indent_size = 4
25+
26+
[coderd/database/migrations/*.sql]
27+
indent_style = tab
28+
indent_size = 4

.github/workflows/typos.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ HELO = "HELO"
2828
LKE = "LKE"
2929
byt = "byt"
3030
typ = "typ"
31+
Inferrable = "Inferrable"
3132

3233
[files]
3334
extend-exclude = [
@@ -47,5 +48,5 @@ extend-exclude = [
4748
"provisioner/terraform/testdata/**",
4849
# notifications' golden files confuse the detector because of quoted-printable encoding
4950
"coderd/notifications/testdata/**",
50-
"agent/agentcontainers/testdata/devcontainercli/**"
51+
"agent/agentcontainers/testdata/devcontainercli/**",
5152
]

.vscode/settings.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"[javascript][javascriptreact][json][jsonc][typescript][typescriptreact]": {
5050
"editor.defaultFormatter": "biomejs.biome",
5151
"editor.codeActionsOnSave": {
52-
"quickfix.biome": "explicit"
52+
"source.fixAll.biome": "explicit"
5353
// "source.organizeImports.biome": "explicit"
5454
}
5555
},
@@ -60,5 +60,7 @@
6060
"typos.config": ".github/workflows/typos.toml",
6161
"[markdown]": {
6262
"editor.defaultFormatter": "DavidAnson.vscode-markdownlint"
63-
}
63+
},
64+
"biome.configurationPath": "./site/biome.jsonc",
65+
"biome.lsp.bin": "./site/node_modules/.bin/biome"
6466
}

CODEOWNERS

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ tailnet/proto/ @spikecurtis @johnstcn
77
vpn/vpn.proto @spikecurtis @johnstcn
88
vpn/version.go @spikecurtis @johnstcn
99

10-
1110
# This caching code is particularly tricky, and one must be very careful when
1211
# altering it.
1312
coderd/files/ @aslilac
@@ -34,3 +33,8 @@ site/CLAUDE.md
3433
# requires elite ball knowledge of most of the scheduling code to make changes
3534
# without inadvertently affecting other parts of the codebase.
3635
coderd/schedule/autostop.go @deansheather @DanielleMaywood
36+
37+
# Usage tracking code requires intimate knowledge of Tallyman and Metronome, as
38+
# well as guidance from revenue.
39+
coderd/usage/ @deansheather @spikecurtis
40+
enterprise/coderd/usage/ @deansheather @spikecurtis

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,7 @@ lint/go:
576576
./scripts/check_codersdk_imports.sh
577577
linter_ver=$(shell egrep -o 'GOLANGCI_LINT_VERSION=\S+' dogfood/coder/Dockerfile | cut -d '=' -f 2)
578578
go run github.com/golangci/golangci-lint/cmd/golangci-lint@v$$linter_ver run
579+
go run github.com/coder/paralleltestctx/cmd/paralleltestctx@v0.0.1 -custom-funcs="testutil.Context" ./...
579580
.PHONY: lint/go
580581

581582
lint/examples:

agent/agent_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,6 @@ func TestAgent_GitSSH(t *testing.T) {
456456

457457
func TestAgent_SessionTTYShell(t *testing.T) {
458458
t.Parallel()
459-
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
460-
t.Cleanup(cancel)
461459
if runtime.GOOS == "windows" {
462460
// This might be our implementation, or ConPTY itself.
463461
// It's difficult to find extensive tests for it, so
@@ -468,6 +466,7 @@ func TestAgent_SessionTTYShell(t *testing.T) {
468466
for _, port := range sshPorts {
469467
t.Run(fmt.Sprintf("(%d)", port), func(t *testing.T) {
470468
t.Parallel()
469+
ctx := testutil.Context(t, testutil.WaitShort)
471470

472471
session := setupSSHSessionOnPort(t, agentsdk.Manifest{}, codersdk.ServiceBannerConfig{}, nil, port)
473472
command := "sh"

agent/agentcontainers/api.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,11 @@ func (api *API) broadcastUpdatesLocked() {
763763
func (api *API) watchContainers(rw http.ResponseWriter, r *http.Request) {
764764
ctx := r.Context()
765765

766-
conn, err := websocket.Accept(rw, r, nil)
766+
conn, err := websocket.Accept(rw, r, &websocket.AcceptOptions{
767+
// We want `NoContextTakeover` compression to balance improving
768+
// bandwidth cost/latency with minimal memory usage overhead.
769+
CompressionMode: websocket.CompressionNoContextTakeover,
770+
})
767771
if err != nil {
768772
httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{
769773
Message: "Failed to upgrade connection to websocket.",

agent/agentcontainers/containers_dockercli_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ func TestIntegrationDockerCLI(t *testing.T) {
5555
}, testutil.WaitShort, testutil.IntervalSlow, "Container did not start in time")
5656

5757
dcli := agentcontainers.NewDockerCLI(agentexec.DefaultExecer)
58-
ctx := testutil.Context(t, testutil.WaitMedium) // Longer timeout for multiple subtests
5958
containerName := strings.TrimPrefix(ct.Container.Name, "/")
6059

6160
t.Run("DetectArchitecture", func(t *testing.T) {
6261
t.Parallel()
62+
ctx := testutil.Context(t, testutil.WaitShort)
6363

6464
arch, err := dcli.DetectArchitecture(ctx, containerName)
6565
require.NoError(t, err, "DetectArchitecture failed")
@@ -71,6 +71,7 @@ func TestIntegrationDockerCLI(t *testing.T) {
7171

7272
t.Run("Copy", func(t *testing.T) {
7373
t.Parallel()
74+
ctx := testutil.Context(t, testutil.WaitShort)
7475

7576
want := "Help, I'm trapped!"
7677
tempFile := filepath.Join(t.TempDir(), "test-file.txt")
@@ -90,6 +91,7 @@ func TestIntegrationDockerCLI(t *testing.T) {
9091

9192
t.Run("ExecAs", func(t *testing.T) {
9293
t.Parallel()
94+
ctx := testutil.Context(t, testutil.WaitShort)
9395

9496
// Test ExecAs without specifying user (should use container's default).
9597
want := "root"

biome.jsonc

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{
2+
"vcs": {
3+
"enabled": true,
4+
"clientKind": "git",
5+
"useIgnoreFile": true,
6+
"defaultBranch": "main"
7+
},
8+
"files": {
9+
"includes": [
10+
"**",
11+
"!**/pnpm-lock.yaml"
12+
],
13+
"ignoreUnknown": true
14+
},
15+
"linter": {
16+
"rules": {
17+
"a11y": {
18+
"noSvgWithoutTitle": "off",
19+
"useButtonType": "off",
20+
"useSemanticElements": "off",
21+
"noStaticElementInteractions": "off"
22+
},
23+
"correctness": {
24+
"noUnusedImports": "warn",
25+
"useUniqueElementIds": "off", // TODO: This is new but we want to fix it
26+
"noNestedComponentDefinitions": "off", // TODO: Investigate, since it is used by shadcn components
27+
"noUnusedVariables": {
28+
"level": "warn",
29+
"options": {
30+
"ignoreRestSiblings": true
31+
}
32+
}
33+
},
34+
"style": {
35+
"noNonNullAssertion": "off",
36+
"noParameterAssign": "off",
37+
"useDefaultParameterLast": "off",
38+
"useSelfClosingElements": "off",
39+
"useAsConstAssertion": "error",
40+
"useEnumInitializers": "error",
41+
"useSingleVarDeclarator": "error",
42+
"noUnusedTemplateLiteral": "error",
43+
"useNumberNamespace": "error",
44+
"noInferrableTypes": "error",
45+
"noUselessElse": "error",
46+
"noRestrictedImports": {
47+
"level": "error",
48+
"options": {
49+
"paths": {
50+
"@mui/material": "Use @mui/material/<name> instead. See: https://material-ui.com/guides/minimizing-bundle-size/.",
51+
"@mui/icons-material": "Use @mui/icons-material/<name> instead. See: https://material-ui.com/guides/minimizing-bundle-size/.",
52+
"@mui/material/Avatar": "Use components/Avatar/Avatar instead.",
53+
"@mui/material/Alert": "Use components/Alert/Alert instead.",
54+
"@mui/material/Popover": "Use components/Popover/Popover instead.",
55+
"@mui/material/Typography": "Use native HTML elements instead. Eg: <span>, <p>, <h1>, etc.",
56+
"@mui/material/Box": "Use a <div> instead.",
57+
"@mui/material/styles": "Import from @emotion/react instead.",
58+
"lodash": "Use lodash/<name> instead."
59+
}
60+
}
61+
}
62+
},
63+
"suspicious": {
64+
"noArrayIndexKey": "off",
65+
"noThenProperty": "off",
66+
"noTemplateCurlyInString": "off",
67+
"useIterableCallbackReturn": "off",
68+
"noUnknownAtRules": "off", // Allow Tailwind directives
69+
"noConsole": {
70+
"level": "error",
71+
"options": {
72+
"allow": [
73+
"error",
74+
"info",
75+
"warn"
76+
]
77+
}
78+
}
79+
},
80+
"complexity": {
81+
"noImportantStyles": "off" // TODO: check and fix !important styles
82+
}
83+
}
84+
},
85+
"$schema": "https://biomejs.dev/schemas/2.2.0/schema.json"
86+
}

coderd/apidoc/docs.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)