Compare commits

..

65 Commits

Author SHA1 Message Date
Paweł Banaszewski d4c7cb2021 feat(aibridged): add overload protection with rate limiting and concurrency control
This adds configurable overload protection to the AI Bridge daemon to prevent
the server from being overwhelmed during periods of high load.

New configuration options:
- CODER_AIBRIDGE_MAX_CONCURRENCY: Maximum number of concurrent AI Bridge requests (0 to disable)
- CODER_AIBRIDGE_RATE_LIMIT: Maximum number of requests per rate window (0 to disable)
- CODER_AIBRIDGE_RATE_WINDOW: Duration of the rate limiting window (default: 1m)

When limits are exceeded:
- Concurrency limit: Returns HTTP 503 Service Unavailable
- Rate limit: Returns HTTP 429 Too Many Requests

The overload protection middleware wraps the aibridged HTTP handler and provides:
- Concurrency limiting using an atomic counter
- Rate limiting using the go-chi/httprate library

Both protections are optional and disabled by default (0 values).

Fixes coder/internal#1153
2025-12-08 11:17:58 +00:00
Jake Howell 25400fedca fix: update colors and theme in error.html (#20941)
### Description

This pull-request ensures that we're using the right colors (and
themeing things within the actual coder brand) on the `error.html` page.
Furthermore, I went ahead and cleaned up the CSS Variables and converted
all `px` units to a standard `rem` unit (16px base).

### Preview

<img width="3516" height="2388" alt="CleanShot 2025-12-02 at 11 09
55@2x"
src="https://github.com/user-attachments/assets/781623ea-a487-4a2e-a08e-bec86d6de6f5"
/>
2025-12-08 14:32:18 +11:00
Andrew Aquino 82bb833099 docs: update AI Bridge description for H2 2025 (#21126)
@suman-bisht This file is the source for docs pages' SEO description +
automatically generated preview image on coder.com
2025-12-05 14:36:39 -08:00
Mathias Fredriksson 61beb7bfa8 docs: rewrite dev containers documentation for GA (#21080)
docs: rewrite dev containers documentation for GA

Corrects inaccuracies in SSH examples (deprecated `--container` flag),
port forwarding (native sub-agent forwarding is primary), and
prerequisites (dev containers are on by default). Fixes template
descriptions: docker-devcontainer uses native Dev Containers while
AWS/Kubernetes templates use Envbuilder.

Renames admin docs folder from `devcontainers/` to `envbuilder/` to
reflect actual content. Adds customization guide documenting agent
naming, display apps, custom apps, and variable interpolation. Documents
multi-repo workspace support and adds note about Terraform module
limitations with sub-agents. Fixes module registry URLs.

Refs #18907
2025-12-05 19:42:16 +02:00
blinkagent[bot] b4be5bcfed docs: fix swagger tags for license endpoints (#21101)
## Summary

Change `@Tags` from `Organizations` to `Enterprise` for `POST /licenses`
and `POST /licenses/refresh-entitlements` to match the `GET` and
`DELETE` license endpoints which are already tagged as `Enterprise`.

## Problem

The license API endpoints were inconsistently tagged in the swagger
annotations:
- `GET /licenses` → `Enterprise` ✓
- `DELETE /licenses/{id}` → `Enterprise` ✓
- `POST /licenses` → `Organizations` ✗
- `POST /licenses/refresh-entitlements` → `Organizations` ✗

This caused the POST endpoints to be documented in the [Organizations
API docs](https://coder.com/docs/reference/api/organizations) instead of
the [Enterprise API
docs](https://coder.com/docs/reference/api/enterprise) where the other
license endpoints live.

## Fix

Simply updated the `@Tags` annotation from `Organizations` to
`Enterprise` for both POST endpoints.

This was an oversight from the original swagger docs addition in #5625
(January 2023).

Co-authored-by: blink-so[bot] <211532188+blink-so[bot]@users.noreply.github.com>
2025-12-05 15:27:22 +00:00
dependabot[bot] ceaba0778e chore: bump github.com/brianvoe/gofakeit/v7 from 7.9.0 to 7.12.1 (#21096)
Bumps
[github.com/brianvoe/gofakeit/v7](https://github.com/brianvoe/gofakeit)
from 7.9.0 to 7.12.1.
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/brianvoe/gofakeit/commit/6cb292655fc27bb9c5d81cb2bf2c5596313740e3"><code>6cb2926</code></a>
go mod - change back to 1.22</li>
<li><a
href="https://github.com/brianvoe/gofakeit/commit/5a2657afecd681df23c4dd8664216db5fe26c805"><code>5a2657a</code></a>
lookup - updated keywords to not have the display name in the keywords
list</li>
<li><a
href="https://github.com/brianvoe/gofakeit/commit/67d31c1b536d7bfe3e8a34d954afc6e9583b15ff"><code>67d31c1</code></a>
person - added ethnicity</li>
<li><a
href="https://github.com/brianvoe/gofakeit/commit/ae0414ce24587529911ca8de6b886d7d9810c0ef"><code>ae0414c</code></a>
lookup - added test to make sure display is not in keywords</li>
<li><a
href="https://github.com/brianvoe/gofakeit/commit/6f01995ab4278531359da913268f2e058becbb92"><code>6f01995</code></a>
user agent - added api user agent</li>
<li><a
href="https://github.com/brianvoe/gofakeit/commit/e4c26beca835cc4262566104db199c6061ae02d2"><code>e4c26be</code></a>
person - added age</li>
<li><a
href="https://github.com/brianvoe/gofakeit/commit/dcf08aee21636c27ef87ca9b4b5424af85fa4991"><code>dcf08ae</code></a>
funclookup concurrency - cleaned up focused verbage more on concurrency.
also...</li>
<li><a
href="https://github.com/brianvoe/gofakeit/commit/1a45942dacb4b0b98d3e7e563033f87f1d34c364"><code>1a45942</code></a>
Merge pull request <a
href="https://redirect.github.com/brianvoe/gofakeit/issues/390">#390</a>
from AdamDrewsTR/race-conditions-fix</li>
<li><a
href="https://github.com/brianvoe/gofakeit/commit/c03d3c83a271e9d543eab20387263adfd639037b"><code>c03d3c8</code></a>
fix: resolve concurrent map read/write race conditions by implementing
RWMute...</li>
<li><a
href="https://github.com/brianvoe/gofakeit/commit/a0380da0d95ea14b94e21a7a1d953e595eb5226f"><code>a0380da</code></a>
refactor: consolidate race condition tests into concurrency_test.go and
remov...</li>
<li>Additional commits viewable in <a
href="https://github.com/brianvoe/gofakeit/compare/v7.9.0...v7.12.1">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github.com/brianvoe/gofakeit/v7&package-manager=go_modules&previous-version=7.9.0&new-version=7.12.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-05 15:13:33 +00:00
Paweł Banaszewski e24cc5e6da feat: add tracing to aibridge (#21106)
Adds tracing for AIBridge.
Updates github.com/coder/aibridge version from `v0.2.2` to `v0.3.0`

Depends on: https://github.com/coder/aibridge/pull/63
Fixes: https://github.com/coder/aibridge/issues/26

---------

Co-authored-by: Danny Kopping <danny@coder.com>
2025-12-05 15:59:52 +01:00
Danny Kopping 259dee2ea8 fix: move contexts to appropriate locations (#21121)
Closes https://github.com/coder/internal/issues/1173,
https://github.com/coder/internal/issues/1174

Currently these two tests are flaky because the contexts were created
before a potentially long-running process. By the time the context was
actually used, it may have timed out - leading to confusion.

Additionally, the `ExpectMatch` calls were not using the test context -
but rather a background context. I've marked that func as deprecated
because we should always tie these to the test context.

Special thanks to @mafredri for the brain probe 🧠

---------

Signed-off-by: Danny Kopping <danny@coder.com>
2025-12-05 13:14:35 +00:00
DevCats 8e0516a19c chore: add support for antigravity external app protocol (#20873)
Adds `antigravity` to the allowed protocols list.

Related PR:
https://github.com/coder/registry/pull/558
2025-12-05 13:09:58 +00:00
Jakub Domeracki 770fdb377c chore: update react to apply patch for CVE-2025-55182 (#21084)
Reference:

https://react.dev/blog/2025/12/03/critical-security-vulnerability-in-react-server-components
2025-12-05 09:49:59 +01:00
Callum Styan 83dbf73dde perf: don't calculate build times for deleted templates (#21072)
The metrics cache to calculate and expose build time metrics for
templates currently calls `GetTemplates`, which returns all templates
even if they are deleted. We can use the `GetTemplatesWithFilter` query
to easily filter out deleted templates from the results, and thus not
call `GetTemplateAverageBuildTime` for those deleted templates. Delete
time for workspaces for non-deleted templates is still calculated.

Signed-off-by: Callum Styan <callumstyan@gmail.com>
2025-12-04 10:27:56 -08:00
Mathias Fredriksson 0ab23abb19 refactor(site): convert workspace batch delete dialog to Tailwind CSS (#20946)
Converts from Emotion to Tailwind CSS, based on the tasks batch delete
dialog implementation.

Also propagates simplifications back to the tasks dialog:
- Use `border-border` instead of hardcoded color variants
- Use `max-h-48` instead of specific `max-h-[184px]`
- Add cancel button to workspaces dialog

Refs #20905
2025-12-04 20:10:21 +02:00
david-fraley c4bf5a2d81 docs: add ESR to Release Channels (#21060) 2025-12-04 11:43:32 -06:00
Mathias Fredriksson 5cb02a6cc0 refactor(site): remove redundant client-side sorting of app statuses (#21102)
Depends on #21099
2025-12-04 18:55:45 +02:00
Mathias Fredriksson cfdd4a9b88 perf(coderd/database): add index on workspace_app_statuses.app_id (#21099) 2025-12-04 17:56:13 +02:00
Mathias Fredriksson d9159103cd fix(agent/agentcontainers): broadcast devcontainer dirty status over websocket (#21100) 2025-12-04 16:11:03 +02:00
Mathias Fredriksson 532a1f3054 fix(coderd): exclude sub-agents from workspace health calculation (#21098) 2025-12-04 15:38:24 +02:00
dependabot[bot] 6aeb144a98 chore: bump google.golang.org/api from 0.256.0 to 0.257.0 (#21094)
Bumps
[google.golang.org/api](https://github.com/googleapis/google-api-go-client)
from 0.256.0 to 0.257.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/googleapis/google-api-go-client/releases">google.golang.org/api's
releases</a>.</em></p>
<blockquote>
<h2>v0.257.0</h2>
<h2><a
href="https://github.com/googleapis/google-api-go-client/compare/v0.256.0...v0.257.0">0.257.0</a>
(2025-12-02)</h2>
<h3>Features</h3>
<ul>
<li><strong>all:</strong> Auto-regenerate discovery clients (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3376">#3376</a>)
(<a
href="https://github.com/googleapis/google-api-go-client/commit/b0c07d2f5cc4aa2cf974c2938508626f8430855e">b0c07d2</a>)</li>
<li><strong>all:</strong> Auto-regenerate discovery clients (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3380">#3380</a>)
(<a
href="https://github.com/googleapis/google-api-go-client/commit/47fcc39088f806c4202ca47159416ce99a0a0c72">47fcc39</a>)</li>
<li><strong>all:</strong> Auto-regenerate discovery clients (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3381">#3381</a>)
(<a
href="https://github.com/googleapis/google-api-go-client/commit/cf5cf20d07fac3acc66c1f9ade705bb99701519a">cf5cf20</a>)</li>
<li><strong>all:</strong> Auto-regenerate discovery clients (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3382">#3382</a>)
(<a
href="https://github.com/googleapis/google-api-go-client/commit/2931d4b217c6934f85bdc378ebbbbe4fa54db96d">2931d4b</a>)</li>
<li><strong>all:</strong> Auto-regenerate discovery clients (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3383">#3383</a>)
(<a
href="https://github.com/googleapis/google-api-go-client/commit/446402e7d6aedbe169505c07aafcf45e96563a8e">446402e</a>)</li>
<li><strong>all:</strong> Auto-regenerate discovery clients (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3384">#3384</a>)
(<a
href="https://github.com/googleapis/google-api-go-client/commit/d82a5d02f83b3455f747cbb1fb14930703dad60e">d82a5d0</a>)</li>
<li><strong>all:</strong> Auto-regenerate discovery clients (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3386">#3386</a>)
(<a
href="https://github.com/googleapis/google-api-go-client/commit/6a0b46d49312d528dab4dce8daee48866f38ba25">6a0b46d</a>)</li>
<li><strong>all:</strong> Auto-regenerate discovery clients (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3387">#3387</a>)
(<a
href="https://github.com/googleapis/google-api-go-client/commit/f3dc8f4bd57ade8c6ffb37cda8d55289228ebcd1">f3dc8f4</a>)</li>
<li><strong>all:</strong> Auto-regenerate discovery clients (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3388">#3388</a>)
(<a
href="https://github.com/googleapis/google-api-go-client/commit/e3ca7fd5738afd1a8aa046431ef005c48e701358">e3ca7fd</a>)</li>
<li><strong>all:</strong> Auto-regenerate discovery clients (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3389">#3389</a>)
(<a
href="https://github.com/googleapis/google-api-go-client/commit/b78dd96b2c603926daca6c30baae9c4843bf5664">b78dd96</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md">google.golang.org/api's
changelog</a>.</em></p>
<blockquote>
<h2><a
href="https://github.com/googleapis/google-api-go-client/compare/v0.256.0...v0.257.0">0.257.0</a>
(2025-12-02)</h2>
<h3>Features</h3>
<ul>
<li><strong>all:</strong> Auto-regenerate discovery clients (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3376">#3376</a>)
(<a
href="https://github.com/googleapis/google-api-go-client/commit/b0c07d2f5cc4aa2cf974c2938508626f8430855e">b0c07d2</a>)</li>
<li><strong>all:</strong> Auto-regenerate discovery clients (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3380">#3380</a>)
(<a
href="https://github.com/googleapis/google-api-go-client/commit/47fcc39088f806c4202ca47159416ce99a0a0c72">47fcc39</a>)</li>
<li><strong>all:</strong> Auto-regenerate discovery clients (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3381">#3381</a>)
(<a
href="https://github.com/googleapis/google-api-go-client/commit/cf5cf20d07fac3acc66c1f9ade705bb99701519a">cf5cf20</a>)</li>
<li><strong>all:</strong> Auto-regenerate discovery clients (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3382">#3382</a>)
(<a
href="https://github.com/googleapis/google-api-go-client/commit/2931d4b217c6934f85bdc378ebbbbe4fa54db96d">2931d4b</a>)</li>
<li><strong>all:</strong> Auto-regenerate discovery clients (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3383">#3383</a>)
(<a
href="https://github.com/googleapis/google-api-go-client/commit/446402e7d6aedbe169505c07aafcf45e96563a8e">446402e</a>)</li>
<li><strong>all:</strong> Auto-regenerate discovery clients (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3384">#3384</a>)
(<a
href="https://github.com/googleapis/google-api-go-client/commit/d82a5d02f83b3455f747cbb1fb14930703dad60e">d82a5d0</a>)</li>
<li><strong>all:</strong> Auto-regenerate discovery clients (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3386">#3386</a>)
(<a
href="https://github.com/googleapis/google-api-go-client/commit/6a0b46d49312d528dab4dce8daee48866f38ba25">6a0b46d</a>)</li>
<li><strong>all:</strong> Auto-regenerate discovery clients (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3387">#3387</a>)
(<a
href="https://github.com/googleapis/google-api-go-client/commit/f3dc8f4bd57ade8c6ffb37cda8d55289228ebcd1">f3dc8f4</a>)</li>
<li><strong>all:</strong> Auto-regenerate discovery clients (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3388">#3388</a>)
(<a
href="https://github.com/googleapis/google-api-go-client/commit/e3ca7fd5738afd1a8aa046431ef005c48e701358">e3ca7fd</a>)</li>
<li><strong>all:</strong> Auto-regenerate discovery clients (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3389">#3389</a>)
(<a
href="https://github.com/googleapis/google-api-go-client/commit/b78dd96b2c603926daca6c30baae9c4843bf5664">b78dd96</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/googleapis/google-api-go-client/commit/3e8573d81048b9abb10fe28e0cbe9623fdb4668a"><code>3e8573d</code></a>
chore(main): release 0.257.0 (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3377">#3377</a>)</li>
<li><a
href="https://github.com/googleapis/google-api-go-client/commit/61592252846bfa757ebd4a68e461bd96381984cf"><code>6159225</code></a>
chore(all): update all to 79d6a2a (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3390">#3390</a>)</li>
<li><a
href="https://github.com/googleapis/google-api-go-client/commit/b78dd96b2c603926daca6c30baae9c4843bf5664"><code>b78dd96</code></a>
feat(all): auto-regenerate discovery clients (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3389">#3389</a>)</li>
<li><a
href="https://github.com/googleapis/google-api-go-client/commit/e3ca7fd5738afd1a8aa046431ef005c48e701358"><code>e3ca7fd</code></a>
feat(all): auto-regenerate discovery clients (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3388">#3388</a>)</li>
<li><a
href="https://github.com/googleapis/google-api-go-client/commit/f3dc8f4bd57ade8c6ffb37cda8d55289228ebcd1"><code>f3dc8f4</code></a>
feat(all): auto-regenerate discovery clients (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3387">#3387</a>)</li>
<li><a
href="https://github.com/googleapis/google-api-go-client/commit/6a0b46d49312d528dab4dce8daee48866f38ba25"><code>6a0b46d</code></a>
feat(all): auto-regenerate discovery clients (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3386">#3386</a>)</li>
<li><a
href="https://github.com/googleapis/google-api-go-client/commit/a07da21fe2e45130d2e9cb1494f98a7fe2420ba1"><code>a07da21</code></a>
chore(deps): bump golang.org/x/crypto from 0.43.0 to 0.45.0 (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3379">#3379</a>)</li>
<li><a
href="https://github.com/googleapis/google-api-go-client/commit/35b0966d9ce6b797c6e63730066ecec3292ade34"><code>35b0966</code></a>
chore(deps): bump golang.org/x/crypto from 0.37.0 to 0.45.0 in
/internal/koko...</li>
<li><a
href="https://github.com/googleapis/google-api-go-client/commit/d82a5d02f83b3455f747cbb1fb14930703dad60e"><code>d82a5d0</code></a>
feat(all): auto-regenerate discovery clients (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3384">#3384</a>)</li>
<li><a
href="https://github.com/googleapis/google-api-go-client/commit/8c1e205890063d558cb41bfc1bf806a9385c2126"><code>8c1e205</code></a>
chore(all): update all (<a
href="https://redirect.github.com/googleapis/google-api-go-client/issues/3374">#3374</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/googleapis/google-api-go-client/compare/v0.256.0...v0.257.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=google.golang.org/api&package-manager=go_modules&previous-version=0.256.0&new-version=0.257.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-04 10:27:14 +00:00
dependabot[bot] f94d8fc019 chore: bump github.com/aws/smithy-go from 1.23.2 to 1.24.0 (#21095)
Bumps [github.com/aws/smithy-go](https://github.com/aws/smithy-go) from
1.23.2 to 1.24.0.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/aws/smithy-go/blob/main/CHANGELOG.md">github.com/aws/smithy-go's
changelog</a>.</em></p>
<blockquote>
<h1>Release (2025-12-01)</h1>
<h2>General Highlights</h2>
<ul>
<li><strong>Dependency Update</strong>: Updated to the latest SDK module
versions</li>
</ul>
<h2>Module Highlights</h2>
<ul>
<li><code>github.com/aws/smithy-go</code>: v1.24.0
<ul>
<li><strong>Feature</strong>: Improve allocation footprint of the
middleware stack. This should convey a ~10% reduction in allocations per
SDK request.</li>
</ul>
</li>
</ul>
<h1>Release (2025-11-03)</h1>
<h2>General Highlights</h2>
<ul>
<li><strong>Dependency Update</strong>: Updated to the latest SDK module
versions</li>
</ul>
<h2>Module Highlights</h2>
<ul>
<li><code>github.com/aws/smithy-go</code>: v1.23.2
<ul>
<li><strong>Bug Fix</strong>: Adjust the initial sizes of each
middleware phase to avoid some unnecessary reallocation.</li>
<li><strong>Bug Fix</strong>: Avoid unnecessary allocation overhead from
the metrics system when not in use.</li>
</ul>
</li>
</ul>
<h1>Release (2025-10-15)</h1>
<h2>General Highlights</h2>
<ul>
<li><strong>Dependency Update</strong>: Bump minimum go version to
1.23.</li>
<li><strong>Dependency Update</strong>: Updated to the latest SDK module
versions</li>
</ul>
<h1>Release (2025-09-18)</h1>
<h2>Module Highlights</h2>
<ul>
<li><code>github.com/aws/smithy-go/aws-http-auth</code>: <a
href="https://github.com/aws/smithy-go/blob/main/aws-http-auth/CHANGELOG.md#v110-2025-09-18">v1.1.0</a>
<ul>
<li><strong>Feature</strong>: Added support for SIG4/SIGV4A querystring
authentication.</li>
</ul>
</li>
</ul>
<h1>Release (2025-08-27)</h1>
<h2>General Highlights</h2>
<ul>
<li><strong>Dependency Update</strong>: Updated to the latest SDK module
versions</li>
</ul>
<h2>Module Highlights</h2>
<ul>
<li><code>github.com/aws/smithy-go</code>: v1.23.0
<ul>
<li><strong>Feature</strong>: Sort map keys in JSON Document types.</li>
</ul>
</li>
</ul>
<h1>Release (2025-07-24)</h1>
<h2>General Highlights</h2>
<ul>
<li><strong>Dependency Update</strong>: Updated to the latest SDK module
versions</li>
</ul>
<h2>Module Highlights</h2>
<ul>
<li><code>github.com/aws/smithy-go</code>: v1.22.5
<ul>
<li><strong>Feature</strong>: Add HTTP interceptors.</li>
</ul>
</li>
</ul>
<h1>Release (2025-06-16)</h1>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/aws/smithy-go/commit/71f5bff362491399f8a2cca586c5802eb5a66d70"><code>71f5bff</code></a>
Release 2025-12-01</li>
<li><a
href="https://github.com/aws/smithy-go/commit/c94c177cfcf46095d48a88253899242f5971ae1b"><code>c94c177</code></a>
changelog</li>
<li><a
href="https://github.com/aws/smithy-go/commit/0cc0b1c115aede116e0a5b901f195fef2ea2567a"><code>0cc0b1c</code></a>
convert middleware steps to linked lists (<a
href="https://redirect.github.com/aws/smithy-go/issues/617">#617</a>)</li>
<li><a
href="https://github.com/aws/smithy-go/commit/ed49224f03828a26529458a48ff56b9b0b4db45e"><code>ed49224</code></a>
Add param binding error check in auth scheme resolution to avoid panic
(<a
href="https://redirect.github.com/aws/smithy-go/issues/619">#619</a>)</li>
<li><a
href="https://github.com/aws/smithy-go/commit/0e0b20cb123137d985083894df55fdbdbe3ce332"><code>0e0b20c</code></a>
add discrete tests for initialize step (<a
href="https://redirect.github.com/aws/smithy-go/issues/618">#618</a>)</li>
<li><a
href="https://github.com/aws/smithy-go/commit/ddbac1c617ac6bea513c16923e7883b1439b2a34"><code>ddbac1c</code></a>
only add interceptors if configured (<a
href="https://redirect.github.com/aws/smithy-go/issues/616">#616</a>)</li>
<li><a
href="https://github.com/aws/smithy-go/commit/798bf4fa874b68b13350766bf270d3b868e8abcf"><code>798bf4f</code></a>
remove pointless trace spans (<a
href="https://redirect.github.com/aws/smithy-go/issues/615">#615</a>)</li>
<li><a
href="https://github.com/aws/smithy-go/commit/dc545a769d214b08bd69e93fffc40a962b815c56"><code>dc545a7</code></a>
don't create op metrics context if not in use (<a
href="https://redirect.github.com/aws/smithy-go/issues/613">#613</a>)</li>
<li><a
href="https://github.com/aws/smithy-go/commit/6f12c095f5277d7e682217bcfd50bab607b193ab"><code>6f12c09</code></a>
add host label validation for region before ep resolution (<a
href="https://redirect.github.com/aws/smithy-go/issues/612">#612</a>)</li>
<li>See full diff in <a
href="https://github.com/aws/smithy-go/compare/v1.23.2...v1.24.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github.com/aws/smithy-go&package-manager=go_modules&previous-version=1.23.2&new-version=1.24.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-04 10:26:32 +00:00
dependabot[bot] e93a917c2f chore: bump the coder-modules group across 3 directories with 7 updates (#21093)
Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will
remove the ignore condition of the specified dependency and ignore
conditions


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-04 10:25:01 +00:00
Jakub Domeracki 0f054096e4 chore: enforce cooldown period (#21079)
Closes:
https://github.com/coder/internal/issues/1170

Changes in scope:
- [enforce cooldown
period](https://github.com/coder/coder/commit/829792e37fbe25b119fa658efd6d310dd507d7d6)
- [remove obsolete reviewers
entry](https://github.com/coder/coder/commit/4875992bc6323249353518d4e361b3f7244c8a71)

Reference:

https://github.blog/changelog/2025-04-29-dependabot-reviewers-configuration-option-being-replaced-by-code-owners/
2025-12-04 11:13:19 +01:00
Mathias Fredriksson 2f829286f2 fix(site): simplify bulk task delete confirmation UI (#20979)
Reduce from 3 confirmation stages to 2 by removing the redundant
"resources" stage. The final button now shows "Delete N tasks and M
workspaces" directly, so users still see what will be deleted.

Also add a Cancel button to match the single task delete dialog UX.

Refs #20905
2025-12-04 10:46:02 +02:00
dependabot[bot] 6acfcd5736 chore: bump next from 15.5.6 to 15.5.7 in /offlinedocs (#21086)
Bumps [next](https://github.com/vercel/next.js) from 15.5.6 to 15.5.7.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/vercel/next.js/releases">next's
releases</a>.</em></p>
<blockquote>
<h2>v15.5.7</h2>
<p>Please see <a
href="https://nextjs.org/blog/CVE-2025-66478">CVE-2025-66478</a> for
additional details about this release.</p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/vercel/next.js/commit/3eaf68b09b2b6b8c0c8e080a9713e131a78dc529"><code>3eaf68b</code></a>
v15.5.7</li>
<li><a
href="https://github.com/vercel/next.js/commit/8367ce592ad0190ec941dac1ce6d0b5a44606593"><code>8367ce5</code></a>
update version script</li>
<li><a
href="https://github.com/vercel/next.js/commit/9115040008baf255499136933a50084b76f4bfd8"><code>9115040</code></a>
Update React Version for Next.js 15.5.7 (<a
href="https://redirect.github.com/vercel/next.js/issues/10">#10</a>)</li>
<li><a
href="https://github.com/vercel/next.js/commit/96f699902a5c57293e312591f843080a4d68ee1b"><code>96f6999</code></a>
update tag</li>
<li>See full diff in <a
href="https://github.com/vercel/next.js/compare/v15.5.6...v15.5.7">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=next&package-manager=npm_and_yarn&previous-version=15.5.6&new-version=15.5.7)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts page](https://github.com/coder/coder/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-03 20:03:02 +00:00
Danny Kopping 9e021f7b57 chore: upgrade to aibridge@v0.2.2 (#21085)
Changes from https://github.com/coder/aibridge/pull/71/

Signed-off-by: Danny Kopping <danny@coder.com>
2025-12-03 19:56:50 +00:00
Mathias Fredriksson aa306f2262 docs: add rules to avoid unnecessary changes to CLAUDE.md (#21083) 2025-12-03 20:49:18 +02:00
Danny Kopping fcd64ea7f5 chore: upgrade to aibridge@v0.2.1 (#21082)
Changes from https://github.com/coder/aibridge/pull/70/

Signed-off-by: Danny Kopping <danny@coder.com>
2025-12-03 15:41:12 +00:00
Max Bretschneider 9d7509aeb3 docs: add link to new ROS2 community template (#20902)
Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
2025-12-03 14:36:15 +00:00
Spike Curtis d5bb1361e2 docs: delete references to adding database replicas (#21077)
Removes references to adding database replicas from the scaling docs, as Coder only allows a single connection URL. These passages where added in error.
2025-12-03 16:15:58 +04:00
blink-so[bot] e17b47f9ff docs: restructure docker installation with tabs (#19567)
Co-authored-by: blink-so[bot] <211532188+blink-so[bot]@users.noreply.github.com>
Co-authored-by: M Atif Ali <U04T3LN8ASU+atif@users.noreply.github.com>
Co-authored-by: Atif Ali <atif@coder.com>
2025-12-03 17:02:08 +05:00
Spike Curtis 40df21ed62 fix: fixes use of possibly nil RemoteAddr() and LocalAddr() return values (#21076)
fixes: https://github.com/coder/internal/issues/1143

Both gVisor and the Go standard library implementations of `net.Conn` can under certain circumstances return `nil` for `RemoteAddr()` and `LocalAddr()` calls. If we call their methods, we segfault.

This PR fixes these calls and adds ruleguard rules.

Note that `slog.F("remote_addr", conn.RemoteAddr())` is fine because slog detects the `nil` before attempting to stringify the type.
2025-12-03 15:06:00 +04:00
Marcin Tojek 65ef6df1df docs: add documentation for preset invalidation (#21018)
Fixes #17917
2025-12-03 11:43:49 +01:00
Mathias Fredriksson f1b2715555 docs: add data retention and export documentation for AI Bridge (#21055)
Previously AI Bridge retention was only documented in the auto-generated
CLI reference, making it difficult for administrators to discover and
understand how to configure data retention for compliance requirements.

This adds retention configuration to the AI Bridge setup guide with
examples, documents the REST API and CLI export options in the monitoring
guide, and cross-references AI Bridge from the central data retention
page for discoverability.

Closes #21038
2025-12-03 11:39:36 +02:00
Mathias Fredriksson ad93262d07 fix(coderd/database/dbpurge): allow disabling AI Bridge retention with 0 (#21062)
Previously setting AI Bridge retention to 0 would cause records to be
deleted immediately since we didn't check for the zero value before
calculating the deletion threshold.

This adds a check for aibridgeRetention > 0 to skip deletion when
retention is disabled, matching the pattern used for other retention
settings (connection logs, audit logs, etc.).

Also fixes the return type of DeleteOldAIBridgeRecords from int32 to
int64 since COUNT(*) returns bigint in PostgreSQL.

Refs #21055
2025-12-03 09:37:18 +00:00
Mathias Fredriksson c750695d83 feat(cli/cliui): output empty string for empty table (#20967)
This changes makes it so that we output the empty string for Format
when there is no data. It turns out there are many places in the code
where we have such handling, but in a way that would break the JSON
formatter (since we'd output nothing on stdout or text rather than
`[]`/`null`).
2025-12-03 11:32:59 +02:00
Rowan Smith 3c05cb6255 feat: add serviceAccount.labels for custom service account labels on helm chart (#21048)
closes #20541 

adds `coder.serviceAccount.labels` var to support custom labels being
added to the SA.

Current chart:
```
➜  helm-service-account-labels git:(rowansmithau/feat/helm_service_account_labels) helm template coder coder-v2/coder --set coder.image.tag=latest --set coder.serviceAccount.labels.mux=isnice | egrep -A13 '^kind: ServiceAccount$'
kind: ServiceAccount
metadata:
  annotations: {}
  labels:
    app.kubernetes.io/instance: coder
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: coder
    app.kubernetes.io/part-of: coder
    app.kubernetes.io/version: 2.28.3
    helm.sh/chart: coder-2.28.3
  name: coder
  namespace: default
---
# Source: coder/templates/rbac.yaml
```

With this PR:
```
➜  helm-service-account-labels git:(rowansmithau/feat/helm_service_account_labels) helm template coder helm/coder --set coder.image.tag=latest --set coder.serviceAccount.labels.mux=isnice | egrep -A13 '^kind: ServiceAccount$'
kind: ServiceAccount
metadata:
  annotations: {}
  labels:
    app.kubernetes.io/instance: coder
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: coder
    app.kubernetes.io/part-of: coder
    app.kubernetes.io/version: 0.1.0
    helm.sh/chart: coder-0.1.0
    mux: isnice
  name: coder
  namespace: default
---
```

A test with `disableCreate=true` still correctly shows no SA created:
```
➜  helm-service-account-labels git:(rowansmithau/feat/helm_service_account_labels) helm template coder helm/coder --set coder.image.tag=latest --set coder.serviceAccount.labels.mux=isnice --set coder.serviceAccount.disableCreate=true | egrep '^kind: ServiceAccount$'
```
2025-12-03 12:25:39 +11:00
DevCats 18ef78604f feat: add google antigravity ide icon to theme (#21068)
adds google antigravity ide icon to theme:



![antigravity](https://github.com/user-attachments/assets/fa1d3550-8175-40fc-8f12-0042c3e66d69)


There is no need for any transformation with this icon, as it should
look good in dark and light mode.
2025-12-02 15:38:44 -06:00
david-fraley db5ccda1ec chore(docs): update Docs Release Cal for 2.29 (#21069) 2025-12-02 21:06:09 +00:00
blinkagent[bot] 0873d9af6d docs: regenerate feature-stages experiments table (#21024)
Co-authored-by: blink-so[bot] <211532188+blink-so[bot]@users.noreply.github.com>
2025-12-03 00:22:55 +05:00
Steven Masley c3c059fbc4 chore: fix provisioner scripts shebang for nix users (#21066) 2025-12-02 13:03:21 -06:00
Mathias Fredriksson ff46917e62 feat: add retention config for workspace_agent_logs (#21039)
Replace hardcoded 7-day retention for workspace agent logs with
configurable retention from deployment settings. Defaults to 7d to
preserve existing behavior.

Depends on #21038
Updates #20743
2025-12-02 16:01:33 +00:00
Mathias Fredriksson d9888ced11 docs: add data retention documentation (#21038)
Document configurable retention policies for Audit Logs, Connection Logs,
and API keys. Add new data-retention.md page and update existing docs to
reference it.

Depends on #21021
Updates #20743
2025-12-02 15:47:36 +00:00
Mathias Fredriksson 9ec90cf2e7 feat(coderd/database/dbpurge): make API keys retention configurable (#21037)
Replace hardcoded 7-day retention for expired API keys with configurable
retention from deployment settings. Skips deletion entirely when effective
retention is 0.

Depends on #21021
Updates #20743
2025-12-02 15:41:38 +00:00
Mathias Fredriksson 929db243cb test(agent/agentcontainers): fix data race and flake in DuringUpWithContainerID test (#21059)
Fixes coder/internal#1169
2025-12-02 16:18:07 +01:00
Mathias Fredriksson c85d79bcdb feat(coderd/database/dbpurge): add retention for audit logs (#21025)
Add configurable retention policy for audit logs. The DeleteOldAuditLogs
query excludes deprecated connection events (connect, disconnect, open,
close) which are handled separately by DeleteOldAuditLogConnectionEvents.

Disabled (0) by default.

Depends on #21021
Updates #20743
2025-12-02 16:50:09 +02:00
Mathias Fredriksson fa7bbe2f55 docs: fix typo in CLAUDE.md (#21058) 2025-12-02 16:35:43 +02:00
Mathias Fredriksson 4e2af837b7 docs(CLAUDE): fix gitignored file loading (#21056)
Follow-up for #21043
2025-12-03 01:21:37 +11:00
Mathias Fredriksson 9ebcca5b0d feat(coderd/database/dbpurge): add retention for connection logs (#21022)
Add `DeleteOldConnectionLogs` query and integrate it into the `dbpurge`
routine. Retention is controlled by `--retention-connection-logs` flag.
Disabled (0) by default.

Depends on #21021
Updates #20743
2025-12-02 14:17:52 +00:00
Mathias Fredriksson 56e7858570 feat(coderd): add retention policy configuration (#21021)
Add `RetentionConfig` with server flags for configuring data retention:

- `--audit-logs-retention`: retention for audit log entries
- `--connection-logs-retention`: retention for connection logs
- `--api-keys-retention`: retention for expired API keys (default 7d)

Updates #20743
2025-12-02 16:04:06 +02:00
Mathias Fredriksson 74d0c39cb3 fix(agent/agentcontainer): allow lifecycle script error on devcontainer up (#21020)
When devcontainer up fails due to a lifecycle script error like
postCreateCommand, the CLI still returns a container ID. Previously
this was discarded and the devcontainer marked as failed. Now we
continue with agent injection if a container ID is available,
allowing users to debug the issue in the running container.

Fixes coder/internal#1137
2025-12-02 15:33:01 +02:00
Ethan bf40d678ec fix(cli): close prebuild runner prometheus server last (#21053)
## Description

Fixes the prebuilds scaletest command where the prometheus server was
being shut down before waiting for metrics to be scraped.

The issue was the defer order - since defers execute in LIFO (last-in,
first-out) order:

**Before (broken):**
1. Register tracing defer (includes wait for prometheus scrape)
2. Register prometheus server defer

Execution order: prometheus closes first, then wait happens (server
already gone!)

**After (fixed):**
1. Register prometheus server defer  
2. Register tracing defer (includes wait for prometheus scrape)

Execution order: wait happens first (server still up), then prometheus
closes.

This matches the pattern used in other scaletest commands.

## Impact

The `coderd_scaletest_prebuild_deletion_jobs_completed` metric (and
potentially others) was always showing 0 because the server shut down
before Prometheus could scrape the final values.

_This PR was generated by [`mux`](https://github.com/coder/mux) and
reviewed by a human._
2025-12-02 12:10:50 +00:00
Mathias Fredriksson a47b3a4cb5 docs: add support for AGENTS.local.md overrides (#21043)
Adds support for local, gitignored `AGENTS.local.md` for
environment-specific overrides.
2025-12-02 10:31:06 +02:00
Ethan 645da33767 test: fix TestDescCacheTimestampUpdate flake (#20975)
## Problem

`TestDescCacheTimestampUpdate` was flaky on Windows CI because
`time.Now()` has ~15.6ms resolution, causing consecutive calls to return
identical timestamps.

## Solution

Inject `quartz.Clock` into `MetricsAggregator` using an options pattern,
making the test deterministic by using a mock clock with explicit time
advancement.

### Changes
- Add `clock quartz.Clock` field to `MetricsAggregator` struct
- Add `WithClock()` option for dependency injection
- Replace all `time.Now()` calls with `ma.clock.Now()`
- Update test to use mock clock with `mClock.Advance(time.Second)`

---

This PR was fully generated by [`mux`](https://github.com/coder/mux)
using Claude Opus 4.5, and reviewed by me.

Closes https://github.com/coder/internal/issues/1146
2025-12-02 10:53:36 +11:00
Jake Howell ab4366f5c6 feat!: implement AI Bridge heading to /deployment/observability (#20791)
> [!CAUTION]
> In whichever release this lands, we've removed the ability to provide
keys via a YAML file (specifically on `openai_key`, `anthropic_key`,
`bedrock_access_key` and finally `bedrock_access_key_secret`). This will
need to be described in the release notes as to not break peoples AI
Bridge integrations upgrading from older versions.

This pull-request ensures that we can see the overview of the settings
of the `AI Bridge` feature within the `/deployment/observability` route.
This set of options only render when the `aibridge` feature flag is
enabled.

### Preview


![preview-ai-bridge-observability](https://github.com/user-attachments/assets/262d2456-94b4-49b2-9b4e-b14583e70ede)
2025-12-01 21:23:46 +00:00
david-fraley afbe9ea154 docs: add GitHub to Coder Task Workflow Guide (#20928)
Co-authored-by: Danielle Maywood <danielle@themaywoods.com>
2025-12-01 13:58:51 -06:00
dependabot[bot] cf6bb40cf8 chore: bump @storybook/react-vite from 9.1.2 to 9.1.16 in /site (#21036)
[//]: # (dependabot-start)
⚠️  **Dependabot is rebasing this PR** ⚠️ 

Rebasing might not happen immediately, so don't worry if this takes some
time.

Note: if you make any changes to this PR yourself, they will take
precedence over the rebase.

---

[//]: # (dependabot-end)

Bumps
[@storybook/react-vite](https://github.com/storybookjs/storybook/tree/HEAD/code/frameworks/react-vite)
from 9.1.2 to 9.1.16.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/storybookjs/storybook/releases"><code>@​storybook/react-vite</code>'s
releases</a>.</em></p>
<blockquote>
<h2>v9.1.16</h2>
<h2>9.1.16</h2>
<ul>
<li>CLI: Fix Nextjs project creation in empty directories - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32828">#32828</a>,
thanks <a
href="https://github.com/yannbf"><code>@​yannbf</code></a>!</li>
<li>Core: Add `experimental_devServer` preset - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32862">#32862</a>,
thanks <a
href="https://github.com/yannbf"><code>@​yannbf</code></a>!</li>
<li>Telemetry: Fix preview-first-load event - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32859">#32859</a>,
thanks <a
href="https://github.com/shilman"><code>@​shilman</code></a>!</li>
</ul>
<h2>v9.1.15</h2>
<h2>9.1.15</h2>
<ul>
<li>Core: Add `preview-first-load` telemetry - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32770">#32770</a>,
thanks <a
href="https://github.com/shilman"><code>@​shilman</code></a>!</li>
<li>Dependencies: Update `vite-plugin-storybook-nextjs` - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32821">#32821</a>,
thanks <a
href="https://github.com/ndelangen"><code>@​ndelangen</code></a>!</li>
</ul>
<h2>v9.1.14</h2>
<h2>9.1.14</h2>
<ul>
<li>NextJS: Add NextJS 16 support - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32791">#32791</a>,
thanks <a href="https://github.com/yannbf"><code>@​yannbf</code></a> and
<a
href="https://github.com/ndelangen"><code>@​ndelangen</code></a>!</li>
<li>Addon-Vitest: Support Vitest 4 - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32819">#32819</a>,
thanks <a href="https://github.com/yannbf"><code>@​yannbf</code></a> and
<a
href="https://github.com/ndelangen"><code>@​ndelangen</code></a>!</li>
<li>CSF: Fix `play-fn` tag for methods - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32695">#32695</a>,
thanks <a
href="https://github.com/shilman"><code>@​shilman</code></a>!</li>
</ul>
<h2>v9.1.12</h2>
<h2>9.1.12</h2>
<ul>
<li>Maintenance: Hotfix for missing nextjs dts files, thanks <a
href="https://github.com/ndelangen"><code>@​ndelangen</code></a>!</li>
</ul>
<h2>v9.1.11</h2>
<h2>9.1.11</h2>
<ul>
<li>Automigration: Improve the viewport/backgrounds automigration - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32619">#32619</a>,
thanks <a
href="https://github.com/valentinpalkovic"><code>@​valentinpalkovic</code></a>!</li>
<li>Mocking: Fix `sb.mock` usage in Storybook's deployed in subpaths -
<a
href="https://redirect.github.com/storybookjs/storybook/pull/32678">#32678</a>,
thanks <a
href="https://github.com/valentinpalkovic"><code>@​valentinpalkovic</code></a>!</li>
<li>NextJS-Vite: Automatically fix bad PostCSS configuration - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32691">#32691</a>,
thanks <a
href="https://github.com/ndelangen"><code>@​ndelangen</code></a>!</li>
<li>React Native Web: Fix REACT_NATIVE_AND_RNW should detect vite
builder - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32718">#32718</a>,
thanks <a
href="https://github.com/dannyhw"><code>@​dannyhw</code></a>!</li>
<li>Telemetry: Add metadata for react routers - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32615">#32615</a>,
thanks <a
href="https://github.com/shilman"><code>@​shilman</code></a>!</li>
</ul>
<h2>v9.1.10</h2>
<h2>9.1.10</h2>
<ul>
<li>Automigrations: Add automigration for viewport and backgrounds - <a
href="https://redirect.github.com/storybookjs/storybook/pull/31614">#31614</a>,
thanks <a
href="https://github.com/valentinpalkovic"><code>@​valentinpalkovic</code></a>!</li>
<li>Telemetry: Log userAgent in onboarding - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32566">#32566</a>,
thanks <a
href="https://github.com/shilman"><code>@​shilman</code></a>!</li>
</ul>
<h2>v9.1.9</h2>
<h2>9.1.9</h2>
<ul>
<li>Angular: Enable experimental zoneless detection on Angular v21 - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32580">#32580</a>,
thanks <a
href="https://github.com/yannbf"><code>@​yannbf</code></a>!</li>
<li>Svelte: Ignore inherited <code>HTMLAttributes</code> docgen when
using utility types - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32173">#32173</a>,
thanks <a
href="https://github.com/steciuk"><code>@​steciuk</code></a>!</li>
</ul>
<h2>v9.1.8</h2>
<h2>9.1.8</h2>
<ul>
<li>PreactVite: Add <code>node</code> entry point - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32534">#32534</a>,
thanks <a
href="https://github.com/ndelangen"><code>@​ndelangen</code></a>!</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md"><code>@​storybook/react-vite</code>'s
changelog</a>.</em></p>
<blockquote>
<h2>9.1.16</h2>
<ul>
<li>CLI: Fix Nextjs project creation in empty directories - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32828">#32828</a>,
thanks <a
href="https://github.com/yannbf"><code>@​yannbf</code></a>!</li>
<li>Core: Add <code>experimental_devServer</code> preset - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32862">#32862</a>,
thanks <a
href="https://github.com/yannbf"><code>@​yannbf</code></a>!</li>
<li>Telemetry: Fix preview-first-load event - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32859">#32859</a>,
thanks <a
href="https://github.com/shilman"><code>@​shilman</code></a>!</li>
</ul>
<h2>9.1.15</h2>
<ul>
<li>Core: Add <code>preview-first-load</code> telemetry - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32770">#32770</a>,
thanks <a
href="https://github.com/shilman"><code>@​shilman</code></a>!</li>
<li>Dependencies: Update <code>vite-plugin-storybook-nextjs</code> - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32821">#32821</a>,
thanks <a
href="https://github.com/ndelangen"><code>@​ndelangen</code></a>!</li>
</ul>
<h2>9.1.14</h2>
<ul>
<li>NextJS: Add NextJS 16 support - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32791">#32791</a>,
thanks <a href="https://github.com/yannbf"><code>@​yannbf</code></a> and
<a
href="https://github.com/ndelangen"><code>@​ndelangen</code></a>!</li>
<li>Addon-Vitest: Support Vitest 4 - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32819">#32819</a>,
thanks <a href="https://github.com/yannbf"><code>@​yannbf</code></a> and
<a
href="https://github.com/ndelangen"><code>@​ndelangen</code></a>!</li>
<li>CSF: Fix <code>play-fn</code> tag for methods - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32695">#32695</a>,
thanks <a
href="https://github.com/shilman"><code>@​shilman</code></a>!</li>
</ul>
<h2>9.1.13</h2>
<ul>
<li>Nextjs: Fix config access for Vite - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32759">#32759</a>,
thanks <a
href="https://github.com/valentinpalkovic"><code>@​valentinpalkovic</code></a>!</li>
</ul>
<h2>9.1.12</h2>
<ul>
<li>Maintenance: Hotfix for missing nextjs dts files, thanks <a
href="https://github.com/ndelangen"><code>@​ndelangen</code></a>!</li>
</ul>
<h2>9.1.11</h2>
<ul>
<li>Automigration: Improve the viewport/backgrounds automigration - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32619">#32619</a>,
thanks <a
href="https://github.com/valentinpalkovic"><code>@​valentinpalkovic</code></a>!</li>
<li>Mocking: Fix <code>sb.mock</code> usage in Storybook's deployed in
subpaths - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32678">#32678</a>,
thanks <a
href="https://github.com/valentinpalkovic"><code>@​valentinpalkovic</code></a>!</li>
<li>NextJS-Vite: Automatically fix bad PostCSS configuration - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32691">#32691</a>,
thanks <a
href="https://github.com/ndelangen"><code>@​ndelangen</code></a>!</li>
<li>React Native Web: Fix REACT_NATIVE_AND_RNW should detect vite
builder - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32718">#32718</a>,
thanks <a
href="https://github.com/dannyhw"><code>@​dannyhw</code></a>!</li>
<li>Telemetry: Add metadata for react routers - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32615">#32615</a>,
thanks <a
href="https://github.com/shilman"><code>@​shilman</code></a>!</li>
</ul>
<h2>9.1.10</h2>
<ul>
<li>Automigrations: Add automigration for viewport and backgrounds - <a
href="https://redirect.github.com/storybookjs/storybook/pull/31614">#31614</a>,
thanks <a
href="https://github.com/valentinpalkovic"><code>@​valentinpalkovic</code></a>!</li>
<li>Telemetry: Log userAgent in onboarding - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32566">#32566</a>,
thanks <a
href="https://github.com/shilman"><code>@​shilman</code></a>!</li>
</ul>
<h2>9.1.9</h2>
<ul>
<li>Angular: Enable experimental zoneless detection on Angular v21 - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32580">#32580</a>,
thanks <a
href="https://github.com/yannbf"><code>@​yannbf</code></a>!</li>
<li>Svelte: Ignore inherited <code>HTMLAttributes</code> docgen when
using utility types - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32173">#32173</a>,
thanks <a
href="https://github.com/steciuk"><code>@​steciuk</code></a>!</li>
</ul>
<h2>9.1.8</h2>
<ul>
<li>PreactVite: Add <code>node</code> entry point - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32534">#32534</a>,
thanks <a
href="https://github.com/ndelangen"><code>@​ndelangen</code></a>!</li>
</ul>
<h2>9.1.7</h2>
<ul>
<li>Dependencies: Update <code>vite-plugin-storybook-nextjs</code> to
2.0.7 - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32331">#32331</a>,
thanks <a href="https://github.com/k35o"><code>@​k35o</code></a>!</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/storybookjs/storybook/commit/a54a04cef3ea631f2dacf3631f7f78e4453cd096"><code>a54a04c</code></a>
Bump version from &quot;9.1.15&quot; to &quot;9.1.16&quot; [skip
ci]</li>
<li><a
href="https://github.com/storybookjs/storybook/commit/d0d17d96288be91ae0969803cbfcd7849b9c98f8"><code>d0d17d9</code></a>
Bump version from &quot;9.1.14&quot; to &quot;9.1.15&quot; [skip
ci]</li>
<li><a
href="https://github.com/storybookjs/storybook/commit/5afb39f85e981d380fba4658a82fac24fa5ce51b"><code>5afb39f</code></a>
Bump version from &quot;9.1.13&quot; to &quot;9.1.14&quot; [skip
ci]</li>
<li><a
href="https://github.com/storybookjs/storybook/commit/c2483f0e584fea0a7b4c306489b506f6165dc73b"><code>c2483f0</code></a>
Bump version from &quot;9.1.12&quot; to &quot;9.1.13&quot; [skip
ci]</li>
<li><a
href="https://github.com/storybookjs/storybook/commit/efe8a7ce5bf67cdef96bb4f34a787ef0d6152745"><code>efe8a7c</code></a>
Bump version from &quot;9.1.11&quot; to &quot;9.1.12&quot; [skip
ci]</li>
<li><a
href="https://github.com/storybookjs/storybook/commit/5b2e0edf9f1b56a4708721578be83d439ebc59f5"><code>5b2e0ed</code></a>
Bump version from &quot;9.1.10&quot; to &quot;9.1.11&quot; [skip
ci]</li>
<li><a
href="https://github.com/storybookjs/storybook/commit/642f0cf47ed9463cecd67fdbad978113edc88196"><code>642f0cf</code></a>
Bump version from &quot;9.1.9&quot; to &quot;9.1.10&quot; [skip ci]</li>
<li><a
href="https://github.com/storybookjs/storybook/commit/01867d0d587fe23765bbd43397d861a6e08223f8"><code>01867d0</code></a>
Bump version from &quot;9.1.8&quot; to &quot;9.1.9&quot; [skip ci]</li>
<li><a
href="https://github.com/storybookjs/storybook/commit/28833d41b8d0e33bdc11244907fa8d14c8ddd1bf"><code>28833d4</code></a>
Bump version from &quot;9.1.7&quot; to &quot;9.1.8&quot; [skip ci]</li>
<li><a
href="https://github.com/storybookjs/storybook/commit/006b304feb4cb0d2fd1408505ebeb5aababb0aad"><code>006b304</code></a>
Bump version from &quot;9.1.6&quot; to &quot;9.1.7&quot; [skip ci]</li>
<li>Additional commits viewable in <a
href="https://github.com/storybookjs/storybook/commits/v9.1.16/code/frameworks/react-vite">compare
view</a></li>
</ul>
</details>
<details>
<summary>Maintainer changes</summary>
<p>This version was pushed to npm by [GitHub Actions](<a
href="https://www.npmjs.com/~GitHub">https://www.npmjs.com/~GitHub</a>
Actions), a new releaser for <code>@​storybook/react-vite</code> since
your current version.</p>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@storybook/react-vite&package-manager=npm_and_yarn&previous-version=9.1.2&new-version=9.1.16)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-01 15:19:39 +00:00
dependabot[bot] 60ac382ae6 chore: bump @storybook/addon-links from 9.1.2 to 9.1.16 in /site (#21035)
Bumps
[@storybook/addon-links](https://github.com/storybookjs/storybook/tree/HEAD/code/addons/links)
from 9.1.2 to 9.1.16.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/storybookjs/storybook/releases"><code>@​storybook/addon-links</code>'s
releases</a>.</em></p>
<blockquote>
<h2>v9.1.16</h2>
<h2>9.1.16</h2>
<ul>
<li>CLI: Fix Nextjs project creation in empty directories - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32828">#32828</a>,
thanks <a
href="https://github.com/yannbf"><code>@​yannbf</code></a>!</li>
<li>Core: Add `experimental_devServer` preset - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32862">#32862</a>,
thanks <a
href="https://github.com/yannbf"><code>@​yannbf</code></a>!</li>
<li>Telemetry: Fix preview-first-load event - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32859">#32859</a>,
thanks <a
href="https://github.com/shilman"><code>@​shilman</code></a>!</li>
</ul>
<h2>v9.1.15</h2>
<h2>9.1.15</h2>
<ul>
<li>Core: Add `preview-first-load` telemetry - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32770">#32770</a>,
thanks <a
href="https://github.com/shilman"><code>@​shilman</code></a>!</li>
<li>Dependencies: Update `vite-plugin-storybook-nextjs` - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32821">#32821</a>,
thanks <a
href="https://github.com/ndelangen"><code>@​ndelangen</code></a>!</li>
</ul>
<h2>v9.1.14</h2>
<h2>9.1.14</h2>
<ul>
<li>NextJS: Add NextJS 16 support - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32791">#32791</a>,
thanks <a href="https://github.com/yannbf"><code>@​yannbf</code></a> and
<a
href="https://github.com/ndelangen"><code>@​ndelangen</code></a>!</li>
<li>Addon-Vitest: Support Vitest 4 - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32819">#32819</a>,
thanks <a href="https://github.com/yannbf"><code>@​yannbf</code></a> and
<a
href="https://github.com/ndelangen"><code>@​ndelangen</code></a>!</li>
<li>CSF: Fix `play-fn` tag for methods - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32695">#32695</a>,
thanks <a
href="https://github.com/shilman"><code>@​shilman</code></a>!</li>
</ul>
<h2>v9.1.12</h2>
<h2>9.1.12</h2>
<ul>
<li>Maintenance: Hotfix for missing nextjs dts files, thanks <a
href="https://github.com/ndelangen"><code>@​ndelangen</code></a>!</li>
</ul>
<h2>v9.1.11</h2>
<h2>9.1.11</h2>
<ul>
<li>Automigration: Improve the viewport/backgrounds automigration - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32619">#32619</a>,
thanks <a
href="https://github.com/valentinpalkovic"><code>@​valentinpalkovic</code></a>!</li>
<li>Mocking: Fix `sb.mock` usage in Storybook's deployed in subpaths -
<a
href="https://redirect.github.com/storybookjs/storybook/pull/32678">#32678</a>,
thanks <a
href="https://github.com/valentinpalkovic"><code>@​valentinpalkovic</code></a>!</li>
<li>NextJS-Vite: Automatically fix bad PostCSS configuration - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32691">#32691</a>,
thanks <a
href="https://github.com/ndelangen"><code>@​ndelangen</code></a>!</li>
<li>React Native Web: Fix REACT_NATIVE_AND_RNW should detect vite
builder - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32718">#32718</a>,
thanks <a
href="https://github.com/dannyhw"><code>@​dannyhw</code></a>!</li>
<li>Telemetry: Add metadata for react routers - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32615">#32615</a>,
thanks <a
href="https://github.com/shilman"><code>@​shilman</code></a>!</li>
</ul>
<h2>v9.1.10</h2>
<h2>9.1.10</h2>
<ul>
<li>Automigrations: Add automigration for viewport and backgrounds - <a
href="https://redirect.github.com/storybookjs/storybook/pull/31614">#31614</a>,
thanks <a
href="https://github.com/valentinpalkovic"><code>@​valentinpalkovic</code></a>!</li>
<li>Telemetry: Log userAgent in onboarding - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32566">#32566</a>,
thanks <a
href="https://github.com/shilman"><code>@​shilman</code></a>!</li>
</ul>
<h2>v9.1.9</h2>
<h2>9.1.9</h2>
<ul>
<li>Angular: Enable experimental zoneless detection on Angular v21 - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32580">#32580</a>,
thanks <a
href="https://github.com/yannbf"><code>@​yannbf</code></a>!</li>
<li>Svelte: Ignore inherited <code>HTMLAttributes</code> docgen when
using utility types - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32173">#32173</a>,
thanks <a
href="https://github.com/steciuk"><code>@​steciuk</code></a>!</li>
</ul>
<h2>v9.1.8</h2>
<h2>9.1.8</h2>
<ul>
<li>PreactVite: Add <code>node</code> entry point - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32534">#32534</a>,
thanks <a
href="https://github.com/ndelangen"><code>@​ndelangen</code></a>!</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md"><code>@​storybook/addon-links</code>'s
changelog</a>.</em></p>
<blockquote>
<h2>9.1.16</h2>
<ul>
<li>CLI: Fix Nextjs project creation in empty directories - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32828">#32828</a>,
thanks <a
href="https://github.com/yannbf"><code>@​yannbf</code></a>!</li>
<li>Core: Add <code>experimental_devServer</code> preset - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32862">#32862</a>,
thanks <a
href="https://github.com/yannbf"><code>@​yannbf</code></a>!</li>
<li>Telemetry: Fix preview-first-load event - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32859">#32859</a>,
thanks <a
href="https://github.com/shilman"><code>@​shilman</code></a>!</li>
</ul>
<h2>9.1.15</h2>
<ul>
<li>Core: Add <code>preview-first-load</code> telemetry - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32770">#32770</a>,
thanks <a
href="https://github.com/shilman"><code>@​shilman</code></a>!</li>
<li>Dependencies: Update <code>vite-plugin-storybook-nextjs</code> - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32821">#32821</a>,
thanks <a
href="https://github.com/ndelangen"><code>@​ndelangen</code></a>!</li>
</ul>
<h2>9.1.14</h2>
<ul>
<li>NextJS: Add NextJS 16 support - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32791">#32791</a>,
thanks <a href="https://github.com/yannbf"><code>@​yannbf</code></a> and
<a
href="https://github.com/ndelangen"><code>@​ndelangen</code></a>!</li>
<li>Addon-Vitest: Support Vitest 4 - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32819">#32819</a>,
thanks <a href="https://github.com/yannbf"><code>@​yannbf</code></a> and
<a
href="https://github.com/ndelangen"><code>@​ndelangen</code></a>!</li>
<li>CSF: Fix <code>play-fn</code> tag for methods - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32695">#32695</a>,
thanks <a
href="https://github.com/shilman"><code>@​shilman</code></a>!</li>
</ul>
<h2>9.1.13</h2>
<ul>
<li>Nextjs: Fix config access for Vite - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32759">#32759</a>,
thanks <a
href="https://github.com/valentinpalkovic"><code>@​valentinpalkovic</code></a>!</li>
</ul>
<h2>9.1.12</h2>
<ul>
<li>Maintenance: Hotfix for missing nextjs dts files, thanks <a
href="https://github.com/ndelangen"><code>@​ndelangen</code></a>!</li>
</ul>
<h2>9.1.11</h2>
<ul>
<li>Automigration: Improve the viewport/backgrounds automigration - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32619">#32619</a>,
thanks <a
href="https://github.com/valentinpalkovic"><code>@​valentinpalkovic</code></a>!</li>
<li>Mocking: Fix <code>sb.mock</code> usage in Storybook's deployed in
subpaths - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32678">#32678</a>,
thanks <a
href="https://github.com/valentinpalkovic"><code>@​valentinpalkovic</code></a>!</li>
<li>NextJS-Vite: Automatically fix bad PostCSS configuration - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32691">#32691</a>,
thanks <a
href="https://github.com/ndelangen"><code>@​ndelangen</code></a>!</li>
<li>React Native Web: Fix REACT_NATIVE_AND_RNW should detect vite
builder - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32718">#32718</a>,
thanks <a
href="https://github.com/dannyhw"><code>@​dannyhw</code></a>!</li>
<li>Telemetry: Add metadata for react routers - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32615">#32615</a>,
thanks <a
href="https://github.com/shilman"><code>@​shilman</code></a>!</li>
</ul>
<h2>9.1.10</h2>
<ul>
<li>Automigrations: Add automigration for viewport and backgrounds - <a
href="https://redirect.github.com/storybookjs/storybook/pull/31614">#31614</a>,
thanks <a
href="https://github.com/valentinpalkovic"><code>@​valentinpalkovic</code></a>!</li>
<li>Telemetry: Log userAgent in onboarding - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32566">#32566</a>,
thanks <a
href="https://github.com/shilman"><code>@​shilman</code></a>!</li>
</ul>
<h2>9.1.9</h2>
<ul>
<li>Angular: Enable experimental zoneless detection on Angular v21 - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32580">#32580</a>,
thanks <a
href="https://github.com/yannbf"><code>@​yannbf</code></a>!</li>
<li>Svelte: Ignore inherited <code>HTMLAttributes</code> docgen when
using utility types - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32173">#32173</a>,
thanks <a
href="https://github.com/steciuk"><code>@​steciuk</code></a>!</li>
</ul>
<h2>9.1.8</h2>
<ul>
<li>PreactVite: Add <code>node</code> entry point - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32534">#32534</a>,
thanks <a
href="https://github.com/ndelangen"><code>@​ndelangen</code></a>!</li>
</ul>
<h2>9.1.7</h2>
<ul>
<li>Dependencies: Update <code>vite-plugin-storybook-nextjs</code> to
2.0.7 - <a
href="https://redirect.github.com/storybookjs/storybook/pull/32331">#32331</a>,
thanks <a href="https://github.com/k35o"><code>@​k35o</code></a>!</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/storybookjs/storybook/commit/a54a04cef3ea631f2dacf3631f7f78e4453cd096"><code>a54a04c</code></a>
Bump version from &quot;9.1.15&quot; to &quot;9.1.16&quot; [skip
ci]</li>
<li><a
href="https://github.com/storybookjs/storybook/commit/d0d17d96288be91ae0969803cbfcd7849b9c98f8"><code>d0d17d9</code></a>
Bump version from &quot;9.1.14&quot; to &quot;9.1.15&quot; [skip
ci]</li>
<li><a
href="https://github.com/storybookjs/storybook/commit/5afb39f85e981d380fba4658a82fac24fa5ce51b"><code>5afb39f</code></a>
Bump version from &quot;9.1.13&quot; to &quot;9.1.14&quot; [skip
ci]</li>
<li><a
href="https://github.com/storybookjs/storybook/commit/c2483f0e584fea0a7b4c306489b506f6165dc73b"><code>c2483f0</code></a>
Bump version from &quot;9.1.12&quot; to &quot;9.1.13&quot; [skip
ci]</li>
<li><a
href="https://github.com/storybookjs/storybook/commit/efe8a7ce5bf67cdef96bb4f34a787ef0d6152745"><code>efe8a7c</code></a>
Bump version from &quot;9.1.11&quot; to &quot;9.1.12&quot; [skip
ci]</li>
<li><a
href="https://github.com/storybookjs/storybook/commit/5b2e0edf9f1b56a4708721578be83d439ebc59f5"><code>5b2e0ed</code></a>
Bump version from &quot;9.1.10&quot; to &quot;9.1.11&quot; [skip
ci]</li>
<li><a
href="https://github.com/storybookjs/storybook/commit/642f0cf47ed9463cecd67fdbad978113edc88196"><code>642f0cf</code></a>
Bump version from &quot;9.1.9&quot; to &quot;9.1.10&quot; [skip ci]</li>
<li><a
href="https://github.com/storybookjs/storybook/commit/01867d0d587fe23765bbd43397d861a6e08223f8"><code>01867d0</code></a>
Bump version from &quot;9.1.8&quot; to &quot;9.1.9&quot; [skip ci]</li>
<li><a
href="https://github.com/storybookjs/storybook/commit/28833d41b8d0e33bdc11244907fa8d14c8ddd1bf"><code>28833d4</code></a>
Bump version from &quot;9.1.7&quot; to &quot;9.1.8&quot; [skip ci]</li>
<li><a
href="https://github.com/storybookjs/storybook/commit/006b304feb4cb0d2fd1408505ebeb5aababb0aad"><code>006b304</code></a>
Bump version from &quot;9.1.6&quot; to &quot;9.1.7&quot; [skip ci]</li>
<li>Additional commits viewable in <a
href="https://github.com/storybookjs/storybook/commits/v9.1.16/code/addons/links">compare
view</a></li>
</ul>
</details>
<details>
<summary>Maintainer changes</summary>
<p>This version was pushed to npm by [GitHub Actions](<a
href="https://www.npmjs.com/~GitHub">https://www.npmjs.com/~GitHub</a>
Actions), a new releaser for <code>@​storybook/addon-links</code> since
your current version.</p>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@storybook/addon-links&package-manager=npm_and_yarn&previous-version=9.1.2&new-version=9.1.16)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-01 15:19:17 +00:00
dependabot[bot] dcb4251849 chore: bump dayjs from 1.11.18 to 1.11.19 in /site (#21033)
[//]: # (dependabot-start)
⚠️  **Dependabot is rebasing this PR** ⚠️ 

Rebasing might not happen immediately, so don't worry if this takes some
time.

Note: if you make any changes to this PR yourself, they will take
precedence over the rebase.

---

[//]: # (dependabot-end)

Bumps [dayjs](https://github.com/iamkun/dayjs) from 1.11.18 to 1.11.19.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/iamkun/dayjs/releases">dayjs's
releases</a>.</em></p>
<blockquote>
<h2>v1.11.19</h2>
<h2><a
href="https://github.com/iamkun/dayjs/compare/v1.11.18...v1.11.19">1.11.19</a>
(2025-10-31)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>added usage warnings for diff + updated unit tests (<a
href="https://redirect.github.com/iamkun/dayjs/issues/2948">#2948</a>)
(<a
href="https://github.com/iamkun/dayjs/commit/269a7a9cf3649b7a4b328e771173701764a8480d">269a7a9</a>)</li>
<li>dont instantiate regexes within ar locale functions to avoid
performance overhead (<a
href="https://redirect.github.com/iamkun/dayjs/issues/2898">#2898</a>)
(<a
href="https://github.com/iamkun/dayjs/commit/af5e9f0e7649cbd1ecf707daab8303f2733f2563">af5e9f0</a>)</li>
<li>replace italian locale &quot;un' ora fa&quot; with &quot;un'ora
fa&quot;, add tests for it (<a
href="https://redirect.github.com/iamkun/dayjs/issues/2930">#2930</a>)
(<a
href="https://github.com/iamkun/dayjs/commit/9e9f76cf117fa834260b30193434bc4481b4b6be">9e9f76c</a>)</li>
<li>Updated Belarusian locale with relative time (<a
href="https://redirect.github.com/iamkun/dayjs/issues/2656">#2656</a>)
(<a
href="https://github.com/iamkun/dayjs/commit/1d8746c23bd667bde80ee627a915301ebd69e1a2">1d8746c</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/iamkun/dayjs/blob/dev/CHANGELOG.md">dayjs's
changelog</a>.</em></p>
<blockquote>
<h2><a
href="https://github.com/iamkun/dayjs/compare/v1.11.18...v1.11.19">1.11.19</a>
(2025-10-31)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>added usage warnings for diff + updated unit tests (<a
href="https://redirect.github.com/iamkun/dayjs/issues/2948">#2948</a>)
(<a
href="https://github.com/iamkun/dayjs/commit/269a7a9cf3649b7a4b328e771173701764a8480d">269a7a9</a>)</li>
<li>dont instantiate regexes within ar locale functions to avoid
performance overhead (<a
href="https://redirect.github.com/iamkun/dayjs/issues/2898">#2898</a>)
(<a
href="https://github.com/iamkun/dayjs/commit/af5e9f0e7649cbd1ecf707daab8303f2733f2563">af5e9f0</a>)</li>
<li>replace italian locale &quot;un' ora fa&quot; with &quot;un'ora
fa&quot;, add tests for it (<a
href="https://redirect.github.com/iamkun/dayjs/issues/2930">#2930</a>)
(<a
href="https://github.com/iamkun/dayjs/commit/9e9f76cf117fa834260b30193434bc4481b4b6be">9e9f76c</a>)</li>
<li>Updated Belarusian locale with relative time (<a
href="https://redirect.github.com/iamkun/dayjs/issues/2656">#2656</a>)
(<a
href="https://github.com/iamkun/dayjs/commit/1d8746c23bd667bde80ee627a915301ebd69e1a2">1d8746c</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/iamkun/dayjs/commit/02b7a5c6c9500ad1a0d95a894ccc1e9f0942d222"><code>02b7a5c</code></a>
chore(release): 1.11.19 [skip ci]</li>
<li><a
href="https://github.com/iamkun/dayjs/commit/37193be1dff17ecc4debc0cc03e8715cc9c9f1a3"><code>37193be</code></a>
Merge pull request <a
href="https://redirect.github.com/iamkun/dayjs/issues/2950">#2950</a>
from iamkun/dev</li>
<li><a
href="https://github.com/iamkun/dayjs/commit/2db920bf9646b2eb55b56d328c376b5ee6a6fe5d"><code>2db920b</code></a>
chore: update doc</li>
<li><a
href="https://github.com/iamkun/dayjs/commit/4f72974ab53890a50f52348cf3a97595941315a0"><code>4f72974</code></a>
chore: update doc</li>
<li><a
href="https://github.com/iamkun/dayjs/commit/0b36a0711ffb0f488cfdfb73b56ed10d88ec3a32"><code>0b36a07</code></a>
chore: update doc</li>
<li><a
href="https://github.com/iamkun/dayjs/commit/269a7a9cf3649b7a4b328e771173701764a8480d"><code>269a7a9</code></a>
fix: added usage warnings for diff + updated unit tests (<a
href="https://redirect.github.com/iamkun/dayjs/issues/2948">#2948</a>)</li>
<li><a
href="https://github.com/iamkun/dayjs/commit/9e3132e952ca0fbd3c38de3ef8bc9a5e24d235a4"><code>9e3132e</code></a>
chore: update doc</li>
<li><a
href="https://github.com/iamkun/dayjs/commit/84201e609157283e008cc01211777fc82ecfdbd6"><code>84201e6</code></a>
chore: update doc</li>
<li><a
href="https://github.com/iamkun/dayjs/commit/80401e3ff91cc6c5310e6603a4d7a5fa92ca90ec"><code>80401e3</code></a>
chore: update readme</li>
<li><a
href="https://github.com/iamkun/dayjs/commit/88ad3fd5b56291ca3be48400f65f5f8316403c83"><code>88ad3fd</code></a>
test: Add unit test for Belarusian locale (<a
href="https://redirect.github.com/iamkun/dayjs/issues/2934">#2934</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/iamkun/dayjs/compare/v1.11.18...v1.11.19">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=dayjs&package-manager=npm_and_yarn&previous-version=1.11.18&new-version=1.11.19)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-01 15:18:41 +00:00
dependabot[bot] dc3b11e545 chore: bump yup from 1.6.1 to 1.7.1 in /site (#21032)
[//]: # (dependabot-start)
⚠️  **Dependabot is rebasing this PR** ⚠️ 

Rebasing might not happen immediately, so don't worry if this takes some
time.

Note: if you make any changes to this PR yourself, they will take
precedence over the rebase.

---

[//]: # (dependabot-end)

Bumps [yup](https://github.com/jquense/yup) from 1.6.1 to 1.7.1.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/jquense/yup/blob/master/CHANGELOG.md">yup's
changelog</a>.</em></p>
<blockquote>
<h2><a
href="https://github.com/jquense/yup/compare/v1.7.0...v1.7.1">1.7.1</a>
(2025-09-21)</h2>
<h1><a
href="https://github.com/jquense/yup/compare/v1.6.1...v1.7.0">1.7.0</a>
(2025-08-01)</h1>
<h3>Features</h3>
<ul>
<li>Implement standard schema interface (<a
href="https://redirect.github.com/jquense/yup/issues/2258">#2258</a>)
(<a
href="https://github.com/jquense/yup/commit/ced5f514a6033a96f5de3b4ae9c17fe0de86d68f">ced5f51</a>)</li>
<li>resolve ref params if present when describing (<a
href="https://github.com/jquense/yup/commit/ef5303025c38e6e0dc0de53c990e7277cc74164e">ef53030</a>),
closes <a
href="https://redirect.github.com/jquense/yup/issues/2276">#2276</a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/jquense/yup/commits">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=yup&package-manager=npm_and_yarn&previous-version=1.6.1&new-version=1.7.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-01 15:18:12 +00:00
dependabot[bot] a110c98040 chore: bump lucide-react from 0.552.0 to 0.555.0 in /site (#21031)
Bumps
[lucide-react](https://github.com/lucide-icons/lucide/tree/HEAD/packages/lucide-react)
from 0.552.0 to 0.555.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/lucide-icons/lucide/releases">lucide-react's
releases</a>.</em></p>
<blockquote>
<h2>Version 0.555.0</h2>
<h2>What's Changed</h2>
<ul>
<li>fix(icons): changed <code>calendars</code> icon by <a
href="https://github.com/jguddas"><code>@​jguddas</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/3795">lucide-icons/lucide#3795</a></li>
<li>fix(docs): correct package name and description for Flutter and
Lustre package (<a
href="https://github.com/lucide-icons/lucide/tree/HEAD/packages/lucide-react/issues/3701">#3701</a>)
by <a
href="https://github.com/epifaniofrancisco"><code>@​epifaniofrancisco</code></a>
in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/3703">lucide-icons/lucide#3703</a></li>
<li>feat(angular): Angular V21 Support by <a
href="https://github.com/JeevanMahesha"><code>@​JeevanMahesha</code></a>
in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/3807">lucide-icons/lucide#3807</a></li>
<li>chore(metadata): Adjust navigation category by <a
href="https://github.com/ericfennis"><code>@​ericfennis</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/3461">lucide-icons/lucide#3461</a></li>
<li>feat(icons): Add <code>waves-arrow-up</code> and
<code>waves-arrow-down</code> by <a
href="https://github.com/ericfennis"><code>@​ericfennis</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/3463">lucide-icons/lucide#3463</a></li>
<li>fix(icons): changed <code>scale</code> icon by <a
href="https://github.com/jamiemlaw"><code>@​jamiemlaw</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/3800">lucide-icons/lucide#3800</a></li>
<li>feat(icons): added <code>form</code> icon by <a
href="https://github.com/jguddas"><code>@​jguddas</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/3558">lucide-icons/lucide#3558</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/lucide-icons/lucide/compare/0.554.0...0.555.0">https://github.com/lucide-icons/lucide/compare/0.554.0...0.555.0</a></p>
<h2>Version 0.554.0</h2>
<h2>What's Changed</h2>
<ul>
<li>fix(icons): Rename fingerprint icon to fingerprint-pattern by <a
href="https://github.com/ericfennis"><code>@​ericfennis</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/3767">lucide-icons/lucide#3767</a></li>
<li>feat(docs): added lucide-rails third-party package by <a
href="https://github.com/theiereman"><code>@​theiereman</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/3769">lucide-icons/lucide#3769</a></li>
<li>fix(icons): changed <code>ampersand</code> icon by <a
href="https://github.com/jguddas"><code>@​jguddas</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/3771">lucide-icons/lucide#3771</a></li>
<li>fix(icons): changed <code>folder-git-2</code> icon by <a
href="https://github.com/jguddas"><code>@​jguddas</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/3790">lucide-icons/lucide#3790</a></li>
<li>fix(icons): update <code>anchor</code> icon by <a
href="https://github.com/jamiemlaw"><code>@​jamiemlaw</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/2523">lucide-icons/lucide#2523</a></li>
<li>feat(icons): added <code>calendars</code> icon by <a
href="https://github.com/jguddas"><code>@​jguddas</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/3788">lucide-icons/lucide#3788</a></li>
</ul>
<h2>Breaking change</h2>
<p>For <code>lucide-react</code> and <code>lucide-solid</code>, imports
for <code>Fingerprint</code> icon are changed to
<code>FingerprintPattern</code>.</p>
<h3>Lucide React</h3>
<pre lang="diff"><code>- import { Fingerprint } from
&quot;lucide-react&quot;;
+ import { FingerprintPattern } from &quot;lucide-react&quot;;
</code></pre>
<h3>Lucide Solid</h3>
<pre lang="diff"><code>- import { Fingerprint } from
&quot;lucide/solid&quot;;
+ import { FingerprintPattern } from &quot;lucide/solid&quot;;
<p>// Or</p>
<ul>
<li>import Fingerprint from
&quot;lucide/solid/icons/fingerprint&quot;;</li>
</ul>
<ul>
<li>import FingerprintPattern from
&quot;lucide/solid/icons/fingerprint-pattern&quot;;<br />
</code></pre></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a
href="https://github.com/theiereman"><code>@​theiereman</code></a> made
their first contribution in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/3769">lucide-icons/lucide#3769</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/lucide-icons/lucide/compare/0.553.0...0.554.0">https://github.com/lucide-icons/lucide/compare/0.553.0...0.554.0</a></p>
<h2>Version 0.553.0</h2>
<h2>What's Changed</h2>
<ul>
<li>feat(icons): added <code>mouse-pointer-2-off</code> icon by <a
href="https://github.com/domingasp"><code>@​domingasp</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/3570">lucide-icons/lucide#3570</a></li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/lucide-icons/lucide/commit/80d6f737e0a02c3c11af8d87cb986e33a4ef08d8"><code>80d6f73</code></a>
fix(icons): Rename fingerprint icon to fingerprint-pattern (<a
href="https://github.com/lucide-icons/lucide/tree/HEAD/packages/lucide-react/issues/3767">#3767</a>)</li>
<li>See full diff in <a
href="https://github.com/lucide-icons/lucide/commits/0.555.0/packages/lucide-react">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=lucide-react&package-manager=npm_and_yarn&previous-version=0.552.0&new-version=0.555.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-01 15:17:22 +00:00
dependabot[bot] bbf3f763fd chore: bump knip from 5.66.4 to 5.71.0 in /site (#21029)
Bumps [knip](https://github.com/webpro-nl/knip/tree/HEAD/packages/knip)
from 5.66.4 to 5.71.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/webpro-nl/knip/releases">knip's
releases</a>.</em></p>
<blockquote>
<h2>Release 5.71.0</h2>
<ul>
<li>Add <code>sed</code> to globally ignored binaries (<a
href="https://github.com/webpro-nl/knip/tree/HEAD/packages/knip/issues/1365">#1365</a>)
(ea8d61899fe8d4ba160ec998d564d3c9f5aafd55) - thanks <a
href="https://github.com/jmoses"><code>@​jmoses</code></a>!</li>
<li>Consider NS in condition referenced (closes <a
href="https://github.com/webpro-nl/knip/tree/HEAD/packages/knip/issues/1364">#1364</a>)
(7a5a8ea2351b31e1cefb1405d33b8dbb464c2ec9)</li>
<li>Improve dynamic import binding handling (close <a
href="https://github.com/webpro-nl/knip/tree/HEAD/packages/knip/issues/1368">#1368</a>)
(b210b18c18357885b33827fc23a7333615ef7d64)</li>
<li>Introduce graph explorer
(b107af4cfbf034159903cf79c82e6926ff7dd91c)</li>
<li>Find mdx plugins in next config (resolve <a
href="https://github.com/webpro-nl/knip/tree/HEAD/packages/knip/issues/1367">#1367</a>)
(07c0539dd167681e2f5533bef15a7759bd6a3f5f)</li>
<li>Filter out subshell function calls (resolve <a
href="https://github.com/webpro-nl/knip/tree/HEAD/packages/knip/issues/1369">#1369</a>)
(97d8f6acc9fda00486b2072f9717789d54b4e225)</li>
</ul>
<h2>Release 5.70.2</h2>
<ul>
<li>Restore &amp; add TS v5.5.0 workarounds ↻ oh my
(fe7ea23981ae1c94118041299b9f1fecceba62d4)</li>
<li>Extend &amp; refactor <code>Import</code> in module graph
(ad25794fc5ed465cf4be151df05fc4196d1589e4)</li>
<li>Fix <code>TYPE_ONLY</code> instance
(b431303d60f84f6abf77f37f93ccf9ab399d4cc9)</li>
<li>Add side-effect imports as well
(ed289ba9e69a030f945a42aef0828029fbe9b734)</li>
<li>Remove <code>project</code> patterns from astro plugin
(ac9e378d2bdf84b70791bdce9febc511bee924b4)</li>
<li>Don't leak negated entry into project patterns
(eab2b892c774c8ed545952997e66cf53719fa68e)</li>
<li>Run glob sets with negations separately (resolves <a
href="https://github.com/webpro-nl/knip/tree/HEAD/packages/knip/issues/1249">#1249</a>)
(969e3afdb25d9e607ff68f60543c8f1e64be5a69)</li>
<li>Include all groups to negate entry patterns in production mode
(406592dca0e44917703b24cee78c2d85b0a42fb6)</li>
</ul>
<h2>Release 5.70.1</h2>
<ul>
<li>chore: fix vitest node env recognition (<a
href="https://github.com/webpro-nl/knip/tree/HEAD/packages/knip/issues/1360">#1360</a>)
(9a38e10230b18b256ee8ed03dcc5217029b5298d) - thanks <a
href="https://github.com/jonathansamines"><code>@​jonathansamines</code></a>!</li>
<li>Improve some export/import positions
(f6f58fa96ef1243c4e5c70e8860b286bd63bed94)</li>
<li>Add some common hints/FAQs to plugin test template
(da7cf84a501321a9bbb3e118e840d36d47abad56)</li>
</ul>
<h2>Release 5.70.0</h2>
<ul>
<li>Revert &quot;Revive some tests in Bun&quot;
(f1406b5d8fc5add850e88ea23619bad745519c97)</li>
<li>feat(plugins): Add Prisma plugin entry and Prisma schema compiler
(<a
href="https://github.com/webpro-nl/knip/tree/HEAD/packages/knip/issues/1340">#1340</a>)
(9f80aa4b09f9c9c5a0e55015a8b0eae9fb2e1812) - thanks <a
href="https://github.com/CHC383"><code>@​CHC383</code></a>!</li>
<li>Improve some export/import positions
(b19282b3ff84d1486820afb9f09e1384d8934bc8)</li>
<li>Move block to group top-level patterns
(bba25f33d489fb1942925d022348536513e4a4dd)</li>
<li>Improve some naming around module graph
(63d61176f0613bb405627f6cab2dc1bbee052df5)</li>
<li>Minor refactors (a63b0dce0f886f297650185c72003f7c935a9deb)</li>
<li>Update auto-fix.mdx (<a
href="https://github.com/webpro-nl/knip/tree/HEAD/packages/knip/issues/1356">#1356</a>)
(c64d9056ef9aed63b1b8255dc1bad120a21f311f) - thanks <a
href="https://github.com/skvale"><code>@​skvale</code></a>!</li>
<li>Improve side-effects &amp; opaque import call handling (resolve <a
href="https://github.com/webpro-nl/knip/tree/HEAD/packages/knip/issues/1352">#1352</a>)
(e364589d790ce185c9a3b29aa2ea00f2663064d6)</li>
<li>Add some unit tests for <code>isIdentifierReferenced</code>
(f31eab4b443f084ff4af3eab187c352deab27089)</li>
<li>Add support for awaited import call promise
(92cbcef6b0501891e9e62ef6a3ef801b0de945e7)</li>
<li>Edit and dim tag hints title
(e4affd2f0651ba530817bb04805805e6474b0fbe)</li>
<li>feat(plugins): Add taskfile plugin (<a
href="https://github.com/webpro-nl/knip/tree/HEAD/packages/knip/issues/1357">#1357</a>)
(f64b72c31f0ee47da68a1eff96505dc770c43194) - thanks <a
href="https://github.com/elierotenberg"><code>@​elierotenberg</code></a>!</li>
<li>Improve pragmas handling/setup (resolves <a
href="https://github.com/webpro-nl/knip/tree/HEAD/packages/knip/issues/1358">#1358</a>)
(e0f497cc937e5cb5281a84a7e9c2181942b94361)</li>
<li>Upgrade js-yaml + some others (resolve <a
href="https://github.com/webpro-nl/knip/tree/HEAD/packages/knip/issues/1359">#1359</a>)
(5195888a691c200c971e214f28ad20bf4a395862)</li>
<li>Clean up (da9440fb6a09222cc8a50093178e6cd69fee3bd6)</li>
</ul>
<h2>Release 5.69.1</h2>
<ul>
<li>Release <code>@​knip/create-config</code> 1.0.8
(87405169656dbfa8cf931092d516c91647f95529)</li>
<li>Edit docs (5eb8a6943904505b5630dee1ee58379c7707f72d)</li>
<li>Apply Next.js page extensions to app directory (<a
href="https://github.com/webpro-nl/knip/tree/HEAD/packages/knip/issues/1351">#1351</a>)
(f9cf9dc0fd44880a515979a104261ed77fa8878d) - thanks <a
href="https://github.com/remcohaszing"><code>@​remcohaszing</code></a>!</li>
<li>Refactor fixes &amp; consistently use <code>issue.fixes</code>
(d7b45cfebb135881160ecda2acf0ad5239d98441)</li>
<li>Revive some tests in Bun
(74a0bd8ebf6e68e121333489495d2b6d58545fd4)</li>
<li>Fix import identifier/specifier pos
(95d2c04d5400ffb57f9057653c0977967b3ae02e)</li>
<li>Fix namespace import pos
(6b6b80b813d545d16ba74fc68beecd492f1252a2)</li>
<li>Improve some export/import positions
(9b87b1ac20fb33d9f9b5af1de1cbe1d053fa18ff)</li>
<li>Rely on absolute paths with formatly (npx acts weird)
(6653f357074c559f537af1b5563b191372d7901e)</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/webpro-nl/knip/commit/879a42ca09721292fc3443443d8d5f9df96c9aa7"><code>879a42c</code></a>
Release 5.71.0</li>
<li><a
href="https://github.com/webpro-nl/knip/commit/97d8f6acc9fda00486b2072f9717789d54b4e225"><code>97d8f6a</code></a>
Filter out subshell function calls (resolve <a
href="https://github.com/webpro-nl/knip/tree/HEAD/packages/knip/issues/1369">#1369</a>)</li>
<li><a
href="https://github.com/webpro-nl/knip/commit/07c0539dd167681e2f5533bef15a7759bd6a3f5f"><code>07c0539</code></a>
Find mdx plugins in next config (resolve <a
href="https://github.com/webpro-nl/knip/tree/HEAD/packages/knip/issues/1367">#1367</a>)</li>
<li><a
href="https://github.com/webpro-nl/knip/commit/b107af4cfbf034159903cf79c82e6926ff7dd91c"><code>b107af4</code></a>
Introduce graph explorer</li>
<li><a
href="https://github.com/webpro-nl/knip/commit/b210b18c18357885b33827fc23a7333615ef7d64"><code>b210b18</code></a>
Improve dynamic import binding handling (close <a
href="https://github.com/webpro-nl/knip/tree/HEAD/packages/knip/issues/1368">#1368</a>)</li>
<li><a
href="https://github.com/webpro-nl/knip/commit/7a5a8ea2351b31e1cefb1405d33b8dbb464c2ec9"><code>7a5a8ea</code></a>
Consider NS in condition referenced (closes <a
href="https://github.com/webpro-nl/knip/tree/HEAD/packages/knip/issues/1364">#1364</a>)</li>
<li><a
href="https://github.com/webpro-nl/knip/commit/ea8d61899fe8d4ba160ec998d564d3c9f5aafd55"><code>ea8d618</code></a>
Add <code>sed</code> to globally ignored binaries (<a
href="https://github.com/webpro-nl/knip/tree/HEAD/packages/knip/issues/1365">#1365</a>)</li>
<li><a
href="https://github.com/webpro-nl/knip/commit/59abdaa9c40bc750d18c5bfb3ddc0f44def93b30"><code>59abdaa</code></a>
Release 5.70.2</li>
<li><a
href="https://github.com/webpro-nl/knip/commit/406592dca0e44917703b24cee78c2d85b0a42fb6"><code>406592d</code></a>
Include all groups to negate entry patterns in production mode</li>
<li><a
href="https://github.com/webpro-nl/knip/commit/969e3afdb25d9e607ff68f60543c8f1e64be5a69"><code>969e3af</code></a>
Run glob sets with negations separately (resolves <a
href="https://github.com/webpro-nl/knip/tree/HEAD/packages/knip/issues/1249">#1249</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/webpro-nl/knip/commits/5.71.0/packages/knip">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=knip&package-manager=npm_and_yarn&previous-version=5.66.4&new-version=5.71.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-01 15:17:00 +00:00
dependabot[bot] 59866d9f52 chore: bump autoprefixer from 10.4.21 to 10.4.22 in /site (#21030)
Bumps [autoprefixer](https://github.com/postcss/autoprefixer) from
10.4.21 to 10.4.22.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/postcss/autoprefixer/releases">autoprefixer's
releases</a>.</em></p>
<blockquote>
<h2>10.4.22</h2>
<ul>
<li>Fixed <code>stretch</code> prefixes on new Can I Use database.</li>
<li>Updated <code>fraction.js</code>.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/postcss/autoprefixer/blob/main/CHANGELOG.md">autoprefixer's
changelog</a>.</em></p>
<blockquote>
<h2>10.4.22</h2>
<ul>
<li>Fixed <code>stretch</code> prefixes on new Can I Use database.</li>
<li>Updated <code>fraction.js</code>.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/postcss/autoprefixer/commit/73dc62c779bf51f2883f9541dc62fd164262e872"><code>73dc62c</code></a>
Release 10.4.22 version</li>
<li><a
href="https://github.com/postcss/autoprefixer/commit/9973c59f4880abff46c94fd5554e7e4ea194b549"><code>9973c59</code></a>
Lock CI action versions</li>
<li><a
href="https://github.com/postcss/autoprefixer/commit/4b4feca71abf7596d978fe7a1e048dec1608d740"><code>4b4feca</code></a>
Fix Node.js 10 on CI</li>
<li><a
href="https://github.com/postcss/autoprefixer/commit/15c21d3a7c626ec8269fdb926ed76e729593f09e"><code>15c21d3</code></a>
Fix old Node.js CI</li>
<li><a
href="https://github.com/postcss/autoprefixer/commit/27523c1c560933adfb5f8e29184a85b45ed60c87"><code>27523c1</code></a>
Update fraction.js</li>
<li><a
href="https://github.com/postcss/autoprefixer/commit/88a0d3e0f8034eb9a54087c74a36abb771de41a0"><code>88a0d3e</code></a>
Update dependencies and fix stretch and update example</li>
<li>See full diff in <a
href="https://github.com/postcss/autoprefixer/compare/10.4.21...10.4.22">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=autoprefixer&package-manager=npm_and_yarn&previous-version=10.4.21&new-version=10.4.22)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-01 15:16:55 +00:00
dependabot[bot] e00578cf99 chore: bump axios from 1.13.1 to 1.13.2 in /site (#21028)
Bumps [axios](https://github.com/axios/axios) from 1.13.1 to 1.13.2.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/axios/axios/releases">axios's
releases</a>.</em></p>
<blockquote>
<h2>Release v1.13.2</h2>
<h2>Release notes:</h2>
<h3>Bug Fixes</h3>
<ul>
<li><strong>http:</strong> fix 'socket hang up' bug for keep-alive
requests when using timeouts; (<a
href="https://redirect.github.com/axios/axios/issues/7206">#7206</a>)
(<a
href="https://github.com/axios/axios/commit/8d372335f5c50ecd01e8615f2468a9eb19703117">8d37233</a>)</li>
<li><strong>http:</strong> use default export for http2 module to
support stubs; (<a
href="https://redirect.github.com/axios/axios/issues/7196">#7196</a>)
(<a
href="https://github.com/axios/axios/commit/0588880ac7ddba7594ef179930493884b7e90bf5">0588880</a>)</li>
</ul>
<h3>Performance Improvements</h3>
<ul>
<li><strong>http:</strong> fix early loop exit; (<a
href="https://redirect.github.com/axios/axios/issues/7202">#7202</a>)
(<a
href="https://github.com/axios/axios/commit/12c314b603e7852a157e93e47edb626a471ba6c5">12c314b</a>)</li>
</ul>
<h3>Contributors to this release</h3>
<ul>
<li><!-- raw HTML omitted --> <a
href="https://github.com/DigitalBrainJS" title="+28/-9
([#7206](https://github.com/axios/axios/issues/7206)
[#7202](https://github.com/axios/axios/issues/7202) )">Dmitriy
Mozgovoy</a></li>
<li><!-- raw HTML omitted --> <a href="https://github.com/kasperisager"
title="+9/-9 ([#7196](https://github.com/axios/axios/issues/7196)
)">Kasper Isager Dalsgarð</a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/axios/axios/blob/v1.x/CHANGELOG.md">axios's
changelog</a>.</em></p>
<blockquote>
<h2><a
href="https://github.com/axios/axios/compare/v1.13.1...v1.13.2">1.13.2</a>
(2025-11-04)</h2>
<h3>Bug Fixes</h3>
<ul>
<li><strong>http:</strong> fix 'socket hang up' bug for keep-alive
requests when using timeouts; (<a
href="https://redirect.github.com/axios/axios/issues/7206">#7206</a>)
(<a
href="https://github.com/axios/axios/commit/8d372335f5c50ecd01e8615f2468a9eb19703117">8d37233</a>)</li>
<li><strong>http:</strong> use default export for http2 module to
support stubs; (<a
href="https://redirect.github.com/axios/axios/issues/7196">#7196</a>)
(<a
href="https://github.com/axios/axios/commit/0588880ac7ddba7594ef179930493884b7e90bf5">0588880</a>)</li>
</ul>
<h3>Performance Improvements</h3>
<ul>
<li><strong>http:</strong> fix early loop exit; (<a
href="https://redirect.github.com/axios/axios/issues/7202">#7202</a>)
(<a
href="https://github.com/axios/axios/commit/12c314b603e7852a157e93e47edb626a471ba6c5">12c314b</a>)</li>
</ul>
<h3>Contributors to this release</h3>
<ul>
<li><!-- raw HTML omitted --> <a
href="https://github.com/DigitalBrainJS" title="+28/-9
([#7206](https://github.com/axios/axios/issues/7206)
[#7202](https://github.com/axios/axios/issues/7202) )">Dmitriy
Mozgovoy</a></li>
<li><!-- raw HTML omitted --> <a href="https://github.com/kasperisager"
title="+9/-9 ([#7196](https://github.com/axios/axios/issues/7196)
)">Kasper Isager Dalsgarð</a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/axios/axios/commit/08b84b52d5835d0c7b81049c365c3d271ade8bff"><code>08b84b5</code></a>
chore(release): v1.13.2 (<a
href="https://redirect.github.com/axios/axios/issues/7207">#7207</a>)</li>
<li><a
href="https://github.com/axios/axios/commit/8d372335f5c50ecd01e8615f2468a9eb19703117"><code>8d37233</code></a>
fix(http): fix 'socket hang up' bug for keep-alive requests when using
timeou...</li>
<li><a
href="https://github.com/axios/axios/commit/12c314b603e7852a157e93e47edb626a471ba6c5"><code>12c314b</code></a>
perf(http): fix early loop exit; (<a
href="https://redirect.github.com/axios/axios/issues/7202">#7202</a>)</li>
<li><a
href="https://github.com/axios/axios/commit/f6d79e773baf70bf4e6d888e72d4bcf589060a84"><code>f6d79e7</code></a>
chore(sponsor): update sponsor block (<a
href="https://redirect.github.com/axios/axios/issues/7203">#7203</a>)</li>
<li><a
href="https://github.com/axios/axios/commit/0588880ac7ddba7594ef179930493884b7e90bf5"><code>0588880</code></a>
fix(http): use default export for http2 module to support stubs; (<a
href="https://redirect.github.com/axios/axios/issues/7196">#7196</a>)</li>
<li>See full diff in <a
href="https://github.com/axios/axios/compare/v1.13.1...v1.13.2">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=axios&package-manager=npm_and_yarn&previous-version=1.13.1&new-version=1.13.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-01 15:16:44 +00:00
dependabot[bot] fe850752dd chore: bump formik from 2.4.6 to 2.4.9 in /site (#21027)
Bumps [formik](https://github.com/jaredpalmer/formik) from 2.4.6 to
2.4.9.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/jaredpalmer/formik/releases">formik's
releases</a>.</em></p>
<blockquote>
<h2>formik@2.4.9</h2>
<h3>Patch Changes</h3>
<ul>
<li><a
href="https://redirect.github.com/jaredpalmer/formik/pull/4051">#4051</a>
<a
href="https://github.com/jaredpalmer/formik/commit/8f9d04d206146ca941facf37ddd9ddb459c459dc"><code>8f9d04d</code></a>
Thanks <a
href="https://github.com/Moumouls"><code>@​Moumouls</code></a>! - fix:
jsx ref for react 19</li>
</ul>
<h2>formik@2.4.8</h2>
<h3>Patch Changes</h3>
<ul>
<li><a
href="https://redirect.github.com/jaredpalmer/formik/pull/4042">#4042</a>
<a
href="https://github.com/jaredpalmer/formik/commit/1de45decf8fd70c038fca88dc1a6543aac269553"><code>1de45de</code></a>
Thanks <a
href="https://github.com/apps/copilot-swe-agent"><code>@​copilot-swe-agent</code></a>!
- Replace JSX.IntrinsicElements with React.JSX.IntrinsicElements for
React 19 compatibility. The global JSX namespace was removed in React
19, so we now use React.JSX.IntrinsicElements instead.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/jaredpalmer/formik/commit/91475adbf33579561e580eceea0c031f4ec2e992"><code>91475ad</code></a>
Merge pull request <a
href="https://redirect.github.com/jaredpalmer/formik/issues/4053">#4053</a>
from jaredpalmer/changeset-release/main</li>
<li><a
href="https://github.com/jaredpalmer/formik/commit/920f107205a9e3440efc5dba127e3aecbe98fda5"><code>920f107</code></a>
Version Packages</li>
<li><a
href="https://github.com/jaredpalmer/formik/commit/8f9d04d206146ca941facf37ddd9ddb459c459dc"><code>8f9d04d</code></a>
fix: jsx ref for react 19 (<a
href="https://redirect.github.com/jaredpalmer/formik/issues/4051">#4051</a>)</li>
<li><a
href="https://github.com/jaredpalmer/formik/commit/ddfae3fad836c088f376e88c2be5282262429c1c"><code>ddfae3f</code></a>
Merge pull request <a
href="https://redirect.github.com/jaredpalmer/formik/issues/4045">#4045</a>
from jaredpalmer/changeset-release/main</li>
<li><a
href="https://github.com/jaredpalmer/formik/commit/741c9d448b13590900bd5170b55cd03ade33f578"><code>741c9d4</code></a>
Version Packages</li>
<li><a
href="https://github.com/jaredpalmer/formik/commit/f7f8f53f9ee379d4e2048ee4c73d1bf9c4af48ad"><code>f7f8f53</code></a>
Upgrade changesets/action to v1.5.3 and npm packages (<a
href="https://redirect.github.com/jaredpalmer/formik/issues/4043">#4043</a>)</li>
<li><a
href="https://github.com/jaredpalmer/formik/commit/7fca4b2cdc881dc0b79a2f219df57a7e15866fc2"><code>7fca4b2</code></a>
Merge pull request <a
href="https://redirect.github.com/jaredpalmer/formik/issues/4044">#4044</a>
from jaredpalmer/copilot/upgrade-to-latest-turborepo</li>
<li><a
href="https://github.com/jaredpalmer/formik/commit/c8e5527ff4c1f2ab9a876f8df71dd24b443f7efe"><code>c8e5527</code></a>
Add .turbo to .gitignore and remove cached files</li>
<li><a
href="https://github.com/jaredpalmer/formik/commit/488dbec5dd619ba71814dc9fb643c0da5f65482a"><code>488dbec</code></a>
Upgrade turborepo from 1.9.9 to 2.6.0 with initial configuration
changes</li>
<li><a
href="https://github.com/jaredpalmer/formik/commit/dc03941b8a9d198aad54e624b850c6446eaadaec"><code>dc03941</code></a>
Initial plan</li>
<li>Additional commits viewable in <a
href="https://github.com/jaredpalmer/formik/compare/formik@2.4.6...formik@2.4.9">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=formik&package-manager=npm_and_yarn&previous-version=2.4.6&new-version=2.4.9)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-01 15:16:02 +00:00
dependabot[bot] d786bc400c chore: bump react-syntax-highlighter from 15.6.1 to 15.6.6 in /site (#21026)
Bumps
[react-syntax-highlighter](https://github.com/react-syntax-highlighter/react-syntax-highlighter)
from 15.6.1 to 15.6.6.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/react-syntax-highlighter/react-syntax-highlighter/releases">react-syntax-highlighter's
releases</a>.</em></p>
<blockquote>
<h2>v15.6.6</h2>
<p>Updated <code>overrides</code> block attempting to solve transitive
<code>prismjs</code> dependency issue:</p>
<pre><code>&quot;overrides&quot;: {
    &quot;prismjs&quot;: &quot;^1.30.0&quot;,
    &quot;refractor&quot;: {
      &quot;prismjs&quot;: &quot;^1.30.0&quot;
    }
  }
</code></pre>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/react-syntax-highlighter/react-syntax-highlighter/compare/v15.6.5...v15.6.6">https://github.com/react-syntax-highlighter/react-syntax-highlighter/compare/v15.6.5...v15.6.6</a></p>
<h2>v15.6.5</h2>
<h2>What's Changed</h2>
<ul>
<li>Bump elliptic from 6.5.5 to 6.6.0 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/react-syntax-highlighter/react-syntax-highlighter/pull/576">react-syntax-highlighter/react-syntax-highlighter#576</a></li>
<li>Bump ws from 6.2.2 to 6.2.3 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/react-syntax-highlighter/react-syntax-highlighter/pull/574">react-syntax-highlighter/react-syntax-highlighter#574</a></li>
<li>Bump express from 4.19.2 to 4.21.1 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/react-syntax-highlighter/react-syntax-highlighter/pull/572">react-syntax-highlighter/react-syntax-highlighter#572</a></li>
<li>Bump send and express by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/react-syntax-highlighter/react-syntax-highlighter/pull/571">react-syntax-highlighter/react-syntax-highlighter#571</a></li>
<li>Bump cookie and express by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/react-syntax-highlighter/react-syntax-highlighter/pull/570">react-syntax-highlighter/react-syntax-highlighter#570</a></li>
<li>Bump serve-static and express by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/react-syntax-highlighter/react-syntax-highlighter/pull/569">react-syntax-highlighter/react-syntax-highlighter#569</a></li>
<li>Bump body-parser and express by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/react-syntax-highlighter/react-syntax-highlighter/pull/568">react-syntax-highlighter/react-syntax-highlighter#568</a></li>
<li>Add Boemly to the built with section of the readme by <a
href="https://github.com/lukasbals"><code>@​lukasbals</code></a> in <a
href="https://redirect.github.com/react-syntax-highlighter/react-syntax-highlighter/pull/467">react-syntax-highlighter/react-syntax-highlighter#467</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/lukasbals"><code>@​lukasbals</code></a>
made their first contribution in <a
href="https://redirect.github.com/react-syntax-highlighter/react-syntax-highlighter/pull/467">react-syntax-highlighter/react-syntax-highlighter#467</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/react-syntax-highlighter/react-syntax-highlighter/compare/v15.6.4...v15.6.5">https://github.com/react-syntax-highlighter/react-syntax-highlighter/compare/v15.6.4...v15.6.5</a></p>
<h2>v15.6.4</h2>
<h2>What's Changed</h2>
<ul>
<li>Override <code>refractor 3.6.0</code>'s <code>prismjs</code>
dependency by <a
href="https://github.com/simmerer"><code>@​simmerer</code></a> in <a
href="https://redirect.github.com/react-syntax-highlighter/react-syntax-highlighter/pull/605">react-syntax-highlighter/react-syntax-highlighter#605</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/react-syntax-highlighter/react-syntax-highlighter/compare/v15.6.3...v15.6.4">https://github.com/react-syntax-highlighter/react-syntax-highlighter/compare/v15.6.3...v15.6.4</a></p>
<h2>v15.6.3</h2>
<h2>What's Changed</h2>
<ul>
<li>fix line count error by <a
href="https://github.com/bbbert"><code>@​bbbert</code></a> in <a
href="https://redirect.github.com/react-syntax-highlighter/react-syntax-highlighter/pull/583">react-syntax-highlighter/react-syntax-highlighter#583</a></li>
<li>fix spelling error by <a
href="https://github.com/BrianHung"><code>@​BrianHung</code></a> in <a
href="https://redirect.github.com/react-syntax-highlighter/react-syntax-highlighter/pull/579">react-syntax-highlighter/react-syntax-highlighter#579</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/bbbert"><code>@​bbbert</code></a> made
their first contribution in <a
href="https://redirect.github.com/react-syntax-highlighter/react-syntax-highlighter/pull/583">react-syntax-highlighter/react-syntax-highlighter#583</a></li>
<li><a href="https://github.com/BrianHung"><code>@​BrianHung</code></a>
made their first contribution in <a
href="https://redirect.github.com/react-syntax-highlighter/react-syntax-highlighter/pull/579">react-syntax-highlighter/react-syntax-highlighter#579</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/react-syntax-highlighter/react-syntax-highlighter/compare/v15.6.2...v15.6.3">https://github.com/react-syntax-highlighter/react-syntax-highlighter/compare/v15.6.2...v15.6.3</a></p>
<h2>v15.6.2</h2>
<h2>What's Changed</h2>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/react-syntax-highlighter/react-syntax-highlighter/blob/master/CHANGELOG.MD">react-syntax-highlighter's
changelog</a>.</em></p>
<blockquote>
<h1>Changelog</h1>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/react-syntax-highlighter/react-syntax-highlighter/commit/56a1b0f779e3bc0175a6e8915fa9274c0f4ca985"><code>56a1b0f</code></a>
add top-level override for prismjs, bump to 15.6.6</li>
<li><a
href="https://github.com/react-syntax-highlighter/react-syntax-highlighter/commit/a169285045a1448d58102e034ac38df63596745a"><code>a169285</code></a>
bump to 15.6.5</li>
<li><a
href="https://github.com/react-syntax-highlighter/react-syntax-highlighter/commit/5d507f0a97d29d9f74c2ce0844f87a08c85b0a46"><code>5d507f0</code></a>
Add Boemly to the built with section of the readme (<a
href="https://redirect.github.com/react-syntax-highlighter/react-syntax-highlighter/issues/467">#467</a>)</li>
<li><a
href="https://github.com/react-syntax-highlighter/react-syntax-highlighter/commit/0bda76915b41ec92aea9e79f360476efc1b7fb2c"><code>0bda769</code></a>
Bump body-parser and express (<a
href="https://redirect.github.com/react-syntax-highlighter/react-syntax-highlighter/issues/568">#568</a>)</li>
<li><a
href="https://github.com/react-syntax-highlighter/react-syntax-highlighter/commit/9fb3f732fc263056e6504fced239dfe0e87dd67a"><code>9fb3f73</code></a>
Bump serve-static and express (<a
href="https://redirect.github.com/react-syntax-highlighter/react-syntax-highlighter/issues/569">#569</a>)</li>
<li><a
href="https://github.com/react-syntax-highlighter/react-syntax-highlighter/commit/5f0dbfcc3c5ec44460595011def5aaa9821dd560"><code>5f0dbfc</code></a>
Bump cookie and express (<a
href="https://redirect.github.com/react-syntax-highlighter/react-syntax-highlighter/issues/570">#570</a>)</li>
<li><a
href="https://github.com/react-syntax-highlighter/react-syntax-highlighter/commit/53e66073ca675005ec069b20a16ff38a81d10a5e"><code>53e6607</code></a>
Bump send and express (<a
href="https://redirect.github.com/react-syntax-highlighter/react-syntax-highlighter/issues/571">#571</a>)</li>
<li><a
href="https://github.com/react-syntax-highlighter/react-syntax-highlighter/commit/130c9c322b7d5975440c0476f6418e2c22a696d6"><code>130c9c3</code></a>
Bump express from 4.19.2 to 4.21.1 (<a
href="https://redirect.github.com/react-syntax-highlighter/react-syntax-highlighter/issues/572">#572</a>)</li>
<li><a
href="https://github.com/react-syntax-highlighter/react-syntax-highlighter/commit/93825906ee0f0f6671830f3d0da601c8174d52d9"><code>9382590</code></a>
Bump ws from 6.2.2 to 6.2.3 (<a
href="https://redirect.github.com/react-syntax-highlighter/react-syntax-highlighter/issues/574">#574</a>)</li>
<li><a
href="https://github.com/react-syntax-highlighter/react-syntax-highlighter/commit/7ecf60606abccc2c7edef5fc254338a7c951db3c"><code>7ecf606</code></a>
Bump elliptic from 6.5.5 to 6.6.0 (<a
href="https://redirect.github.com/react-syntax-highlighter/react-syntax-highlighter/issues/576">#576</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/react-syntax-highlighter/react-syntax-highlighter/compare/v15.6.1...v15.6.6">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=react-syntax-highlighter&package-manager=npm_and_yarn&previous-version=15.6.1&new-version=15.6.6)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-01 15:15:38 +00:00
Jakub Domeracki cbb0952e5a chore: disable autoupgrade of GH Actions version upgrades (#21019)
Addresses
https://github.com/coder/internal/issues/1166
2025-12-01 15:09:36 +01:00
203 changed files with 5889 additions and 2424 deletions
+4 -2
View File
@@ -6,6 +6,8 @@ updates:
interval: "weekly"
time: "06:00"
timezone: "America/Chicago"
cooldown:
default-days: 7
labels: []
commit-message:
prefix: "ci"
@@ -68,8 +70,8 @@ updates:
interval: "monthly"
time: "06:00"
timezone: "America/Chicago"
reviewers:
- "coder/ts"
cooldown:
default-days: 7
commit-message:
prefix: "chore"
labels: []
+9 -1
View File
@@ -28,6 +28,7 @@ jobs:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Approve the PR
if: steps.metadata.outputs.package-ecosystem != 'github-actions'
run: |
echo "Approving $PR_URL"
gh pr review --approve "$PR_URL"
@@ -36,6 +37,7 @@ jobs:
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Enable auto-merge
if: steps.metadata.outputs.package-ecosystem != 'github-actions'
run: |
echo "Enabling auto-merge for $PR_URL"
gh pr merge --auto --squash "$PR_URL"
@@ -45,6 +47,11 @@ jobs:
- name: Send Slack notification
run: |
if [ "$PACKAGE_ECOSYSTEM" = "github-actions" ]; then
STATUS_TEXT=":pr-opened: Dependabot opened PR #${PR_NUMBER} (GitHub Actions changes are not auto-merged)"
else
STATUS_TEXT=":pr-merged: Auto merge enabled for Dependabot PR #${PR_NUMBER}"
fi
curl -X POST -H 'Content-type: application/json' \
--data '{
"username": "dependabot",
@@ -54,7 +61,7 @@ jobs:
"type": "header",
"text": {
"type": "plain_text",
"text": ":pr-merged: Auto merge enabled for Dependabot PR #'"${PR_NUMBER}"'",
"text": "'"${STATUS_TEXT}"'",
"emoji": true
}
},
@@ -84,6 +91,7 @@ jobs:
}' "${{ secrets.DEPENDABOT_PRS_SLACK_WEBHOOK }}"
env:
SLACK_WEBHOOK: ${{ secrets.DEPENDABOT_PRS_SLACK_WEBHOOK }}
PACKAGE_ECOSYSTEM: ${{ steps.metadata.outputs.package-ecosystem }}
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_TITLE: ${{ github.event.pull_request.title }}
PR_URL: ${{ github.event.pull_request.html_url }}
+3
View File
@@ -90,6 +90,9 @@ __debug_bin*
**/.claude/settings.local.json
# Local agent configuration
AGENTS.local.md
/.env
# Ignore plans written by AI agents.
+3
View File
@@ -0,0 +1,3 @@
{
"ignores": ["PLAN.md"],
}
+23
View File
@@ -173,6 +173,23 @@ ctx, cancel := context.WithTimeout(ctx, 5*time.Minute)
ctx, cancel := context.WithTimeout(ctx, 5*time.Minute)
```
### Avoid Unnecessary Changes
When fixing a bug or adding a feature, don't modify code unrelated to your
task. Unnecessary changes make PRs harder to review and can introduce
regressions.
**Don't reword existing comments or code** unless the change is directly
motivated by your task. Rewording comments to be shorter or "cleaner" wastes
reviewer time and clutters the diff.
**Don't delete existing comments** that explain non-obvious behavior. These
comments preserve important context about why code works a certain way.
**When adding tests for new behavior**, add new test cases instead of modifying
existing ones. This preserves coverage for the original behavior and makes it
clear what the new test covers.
## Detailed Development Guides
@.claude/docs/ARCHITECTURE.md
@@ -181,6 +198,12 @@ ctx, cancel := context.WithTimeout(ctx, 5*time.Minute)
@.claude/docs/TROUBLESHOOTING.md
@.claude/docs/DATABASE.md
## Local Configuration
These files may be gitignored, read manually if not auto-loaded.
@AGENTS.local.md
## Common Pitfalls
1. **Audit table errors** → Update `enterprise/audit/table.go`
+4 -4
View File
@@ -679,7 +679,7 @@ gen/db: $(DB_GEN_FILES)
gen/golden-files: \
agent/unit/testdata/.gen-golden \
cli/testdata/.gen-golden \
coderd/insightsapi/.gen-golden \
coderd/.gen-golden \
coderd/notifications/.gen-golden \
enterprise/cli/testdata/.gen-golden \
enterprise/tailnet/testdata/.gen-golden \
@@ -953,7 +953,7 @@ clean/golden-files:
find \
cli/testdata \
coderd/notifications/testdata \
coderd/insightsapi/testdata \
coderd/testdata \
enterprise/cli/testdata \
enterprise/tailnet/testdata \
helm/coder/tests/testdata \
@@ -991,8 +991,8 @@ helm/provisioner/tests/testdata/.gen-golden: $(wildcard helm/provisioner/tests/t
TZ=UTC go test ./helm/provisioner/tests -run=TestUpdateGoldenFiles -update
touch "$@"
coderd/insightsapi/.gen-golden: $(wildcard coderd/insightsapi/testdata/*/*.golden) $(GO_SRC_FILES) $(wildcard coderd/insightsapi/*_test.go)
TZ=UTC go test ./coderd/insightsapi -run="Test.*Golden$$" -update
coderd/.gen-golden: $(wildcard coderd/testdata/*/*.golden) $(GO_SRC_FILES) $(wildcard coderd/*_test.go)
TZ=UTC go test ./coderd -run="Test.*Golden$$" -update
touch "$@"
coderd/notifications/.gen-golden: $(wildcard coderd/notifications/testdata/*/*.golden) $(GO_SRC_FILES) $(wildcard coderd/notifications/*_test.go)
+2 -2
View File
@@ -1576,8 +1576,8 @@ func (a *agent) createTailnet(
break
}
clog := a.logger.Named("speedtest").With(
slog.F("remote", conn.RemoteAddr().String()),
slog.F("local", conn.LocalAddr().String()))
slog.F("remote", conn.RemoteAddr()),
slog.F("local", conn.LocalAddr()))
clog.Info(ctx, "accepted conn")
wg.Add(1)
closed := make(chan struct{})
+45
View File
@@ -0,0 +1,45 @@
package agent
import (
"testing"
"github.com/google/uuid"
"github.com/stretchr/testify/require"
"cdr.dev/slog"
"cdr.dev/slog/sloggers/slogtest"
"github.com/coder/coder/v2/agent/proto"
"github.com/coder/coder/v2/testutil"
)
// TestReportConnectionEmpty tests that reportConnection() doesn't choke if given an empty IP string, which is what we
// send if we cannot get the remote address.
func TestReportConnectionEmpty(t *testing.T) {
t.Parallel()
connID := uuid.UUID{1}
logger := slogtest.Make(t, &slogtest.Options{IgnoreErrors: true}).Leveled(slog.LevelDebug)
ctx := testutil.Context(t, testutil.WaitShort)
uut := &agent{
hardCtx: ctx,
logger: logger,
}
disconnected := uut.reportConnection(connID, proto.Connection_TYPE_UNSPECIFIED, "")
require.Len(t, uut.reportConnections, 1)
req0 := uut.reportConnections[0]
require.Equal(t, proto.Connection_TYPE_UNSPECIFIED, req0.GetConnection().GetType())
require.Equal(t, "", req0.GetConnection().Ip)
require.Equal(t, connID[:], req0.GetConnection().GetId())
require.Equal(t, proto.Connection_CONNECT, req0.GetConnection().GetAction())
disconnected(0, "because")
require.Len(t, uut.reportConnections, 2)
req1 := uut.reportConnections[1]
require.Equal(t, proto.Connection_TYPE_UNSPECIFIED, req1.GetConnection().GetType())
require.Equal(t, "", req1.GetConnection().Ip)
require.Equal(t, connID[:], req1.GetConnection().GetId())
require.Equal(t, proto.Connection_DISCONNECT, req1.GetConnection().GetAction())
require.Equal(t, "because", req1.GetConnection().GetReason())
}
+44 -19
View File
@@ -1039,6 +1039,10 @@ func (api *API) processUpdatedContainersLocked(ctx context.Context, updated code
logger.Error(ctx, "inject subagent into container failed", slog.Error(err))
dc.Error = err.Error()
} else {
// TODO(mafredri): Preserve the error from devcontainer
// up if it was a lifecycle script error. Currently
// this results in a brief flicker for the user if
// injection is fast, as the error is shown then erased.
dc.Error = ""
}
}
@@ -1347,27 +1351,41 @@ func (api *API) CreateDevcontainer(workspaceFolder, configPath string, opts ...D
upOptions := []DevcontainerCLIUpOptions{WithUpOutput(infoW, errW)}
upOptions = append(upOptions, opts...)
_, err := api.dccli.Up(ctx, dc.WorkspaceFolder, configPath, upOptions...)
if err != nil {
containerID, upErr := api.dccli.Up(ctx, dc.WorkspaceFolder, configPath, upOptions...)
if upErr != nil {
// No need to log if the API is closing (context canceled), as this
// is expected behavior when the API is shutting down.
if !errors.Is(err, context.Canceled) {
logger.Error(ctx, "devcontainer creation failed", slog.Error(err))
if !errors.Is(upErr, context.Canceled) {
logger.Error(ctx, "devcontainer creation failed", slog.Error(upErr))
}
api.mu.Lock()
dc = api.knownDevcontainers[dc.WorkspaceFolder]
dc.Status = codersdk.WorkspaceAgentDevcontainerStatusError
dc.Error = err.Error()
api.knownDevcontainers[dc.WorkspaceFolder] = dc
api.recreateErrorTimes[dc.WorkspaceFolder] = api.clock.Now("agentcontainers", "recreate", "errorTimes")
api.mu.Unlock()
// If we don't have a container ID, the error is fatal, so we
// should mark the devcontainer as errored and return.
if containerID == "" {
api.mu.Lock()
dc = api.knownDevcontainers[dc.WorkspaceFolder]
dc.Status = codersdk.WorkspaceAgentDevcontainerStatusError
dc.Error = upErr.Error()
api.knownDevcontainers[dc.WorkspaceFolder] = dc
api.recreateErrorTimes[dc.WorkspaceFolder] = api.clock.Now("agentcontainers", "recreate", "errorTimes")
api.broadcastUpdatesLocked()
api.mu.Unlock()
return xerrors.Errorf("start devcontainer: %w", err)
return xerrors.Errorf("start devcontainer: %w", upErr)
}
// If we have a container ID, it means the container was created
// but a lifecycle script (e.g. postCreateCommand) failed. In this
// case, we still want to refresh containers to pick up the new
// container, inject the agent, and allow the user to debug the
// issue. We store the error to surface it to the user.
logger.Warn(ctx, "devcontainer created with errors (e.g. lifecycle script failure), container is available",
slog.F("container_id", containerID),
)
} else {
logger.Info(ctx, "devcontainer created successfully")
}
logger.Info(ctx, "devcontainer created successfully")
api.mu.Lock()
dc = api.knownDevcontainers[dc.WorkspaceFolder]
// Update the devcontainer status to Running or Stopped based on the
@@ -1376,13 +1394,18 @@ func (api *API) CreateDevcontainer(workspaceFolder, configPath string, opts ...D
// to minimize the time between API consistency, we guess the status
// based on the container state.
dc.Status = codersdk.WorkspaceAgentDevcontainerStatusStopped
if dc.Container != nil {
if dc.Container.Running {
dc.Status = codersdk.WorkspaceAgentDevcontainerStatusRunning
}
if dc.Container != nil && dc.Container.Running {
dc.Status = codersdk.WorkspaceAgentDevcontainerStatusRunning
}
dc.Dirty = false
dc.Error = ""
if upErr != nil {
// If there was a lifecycle script error but we have a container ID,
// the container is running so we should set the status to Running.
dc.Status = codersdk.WorkspaceAgentDevcontainerStatusRunning
dc.Error = upErr.Error()
} else {
dc.Error = ""
}
api.recreateSuccessTimes[dc.WorkspaceFolder] = api.clock.Now("agentcontainers", "recreate", "successTimes")
api.knownDevcontainers[dc.WorkspaceFolder] = dc
api.broadcastUpdatesLocked()
@@ -1434,6 +1457,8 @@ func (api *API) markDevcontainerDirty(configPath string, modifiedAt time.Time) {
api.knownDevcontainers[dc.WorkspaceFolder] = dc
}
api.broadcastUpdatesLocked()
}
// cleanupSubAgents removes subagents that are no longer managed by
+196
View File
@@ -234,6 +234,8 @@ func (w *fakeWatcher) sendEventWaitNextCalled(ctx context.Context, event fsnotif
// fakeSubAgentClient implements SubAgentClient for testing purposes.
type fakeSubAgentClient struct {
logger slog.Logger
mu sync.Mutex // Protects following.
agents map[uuid.UUID]agentcontainers.SubAgent
listErrC chan error // If set, send to return error, close to return nil.
@@ -254,6 +256,8 @@ func (m *fakeSubAgentClient) List(ctx context.Context) ([]agentcontainers.SubAge
}
}
}
m.mu.Lock()
defer m.mu.Unlock()
var agents []agentcontainers.SubAgent
for _, agent := range m.agents {
agents = append(agents, agent)
@@ -283,6 +287,9 @@ func (m *fakeSubAgentClient) Create(ctx context.Context, agent agentcontainers.S
return agentcontainers.SubAgent{}, xerrors.New("operating system must be set")
}
m.mu.Lock()
defer m.mu.Unlock()
for _, a := range m.agents {
if a.Name == agent.Name {
return agentcontainers.SubAgent{}, &pq.Error{
@@ -314,6 +321,8 @@ func (m *fakeSubAgentClient) Delete(ctx context.Context, id uuid.UUID) error {
}
}
}
m.mu.Lock()
defer m.mu.Unlock()
if m.agents == nil {
m.agents = make(map[uuid.UUID]agentcontainers.SubAgent)
}
@@ -1632,6 +1641,77 @@ func TestAPI(t *testing.T) {
require.NotNil(t, response.Devcontainers[0].Container, "container should not be nil")
})
// Verify that modifying a config file broadcasts the dirty status
// over websocket immediately.
t.Run("FileWatcherDirtyBroadcast", func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitShort)
configPath := "/workspace/project/.devcontainer/devcontainer.json"
fWatcher := newFakeWatcher(t)
fLister := &fakeContainerCLI{
containers: codersdk.WorkspaceAgentListContainersResponse{
Containers: []codersdk.WorkspaceAgentContainer{
{
ID: "container-id",
FriendlyName: "container-name",
Running: true,
Labels: map[string]string{
agentcontainers.DevcontainerLocalFolderLabel: "/workspace/project",
agentcontainers.DevcontainerConfigFileLabel: configPath,
},
},
},
},
}
mClock := quartz.NewMock(t)
tickerTrap := mClock.Trap().TickerFunc("updaterLoop")
api := agentcontainers.NewAPI(
slogtest.Make(t, nil).Leveled(slog.LevelDebug),
agentcontainers.WithContainerCLI(fLister),
agentcontainers.WithWatcher(fWatcher),
agentcontainers.WithClock(mClock),
)
api.Start()
defer api.Close()
srv := httptest.NewServer(api.Routes())
defer srv.Close()
tickerTrap.MustWait(ctx).MustRelease(ctx)
tickerTrap.Close()
wsConn, resp, err := websocket.Dial(ctx, "ws"+strings.TrimPrefix(srv.URL, "http")+"/watch", nil)
require.NoError(t, err)
if resp != nil && resp.Body != nil {
defer resp.Body.Close()
}
defer wsConn.Close(websocket.StatusNormalClosure, "")
// Read and discard initial state.
_, _, err = wsConn.Read(ctx)
require.NoError(t, err)
fWatcher.waitNext(ctx)
fWatcher.sendEventWaitNextCalled(ctx, fsnotify.Event{
Name: configPath,
Op: fsnotify.Write,
})
// Verify dirty status is broadcast without advancing the clock.
_, msg, err := wsConn.Read(ctx)
require.NoError(t, err)
var response codersdk.WorkspaceAgentListContainersResponse
err = json.Unmarshal(msg, &response)
require.NoError(t, err)
require.Len(t, response.Devcontainers, 1)
assert.True(t, response.Devcontainers[0].Dirty,
"devcontainer should be marked as dirty after config file modification")
})
t.Run("SubAgentLifecycle", func(t *testing.T) {
t.Parallel()
@@ -2070,6 +2150,122 @@ func TestAPI(t *testing.T) {
require.Equal(t, "", response.Devcontainers[0].Error)
})
// This test verifies that when devcontainer up fails due to a
// lifecycle script error (such as postCreateCommand failing) but the
// container was successfully created, we still proceed with the
// devcontainer. The container should be available for use and the
// agent should be injected.
t.Run("DuringUpWithContainerID", func(t *testing.T) {
t.Parallel()
var (
ctx = testutil.Context(t, testutil.WaitMedium)
logger = slogtest.Make(t, &slogtest.Options{IgnoreErrors: true}).Leveled(slog.LevelDebug)
mClock = quartz.NewMock(t)
testContainer = codersdk.WorkspaceAgentContainer{
ID: "test-container-id",
FriendlyName: "test-container",
Image: "test-image",
Running: true,
CreatedAt: time.Now(),
Labels: map[string]string{
agentcontainers.DevcontainerLocalFolderLabel: "/workspaces/project",
agentcontainers.DevcontainerConfigFileLabel: "/workspaces/project/.devcontainer/devcontainer.json",
},
}
fCCLI = &fakeContainerCLI{
containers: codersdk.WorkspaceAgentListContainersResponse{
Containers: []codersdk.WorkspaceAgentContainer{testContainer},
},
arch: "amd64",
}
fDCCLI = &fakeDevcontainerCLI{
upID: testContainer.ID,
upErrC: make(chan func() error, 1),
}
fSAC = &fakeSubAgentClient{
logger: logger.Named("fakeSubAgentClient"),
}
testDevcontainer = codersdk.WorkspaceAgentDevcontainer{
ID: uuid.New(),
Name: "test-devcontainer",
WorkspaceFolder: "/workspaces/project",
ConfigPath: "/workspaces/project/.devcontainer/devcontainer.json",
Status: codersdk.WorkspaceAgentDevcontainerStatusStopped,
}
)
mClock.Set(time.Now()).MustWait(ctx)
tickerTrap := mClock.Trap().TickerFunc("updaterLoop")
nowRecreateSuccessTrap := mClock.Trap().Now("recreate", "successTimes")
api := agentcontainers.NewAPI(logger,
agentcontainers.WithClock(mClock),
agentcontainers.WithContainerCLI(fCCLI),
agentcontainers.WithDevcontainerCLI(fDCCLI),
agentcontainers.WithDevcontainers(
[]codersdk.WorkspaceAgentDevcontainer{testDevcontainer},
[]codersdk.WorkspaceAgentScript{{ID: testDevcontainer.ID, LogSourceID: uuid.New()}},
),
agentcontainers.WithSubAgentClient(fSAC),
agentcontainers.WithSubAgentURL("test-subagent-url"),
agentcontainers.WithWatcher(watcher.NewNoop()),
)
api.Start()
defer func() {
close(fDCCLI.upErrC)
api.Close()
}()
r := chi.NewRouter()
r.Mount("/", api.Routes())
tickerTrap.MustWait(ctx).MustRelease(ctx)
tickerTrap.Close()
// Send a recreate request to trigger devcontainer up.
req := httptest.NewRequest(http.MethodPost, "/devcontainers/"+testDevcontainer.ID.String()+"/recreate", nil)
rec := httptest.NewRecorder()
r.ServeHTTP(rec, req)
require.Equal(t, http.StatusAccepted, rec.Code)
// Simulate a lifecycle script failure. The devcontainer CLI
// will return an error but also provide a container ID since
// the container was created before the script failed.
simulatedError := xerrors.New("postCreateCommand failed with exit code 1")
testutil.RequireSend(ctx, t, fDCCLI.upErrC, func() error { return simulatedError })
// Wait for the recreate operation to complete. We expect it to
// record a success time because the container was created.
nowRecreateSuccessTrap.MustWait(ctx).MustRelease(ctx)
nowRecreateSuccessTrap.Close()
// Advance the clock to run the devcontainer state update routine.
_, aw := mClock.AdvanceNext()
aw.MustWait(ctx)
req = httptest.NewRequest(http.MethodGet, "/", nil)
rec = httptest.NewRecorder()
r.ServeHTTP(rec, req)
require.Equal(t, http.StatusOK, rec.Code)
var response codersdk.WorkspaceAgentListContainersResponse
err := json.NewDecoder(rec.Body).Decode(&response)
require.NoError(t, err)
// Verify that the devcontainer is running and has the container
// associated with it despite the lifecycle script error. The
// error may be cleared during refresh if agent injection
// succeeds, but the important thing is that the container is
// available for use.
require.Len(t, response.Devcontainers, 1)
assert.Equal(t, codersdk.WorkspaceAgentDevcontainerStatusRunning, response.Devcontainers[0].Status)
require.NotNil(t, response.Devcontainers[0].Container)
assert.Equal(t, testContainer.ID, response.Devcontainers[0].Container.ID)
})
t.Run("DuringInjection", func(t *testing.T) {
t.Parallel()
+16 -15
View File
@@ -263,11 +263,14 @@ func (d *devcontainerCLI) Up(ctx context.Context, workspaceFolder, configPath st
}
if err := cmd.Run(); err != nil {
_, err2 := parseDevcontainerCLILastLine[devcontainerCLIResult](ctx, logger, stdoutBuf.Bytes())
result, err2 := parseDevcontainerCLILastLine[devcontainerCLIResult](ctx, logger, stdoutBuf.Bytes())
if err2 != nil {
err = errors.Join(err, err2)
}
return "", err
// Return the container ID if available, even if there was an error.
// This can happen if the container was created successfully but a
// lifecycle script (e.g. postCreateCommand) failed.
return result.ContainerID, err
}
result, err := parseDevcontainerCLILastLine[devcontainerCLIResult](ctx, logger, stdoutBuf.Bytes())
@@ -275,6 +278,13 @@ func (d *devcontainerCLI) Up(ctx context.Context, workspaceFolder, configPath st
return "", err
}
// Check if the result indicates an error (e.g. lifecycle script failure)
// but still has a container ID, allowing the caller to potentially
// continue with the container that was created.
if err := result.Err(); err != nil {
return result.ContainerID, err
}
return result.ContainerID, nil
}
@@ -394,7 +404,10 @@ func parseDevcontainerCLILastLine[T any](ctx context.Context, logger slog.Logger
type devcontainerCLIResult struct {
Outcome string `json:"outcome"` // "error", "success".
// The following fields are set if outcome is success.
// The following fields are typically set if outcome is success, but
// ContainerID may also be present when outcome is error if the
// container was created but a lifecycle script (e.g. postCreateCommand)
// failed.
ContainerID string `json:"containerId"`
RemoteUser string `json:"remoteUser"`
RemoteWorkspaceFolder string `json:"remoteWorkspaceFolder"`
@@ -404,18 +417,6 @@ type devcontainerCLIResult struct {
Description string `json:"description"`
}
func (r *devcontainerCLIResult) UnmarshalJSON(data []byte) error {
type wrapperResult devcontainerCLIResult
var wrappedResult wrapperResult
if err := json.Unmarshal(data, &wrappedResult); err != nil {
return err
}
*r = devcontainerCLIResult(wrappedResult)
return r.Err()
}
func (r devcontainerCLIResult) Err() error {
if r.Outcome == "success" {
return nil
+64 -41
View File
@@ -42,56 +42,63 @@ func TestDevcontainerCLI_ArgsAndParsing(t *testing.T) {
t.Parallel()
tests := []struct {
name string
logFile string
workspace string
config string
opts []agentcontainers.DevcontainerCLIUpOptions
wantArgs string
wantError bool
name string
logFile string
workspace string
config string
opts []agentcontainers.DevcontainerCLIUpOptions
wantArgs string
wantError bool
wantContainerID bool // If true, expect a container ID even when wantError is true.
}{
{
name: "success",
logFile: "up.log",
workspace: "/test/workspace",
wantArgs: "up --log-format json --workspace-folder /test/workspace",
wantError: false,
name: "success",
logFile: "up.log",
workspace: "/test/workspace",
wantArgs: "up --log-format json --workspace-folder /test/workspace",
wantError: false,
wantContainerID: true,
},
{
name: "success with config",
logFile: "up.log",
workspace: "/test/workspace",
config: "/test/config.json",
wantArgs: "up --log-format json --workspace-folder /test/workspace --config /test/config.json",
wantError: false,
name: "success with config",
logFile: "up.log",
workspace: "/test/workspace",
config: "/test/config.json",
wantArgs: "up --log-format json --workspace-folder /test/workspace --config /test/config.json",
wantError: false,
wantContainerID: true,
},
{
name: "already exists",
logFile: "up-already-exists.log",
workspace: "/test/workspace",
wantArgs: "up --log-format json --workspace-folder /test/workspace",
wantError: false,
name: "already exists",
logFile: "up-already-exists.log",
workspace: "/test/workspace",
wantArgs: "up --log-format json --workspace-folder /test/workspace",
wantError: false,
wantContainerID: true,
},
{
name: "docker error",
logFile: "up-error-docker.log",
workspace: "/test/workspace",
wantArgs: "up --log-format json --workspace-folder /test/workspace",
wantError: true,
name: "docker error",
logFile: "up-error-docker.log",
workspace: "/test/workspace",
wantArgs: "up --log-format json --workspace-folder /test/workspace",
wantError: true,
wantContainerID: false,
},
{
name: "bad outcome",
logFile: "up-error-bad-outcome.log",
workspace: "/test/workspace",
wantArgs: "up --log-format json --workspace-folder /test/workspace",
wantError: true,
name: "bad outcome",
logFile: "up-error-bad-outcome.log",
workspace: "/test/workspace",
wantArgs: "up --log-format json --workspace-folder /test/workspace",
wantError: true,
wantContainerID: false,
},
{
name: "does not exist",
logFile: "up-error-does-not-exist.log",
workspace: "/test/workspace",
wantArgs: "up --log-format json --workspace-folder /test/workspace",
wantError: true,
name: "does not exist",
logFile: "up-error-does-not-exist.log",
workspace: "/test/workspace",
wantArgs: "up --log-format json --workspace-folder /test/workspace",
wantError: true,
wantContainerID: false,
},
{
name: "with remove existing container",
@@ -100,8 +107,21 @@ func TestDevcontainerCLI_ArgsAndParsing(t *testing.T) {
opts: []agentcontainers.DevcontainerCLIUpOptions{
agentcontainers.WithRemoveExistingContainer(),
},
wantArgs: "up --log-format json --workspace-folder /test/workspace --remove-existing-container",
wantError: false,
wantArgs: "up --log-format json --workspace-folder /test/workspace --remove-existing-container",
wantError: false,
wantContainerID: true,
},
{
// This test verifies that when a lifecycle script like
// postCreateCommand fails, the CLI returns both an error
// and a container ID. The caller can then proceed with
// agent injection into the created container.
name: "lifecycle script failure with container",
logFile: "up-error-lifecycle-script.log",
workspace: "/test/workspace",
wantArgs: "up --log-format json --workspace-folder /test/workspace",
wantError: true,
wantContainerID: true,
},
}
@@ -122,10 +142,13 @@ func TestDevcontainerCLI_ArgsAndParsing(t *testing.T) {
containerID, err := dccli.Up(ctx, tt.workspace, tt.config, tt.opts...)
if tt.wantError {
assert.Error(t, err, "want error")
assert.Empty(t, containerID, "expected empty container ID")
} else {
assert.NoError(t, err, "want no error")
}
if tt.wantContainerID {
assert.NotEmpty(t, containerID, "expected non-empty container ID")
} else {
assert.Empty(t, containerID, "expected empty container ID")
}
})
}
File diff suppressed because one or more lines are too long
+11 -2
View File
@@ -391,10 +391,19 @@ func (s *Server) sessionHandler(session ssh.Session) {
env := session.Environ()
magicType, magicTypeRaw, env := extractMagicSessionType(env)
// It's not safe to assume RemoteAddr() returns a non-nil value. slog.F usage is fine because it correctly
// handles nil.
// c.f. https://github.com/coder/internal/issues/1143
remoteAddr := session.RemoteAddr()
remoteAddrString := ""
if remoteAddr != nil {
remoteAddrString = remoteAddr.String()
}
if !s.trackSession(session, true) {
reason := "unable to accept new session, server is closing"
// Report connection attempt even if we couldn't accept it.
disconnected := s.config.ReportConnection(id, magicType, session.RemoteAddr().String())
disconnected := s.config.ReportConnection(id, magicType, remoteAddrString)
defer disconnected(1, reason)
logger.Info(ctx, reason)
@@ -429,7 +438,7 @@ func (s *Server) sessionHandler(session ssh.Session) {
scr := &sessionCloseTracker{Session: session}
session = scr
disconnected := s.config.ReportConnection(id, magicType, session.RemoteAddr().String())
disconnected := s.config.ReportConnection(id, magicType, remoteAddrString)
defer func() {
disconnected(scr.exitCode(), reason)
}()
+1 -1
View File
@@ -176,7 +176,7 @@ func (x *x11Forwarder) listenForConnections(
var originPort uint32
if tcpConn, ok := conn.(*net.TCPConn); ok {
if tcpAddr, ok := tcpConn.LocalAddr().(*net.TCPAddr); ok {
if tcpAddr, ok := tcpConn.LocalAddr().(*net.TCPAddr); ok && tcpAddr != nil {
originAddr = tcpAddr.IP.String()
// #nosec G115 - Safe conversion as TCP port numbers are within uint32 range (0-65535)
originPort = uint32(tcpAddr.Port)
+13 -3
View File
@@ -74,11 +74,21 @@ func (s *Server) Serve(ctx, hardCtx context.Context, l net.Listener) (retErr err
break
}
clog := s.logger.With(
slog.F("remote", conn.RemoteAddr().String()),
slog.F("local", conn.LocalAddr().String()))
slog.F("remote", conn.RemoteAddr()),
slog.F("local", conn.LocalAddr()))
clog.Info(ctx, "accepted conn")
// It's not safe to assume RemoteAddr() returns a non-nil value. slog.F usage is fine because it correctly
// handles nil.
// c.f. https://github.com/coder/internal/issues/1143
remoteAddr := conn.RemoteAddr()
remoteAddrString := ""
if remoteAddr != nil {
remoteAddrString = remoteAddr.String()
}
wg.Add(1)
disconnected := s.reportConnection(uuid.New(), conn.RemoteAddr().String())
disconnected := s.reportConnection(uuid.New(), remoteAddrString)
closed := make(chan struct{})
go func() {
defer wg.Done()
+3
View File
@@ -106,6 +106,9 @@ var _ OutputFormat = &tableFormat{}
//
// defaultColumns is optional and specifies the default columns to display. If
// not specified, all columns are displayed by default.
//
// If the data is empty, an empty string is returned. Callers should check for
// this and provide an appropriate message to the user.
func TableFormat(out any, defaultColumns []string) OutputFormat {
v := reflect.Indirect(reflect.ValueOf(out))
if v.Kind() != reflect.Slice {
+6
View File
@@ -180,6 +180,12 @@ func DisplayTable(out any, sort string, filterColumns []string) (string, error)
func renderTable(out any, sort string, headers table.Row, filterColumns []string) (string, error) {
v := reflect.Indirect(reflect.ValueOf(out))
// Return empty string for empty data. Callers should check for this
// and provide an appropriate message to the user.
if v.Kind() == reflect.Slice && v.Len() == 0 {
return "", nil
}
headers = filterHeaders(headers, filterColumns)
columnConfigs := createColumnConfigs(headers, filterColumns)
+9
View File
@@ -472,6 +472,15 @@ alice 1
require.NoError(t, err)
compareTables(t, expected, out)
})
t.Run("Empty", func(t *testing.T) {
t.Parallel()
var in []tableTest4
out, err := cliui.DisplayTable(in, "", nil)
require.NoError(t, err)
require.Empty(t, out)
})
}
// compareTables normalizes the incoming table lines
+3 -3
View File
@@ -90,7 +90,6 @@ func TestExpRpty(t *testing.T) {
wantLabel := "coder.devcontainers.TestExpRpty.Container"
client, workspace, agentToken := setupWorkspaceForAgent(t)
ctx := testutil.Context(t, testutil.WaitLong)
pool, err := dockertest.NewPool("")
require.NoError(t, err, "Could not connect to docker")
ct, err := pool.RunWithOptions(&dockertest.RunOptions{
@@ -128,14 +127,15 @@ func TestExpRpty(t *testing.T) {
clitest.SetupConfig(t, client, root)
pty := ptytest.New(t).Attach(inv)
ctx := testutil.Context(t, testutil.WaitLong)
cmdDone := tGo(t, func() {
err := inv.WithContext(ctx).Run()
assert.NoError(t, err)
})
pty.ExpectMatch(" #")
pty.ExpectMatchContext(ctx, " #")
pty.WriteLine("hostname")
pty.ExpectMatch(ct.Container.Config.Hostname)
pty.ExpectMatchContext(ctx, ct.Container.Config.Hostname)
pty.WriteLine("exit")
<-cmdDone
})
+10 -8
View File
@@ -1559,6 +1559,15 @@ func (r *RootCmd) scaletestDashboard() *serpent.Command {
if err != nil {
return xerrors.Errorf("create tracer provider: %w", err)
}
tracer := tracerProvider.Tracer(scaletestTracerName)
outputs, err := output.parse()
if err != nil {
return xerrors.Errorf("could not parse --output flags")
}
reg := prometheus.NewRegistry()
prometheusSrvClose := ServeHandler(ctx, logger, promhttp.HandlerFor(reg, promhttp.HandlerOpts{}), prometheusFlags.Address, "prometheus")
defer prometheusSrvClose()
defer func() {
// Allow time for traces to flush even if command context is
// canceled. This is a no-op if tracing is not enabled.
@@ -1570,14 +1579,7 @@ func (r *RootCmd) scaletestDashboard() *serpent.Command {
_, _ = fmt.Fprintf(inv.Stderr, "Waiting %s for prometheus metrics to be scraped\n", prometheusFlags.Wait)
<-time.After(prometheusFlags.Wait)
}()
tracer := tracerProvider.Tracer(scaletestTracerName)
outputs, err := output.parse()
if err != nil {
return xerrors.Errorf("could not parse --output flags")
}
reg := prometheus.NewRegistry()
prometheusSrvClose := ServeHandler(ctx, logger, promhttp.HandlerFor(reg, promhttp.HandlerOpts{}), prometheusFlags.Address, "prometheus")
defer prometheusSrvClose()
metrics := dashboard.NewMetrics(reg)
th := harness.NewTestHarness(strategy.toStrategy(), cleanupStrategy.toStrategy())
+9 -8
View File
@@ -84,14 +84,6 @@ func (r *RootCmd) scaletestPrebuilds() *serpent.Command {
if err != nil {
return xerrors.Errorf("create tracer provider: %w", err)
}
defer func() {
_, _ = fmt.Fprintln(inv.Stderr, "\nUploading traces...")
if err := closeTracing(ctx); err != nil {
_, _ = fmt.Fprintf(inv.Stderr, "\nError uploading traces: %+v\n", err)
}
_, _ = fmt.Fprintf(inv.Stderr, "Waiting %s for prometheus metrics to be scraped\n", prometheusFlags.Wait)
<-time.After(prometheusFlags.Wait)
}()
tracer := tracerProvider.Tracer(scaletestTracerName)
reg := prometheus.NewRegistry()
@@ -101,6 +93,15 @@ func (r *RootCmd) scaletestPrebuilds() *serpent.Command {
prometheusSrvClose := ServeHandler(ctx, logger, promhttp.HandlerFor(reg, promhttp.HandlerOpts{}), prometheusFlags.Address, "prometheus")
defer prometheusSrvClose()
defer func() {
_, _ = fmt.Fprintln(inv.Stderr, "\nUploading traces...")
if err := closeTracing(ctx); err != nil {
_, _ = fmt.Fprintf(inv.Stderr, "\nError uploading traces: %+v\n", err)
}
_, _ = fmt.Fprintf(inv.Stderr, "Waiting %s for prometheus metrics to be scraped\n", prometheusFlags.Wait)
<-time.After(prometheusFlags.Wait)
}()
err = client.PutPrebuildsSettings(ctx, codersdk.PrebuildsSettings{
ReconciliationPaused: true,
})
+6 -6
View File
@@ -139,7 +139,12 @@ func (r *RootCmd) list() *serpent.Command {
return err
}
if len(res) == 0 && formatter.FormatID() != cliui.JSONFormat().ID() {
out, err := formatter.Format(inv.Context(), res)
if err != nil {
return err
}
if out == "" {
pretty.Fprintf(inv.Stderr, cliui.DefaultStyles.Prompt, "No workspaces found! Create one:\n")
_, _ = fmt.Fprintln(inv.Stderr)
_, _ = fmt.Fprintln(inv.Stderr, " "+pretty.Sprint(cliui.DefaultStyles.Code, "coder create <name>"))
@@ -147,11 +152,6 @@ func (r *RootCmd) list() *serpent.Command {
return nil
}
out, err := formatter.Format(inv.Context(), res)
if err != nil {
return err
}
_, err = fmt.Fprintln(inv.Stdout, out)
return err
},
+5
View File
@@ -170,6 +170,11 @@ func (r *RootCmd) listOrganizationMembers(orgContext *OrganizationContext) *serp
return err
}
if out == "" {
cliui.Infof(inv.Stderr, "No organization members found.")
return nil
}
_, err = fmt.Fprintln(inv.Stdout, out)
return err
},
+5
View File
@@ -92,6 +92,11 @@ func (r *RootCmd) showOrganizationRoles(orgContext *OrganizationContext) *serpen
return err
}
if out == "" {
cliui.Infof(inv.Stderr, "No organization roles found.")
return nil
}
_, err = fmt.Fprintln(inv.Stdout, out)
return err
},
+5
View File
@@ -110,6 +110,11 @@ func (r *RootCmd) provisionerJobsList() *serpent.Command {
return xerrors.Errorf("display provisioner daemons: %w", err)
}
if out == "" {
cliui.Infof(inv.Stderr, "No provisioner jobs found.")
return nil
}
_, _ = fmt.Fprintln(inv.Stdout, out)
return nil
+5 -5
View File
@@ -74,11 +74,6 @@ func (r *RootCmd) provisionerList() *serpent.Command {
return xerrors.Errorf("list provisioner daemons: %w", err)
}
if len(daemons) == 0 {
_, _ = fmt.Fprintln(inv.Stdout, "No provisioner daemons found")
return nil
}
var rows []provisionerDaemonRow
for _, daemon := range daemons {
rows = append(rows, provisionerDaemonRow{
@@ -92,6 +87,11 @@ func (r *RootCmd) provisionerList() *serpent.Command {
return xerrors.Errorf("display provisioner daemons: %w", err)
}
if out == "" {
cliui.Infof(inv.Stderr, "No provisioner daemons found.")
return nil
}
_, _ = fmt.Fprintln(inv.Stdout, out)
return nil
+5
View File
@@ -129,6 +129,11 @@ func (r *RootCmd) scheduleShow() *serpent.Command {
return err
}
if out == "" {
cliui.Infof(inv.Stderr, "No schedules found.")
return nil
}
_, err = fmt.Fprintln(inv.Stdout, out)
return err
},
+3 -3
View File
@@ -2052,7 +2052,6 @@ func TestSSH_Container(t *testing.T) {
t.Parallel()
client, workspace, agentToken := setupWorkspaceForAgent(t)
ctx := testutil.Context(t, testutil.WaitLong)
pool, err := dockertest.NewPool("")
require.NoError(t, err, "Could not connect to docker")
ct, err := pool.RunWithOptions(&dockertest.RunOptions{
@@ -2087,14 +2086,15 @@ func TestSSH_Container(t *testing.T) {
clitest.SetupConfig(t, client, root)
ptty := ptytest.New(t).Attach(inv)
ctx := testutil.Context(t, testutil.WaitLong)
cmdDone := tGo(t, func() {
err := inv.WithContext(ctx).Run()
assert.NoError(t, err)
})
ptty.ExpectMatch(" #")
ptty.ExpectMatchContext(ctx, " #")
ptty.WriteLine("hostname")
ptty.ExpectMatch(ct.Container.Config.Hostname)
ptty.ExpectMatchContext(ctx, ct.Container.Config.Hostname)
ptty.WriteLine("exit")
<-cmdDone
})
+4 -6
View File
@@ -157,12 +157,6 @@ func (r *RootCmd) taskList() *serpent.Command {
return nil
}
// If no rows and not JSON, show a friendly message.
if len(tasks) == 0 && formatter.FormatID() != cliui.JSONFormat().ID() {
_, _ = fmt.Fprintln(inv.Stderr, "No tasks found.")
return nil
}
rows := make([]taskListRow, len(tasks))
now := time.Now()
for i := range tasks {
@@ -173,6 +167,10 @@ func (r *RootCmd) taskList() *serpent.Command {
if err != nil {
return xerrors.Errorf("format tasks: %w", err)
}
if out == "" {
cliui.Infof(inv.Stderr, "No tasks found.")
return nil
}
_, _ = fmt.Fprintln(inv.Stdout, out)
return nil
},
+5
View File
@@ -59,6 +59,11 @@ func (r *RootCmd) taskLogs() *serpent.Command {
return xerrors.Errorf("format task logs: %w", err)
}
if out == "" {
cliui.Infof(inv.Stderr, "No task logs found.")
return nil
}
_, _ = fmt.Fprintln(inv.Stdout, out)
return nil
},
+6 -6
View File
@@ -30,18 +30,18 @@ func (r *RootCmd) templateList() *serpent.Command {
return err
}
if len(templates) == 0 {
_, _ = fmt.Fprintf(inv.Stderr, "%s No templates found! Create one:\n\n", Caret)
_, _ = fmt.Fprintln(inv.Stderr, color.HiMagentaString(" $ coder templates push <directory>\n"))
return nil
}
rows := templatesToRows(templates...)
out, err := formatter.Format(inv.Context(), rows)
if err != nil {
return err
}
if out == "" {
_, _ = fmt.Fprintf(inv.Stderr, "%s No templates found! Create one:\n\n", Caret)
_, _ = fmt.Fprintln(inv.Stderr, color.HiMagentaString(" $ coder templates push <directory>\n"))
return nil
}
_, err = fmt.Fprintln(inv.Stdout, out)
return err
},
+7 -2
View File
@@ -106,7 +106,7 @@ func (r *RootCmd) templatePresetsList() *serpent.Command {
if len(presets) == 0 {
cliui.Infof(
inv.Stdout,
"No presets found for template %q and template-version %q.\n", template.Name, version.Name,
"No presets found for template %q and template-version %q.", template.Name, version.Name,
)
return nil
}
@@ -115,7 +115,7 @@ func (r *RootCmd) templatePresetsList() *serpent.Command {
if formatter.FormatID() == "table" {
cliui.Infof(
inv.Stdout,
"Showing presets for template %q and template version %q.\n", template.Name, version.Name,
"Showing presets for template %q and template version %q.", template.Name, version.Name,
)
}
rows := templatePresetsToRows(presets...)
@@ -124,6 +124,11 @@ func (r *RootCmd) templatePresetsList() *serpent.Command {
return xerrors.Errorf("render table: %w", err)
}
if out == "" {
cliui.Infof(inv.Stderr, "No template presets found.")
return nil
}
_, err = fmt.Fprintln(inv.Stdout, out)
return err
},
+5
View File
@@ -121,6 +121,11 @@ func (r *RootCmd) templateVersionsList() *serpent.Command {
return xerrors.Errorf("render table: %w", err)
}
if out == "" {
cliui.Infof(inv.Stderr, "No template versions found.")
return nil
}
_, err = fmt.Fprintln(inv.Stdout, out)
return err
},
+38
View File
@@ -118,12 +118,23 @@ AI BRIDGE OPTIONS:
requests (requires the "oauth2" and "mcp-server-http" experiments to
be enabled).
--aibridge-max-concurrency int, $CODER_AIBRIDGE_MAX_CONCURRENCY (default: 0)
Maximum number of concurrent AI Bridge requests. Set to 0 to disable
(unlimited).
--aibridge-openai-base-url string, $CODER_AIBRIDGE_OPENAI_BASE_URL (default: https://api.openai.com/v1/)
The base URL of the OpenAI API.
--aibridge-openai-key string, $CODER_AIBRIDGE_OPENAI_KEY
The key to authenticate against the OpenAI API.
--aibridge-rate-limit int, $CODER_AIBRIDGE_RATE_LIMIT (default: 0)
Maximum number of AI Bridge requests per rate window. Set to 0 to
disable rate limiting.
--aibridge-rate-window duration, $CODER_AIBRIDGE_RATE_WINDOW (default: 1m)
Duration of the rate limiting window for AI Bridge requests.
CLIENT OPTIONS:
These options change the behavior of how clients interact with the Coder.
Clients include the Coder CLI, Coder Desktop, IDE extensions, and the web UI.
@@ -696,6 +707,33 @@ updating, and deleting workspace resources.
Number of provisioner daemons to create on start. If builds are stuck
in queued state for a long time, consider increasing this.
RETENTION OPTIONS:
Configure data retention policies for various database tables. Retention
policies automatically purge old data to reduce database size and improve
performance. Setting a retention duration to 0 disables automatic purging for
that data type.
--api-keys-retention duration, $CODER_API_KEYS_RETENTION (default: 7d)
How long expired API keys are retained before being deleted. Keeping
expired keys allows the backend to return a more helpful error when a
user tries to use an expired key. Set to 0 to disable automatic
deletion of expired keys.
--audit-logs-retention duration, $CODER_AUDIT_LOGS_RETENTION (default: 0)
How long audit log entries are retained. Set to 0 to disable (keep
indefinitely). We advise keeping audit logs for at least a year, and
in accordance with your compliance requirements.
--connection-logs-retention duration, $CODER_CONNECTION_LOGS_RETENTION (default: 0)
How long connection log entries are retained. Set to 0 to disable
(keep indefinitely).
--workspace-agent-logs-retention duration, $CODER_WORKSPACE_AGENT_LOGS_RETENTION (default: 7d)
How long workspace agent logs are retained. Logs from non-latest
builds are deleted if the agent hasn't connected within this period.
Logs from the latest build are always retained. Set to 0 to disable
automatic deletion.
TELEMETRY OPTIONS:
Telemetry is critical to our ability to improve Coder. We strip all personal
information before sending data to our servers. Please only disable telemetry
+35 -13
View File
@@ -720,25 +720,12 @@ aibridge:
# The base URL of the OpenAI API.
# (default: https://api.openai.com/v1/, type: string)
openai_base_url: https://api.openai.com/v1/
# The key to authenticate against the OpenAI API.
# (default: <unset>, type: string)
openai_key: ""
# The base URL of the Anthropic API.
# (default: https://api.anthropic.com/, type: string)
anthropic_base_url: https://api.anthropic.com/
# The key to authenticate against the Anthropic API.
# (default: <unset>, type: string)
anthropic_key: ""
# The AWS Bedrock API region.
# (default: <unset>, type: string)
bedrock_region: ""
# The access key to authenticate against the AWS Bedrock API.
# (default: <unset>, type: string)
bedrock_access_key: ""
# The access key secret to use with the access key to authenticate against the AWS
# Bedrock API.
# (default: <unset>, type: string)
bedrock_access_key_secret: ""
# The model to use when making requests to the AWS Bedrock API.
# (default: global.anthropic.claude-sonnet-4-5-20250929-v1:0, type: string)
bedrock_model: global.anthropic.claude-sonnet-4-5-20250929-v1:0
@@ -755,3 +742,38 @@ aibridge:
# (token, prompt, tool use).
# (default: 60d, type: duration)
retention: 1440h0m0s
# Maximum number of concurrent AI Bridge requests. Set to 0 to disable
# (unlimited).
# (default: 0, type: int)
max_concurrency: 0
# Maximum number of AI Bridge requests per rate window. Set to 0 to disable rate
# limiting.
# (default: 0, type: int)
rate_limit: 0
# Duration of the rate limiting window for AI Bridge requests.
# (default: 1m, type: duration)
rate_window: 1m0s
# Configure data retention policies for various database tables. Retention
# policies automatically purge old data to reduce database size and improve
# performance. Setting a retention duration to 0 disables automatic purging for
# that data type.
retention:
# How long audit log entries are retained. Set to 0 to disable (keep
# indefinitely). We advise keeping audit logs for at least a year, and in
# accordance with your compliance requirements.
# (default: 0, type: duration)
audit_logs: 0s
# How long connection log entries are retained. Set to 0 to disable (keep
# indefinitely).
# (default: 0, type: duration)
connection_logs: 0s
# How long expired API keys are retained before being deleted. Keeping expired
# keys allows the backend to return a more helpful error when a user tries to use
# an expired key. Set to 0 to disable automatic deletion of expired keys.
# (default: 7d, type: duration)
api_keys: 168h0m0s
# How long workspace agent logs are retained. Logs from non-latest builds are
# deleted if the agent hasn't connected within this period. Logs from the latest
# build are always retained. Set to 0 to disable automatic deletion.
# (default: 7d, type: duration)
workspace_agent_logs: 168h0m0s
+5 -7
View File
@@ -246,13 +246,6 @@ func (r *RootCmd) listTokens() *serpent.Command {
return xerrors.Errorf("list tokens: %w", err)
}
if len(tokens) == 0 {
cliui.Infof(
inv.Stdout,
"No tokens found.\n",
)
}
displayTokens = make([]tokenListRow, len(tokens))
for i, token := range tokens {
@@ -264,6 +257,11 @@ func (r *RootCmd) listTokens() *serpent.Command {
return err
}
if out == "" {
cliui.Info(inv.Stderr, "No tokens found.")
return nil
}
_, err = fmt.Fprintln(inv.Stdout, out)
return err
},
+1
View File
@@ -34,6 +34,7 @@ func TestTokens(t *testing.T) {
clitest.SetupConfig(t, client, root)
buf := new(bytes.Buffer)
inv.Stdout = buf
inv.Stderr = buf
err := inv.WithContext(ctx).Run()
require.NoError(t, err)
res := buf.String()
+5
View File
@@ -58,6 +58,11 @@ func (r *RootCmd) userList() *serpent.Command {
return err
}
if out == "" {
cliui.Infof(inv.Stderr, "No users found.")
return nil
}
_, err = fmt.Fprintln(inv.Stdout, out)
return err
},
+2 -2
View File
@@ -1680,8 +1680,8 @@ func TestTasksNotification(t *testing.T) {
require.NoError(t, err)
require.Len(t, workspaceAgent.Apps, 1)
require.GreaterOrEqual(t, len(workspaceAgent.Apps[0].Statuses), 1)
latestStatusIndex := len(workspaceAgent.Apps[0].Statuses) - 1
require.Equal(t, tc.newAppStatus, workspaceAgent.Apps[0].Statuses[latestStatusIndex].State)
// Statuses are ordered by created_at DESC, so the first element is the latest.
require.Equal(t, tc.newAppStatus, workspaceAgent.Apps[0].Statuses[0].State)
if tc.isNotificationSent {
// Then: A notification is sent to the workspace owner (memberUser)
+36 -2
View File
@@ -1800,7 +1800,7 @@ const docTemplate = `{
"application/json"
],
"tags": [
"Organizations"
"Enterprise"
],
"summary": "Add new license",
"operationId": "add-new-license",
@@ -1836,7 +1836,7 @@ const docTemplate = `{
"application/json"
],
"tags": [
"Organizations"
"Enterprise"
],
"summary": "Update license entitlements",
"operationId": "update-license-entitlements",
@@ -11877,9 +11877,19 @@ const docTemplate = `{
"inject_coder_mcp_tools": {
"type": "boolean"
},
"max_concurrency": {
"description": "Overload protection settings.",
"type": "integer"
},
"openai": {
"$ref": "#/definitions/codersdk.AIBridgeOpenAIConfig"
},
"rate_limit": {
"type": "integer"
},
"rate_window": {
"type": "integer"
},
"retention": {
"type": "integer"
}
@@ -14302,6 +14312,9 @@ const docTemplate = `{
"redirect_to_access_url": {
"type": "boolean"
},
"retention": {
"$ref": "#/definitions/codersdk.RetentionConfig"
},
"scim_api_key": {
"type": "string"
},
@@ -17728,6 +17741,27 @@ const docTemplate = `{
}
}
},
"codersdk.RetentionConfig": {
"type": "object",
"properties": {
"api_keys": {
"description": "APIKeys controls how long expired API keys are retained before being deleted.\nKeys are only deleted if they have been expired for at least this duration.\nDefaults to 7 days to preserve existing behavior.",
"type": "integer"
},
"audit_logs": {
"description": "AuditLogs controls how long audit log entries are retained.\nSet to 0 to disable (keep indefinitely).",
"type": "integer"
},
"connection_logs": {
"description": "ConnectionLogs controls how long connection log entries are retained.\nSet to 0 to disable (keep indefinitely).",
"type": "integer"
},
"workspace_agent_logs": {
"description": "WorkspaceAgentLogs controls how long workspace agent logs are retained.\nLogs are deleted if the agent hasn't connected within this period.\nLogs from the latest build are always retained regardless of age.\nDefaults to 7 days to preserve existing behavior.",
"type": "integer"
}
}
},
"codersdk.Role": {
"type": "object",
"properties": {
+36 -2
View File
@@ -1570,7 +1570,7 @@
],
"consumes": ["application/json"],
"produces": ["application/json"],
"tags": ["Organizations"],
"tags": ["Enterprise"],
"summary": "Add new license",
"operationId": "add-new-license",
"parameters": [
@@ -1602,7 +1602,7 @@
}
],
"produces": ["application/json"],
"tags": ["Organizations"],
"tags": ["Enterprise"],
"summary": "Update license entitlements",
"operationId": "update-license-entitlements",
"responses": {
@@ -10543,9 +10543,19 @@
"inject_coder_mcp_tools": {
"type": "boolean"
},
"max_concurrency": {
"description": "Overload protection settings.",
"type": "integer"
},
"openai": {
"$ref": "#/definitions/codersdk.AIBridgeOpenAIConfig"
},
"rate_limit": {
"type": "integer"
},
"rate_window": {
"type": "integer"
},
"retention": {
"type": "integer"
}
@@ -12886,6 +12896,9 @@
"redirect_to_access_url": {
"type": "boolean"
},
"retention": {
"$ref": "#/definitions/codersdk.RetentionConfig"
},
"scim_api_key": {
"type": "string"
},
@@ -16190,6 +16203,27 @@
}
}
},
"codersdk.RetentionConfig": {
"type": "object",
"properties": {
"api_keys": {
"description": "APIKeys controls how long expired API keys are retained before being deleted.\nKeys are only deleted if they have been expired for at least this duration.\nDefaults to 7 days to preserve existing behavior.",
"type": "integer"
},
"audit_logs": {
"description": "AuditLogs controls how long audit log entries are retained.\nSet to 0 to disable (keep indefinitely).",
"type": "integer"
},
"connection_logs": {
"description": "ConnectionLogs controls how long connection log entries are retained.\nSet to 0 to disable (keep indefinitely).",
"type": "integer"
},
"workspace_agent_logs": {
"description": "WorkspaceAgentLogs controls how long workspace agent logs are retained.\nLogs are deleted if the agent hasn't connected within this period.\nLogs from the latest build are always retained regardless of age.\nDefaults to 7 days to preserve existing behavior.",
"type": "integer"
}
}
},
"codersdk.Role": {
"type": "object",
"properties": {
+1 -2
View File
@@ -19,7 +19,6 @@ import (
"github.com/coder/coder/v2/coderd/database"
"github.com/coder/coder/v2/coderd/database/dbtime"
"github.com/coder/coder/v2/coderd/httpapi"
"github.com/coder/coder/v2/coderd/httpauthz"
"github.com/coder/coder/v2/coderd/httpmw"
"github.com/coder/coder/v2/coderd/rbac"
"github.com/coder/coder/v2/coderd/rbac/policy"
@@ -342,7 +341,7 @@ func (api *API) tokens(rw http.ResponseWriter, r *http.Request) {
}
}
keys, err = httpauthz.AuthorizationFilter(api.HTTPAuth, r, policy.ActionRead, keys)
keys, err = AuthorizeFilter(api.HTTPAuth, r, policy.ActionRead, keys)
if err != nil {
httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{
Message: "Internal error fetching keys.",
+79
View File
@@ -5,6 +5,7 @@ import (
"net/http"
"github.com/google/uuid"
"golang.org/x/xerrors"
"cdr.dev/slog"
"github.com/coder/coder/v2/coderd/httpapi"
@@ -14,6 +15,33 @@ import (
"github.com/coder/coder/v2/codersdk"
)
// AuthorizeFilter takes a list of objects and returns the filtered list of
// objects that the user is authorized to perform the given action on.
// This is faster than calling Authorize() on each object.
func AuthorizeFilter[O rbac.Objecter](h *HTTPAuthorizer, r *http.Request, action policy.Action, objects []O) ([]O, error) {
roles := httpmw.UserAuthorization(r.Context())
objects, err := rbac.Filter(r.Context(), h.Authorizer, roles, action, objects)
if err != nil {
// Log the error as Filter should not be erroring.
h.Logger.Error(r.Context(), "authorization filter failed",
slog.Error(err),
slog.F("user_id", roles.ID),
slog.F("username", roles),
slog.F("roles", roles.SafeRoleNames()),
slog.F("scope", roles.SafeScopeName()),
slog.F("route", r.URL.Path),
slog.F("action", action),
)
return nil, err
}
return objects, nil
}
type HTTPAuthorizer struct {
Authorizer rbac.Authorizer
Logger slog.Logger
}
// Authorize will return false if the user is not authorized to do the action.
// This function will log appropriately, but the caller must return an
// error to the api client.
@@ -27,6 +55,57 @@ func (api *API) Authorize(r *http.Request, action policy.Action, object rbac.Obj
return api.HTTPAuth.Authorize(r, action, object)
}
// Authorize will return false if the user is not authorized to do the action.
// This function will log appropriately, but the caller must return an
// error to the api client.
// Eg:
//
// if !h.Authorize(...) {
// httpapi.Forbidden(rw)
// return
// }
func (h *HTTPAuthorizer) Authorize(r *http.Request, action policy.Action, object rbac.Objecter) bool {
roles := httpmw.UserAuthorization(r.Context())
err := h.Authorizer.Authorize(r.Context(), roles, action, object.RBACObject())
if err != nil {
// Log the errors for debugging
internalError := new(rbac.UnauthorizedError)
logger := h.Logger
if xerrors.As(err, internalError) {
logger = h.Logger.With(slog.F("internal_error", internalError.Internal()))
}
// Log information for debugging. This will be very helpful
// in the early days
logger.Warn(r.Context(), "requester is not authorized to access the object",
slog.F("roles", roles.SafeRoleNames()),
slog.F("actor_id", roles.ID),
slog.F("actor_name", roles),
slog.F("scope", roles.SafeScopeName()),
slog.F("route", r.URL.Path),
slog.F("action", action),
slog.F("object", object),
)
return false
}
return true
}
// AuthorizeSQLFilter returns an authorization filter that can used in a
// SQL 'WHERE' clause. If the filter is used, the resulting rows returned
// from postgres are already authorized, and the caller does not need to
// call 'Authorize()' on the returned objects.
// Note the authorization is only for the given action and object type.
func (h *HTTPAuthorizer) AuthorizeSQLFilter(r *http.Request, action policy.Action, objectType string) (rbac.PreparedAuthorized, error) {
roles := httpmw.UserAuthorization(r.Context())
prepared, err := h.Authorizer.Prepare(r.Context(), roles, action, objectType)
if err != nil {
return nil, xerrors.Errorf("prepare filter: %w", err)
}
return prepared, nil
}
// checkAuthorization returns if the current API key can use the given
// permissions, factoring in the current user's roles and the API key scopes.
//
+7 -13
View File
@@ -21,8 +21,6 @@ import (
"sync/atomic"
"time"
"github.com/coder/coder/v2/coderd/httpauthz"
"github.com/coder/coder/v2/coderd/insightsapi"
"github.com/coder/coder/v2/coderd/oauth2provider"
"github.com/coder/coder/v2/coderd/pproflabel"
"github.com/coder/coder/v2/coderd/prebuilds"
@@ -586,7 +584,7 @@ func New(options *Options) *API {
ID: uuid.New(),
Options: options,
RootHandler: r,
HTTPAuth: &httpauthz.HTTPAuthorizer{
HTTPAuth: &HTTPAuthorizer{
Authorizer: options.Authorizer,
Logger: options.Logger,
},
@@ -802,8 +800,6 @@ func New(options *Options) *API {
APIKeyEncryptionKeycache: options.AppEncryptionKeyCache,
})
api.insightsAPI = insightsapi.NewAPI(api.Logger, api.Database, api.HTTPAuth)
apiKeyMiddleware := httpmw.ExtractAPIKeyMW(httpmw.ExtractAPIKeyConfig{
DB: options.Database,
ActivateDormantUser: ActivateDormantUser(options.Logger, &api.Auditor, options.Database),
@@ -1528,11 +1524,11 @@ func New(options *Options) *API {
})
r.Route("/insights", func(r chi.Router) {
r.Use(apiKeyMiddleware)
r.Get("/daus", api.insightsAPI.DeploymentDAUs)
r.Get("/user-activity", api.insightsAPI.UserActivity)
r.Get("/user-status-counts", api.insightsAPI.UserStatusCounts)
r.Get("/user-latency", api.insightsAPI.UserLatency)
r.Get("/templates", api.insightsAPI.Templates)
r.Get("/daus", api.deploymentDAUs)
r.Get("/user-activity", api.insightsUserActivity)
r.Get("/user-status-counts", api.insightsUserStatusCounts)
r.Get("/user-latency", api.insightsUserLatency)
r.Get("/templates", api.insightsTemplates)
})
r.Route("/debug", func(r chi.Router) {
r.Use(
@@ -1806,7 +1802,7 @@ type API struct {
UpdatesProvider tailnet.WorkspaceUpdatesProvider
HTTPAuth *httpauthz.HTTPAuthorizer
HTTPAuth *HTTPAuthorizer
// APIHandler serves "/api/v2"
APIHandler chi.Router
@@ -1841,8 +1837,6 @@ type API struct {
// dbRolluper rolls up template usage stats from raw agent and app
// stats. This is used to provide insights in the WebUI.
dbRolluper *dbrollup.Rolluper
insightsAPI *insightsapi.API
}
// Close waits for all WebSocket connections to drain before returning.
+4
View File
@@ -2,6 +2,7 @@ package coderd_test
import (
"context"
"flag"
"fmt"
"io"
"net/http"
@@ -34,6 +35,9 @@ import (
"github.com/coder/coder/v2/testutil"
)
// updateGoldenFiles is a flag that can be set to update golden files.
var updateGoldenFiles = flag.Bool("update", false, "Update golden files")
func TestMain(m *testing.M) {
goleak.VerifyTestMain(m, testutil.GoleakOptions...)
}
-29
View File
@@ -1,29 +0,0 @@
package coderdtest
import (
"sync/atomic"
"testing"
"github.com/prometheus/client_golang/prometheus"
"go.uber.org/mock/gomock"
"cdr.dev/slog"
"github.com/coder/coder/v2/coderd/database"
"github.com/coder/coder/v2/coderd/database/dbauthz"
"github.com/coder/coder/v2/coderd/database/dbmock"
"github.com/coder/coder/v2/coderd/rbac"
)
func MockedDatabaseWithAuthz(t testing.TB, logger slog.Logger) (*gomock.Controller, *dbmock.MockStore, database.Store, rbac.Authorizer) {
ctrl := gomock.NewController(t)
mDB := dbmock.NewMockStore(ctrl)
auth := rbac.NewStrictCachingAuthorizer(prometheus.NewRegistry())
accessControlStore := &atomic.Pointer[dbauthz.AccessControlStore]{}
var acs dbauthz.AccessControlStore = dbauthz.AGPLTemplateAccessControlStore{}
accessControlStore.Store(&acs)
// dbauthz will call Wrappers() to check for wrapped databases
mDB.EXPECT().Wrappers().Return([]string{}).AnyTimes()
authDB := dbauthz.New(mDB, auth, logger, accessControlStore)
return ctrl, mDB, authDB, auth
}
-14
View File
@@ -1,14 +0,0 @@
package coderdtest
import "github.com/coder/coder/v2/coderd/rbac"
func OwnerSubject() rbac.Subject {
return rbac.Subject{
FriendlyName: "coderdtest-owner",
Email: "owner@coderd.test",
Type: rbac.SubjectTypeUser,
ID: "coderdtest-owner-id",
Roles: rbac.RoleIdentifiers{rbac.RoleOwner()},
Scope: rbac.ScopeAll,
}.WithCachedASTValue()
}
+1 -1
View File
@@ -16,7 +16,7 @@ import (
func TestEndpointsDocumented(t *testing.T) {
t.Parallel()
swaggerComments, err := coderdtest.ParseSwaggerComments("..", "../insightsapi")
swaggerComments, err := coderdtest.ParseSwaggerComments("..")
require.NoError(t, err, "can't parse swagger comments")
require.NotEmpty(t, swaggerComments, "swagger comments must be present")
+17 -3
View File
@@ -1732,7 +1732,7 @@ func (q *querier) DeleteOAuth2ProviderAppTokensByAppAndUserID(ctx context.Contex
return q.db.DeleteOAuth2ProviderAppTokensByAppAndUserID(ctx, arg)
}
func (q *querier) DeleteOldAIBridgeRecords(ctx context.Context, beforeTime time.Time) (int32, error) {
func (q *querier) DeleteOldAIBridgeRecords(ctx context.Context, beforeTime time.Time) (int64, error) {
if err := q.authorizeContext(ctx, policy.ActionDelete, rbac.ResourceAibridgeInterception); err != nil {
return -1, err
}
@@ -1749,6 +1749,20 @@ func (q *querier) DeleteOldAuditLogConnectionEvents(ctx context.Context, thresho
return q.db.DeleteOldAuditLogConnectionEvents(ctx, threshold)
}
func (q *querier) DeleteOldAuditLogs(ctx context.Context, arg database.DeleteOldAuditLogsParams) (int64, error) {
if err := q.authorizeContext(ctx, policy.ActionDelete, rbac.ResourceSystem); err != nil {
return 0, err
}
return q.db.DeleteOldAuditLogs(ctx, arg)
}
func (q *querier) DeleteOldConnectionLogs(ctx context.Context, arg database.DeleteOldConnectionLogsParams) (int64, error) {
if err := q.authorizeContext(ctx, policy.ActionDelete, rbac.ResourceSystem); err != nil {
return 0, err
}
return q.db.DeleteOldConnectionLogs(ctx, arg)
}
func (q *querier) DeleteOldNotificationMessages(ctx context.Context) error {
if err := q.authorizeContext(ctx, policy.ActionDelete, rbac.ResourceNotificationMessage); err != nil {
return err
@@ -1770,9 +1784,9 @@ func (q *querier) DeleteOldTelemetryLocks(ctx context.Context, beforeTime time.T
return q.db.DeleteOldTelemetryLocks(ctx, beforeTime)
}
func (q *querier) DeleteOldWorkspaceAgentLogs(ctx context.Context, threshold time.Time) error {
func (q *querier) DeleteOldWorkspaceAgentLogs(ctx context.Context, threshold time.Time) (int64, error) {
if err := q.authorizeContext(ctx, policy.ActionDelete, rbac.ResourceSystem); err != nil {
return err
return 0, err
}
return q.db.DeleteOldWorkspaceAgentLogs(ctx, threshold)
}
+10 -2
View File
@@ -324,6 +324,10 @@ func (s *MethodTestSuite) TestAuditLogs() {
dbm.EXPECT().DeleteOldAuditLogConnectionEvents(gomock.Any(), database.DeleteOldAuditLogConnectionEventsParams{}).Return(nil).AnyTimes()
check.Args(database.DeleteOldAuditLogConnectionEventsParams{}).Asserts(rbac.ResourceSystem, policy.ActionDelete)
}))
s.Run("DeleteOldAuditLogs", s.Mocked(func(dbm *dbmock.MockStore, _ *gofakeit.Faker, check *expects) {
dbm.EXPECT().DeleteOldAuditLogs(gomock.Any(), database.DeleteOldAuditLogsParams{}).Return(int64(0), nil).AnyTimes()
check.Args(database.DeleteOldAuditLogsParams{}).Asserts(rbac.ResourceSystem, policy.ActionDelete)
}))
}
func (s *MethodTestSuite) TestConnectionLogs() {
@@ -355,6 +359,10 @@ func (s *MethodTestSuite) TestConnectionLogs() {
dbm.EXPECT().CountConnectionLogs(gomock.Any(), database.CountConnectionLogsParams{}).Return(int64(0), nil).AnyTimes()
check.Args(database.CountConnectionLogsParams{}, emptyPreparedAuthorized{}).Asserts(rbac.ResourceConnectionLog, policy.ActionRead)
}))
s.Run("DeleteOldConnectionLogs", s.Mocked(func(dbm *dbmock.MockStore, _ *gofakeit.Faker, check *expects) {
dbm.EXPECT().DeleteOldConnectionLogs(gomock.Any(), database.DeleteOldConnectionLogsParams{}).Return(int64(0), nil).AnyTimes()
check.Args(database.DeleteOldConnectionLogsParams{}).Asserts(rbac.ResourceSystem, policy.ActionDelete)
}))
}
func (s *MethodTestSuite) TestFile() {
@@ -3219,7 +3227,7 @@ func (s *MethodTestSuite) TestSystemFunctions() {
}))
s.Run("DeleteOldWorkspaceAgentLogs", s.Mocked(func(dbm *dbmock.MockStore, _ *gofakeit.Faker, check *expects) {
t := time.Time{}
dbm.EXPECT().DeleteOldWorkspaceAgentLogs(gomock.Any(), t).Return(nil).AnyTimes()
dbm.EXPECT().DeleteOldWorkspaceAgentLogs(gomock.Any(), t).Return(int64(0), nil).AnyTimes()
check.Args(t).Asserts(rbac.ResourceSystem, policy.ActionDelete)
}))
s.Run("InsertWorkspaceAgentStats", s.Mocked(func(dbm *dbmock.MockStore, _ *gofakeit.Faker, check *expects) {
@@ -4697,7 +4705,7 @@ func (s *MethodTestSuite) TestAIBridge() {
s.Run("DeleteOldAIBridgeRecords", s.Mocked(func(db *dbmock.MockStore, faker *gofakeit.Faker, check *expects) {
t := dbtime.Now()
db.EXPECT().DeleteOldAIBridgeRecords(gomock.Any(), t).Return(int32(0), nil).AnyTimes()
db.EXPECT().DeleteOldAIBridgeRecords(gomock.Any(), t).Return(int64(0), nil).AnyTimes()
check.Args(t).Asserts(rbac.ResourceAibridgeInterception, policy.ActionDelete)
}))
}
+18 -4
View File
@@ -396,7 +396,7 @@ func (m queryMetricsStore) DeleteOAuth2ProviderAppTokensByAppAndUserID(ctx conte
return r0
}
func (m queryMetricsStore) DeleteOldAIBridgeRecords(ctx context.Context, beforeTime time.Time) (int32, error) {
func (m queryMetricsStore) DeleteOldAIBridgeRecords(ctx context.Context, beforeTime time.Time) (int64, error) {
start := time.Now()
r0, r1 := m.s.DeleteOldAIBridgeRecords(ctx, beforeTime)
m.queryLatencies.WithLabelValues("DeleteOldAIBridgeRecords").Observe(time.Since(start).Seconds())
@@ -410,6 +410,20 @@ func (m queryMetricsStore) DeleteOldAuditLogConnectionEvents(ctx context.Context
return r0
}
func (m queryMetricsStore) DeleteOldAuditLogs(ctx context.Context, arg database.DeleteOldAuditLogsParams) (int64, error) {
start := time.Now()
r0, r1 := m.s.DeleteOldAuditLogs(ctx, arg)
m.queryLatencies.WithLabelValues("DeleteOldAuditLogs").Observe(time.Since(start).Seconds())
return r0, r1
}
func (m queryMetricsStore) DeleteOldConnectionLogs(ctx context.Context, arg database.DeleteOldConnectionLogsParams) (int64, error) {
start := time.Now()
r0, r1 := m.s.DeleteOldConnectionLogs(ctx, arg)
m.queryLatencies.WithLabelValues("DeleteOldConnectionLogs").Observe(time.Since(start).Seconds())
return r0, r1
}
func (m queryMetricsStore) DeleteOldNotificationMessages(ctx context.Context) error {
start := time.Now()
r0 := m.s.DeleteOldNotificationMessages(ctx)
@@ -431,11 +445,11 @@ func (m queryMetricsStore) DeleteOldTelemetryLocks(ctx context.Context, periodEn
return r0
}
func (m queryMetricsStore) DeleteOldWorkspaceAgentLogs(ctx context.Context, arg time.Time) error {
func (m queryMetricsStore) DeleteOldWorkspaceAgentLogs(ctx context.Context, arg time.Time) (int64, error) {
start := time.Now()
r0 := m.s.DeleteOldWorkspaceAgentLogs(ctx, arg)
r0, r1 := m.s.DeleteOldWorkspaceAgentLogs(ctx, arg)
m.queryLatencies.WithLabelValues("DeleteOldWorkspaceAgentLogs").Observe(time.Since(start).Seconds())
return r0
return r0, r1
}
func (m queryMetricsStore) DeleteOldWorkspaceAgentStats(ctx context.Context) error {
+36 -5
View File
@@ -725,10 +725,10 @@ func (mr *MockStoreMockRecorder) DeleteOAuth2ProviderAppTokensByAppAndUserID(ctx
}
// DeleteOldAIBridgeRecords mocks base method.
func (m *MockStore) DeleteOldAIBridgeRecords(ctx context.Context, beforeTime time.Time) (int32, error) {
func (m *MockStore) DeleteOldAIBridgeRecords(ctx context.Context, beforeTime time.Time) (int64, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "DeleteOldAIBridgeRecords", ctx, beforeTime)
ret0, _ := ret[0].(int32)
ret0, _ := ret[0].(int64)
ret1, _ := ret[1].(error)
return ret0, ret1
}
@@ -753,6 +753,36 @@ func (mr *MockStoreMockRecorder) DeleteOldAuditLogConnectionEvents(ctx, arg any)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteOldAuditLogConnectionEvents", reflect.TypeOf((*MockStore)(nil).DeleteOldAuditLogConnectionEvents), ctx, arg)
}
// DeleteOldAuditLogs mocks base method.
func (m *MockStore) DeleteOldAuditLogs(ctx context.Context, arg database.DeleteOldAuditLogsParams) (int64, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "DeleteOldAuditLogs", ctx, arg)
ret0, _ := ret[0].(int64)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// DeleteOldAuditLogs indicates an expected call of DeleteOldAuditLogs.
func (mr *MockStoreMockRecorder) DeleteOldAuditLogs(ctx, arg any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteOldAuditLogs", reflect.TypeOf((*MockStore)(nil).DeleteOldAuditLogs), ctx, arg)
}
// DeleteOldConnectionLogs mocks base method.
func (m *MockStore) DeleteOldConnectionLogs(ctx context.Context, arg database.DeleteOldConnectionLogsParams) (int64, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "DeleteOldConnectionLogs", ctx, arg)
ret0, _ := ret[0].(int64)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// DeleteOldConnectionLogs indicates an expected call of DeleteOldConnectionLogs.
func (mr *MockStoreMockRecorder) DeleteOldConnectionLogs(ctx, arg any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteOldConnectionLogs", reflect.TypeOf((*MockStore)(nil).DeleteOldConnectionLogs), ctx, arg)
}
// DeleteOldNotificationMessages mocks base method.
func (m *MockStore) DeleteOldNotificationMessages(ctx context.Context) error {
m.ctrl.T.Helper()
@@ -796,11 +826,12 @@ func (mr *MockStoreMockRecorder) DeleteOldTelemetryLocks(ctx, periodEndingAtBefo
}
// DeleteOldWorkspaceAgentLogs mocks base method.
func (m *MockStore) DeleteOldWorkspaceAgentLogs(ctx context.Context, threshold time.Time) error {
func (m *MockStore) DeleteOldWorkspaceAgentLogs(ctx context.Context, threshold time.Time) (int64, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "DeleteOldWorkspaceAgentLogs", ctx, threshold)
ret0, _ := ret[0].(error)
return ret0
ret0, _ := ret[0].(int64)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// DeleteOldWorkspaceAgentLogs indicates an expected call of DeleteOldWorkspaceAgentLogs.
+71 -24
View File
@@ -18,13 +18,16 @@ import (
)
const (
delay = 10 * time.Minute
maxAgentLogAge = 7 * 24 * time.Hour
delay = 10 * time.Minute
// Connection events are now inserted into the `connection_logs` table.
// We'll slowly remove old connection events from the `audit_logs` table,
// but we won't touch the `connection_logs` table.
// We'll slowly remove old connection events from the `audit_logs` table.
// The `connection_logs` table is purged based on the configured retention.
maxAuditLogConnectionEventAge = 90 * 24 * time.Hour // 90 days
auditLogConnectionEventBatchSize = 1000
// Batch size for connection log deletion.
connectionLogsBatchSize = 10000
// Batch size for audit log deletion.
auditLogsBatchSize = 10000
// Telemetry heartbeats are used to deduplicate events across replicas. We
// don't need to persist heartbeat rows for longer than 24 hours, as they
// are only used for deduplication across replicas. The time needs to be
@@ -62,9 +65,14 @@ func New(ctx context.Context, logger slog.Logger, db database.Store, vals *coder
return nil
}
deleteOldWorkspaceAgentLogsBefore := start.Add(-maxAgentLogAge)
if err := tx.DeleteOldWorkspaceAgentLogs(ctx, deleteOldWorkspaceAgentLogsBefore); err != nil {
return xerrors.Errorf("failed to delete old workspace agent logs: %w", err)
var purgedWorkspaceAgentLogs int64
workspaceAgentLogsRetention := vals.Retention.WorkspaceAgentLogs.Value()
if workspaceAgentLogsRetention > 0 {
deleteOldWorkspaceAgentLogsBefore := start.Add(-workspaceAgentLogsRetention)
purgedWorkspaceAgentLogs, err = tx.DeleteOldWorkspaceAgentLogs(ctx, deleteOldWorkspaceAgentLogsBefore)
if err != nil {
return xerrors.Errorf("failed to delete old workspace agent logs: %w", err)
}
}
if err := tx.DeleteOldWorkspaceAgentStats(ctx); err != nil {
return xerrors.Errorf("failed to delete old workspace agent stats: %w", err)
@@ -78,18 +86,24 @@ func New(ctx context.Context, logger slog.Logger, db database.Store, vals *coder
if err := tx.ExpirePrebuildsAPIKeys(ctx, dbtime.Time(start)); err != nil {
return xerrors.Errorf("failed to expire prebuilds user api keys: %w", err)
}
expiredAPIKeys, err := tx.DeleteExpiredAPIKeys(ctx, database.DeleteExpiredAPIKeysParams{
// Leave expired keys for a week to allow the backend to know the difference
// between a 404 and an expired key. This purge code is just to bound the size of
// the table to something more reasonable.
Before: dbtime.Time(start.Add(time.Hour * 24 * 7 * -1)),
// There could be a lot of expired keys here, so set a limit to prevent this
// taking too long.
// This runs every 10 minutes, so it deletes ~1.5m keys per day at most.
LimitCount: 10000,
})
if err != nil {
return xerrors.Errorf("failed to delete expired api keys: %w", err)
var expiredAPIKeys int64
apiKeysRetention := vals.Retention.APIKeys.Value()
if apiKeysRetention > 0 {
// Delete keys that have been expired for at least the retention period.
// A higher retention period allows the backend to return a more helpful
// error message when a user tries to use an expired key.
deleteExpiredKeysBefore := start.Add(-apiKeysRetention)
expiredAPIKeys, err = tx.DeleteExpiredAPIKeys(ctx, database.DeleteExpiredAPIKeysParams{
Before: dbtime.Time(deleteExpiredKeysBefore),
// There could be a lot of expired keys here, so set a limit to prevent
// this taking too long. This runs every 10 minutes, so it deletes
// ~1.5m keys per day at most.
LimitCount: 10000,
})
if err != nil {
return xerrors.Errorf("failed to delete expired api keys: %w", err)
}
}
deleteOldTelemetryLocksBefore := start.Add(-maxTelemetryHeartbeatAge)
if err := tx.DeleteOldTelemetryLocks(ctx, deleteOldTelemetryLocksBefore); err != nil {
@@ -104,16 +118,49 @@ func New(ctx context.Context, logger slog.Logger, db database.Store, vals *coder
return xerrors.Errorf("failed to delete old audit log connection events: %w", err)
}
deleteAIBridgeRecordsBefore := start.Add(-vals.AI.BridgeConfig.Retention.Value())
// nolint:gocritic // Needs to run as aibridge context.
purgedAIBridgeRecords, err := tx.DeleteOldAIBridgeRecords(dbauthz.AsAIBridged(ctx), deleteAIBridgeRecordsBefore)
if err != nil {
return xerrors.Errorf("failed to delete old aibridge records: %w", err)
var purgedAIBridgeRecords int64
aibridgeRetention := vals.AI.BridgeConfig.Retention.Value()
if aibridgeRetention > 0 {
deleteAIBridgeRecordsBefore := start.Add(-aibridgeRetention)
// nolint:gocritic // Needs to run as aibridge context.
purgedAIBridgeRecords, err = tx.DeleteOldAIBridgeRecords(dbauthz.AsAIBridged(ctx), deleteAIBridgeRecordsBefore)
if err != nil {
return xerrors.Errorf("failed to delete old aibridge records: %w", err)
}
}
var purgedConnectionLogs int64
connectionLogsRetention := vals.Retention.ConnectionLogs.Value()
if connectionLogsRetention > 0 {
deleteConnectionLogsBefore := start.Add(-connectionLogsRetention)
purgedConnectionLogs, err = tx.DeleteOldConnectionLogs(ctx, database.DeleteOldConnectionLogsParams{
BeforeTime: deleteConnectionLogsBefore,
LimitCount: connectionLogsBatchSize,
})
if err != nil {
return xerrors.Errorf("failed to delete old connection logs: %w", err)
}
}
var purgedAuditLogs int64
auditLogsRetention := vals.Retention.AuditLogs.Value()
if auditLogsRetention > 0 {
deleteAuditLogsBefore := start.Add(-auditLogsRetention)
purgedAuditLogs, err = tx.DeleteOldAuditLogs(ctx, database.DeleteOldAuditLogsParams{
BeforeTime: deleteAuditLogsBefore,
LimitCount: auditLogsBatchSize,
})
if err != nil {
return xerrors.Errorf("failed to delete old audit logs: %w", err)
}
}
logger.Debug(ctx, "purged old database entries",
slog.F("workspace_agent_logs", purgedWorkspaceAgentLogs),
slog.F("expired_api_keys", expiredAPIKeys),
slog.F("aibridge_records", purgedAIBridgeRecords),
slog.F("connection_logs", purgedConnectionLogs),
slog.F("audit_logs", purgedAuditLogs),
slog.F("duration", clk.Since(start)),
)
+751 -150
View File
@@ -246,7 +246,11 @@ func TestDeleteOldWorkspaceAgentLogs(t *testing.T) {
// After dbpurge completes, the ticker is reset. Trap this call.
done := awaitDoTick(ctx, t, clk)
closer := dbpurge.New(ctx, logger, db, &codersdk.DeploymentValues{}, clk)
closer := dbpurge.New(ctx, logger, db, &codersdk.DeploymentValues{
Retention: codersdk.RetentionConfig{
WorkspaceAgentLogs: serpent.Duration(7 * 24 * time.Hour),
},
}, clk)
defer closer.Close()
<-done // doTick() has now run.
@@ -392,6 +396,90 @@ func mustCreateAgentLogs(ctx context.Context, t *testing.T, db database.Store, a
require.NotEmpty(t, agentLogs, "agent logs must be present")
}
func TestDeleteOldWorkspaceAgentLogsRetention(t *testing.T) {
t.Parallel()
now := time.Date(2025, 1, 15, 7, 30, 0, 0, time.UTC)
testCases := []struct {
name string
retentionConfig codersdk.RetentionConfig
logsAge time.Duration
expectDeleted bool
}{
{
name: "RetentionEnabled",
retentionConfig: codersdk.RetentionConfig{
WorkspaceAgentLogs: serpent.Duration(7 * 24 * time.Hour), // 7 days
},
logsAge: 8 * 24 * time.Hour, // 8 days ago
expectDeleted: true,
},
{
name: "RetentionDisabled",
retentionConfig: codersdk.RetentionConfig{
WorkspaceAgentLogs: serpent.Duration(0),
},
logsAge: 60 * 24 * time.Hour, // 60 days ago
expectDeleted: false,
},
{
name: "CustomRetention30Days",
retentionConfig: codersdk.RetentionConfig{
WorkspaceAgentLogs: serpent.Duration(30 * 24 * time.Hour), // 30 days
},
logsAge: 31 * 24 * time.Hour, // 31 days ago
expectDeleted: true,
},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitShort)
clk := quartz.NewMock(t)
clk.Set(now).MustWait(ctx)
oldTime := now.Add(-tc.logsAge)
db, _ := dbtestutil.NewDB(t, dbtestutil.WithDumpOnFailure())
logger := slogtest.Make(t, &slogtest.Options{IgnoreErrors: true})
org := dbgen.Organization(t, db, database.Organization{})
user := dbgen.User(t, db, database.User{})
_ = dbgen.OrganizationMember(t, db, database.OrganizationMember{UserID: user.ID, OrganizationID: org.ID})
tv := dbgen.TemplateVersion(t, db, database.TemplateVersion{OrganizationID: org.ID, CreatedBy: user.ID})
tmpl := dbgen.Template(t, db, database.Template{OrganizationID: org.ID, ActiveVersionID: tv.ID, CreatedBy: user.ID})
ws := dbgen.Workspace(t, db, database.WorkspaceTable{Name: "test-ws", OwnerID: user.ID, OrganizationID: org.ID, TemplateID: tmpl.ID})
wb1 := mustCreateWorkspaceBuild(t, db, org, tv, ws.ID, oldTime, 1)
wb2 := mustCreateWorkspaceBuild(t, db, org, tv, ws.ID, oldTime, 2)
agent1 := mustCreateAgent(t, db, wb1)
agent2 := mustCreateAgent(t, db, wb2)
mustCreateAgentLogs(ctx, t, db, agent1, &oldTime, "agent 1 logs")
mustCreateAgentLogs(ctx, t, db, agent2, &oldTime, "agent 2 logs")
// Run the purge.
done := awaitDoTick(ctx, t, clk)
closer := dbpurge.New(ctx, logger, db, &codersdk.DeploymentValues{
Retention: tc.retentionConfig,
}, clk)
defer closer.Close()
testutil.TryReceive(ctx, t, done)
// Verify results.
if tc.expectDeleted {
assertNoWorkspaceAgentLogs(ctx, t, db, agent1.ID)
} else {
assertWorkspaceAgentLogs(ctx, t, db, agent1.ID, "agent 1 logs")
}
// Latest build logs are always retained.
assertWorkspaceAgentLogs(ctx, t, db, agent2.ID, "agent 2 logs")
})
}
}
//nolint:paralleltest // It uses LockIDDBPurge.
func TestDeleteOldProvisionerDaemons(t *testing.T) {
// TODO: must refactor DeleteOldProvisionerDaemons to allow passing in cutoff
@@ -759,171 +847,684 @@ func TestDeleteOldTelemetryHeartbeats(t *testing.T) {
}, testutil.WaitShort, testutil.IntervalFast, "it should delete old telemetry heartbeats")
}
func TestDeleteOldConnectionLogs(t *testing.T) {
t.Parallel()
now := time.Date(2025, 1, 15, 7, 30, 0, 0, time.UTC)
retentionPeriod := 30 * 24 * time.Hour
afterThreshold := now.Add(-retentionPeriod).Add(-24 * time.Hour) // 31 days ago (older than threshold)
beforeThreshold := now.Add(-15 * 24 * time.Hour) // 15 days ago (newer than threshold)
testCases := []struct {
name string
retentionConfig codersdk.RetentionConfig
oldLogTime time.Time
recentLogTime *time.Time // nil means no recent log created
expectOldDeleted bool
expectedLogsRemaining int
}{
{
name: "RetentionEnabled",
retentionConfig: codersdk.RetentionConfig{
ConnectionLogs: serpent.Duration(retentionPeriod),
},
oldLogTime: afterThreshold,
recentLogTime: &beforeThreshold,
expectOldDeleted: true,
expectedLogsRemaining: 1, // only recent log remains
},
{
name: "RetentionDisabled",
retentionConfig: codersdk.RetentionConfig{
ConnectionLogs: serpent.Duration(0),
},
oldLogTime: now.Add(-365 * 24 * time.Hour), // 1 year ago
recentLogTime: nil,
expectOldDeleted: false,
expectedLogsRemaining: 1, // old log is kept
},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitShort)
clk := quartz.NewMock(t)
clk.Set(now).MustWait(ctx)
db, _ := dbtestutil.NewDB(t, dbtestutil.WithDumpOnFailure())
logger := slogtest.Make(t, &slogtest.Options{IgnoreErrors: true})
// Setup test fixtures.
user := dbgen.User(t, db, database.User{})
org := dbgen.Organization(t, db, database.Organization{})
_ = dbgen.OrganizationMember(t, db, database.OrganizationMember{UserID: user.ID, OrganizationID: org.ID})
tv := dbgen.TemplateVersion(t, db, database.TemplateVersion{OrganizationID: org.ID, CreatedBy: user.ID})
tmpl := dbgen.Template(t, db, database.Template{OrganizationID: org.ID, ActiveVersionID: tv.ID, CreatedBy: user.ID})
workspace := dbgen.Workspace(t, db, database.WorkspaceTable{
OwnerID: user.ID,
OrganizationID: org.ID,
TemplateID: tmpl.ID,
})
// Create old connection log.
oldLog := dbgen.ConnectionLog(t, db, database.UpsertConnectionLogParams{
ID: uuid.New(),
Time: tc.oldLogTime,
OrganizationID: org.ID,
WorkspaceOwnerID: user.ID,
WorkspaceID: workspace.ID,
WorkspaceName: workspace.Name,
AgentName: "agent1",
Type: database.ConnectionTypeSsh,
ConnectionStatus: database.ConnectionStatusConnected,
})
// Create recent connection log if specified.
var recentLog database.ConnectionLog
if tc.recentLogTime != nil {
recentLog = dbgen.ConnectionLog(t, db, database.UpsertConnectionLogParams{
ID: uuid.New(),
Time: *tc.recentLogTime,
OrganizationID: org.ID,
WorkspaceOwnerID: user.ID,
WorkspaceID: workspace.ID,
WorkspaceName: workspace.Name,
AgentName: "agent2",
Type: database.ConnectionTypeSsh,
ConnectionStatus: database.ConnectionStatusConnected,
})
}
// Run the purge.
done := awaitDoTick(ctx, t, clk)
closer := dbpurge.New(ctx, logger, db, &codersdk.DeploymentValues{
Retention: tc.retentionConfig,
}, clk)
defer closer.Close()
testutil.TryReceive(ctx, t, done)
// Verify results.
logs, err := db.GetConnectionLogsOffset(ctx, database.GetConnectionLogsOffsetParams{
LimitOpt: 100,
})
require.NoError(t, err)
require.Len(t, logs, tc.expectedLogsRemaining, "unexpected number of logs remaining")
logIDs := make([]uuid.UUID, len(logs))
for i, log := range logs {
logIDs[i] = log.ConnectionLog.ID
}
if tc.expectOldDeleted {
require.NotContains(t, logIDs, oldLog.ID, "old connection log should be deleted")
} else {
require.Contains(t, logIDs, oldLog.ID, "old connection log should NOT be deleted")
}
if tc.recentLogTime != nil {
require.Contains(t, logIDs, recentLog.ID, "recent connection log should be kept")
}
})
}
}
func TestDeleteOldAIBridgeRecords(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitShort)
clk := quartz.NewMock(t)
now := time.Date(2025, 1, 15, 7, 30, 0, 0, time.UTC)
retentionPeriod := 30 * 24 * time.Hour // 30 days
afterThreshold := now.Add(-retentionPeriod).Add(-24 * time.Hour) // 31 days ago (older than threshold)
beforeThreshold := now.Add(-15 * 24 * time.Hour) // 15 days ago (newer than threshold)
closeBeforeThreshold := now.Add(-retentionPeriod).Add(24 * time.Hour) // 29 days ago
clk.Set(now).MustWait(ctx)
db, _ := dbtestutil.NewDB(t, dbtestutil.WithDumpOnFailure())
logger := slogtest.Make(t, &slogtest.Options{IgnoreErrors: true})
user := dbgen.User(t, db, database.User{})
// Create old AI Bridge interception (should be deleted)
oldInterception := dbgen.AIBridgeInterception(t, db, database.InsertAIBridgeInterceptionParams{
ID: uuid.New(),
APIKeyID: sql.NullString{},
InitiatorID: user.ID,
Provider: "anthropic",
Model: "claude-3-5-sonnet",
StartedAt: afterThreshold,
}, &afterThreshold)
// Create old interception with related records (should all be deleted)
oldInterceptionWithRelated := dbgen.AIBridgeInterception(t, db, database.InsertAIBridgeInterceptionParams{
ID: uuid.New(),
APIKeyID: sql.NullString{},
InitiatorID: user.ID,
Provider: "openai",
Model: "gpt-4",
StartedAt: afterThreshold,
}, &afterThreshold)
_ = dbgen.AIBridgeTokenUsage(t, db, database.InsertAIBridgeTokenUsageParams{
ID: uuid.New(),
InterceptionID: oldInterceptionWithRelated.ID,
ProviderResponseID: "resp-1",
InputTokens: 100,
OutputTokens: 50,
CreatedAt: afterThreshold,
})
_ = dbgen.AIBridgeUserPrompt(t, db, database.InsertAIBridgeUserPromptParams{
ID: uuid.New(),
InterceptionID: oldInterceptionWithRelated.ID,
ProviderResponseID: "resp-1",
Prompt: "test prompt",
CreatedAt: afterThreshold,
})
_ = dbgen.AIBridgeToolUsage(t, db, database.InsertAIBridgeToolUsageParams{
ID: uuid.New(),
InterceptionID: oldInterceptionWithRelated.ID,
ProviderResponseID: "resp-1",
Tool: "test-tool",
ServerUrl: sql.NullString{String: "http://test", Valid: true},
Input: "{}",
Injected: true,
CreatedAt: afterThreshold,
})
// Create recent AI Bridge interception (should be kept)
recentInterception := dbgen.AIBridgeInterception(t, db, database.InsertAIBridgeInterceptionParams{
ID: uuid.New(),
APIKeyID: sql.NullString{},
InitiatorID: user.ID,
Provider: "anthropic",
Model: "claude-3-5-sonnet",
StartedAt: beforeThreshold,
}, &beforeThreshold)
// Create interception close to threshold (should be kept)
nearThresholdInterception := dbgen.AIBridgeInterception(t, db, database.InsertAIBridgeInterceptionParams{
ID: uuid.New(),
APIKeyID: sql.NullString{},
InitiatorID: user.ID,
Provider: "anthropic",
Model: "claude-3-5-sonnet",
StartedAt: closeBeforeThreshold,
}, &closeBeforeThreshold)
_ = dbgen.AIBridgeTokenUsage(t, db, database.InsertAIBridgeTokenUsageParams{
ID: uuid.New(),
InterceptionID: nearThresholdInterception.ID,
ProviderResponseID: "resp-1",
InputTokens: 100,
OutputTokens: 50,
CreatedAt: closeBeforeThreshold,
})
_ = dbgen.AIBridgeUserPrompt(t, db, database.InsertAIBridgeUserPromptParams{
ID: uuid.New(),
InterceptionID: nearThresholdInterception.ID,
ProviderResponseID: "resp-1",
Prompt: "test prompt",
CreatedAt: closeBeforeThreshold,
})
_ = dbgen.AIBridgeToolUsage(t, db, database.InsertAIBridgeToolUsageParams{
ID: uuid.New(),
InterceptionID: nearThresholdInterception.ID,
ProviderResponseID: "resp-1",
Tool: "test-tool",
ServerUrl: sql.NullString{String: "http://test", Valid: true},
Input: "{}",
Injected: true,
CreatedAt: closeBeforeThreshold,
})
// Run the purge with configured retention period
done := awaitDoTick(ctx, t, clk)
closer := dbpurge.New(ctx, logger, db, &codersdk.DeploymentValues{
AI: codersdk.AIConfig{
BridgeConfig: codersdk.AIBridgeConfig{
Retention: serpent.Duration(retentionPeriod),
},
},
}, clk)
defer closer.Close()
// Wait for tick
testutil.TryReceive(ctx, t, done)
// Verify results by querying all AI Bridge records
interceptions, err := db.GetAIBridgeInterceptions(ctx)
require.NoError(t, err)
// Extract interception IDs for comparison
interceptionIDs := make([]uuid.UUID, len(interceptions))
for i, interception := range interceptions {
interceptionIDs[i] = interception.ID
type testFixtures struct {
oldInterception database.AIBridgeInterception
oldInterceptionWithRelated database.AIBridgeInterception
recentInterception database.AIBridgeInterception
nearThresholdInterception database.AIBridgeInterception
}
require.NotContains(t, interceptionIDs, oldInterception.ID, "old interception should be deleted")
require.NotContains(t, interceptionIDs, oldInterceptionWithRelated.ID, "old interception with related records should be deleted")
testCases := []struct {
name string
retention time.Duration
verify func(t *testing.T, ctx context.Context, db database.Store, fixtures testFixtures)
}{
{
name: "RetentionEnabled",
retention: retentionPeriod,
verify: func(t *testing.T, ctx context.Context, db database.Store, fixtures testFixtures) {
t.Helper()
// Verify related records were also deleted
oldTokenUsages, err := db.GetAIBridgeTokenUsagesByInterceptionID(ctx, oldInterceptionWithRelated.ID)
require.NoError(t, err)
require.Empty(t, oldTokenUsages, "old token usages should be deleted")
interceptions, err := db.GetAIBridgeInterceptions(ctx)
require.NoError(t, err)
require.Len(t, interceptions, 2, "expected 2 interceptions remaining")
oldUserPrompts, err := db.GetAIBridgeUserPromptsByInterceptionID(ctx, oldInterceptionWithRelated.ID)
require.NoError(t, err)
require.Empty(t, oldUserPrompts, "old user prompts should be deleted")
interceptionIDs := make([]uuid.UUID, len(interceptions))
for i, interception := range interceptions {
interceptionIDs[i] = interception.ID
}
oldToolUsages, err := db.GetAIBridgeToolUsagesByInterceptionID(ctx, oldInterceptionWithRelated.ID)
require.NoError(t, err)
require.Empty(t, oldToolUsages, "old tool usages should be deleted")
require.NotContains(t, interceptionIDs, fixtures.oldInterception.ID, "old interception should be deleted")
require.NotContains(t, interceptionIDs, fixtures.oldInterceptionWithRelated.ID, "old interception with related records should be deleted")
require.Contains(t, interceptionIDs, fixtures.recentInterception.ID, "recent interception should be kept")
require.Contains(t, interceptionIDs, fixtures.nearThresholdInterception.ID, "near threshold interception should be kept")
require.Contains(t, interceptionIDs, recentInterception.ID, "recent interception should be kept")
require.Contains(t, interceptionIDs, nearThresholdInterception.ID, "near threshold interception should be kept")
// Verify related records were deleted for old interception.
oldTokenUsages, err := db.GetAIBridgeTokenUsagesByInterceptionID(ctx, fixtures.oldInterceptionWithRelated.ID)
require.NoError(t, err)
require.Empty(t, oldTokenUsages, "old token usages should be deleted")
// Verify related records were NOT deleted
newTokenUsages, err := db.GetAIBridgeTokenUsagesByInterceptionID(ctx, nearThresholdInterception.ID)
require.NoError(t, err)
require.Len(t, newTokenUsages, 1, "near threshold token usages should not be deleted")
oldUserPrompts, err := db.GetAIBridgeUserPromptsByInterceptionID(ctx, fixtures.oldInterceptionWithRelated.ID)
require.NoError(t, err)
require.Empty(t, oldUserPrompts, "old user prompts should be deleted")
newUserPrompts, err := db.GetAIBridgeUserPromptsByInterceptionID(ctx, nearThresholdInterception.ID)
require.NoError(t, err)
require.Len(t, newUserPrompts, 1, "near threshold user prompts should not be deleted")
oldToolUsages, err := db.GetAIBridgeToolUsagesByInterceptionID(ctx, fixtures.oldInterceptionWithRelated.ID)
require.NoError(t, err)
require.Empty(t, oldToolUsages, "old tool usages should be deleted")
newToolUsages, err := db.GetAIBridgeToolUsagesByInterceptionID(ctx, nearThresholdInterception.ID)
require.NoError(t, err)
require.Len(t, newToolUsages, 1, "near threshold tool usages should not be deleted")
// Verify related records were NOT deleted for near-threshold interception.
newTokenUsages, err := db.GetAIBridgeTokenUsagesByInterceptionID(ctx, fixtures.nearThresholdInterception.ID)
require.NoError(t, err)
require.Len(t, newTokenUsages, 1, "near threshold token usages should not be deleted")
newUserPrompts, err := db.GetAIBridgeUserPromptsByInterceptionID(ctx, fixtures.nearThresholdInterception.ID)
require.NoError(t, err)
require.Len(t, newUserPrompts, 1, "near threshold user prompts should not be deleted")
newToolUsages, err := db.GetAIBridgeToolUsagesByInterceptionID(ctx, fixtures.nearThresholdInterception.ID)
require.NoError(t, err)
require.Len(t, newToolUsages, 1, "near threshold tool usages should not be deleted")
},
},
{
name: "RetentionDisabled",
retention: 0,
verify: func(t *testing.T, ctx context.Context, db database.Store, fixtures testFixtures) {
t.Helper()
interceptions, err := db.GetAIBridgeInterceptions(ctx)
require.NoError(t, err)
require.Len(t, interceptions, 4, "expected all 4 interceptions to be retained")
interceptionIDs := make([]uuid.UUID, len(interceptions))
for i, interception := range interceptions {
interceptionIDs[i] = interception.ID
}
require.Contains(t, interceptionIDs, fixtures.oldInterception.ID, "old interception should be kept")
require.Contains(t, interceptionIDs, fixtures.oldInterceptionWithRelated.ID, "old interception with related records should be kept")
require.Contains(t, interceptionIDs, fixtures.recentInterception.ID, "recent interception should be kept")
require.Contains(t, interceptionIDs, fixtures.nearThresholdInterception.ID, "near threshold interception should be kept")
// Verify all related records were kept.
oldTokenUsages, err := db.GetAIBridgeTokenUsagesByInterceptionID(ctx, fixtures.oldInterceptionWithRelated.ID)
require.NoError(t, err)
require.Len(t, oldTokenUsages, 1, "old token usages should be kept")
oldUserPrompts, err := db.GetAIBridgeUserPromptsByInterceptionID(ctx, fixtures.oldInterceptionWithRelated.ID)
require.NoError(t, err)
require.Len(t, oldUserPrompts, 1, "old user prompts should be kept")
oldToolUsages, err := db.GetAIBridgeToolUsagesByInterceptionID(ctx, fixtures.oldInterceptionWithRelated.ID)
require.NoError(t, err)
require.Len(t, oldToolUsages, 1, "old tool usages should be kept")
},
},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitShort)
clk := quartz.NewMock(t)
clk.Set(now).MustWait(ctx)
db, _ := dbtestutil.NewDB(t, dbtestutil.WithDumpOnFailure())
logger := slogtest.Make(t, &slogtest.Options{IgnoreErrors: true})
user := dbgen.User(t, db, database.User{})
// Create old AI Bridge interception (should be deleted when retention enabled).
oldInterception := dbgen.AIBridgeInterception(t, db, database.InsertAIBridgeInterceptionParams{
ID: uuid.New(),
APIKeyID: sql.NullString{},
InitiatorID: user.ID,
Provider: "anthropic",
Model: "claude-3-5-sonnet",
StartedAt: afterThreshold,
}, &afterThreshold)
// Create old interception with related records (should all be deleted when retention enabled).
oldInterceptionWithRelated := dbgen.AIBridgeInterception(t, db, database.InsertAIBridgeInterceptionParams{
ID: uuid.New(),
APIKeyID: sql.NullString{},
InitiatorID: user.ID,
Provider: "openai",
Model: "gpt-4",
StartedAt: afterThreshold,
}, &afterThreshold)
_ = dbgen.AIBridgeTokenUsage(t, db, database.InsertAIBridgeTokenUsageParams{
ID: uuid.New(),
InterceptionID: oldInterceptionWithRelated.ID,
ProviderResponseID: "resp-1",
InputTokens: 100,
OutputTokens: 50,
CreatedAt: afterThreshold,
})
_ = dbgen.AIBridgeUserPrompt(t, db, database.InsertAIBridgeUserPromptParams{
ID: uuid.New(),
InterceptionID: oldInterceptionWithRelated.ID,
ProviderResponseID: "resp-1",
Prompt: "test prompt",
CreatedAt: afterThreshold,
})
_ = dbgen.AIBridgeToolUsage(t, db, database.InsertAIBridgeToolUsageParams{
ID: uuid.New(),
InterceptionID: oldInterceptionWithRelated.ID,
ProviderResponseID: "resp-1",
Tool: "test-tool",
ServerUrl: sql.NullString{String: "http://test", Valid: true},
Input: "{}",
Injected: true,
CreatedAt: afterThreshold,
})
// Create recent AI Bridge interception (should be kept).
recentInterception := dbgen.AIBridgeInterception(t, db, database.InsertAIBridgeInterceptionParams{
ID: uuid.New(),
APIKeyID: sql.NullString{},
InitiatorID: user.ID,
Provider: "anthropic",
Model: "claude-3-5-sonnet",
StartedAt: beforeThreshold,
}, &beforeThreshold)
// Create interception close to threshold (should be kept).
nearThresholdInterception := dbgen.AIBridgeInterception(t, db, database.InsertAIBridgeInterceptionParams{
ID: uuid.New(),
APIKeyID: sql.NullString{},
InitiatorID: user.ID,
Provider: "anthropic",
Model: "claude-3-5-sonnet",
StartedAt: closeBeforeThreshold,
}, &closeBeforeThreshold)
_ = dbgen.AIBridgeTokenUsage(t, db, database.InsertAIBridgeTokenUsageParams{
ID: uuid.New(),
InterceptionID: nearThresholdInterception.ID,
ProviderResponseID: "resp-1",
InputTokens: 100,
OutputTokens: 50,
CreatedAt: closeBeforeThreshold,
})
_ = dbgen.AIBridgeUserPrompt(t, db, database.InsertAIBridgeUserPromptParams{
ID: uuid.New(),
InterceptionID: nearThresholdInterception.ID,
ProviderResponseID: "resp-1",
Prompt: "test prompt",
CreatedAt: closeBeforeThreshold,
})
_ = dbgen.AIBridgeToolUsage(t, db, database.InsertAIBridgeToolUsageParams{
ID: uuid.New(),
InterceptionID: nearThresholdInterception.ID,
ProviderResponseID: "resp-1",
Tool: "test-tool",
ServerUrl: sql.NullString{String: "http://test", Valid: true},
Input: "{}",
Injected: true,
CreatedAt: closeBeforeThreshold,
})
fixtures := testFixtures{
oldInterception: oldInterception,
oldInterceptionWithRelated: oldInterceptionWithRelated,
recentInterception: recentInterception,
nearThresholdInterception: nearThresholdInterception,
}
// Run the purge with configured retention period.
done := awaitDoTick(ctx, t, clk)
closer := dbpurge.New(ctx, logger, db, &codersdk.DeploymentValues{
AI: codersdk.AIConfig{
BridgeConfig: codersdk.AIBridgeConfig{
Retention: serpent.Duration(tc.retention),
},
},
}, clk)
defer closer.Close()
testutil.TryReceive(ctx, t, done)
tc.verify(t, ctx, db, fixtures)
})
}
}
func TestDeleteOldAuditLogs(t *testing.T) {
t.Parallel()
now := time.Date(2025, 1, 15, 7, 30, 0, 0, time.UTC)
retentionPeriod := 30 * 24 * time.Hour
afterThreshold := now.Add(-retentionPeriod).Add(-24 * time.Hour) // 31 days ago (older than threshold)
beforeThreshold := now.Add(-15 * 24 * time.Hour) // 15 days ago (newer than threshold)
testCases := []struct {
name string
retentionConfig codersdk.RetentionConfig
oldLogTime time.Time
recentLogTime *time.Time // nil means no recent log created
expectOldDeleted bool
expectedLogsRemaining int
}{
{
name: "RetentionEnabled",
retentionConfig: codersdk.RetentionConfig{
AuditLogs: serpent.Duration(retentionPeriod),
},
oldLogTime: afterThreshold,
recentLogTime: &beforeThreshold,
expectOldDeleted: true,
expectedLogsRemaining: 1, // only recent log remains
},
{
name: "RetentionDisabled",
retentionConfig: codersdk.RetentionConfig{
AuditLogs: serpent.Duration(0),
},
oldLogTime: now.Add(-365 * 24 * time.Hour), // 1 year ago
recentLogTime: nil,
expectOldDeleted: false,
expectedLogsRemaining: 1, // old log is kept
},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitShort)
clk := quartz.NewMock(t)
clk.Set(now).MustWait(ctx)
db, _ := dbtestutil.NewDB(t, dbtestutil.WithDumpOnFailure())
logger := slogtest.Make(t, &slogtest.Options{IgnoreErrors: true})
// Setup test fixtures.
user := dbgen.User(t, db, database.User{})
org := dbgen.Organization(t, db, database.Organization{})
// Create old audit log.
oldLog := dbgen.AuditLog(t, db, database.AuditLog{
UserID: user.ID,
OrganizationID: org.ID,
Time: tc.oldLogTime,
Action: database.AuditActionCreate,
ResourceType: database.ResourceTypeWorkspace,
})
// Create recent audit log if specified.
var recentLog database.AuditLog
if tc.recentLogTime != nil {
recentLog = dbgen.AuditLog(t, db, database.AuditLog{
UserID: user.ID,
OrganizationID: org.ID,
Time: *tc.recentLogTime,
Action: database.AuditActionCreate,
ResourceType: database.ResourceTypeWorkspace,
})
}
// Run the purge.
done := awaitDoTick(ctx, t, clk)
closer := dbpurge.New(ctx, logger, db, &codersdk.DeploymentValues{
Retention: tc.retentionConfig,
}, clk)
defer closer.Close()
testutil.TryReceive(ctx, t, done)
// Verify results.
logs, err := db.GetAuditLogsOffset(ctx, database.GetAuditLogsOffsetParams{
LimitOpt: 100,
})
require.NoError(t, err)
require.Len(t, logs, tc.expectedLogsRemaining, "unexpected number of logs remaining")
logIDs := make([]uuid.UUID, len(logs))
for i, log := range logs {
logIDs[i] = log.AuditLog.ID
}
if tc.expectOldDeleted {
require.NotContains(t, logIDs, oldLog.ID, "old audit log should be deleted")
} else {
require.Contains(t, logIDs, oldLog.ID, "old audit log should NOT be deleted")
}
if tc.recentLogTime != nil {
require.Contains(t, logIDs, recentLog.ID, "recent audit log should be kept")
}
})
}
// ConnectionEventsNotDeleted is a special case that tests multiple audit
// action types, so it's kept as a separate subtest.
t.Run("ConnectionEventsNotDeleted", func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitShort)
clk := quartz.NewMock(t)
clk.Set(now).MustWait(ctx)
db, _ := dbtestutil.NewDB(t, dbtestutil.WithDumpOnFailure())
logger := slogtest.Make(t, &slogtest.Options{IgnoreErrors: true})
user := dbgen.User(t, db, database.User{})
org := dbgen.Organization(t, db, database.Organization{})
// Create old connection events (should NOT be deleted by audit logs retention).
oldConnectLog := dbgen.AuditLog(t, db, database.AuditLog{
UserID: user.ID,
OrganizationID: org.ID,
Time: afterThreshold,
Action: database.AuditActionConnect,
ResourceType: database.ResourceTypeWorkspace,
})
oldDisconnectLog := dbgen.AuditLog(t, db, database.AuditLog{
UserID: user.ID,
OrganizationID: org.ID,
Time: afterThreshold,
Action: database.AuditActionDisconnect,
ResourceType: database.ResourceTypeWorkspace,
})
oldOpenLog := dbgen.AuditLog(t, db, database.AuditLog{
UserID: user.ID,
OrganizationID: org.ID,
Time: afterThreshold,
Action: database.AuditActionOpen,
ResourceType: database.ResourceTypeWorkspace,
})
oldCloseLog := dbgen.AuditLog(t, db, database.AuditLog{
UserID: user.ID,
OrganizationID: org.ID,
Time: afterThreshold,
Action: database.AuditActionClose,
ResourceType: database.ResourceTypeWorkspace,
})
// Create old non-connection audit log (should be deleted).
oldCreateLog := dbgen.AuditLog(t, db, database.AuditLog{
UserID: user.ID,
OrganizationID: org.ID,
Time: afterThreshold,
Action: database.AuditActionCreate,
ResourceType: database.ResourceTypeWorkspace,
})
// Run the purge with audit logs retention enabled.
done := awaitDoTick(ctx, t, clk)
closer := dbpurge.New(ctx, logger, db, &codersdk.DeploymentValues{
Retention: codersdk.RetentionConfig{
AuditLogs: serpent.Duration(retentionPeriod),
},
}, clk)
defer closer.Close()
testutil.TryReceive(ctx, t, done)
// Verify results.
logs, err := db.GetAuditLogsOffset(ctx, database.GetAuditLogsOffsetParams{
LimitOpt: 100,
})
require.NoError(t, err)
require.Len(t, logs, 4, "should have 4 connection event logs remaining")
logIDs := make([]uuid.UUID, len(logs))
for i, log := range logs {
logIDs[i] = log.AuditLog.ID
}
// Connection events should NOT be deleted by audit logs retention.
require.Contains(t, logIDs, oldConnectLog.ID, "old connect log should NOT be deleted by audit logs retention")
require.Contains(t, logIDs, oldDisconnectLog.ID, "old disconnect log should NOT be deleted by audit logs retention")
require.Contains(t, logIDs, oldOpenLog.ID, "old open log should NOT be deleted by audit logs retention")
require.Contains(t, logIDs, oldCloseLog.ID, "old close log should NOT be deleted by audit logs retention")
// Non-connection event should be deleted.
require.NotContains(t, logIDs, oldCreateLog.ID, "old create log should be deleted by audit logs retention")
})
}
func TestDeleteExpiredAPIKeys(t *testing.T) {
t.Parallel()
now := time.Date(2025, 1, 15, 7, 30, 0, 0, time.UTC)
testCases := []struct {
name string
retentionConfig codersdk.RetentionConfig
oldExpiredTime time.Time
recentExpiredTime *time.Time // nil means no recent expired key created
activeTime *time.Time // nil means no active key created
expectOldExpiredDeleted bool
expectedKeysRemaining int
}{
{
name: "RetentionEnabled",
retentionConfig: codersdk.RetentionConfig{
APIKeys: serpent.Duration(7 * 24 * time.Hour), // 7 days
},
oldExpiredTime: now.Add(-8 * 24 * time.Hour), // Expired 8 days ago
recentExpiredTime: ptr(now.Add(-6 * 24 * time.Hour)), // Expired 6 days ago
activeTime: ptr(now.Add(24 * time.Hour)), // Expires tomorrow
expectOldExpiredDeleted: true,
expectedKeysRemaining: 2, // recent expired + active
},
{
name: "RetentionDisabled",
retentionConfig: codersdk.RetentionConfig{
APIKeys: serpent.Duration(0),
},
oldExpiredTime: now.Add(-365 * 24 * time.Hour), // Expired 1 year ago
recentExpiredTime: nil,
activeTime: nil,
expectOldExpiredDeleted: false,
expectedKeysRemaining: 1, // old expired is kept
},
{
name: "CustomRetention30Days",
retentionConfig: codersdk.RetentionConfig{
APIKeys: serpent.Duration(30 * 24 * time.Hour), // 30 days
},
oldExpiredTime: now.Add(-31 * 24 * time.Hour), // Expired 31 days ago
recentExpiredTime: ptr(now.Add(-29 * 24 * time.Hour)), // Expired 29 days ago
activeTime: nil,
expectOldExpiredDeleted: true,
expectedKeysRemaining: 1, // only recent expired remains
},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitShort)
clk := quartz.NewMock(t)
clk.Set(now).MustWait(ctx)
db, _ := dbtestutil.NewDB(t, dbtestutil.WithDumpOnFailure())
logger := slogtest.Make(t, &slogtest.Options{IgnoreErrors: true})
user := dbgen.User(t, db, database.User{})
// Create API key that expired long ago.
oldExpiredKey, _ := dbgen.APIKey(t, db, database.APIKey{
UserID: user.ID,
ExpiresAt: tc.oldExpiredTime,
TokenName: "old-expired-key",
})
// Create API key that expired recently if specified.
var recentExpiredKey database.APIKey
if tc.recentExpiredTime != nil {
recentExpiredKey, _ = dbgen.APIKey(t, db, database.APIKey{
UserID: user.ID,
ExpiresAt: *tc.recentExpiredTime,
TokenName: "recent-expired-key",
})
}
// Create API key that hasn't expired yet if specified.
var activeKey database.APIKey
if tc.activeTime != nil {
activeKey, _ = dbgen.APIKey(t, db, database.APIKey{
UserID: user.ID,
ExpiresAt: *tc.activeTime,
TokenName: "active-key",
})
}
// Run the purge.
done := awaitDoTick(ctx, t, clk)
closer := dbpurge.New(ctx, logger, db, &codersdk.DeploymentValues{
Retention: tc.retentionConfig,
}, clk)
defer closer.Close()
testutil.TryReceive(ctx, t, done)
// Verify total keys remaining.
keys, err := db.GetAPIKeysLastUsedAfter(ctx, time.Time{})
require.NoError(t, err)
require.Len(t, keys, tc.expectedKeysRemaining, "unexpected number of keys remaining")
// Verify results.
_, err = db.GetAPIKeyByID(ctx, oldExpiredKey.ID)
if tc.expectOldExpiredDeleted {
require.Error(t, err, "old expired key should be deleted")
} else {
require.NoError(t, err, "old expired key should NOT be deleted")
}
if tc.recentExpiredTime != nil {
_, err = db.GetAPIKeyByID(ctx, recentExpiredKey.ID)
require.NoError(t, err, "recently expired key should be kept")
}
if tc.activeTime != nil {
_, err = db.GetAPIKeyByID(ctx, activeKey.ID)
require.NoError(t, err, "active key should be kept")
}
})
}
}
// ptr is a helper to create a pointer to a value.
func ptr[T any](v T) *T {
return &v
}
+2
View File
@@ -3449,6 +3449,8 @@ COMMENT ON INDEX workspace_app_audit_sessions_unique_index IS 'Unique index to e
CREATE INDEX workspace_app_stats_workspace_id_idx ON workspace_app_stats USING btree (workspace_id);
CREATE INDEX workspace_app_statuses_app_id_idx ON workspace_app_statuses USING btree (app_id, created_at DESC);
CREATE INDEX workspace_modules_created_at_idx ON workspace_modules USING btree (created_at);
CREATE INDEX workspace_next_start_at_idx ON workspaces USING btree (next_start_at) WHERE (deleted = false);
@@ -0,0 +1 @@
DROP INDEX IF EXISTS workspace_app_statuses_app_id_idx;
@@ -0,0 +1 @@
CREATE INDEX workspace_app_statuses_app_id_idx ON workspace_app_statuses (app_id, created_at DESC);
+8 -3
View File
@@ -104,8 +104,13 @@ type sqlcQuerier interface {
DeleteOAuth2ProviderAppSecretByID(ctx context.Context, id uuid.UUID) error
DeleteOAuth2ProviderAppTokensByAppAndUserID(ctx context.Context, arg DeleteOAuth2ProviderAppTokensByAppAndUserIDParams) error
// Cumulative count.
DeleteOldAIBridgeRecords(ctx context.Context, beforeTime time.Time) (int32, error)
DeleteOldAIBridgeRecords(ctx context.Context, beforeTime time.Time) (int64, error)
DeleteOldAuditLogConnectionEvents(ctx context.Context, arg DeleteOldAuditLogConnectionEventsParams) error
// Deletes old audit logs based on retention policy, excluding deprecated
// connection events (connect, disconnect, open, close) which are handled
// separately by DeleteOldAuditLogConnectionEvents.
DeleteOldAuditLogs(ctx context.Context, arg DeleteOldAuditLogsParams) (int64, error)
DeleteOldConnectionLogs(ctx context.Context, arg DeleteOldConnectionLogsParams) (int64, error)
// Delete all notification messages which have not been updated for over a week.
DeleteOldNotificationMessages(ctx context.Context) error
// Delete provisioner daemons that have been created at least a week ago
@@ -115,10 +120,10 @@ type sqlcQuerier interface {
DeleteOldProvisionerDaemons(ctx context.Context) error
// Deletes old telemetry locks from the telemetry_locks table.
DeleteOldTelemetryLocks(ctx context.Context, periodEndingAtBefore time.Time) error
// If an agent hasn't connected in the last 7 days, we purge it's logs.
// If an agent hasn't connected within the retention period, we purge its logs.
// Exception: if the logs are related to the latest build, we keep those around.
// Logs can take up a lot of space, so it's important we clean up frequently.
DeleteOldWorkspaceAgentLogs(ctx context.Context, threshold time.Time) error
DeleteOldWorkspaceAgentLogs(ctx context.Context, threshold time.Time) (int64, error)
DeleteOldWorkspaceAgentStats(ctx context.Context) error
DeleteOrganizationMember(ctx context.Context, arg DeleteOrganizationMemberParams) error
DeleteProvisionerKey(ctx context.Context, id uuid.UUID) error
+84 -25
View File
@@ -354,17 +354,18 @@ WITH
WHERE id IN (SELECT id FROM to_delete)
RETURNING 1
)
SELECT
SELECT (
(SELECT COUNT(*) FROM tool_usages) +
(SELECT COUNT(*) FROM token_usages) +
(SELECT COUNT(*) FROM user_prompts) +
(SELECT COUNT(*) FROM interceptions) as total_deleted
(SELECT COUNT(*) FROM interceptions)
)::bigint as total_deleted
`
// Cumulative count.
func (q *sqlQuerier) DeleteOldAIBridgeRecords(ctx context.Context, beforeTime time.Time) (int32, error) {
func (q *sqlQuerier) DeleteOldAIBridgeRecords(ctx context.Context, beforeTime time.Time) (int64, error) {
row := q.db.QueryRowContext(ctx, deleteOldAIBridgeRecords, beforeTime)
var total_deleted int32
var total_deleted int64
err := row.Scan(&total_deleted)
return total_deleted, err
}
@@ -1107,24 +1108,20 @@ func (q *sqlQuerier) DeleteApplicationConnectAPIKeysByUserID(ctx context.Context
return err
}
const deleteExpiredAPIKeys = `-- name: DeleteExpiredAPIKeys :one
const deleteExpiredAPIKeys = `-- name: DeleteExpiredAPIKeys :execrows
WITH expired_keys AS (
SELECT id
FROM api_keys
-- expired keys only
WHERE expires_at < $1::timestamptz
LIMIT $2
),
deleted_rows AS (
DELETE FROM
api_keys
USING
expired_keys
WHERE
api_keys.id = expired_keys.id
RETURNING api_keys.id
)
SELECT COUNT(deleted_rows.id) AS deleted_count FROM deleted_rows
)
DELETE FROM
api_keys
USING
expired_keys
WHERE
api_keys.id = expired_keys.id
`
type DeleteExpiredAPIKeysParams struct {
@@ -1133,10 +1130,11 @@ type DeleteExpiredAPIKeysParams struct {
}
func (q *sqlQuerier) DeleteExpiredAPIKeys(ctx context.Context, arg DeleteExpiredAPIKeysParams) (int64, error) {
row := q.db.QueryRowContext(ctx, deleteExpiredAPIKeys, arg.Before, arg.LimitCount)
var deleted_count int64
err := row.Scan(&deleted_count)
return deleted_count, err
result, err := q.db.ExecContext(ctx, deleteExpiredAPIKeys, arg.Before, arg.LimitCount)
if err != nil {
return 0, err
}
return result.RowsAffected()
}
const expirePrebuildsAPIKeys = `-- name: ExpirePrebuildsAPIKeys :exec
@@ -1637,6 +1635,37 @@ func (q *sqlQuerier) DeleteOldAuditLogConnectionEvents(ctx context.Context, arg
return err
}
const deleteOldAuditLogs = `-- name: DeleteOldAuditLogs :execrows
WITH old_logs AS (
SELECT id
FROM audit_logs
WHERE
"time" < $1::timestamp with time zone
AND action NOT IN ('connect', 'disconnect', 'open', 'close')
ORDER BY "time" ASC
LIMIT $2
)
DELETE FROM audit_logs
USING old_logs
WHERE audit_logs.id = old_logs.id
`
type DeleteOldAuditLogsParams struct {
BeforeTime time.Time `db:"before_time" json:"before_time"`
LimitCount int32 `db:"limit_count" json:"limit_count"`
}
// Deletes old audit logs based on retention policy, excluding deprecated
// connection events (connect, disconnect, open, close) which are handled
// separately by DeleteOldAuditLogConnectionEvents.
func (q *sqlQuerier) DeleteOldAuditLogs(ctx context.Context, arg DeleteOldAuditLogsParams) (int64, error) {
result, err := q.db.ExecContext(ctx, deleteOldAuditLogs, arg.BeforeTime, arg.LimitCount)
if err != nil {
return 0, err
}
return result.RowsAffected()
}
const getAuditLogsOffset = `-- name: GetAuditLogsOffset :many
SELECT audit_logs.id, audit_logs.time, audit_logs.user_id, audit_logs.organization_id, audit_logs.ip, audit_logs.user_agent, audit_logs.resource_type, audit_logs.resource_id, audit_logs.resource_target, audit_logs.action, audit_logs.diff, audit_logs.status_code, audit_logs.additional_fields, audit_logs.request_id, audit_logs.resource_icon,
-- sqlc.embed(users) would be nice but it does not seem to play well with
@@ -2095,6 +2124,32 @@ func (q *sqlQuerier) CountConnectionLogs(ctx context.Context, arg CountConnectio
return count, err
}
const deleteOldConnectionLogs = `-- name: DeleteOldConnectionLogs :execrows
WITH old_logs AS (
SELECT id
FROM connection_logs
WHERE connect_time < $1::timestamp with time zone
ORDER BY connect_time ASC
LIMIT $2
)
DELETE FROM connection_logs
USING old_logs
WHERE connection_logs.id = old_logs.id
`
type DeleteOldConnectionLogsParams struct {
BeforeTime time.Time `db:"before_time" json:"before_time"`
LimitCount int32 `db:"limit_count" json:"limit_count"`
}
func (q *sqlQuerier) DeleteOldConnectionLogs(ctx context.Context, arg DeleteOldConnectionLogsParams) (int64, error) {
result, err := q.db.ExecContext(ctx, deleteOldConnectionLogs, arg.BeforeTime, arg.LimitCount)
if err != nil {
return 0, err
}
return result.RowsAffected()
}
const getConnectionLogsOffset = `-- name: GetConnectionLogsOffset :many
SELECT
connection_logs.id, connection_logs.connect_time, connection_logs.organization_id, connection_logs.workspace_owner_id, connection_logs.workspace_id, connection_logs.workspace_name, connection_logs.agent_name, connection_logs.type, connection_logs.ip, connection_logs.code, connection_logs.user_agent, connection_logs.user_id, connection_logs.slug_or_port, connection_logs.connection_id, connection_logs.disconnect_time, connection_logs.disconnect_reason,
@@ -17792,7 +17847,7 @@ func (q *sqlQuerier) UpdateVolumeResourceMonitor(ctx context.Context, arg Update
return err
}
const deleteOldWorkspaceAgentLogs = `-- name: DeleteOldWorkspaceAgentLogs :exec
const deleteOldWorkspaceAgentLogs = `-- name: DeleteOldWorkspaceAgentLogs :execrows
WITH
latest_builds AS (
SELECT
@@ -17835,12 +17890,15 @@ WITH
DELETE FROM workspace_agent_logs WHERE agent_id IN (SELECT id FROM old_agents)
`
// If an agent hasn't connected in the last 7 days, we purge it's logs.
// If an agent hasn't connected within the retention period, we purge its logs.
// Exception: if the logs are related to the latest build, we keep those around.
// Logs can take up a lot of space, so it's important we clean up frequently.
func (q *sqlQuerier) DeleteOldWorkspaceAgentLogs(ctx context.Context, threshold time.Time) error {
_, err := q.db.ExecContext(ctx, deleteOldWorkspaceAgentLogs, threshold)
return err
func (q *sqlQuerier) DeleteOldWorkspaceAgentLogs(ctx context.Context, threshold time.Time) (int64, error) {
result, err := q.db.ExecContext(ctx, deleteOldWorkspaceAgentLogs, threshold)
if err != nil {
return 0, err
}
return result.RowsAffected()
}
const deleteWorkspaceSubAgentByID = `-- name: DeleteWorkspaceSubAgentByID :exec
@@ -20188,6 +20246,7 @@ func (q *sqlQuerier) GetWorkspaceAppByAgentIDAndSlug(ctx context.Context, arg Ge
const getWorkspaceAppStatusesByAppIDs = `-- name: GetWorkspaceAppStatusesByAppIDs :many
SELECT id, created_at, agent_id, app_id, workspace_id, state, message, uri FROM workspace_app_statuses WHERE app_id = ANY($1 :: uuid [ ])
ORDER BY created_at DESC, id DESC
`
func (q *sqlQuerier) GetWorkspaceAppStatusesByAppIDs(ctx context.Context, ids []uuid.UUID) ([]WorkspaceAppStatus, error) {
+3 -2
View File
@@ -360,8 +360,9 @@ WITH
RETURNING 1
)
-- Cumulative count.
SELECT
SELECT (
(SELECT COUNT(*) FROM tool_usages) +
(SELECT COUNT(*) FROM token_usages) +
(SELECT COUNT(*) FROM user_prompts) +
(SELECT COUNT(*) FROM interceptions) as total_deleted;
(SELECT COUNT(*) FROM interceptions)
)::bigint as total_deleted;
+8 -13
View File
@@ -85,25 +85,20 @@ DELETE FROM
WHERE
user_id = $1;
-- name: DeleteExpiredAPIKeys :one
-- name: DeleteExpiredAPIKeys :execrows
WITH expired_keys AS (
SELECT id
FROM api_keys
-- expired keys only
WHERE expires_at < @before::timestamptz
LIMIT @limit_count
),
deleted_rows AS (
DELETE FROM
api_keys
USING
expired_keys
WHERE
api_keys.id = expired_keys.id
RETURNING api_keys.id
)
SELECT COUNT(deleted_rows.id) AS deleted_count FROM deleted_rows;
;
)
DELETE FROM
api_keys
USING
expired_keys
WHERE
api_keys.id = expired_keys.id;
-- name: ExpirePrebuildsAPIKeys :exec
-- Firstly, collect api_keys owned by the prebuilds user that correlate
+17
View File
@@ -253,3 +253,20 @@ WHERE id IN (
ORDER BY "time" ASC
LIMIT @limit_count
);
-- name: DeleteOldAuditLogs :execrows
-- Deletes old audit logs based on retention policy, excluding deprecated
-- connection events (connect, disconnect, open, close) which are handled
-- separately by DeleteOldAuditLogConnectionEvents.
WITH old_logs AS (
SELECT id
FROM audit_logs
WHERE
"time" < @before_time::timestamp with time zone
AND action NOT IN ('connect', 'disconnect', 'open', 'close')
ORDER BY "time" ASC
LIMIT @limit_count
)
DELETE FROM audit_logs
USING old_logs
WHERE audit_logs.id = old_logs.id;
@@ -239,6 +239,18 @@ WHERE
-- @authorize_filter
;
-- name: DeleteOldConnectionLogs :execrows
WITH old_logs AS (
SELECT id
FROM connection_logs
WHERE connect_time < @before_time::timestamp with time zone
ORDER BY connect_time ASC
LIMIT @limit_count
)
DELETE FROM connection_logs
USING old_logs
WHERE connection_logs.id = old_logs.id;
-- name: UpsertConnectionLog :one
INSERT INTO connection_logs (
id,
+2 -2
View File
@@ -199,10 +199,10 @@ INSERT INTO
-- name: GetWorkspaceAgentLogSourcesByAgentIDs :many
SELECT * FROM workspace_agent_log_sources WHERE workspace_agent_id = ANY(@ids :: uuid [ ]);
-- If an agent hasn't connected in the last 7 days, we purge it's logs.
-- If an agent hasn't connected within the retention period, we purge its logs.
-- Exception: if the logs are related to the latest build, we keep those around.
-- Logs can take up a lot of space, so it's important we clean up frequently.
-- name: DeleteOldWorkspaceAgentLogs :exec
-- name: DeleteOldWorkspaceAgentLogs :execrows
WITH
latest_builds AS (
SELECT
+2 -1
View File
@@ -71,7 +71,8 @@ VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
RETURNING *;
-- name: GetWorkspaceAppStatusesByAppIDs :many
SELECT * FROM workspace_app_statuses WHERE app_id = ANY(@ids :: uuid [ ]);
SELECT * FROM workspace_app_statuses WHERE app_id = ANY(@ids :: uuid [ ])
ORDER BY created_at DESC, id DESC;
-- name: GetLatestWorkspaceAppStatusByAppID :one
SELECT *
+3 -1
View File
@@ -153,7 +153,9 @@ func freeUDPPort(t *testing.T) uint16 {
})
require.NoError(t, err, "listen on random UDP port")
_, port, err := net.SplitHostPort(l.LocalAddr().String())
localAddr := l.LocalAddr()
require.NotNil(t, localAddr, "local address is nil")
_, port, err := net.SplitHostPort(localAddr.String())
require.NoError(t, err, "split host port")
portUint, err := strconv.ParseUint(port, 10, 16)
-91
View File
@@ -1,91 +0,0 @@
package httpauthz
import (
"net/http"
"golang.org/x/xerrors"
"cdr.dev/slog"
"github.com/coder/coder/v2/coderd/httpmw"
"github.com/coder/coder/v2/coderd/rbac"
"github.com/coder/coder/v2/coderd/rbac/policy"
)
// AuthorizationFilter takes a list of objects and returns the filtered list of
// objects that the user is authorized to perform the given action on.
// This is faster than calling Authorize() on each object.
func AuthorizationFilter[O rbac.Objecter](h *HTTPAuthorizer, r *http.Request, action policy.Action, objects []O) ([]O, error) {
roles := httpmw.UserAuthorization(r.Context())
objects, err := rbac.Filter(r.Context(), h.Authorizer, roles, action, objects)
if err != nil {
// Log the error as Filter should not be erroring.
h.Logger.Error(r.Context(), "authorization filter failed",
slog.Error(err),
slog.F("user_id", roles.ID),
slog.F("username", roles),
slog.F("roles", roles.SafeRoleNames()),
slog.F("scope", roles.SafeScopeName()),
slog.F("route", r.URL.Path),
slog.F("action", action),
)
return nil, err
}
return objects, nil
}
type HTTPAuthorizer struct {
Authorizer rbac.Authorizer
Logger slog.Logger
}
// AuthorizeSQLFilter returns an authorization filter that can used in a
// SQL 'WHERE' clause. If the filter is used, the resulting rows returned
// from postgres are already authorized, and the caller does not need to
// call 'Authorize()' on the returned objects.
// Note the authorization is only for the given action and object type.
func (h *HTTPAuthorizer) AuthorizeSQLFilter(r *http.Request, action policy.Action, objectType string) (rbac.PreparedAuthorized, error) {
roles := httpmw.UserAuthorization(r.Context())
prepared, err := h.Authorizer.Prepare(r.Context(), roles, action, objectType)
if err != nil {
return nil, xerrors.Errorf("prepare filter: %w", err)
}
return prepared, nil
}
// Authorize will return false if the user is not authorized to do the action.
// This function will log appropriately, but the caller must return an
// error to the api client.
// Eg:
//
// if !h.Authorize(...) {
// httpapi.Forbidden(rw)
// return
// }
func (h *HTTPAuthorizer) Authorize(r *http.Request, action policy.Action, object rbac.Objecter) bool {
roles := httpmw.UserAuthorization(r.Context())
err := h.Authorizer.Authorize(r.Context(), roles, action, object.RBACObject())
if err != nil {
// Log the errors for debugging
internalError := new(rbac.UnauthorizedError)
logger := h.Logger
if xerrors.As(err, internalError) {
logger = h.Logger.With(slog.F("internal_error", internalError.Internal()))
}
// Log information for debugging. This will be very helpful
// in the early days
logger.Warn(r.Context(), "requester is not authorized to access the object",
slog.F("roles", roles.SafeRoleNames()),
slog.F("actor_id", roles.ID),
slog.F("actor_name", roles),
slog.F("scope", roles.SafeScopeName()),
slog.F("route", r.URL.Path),
slog.F("action", action),
slog.F("object", object),
)
return false
}
return true
}
@@ -1,4 +1,4 @@
package insightsapi
package coderd
import (
"context"
@@ -34,16 +34,16 @@ const insightsTimeLayout = time.RFC3339
// @Param tz_offset query int true "Time-zone offset (e.g. -2)"
// @Success 200 {object} codersdk.DAUsResponse
// @Router /insights/daus [get]
func (a *API) DeploymentDAUs(rw http.ResponseWriter, r *http.Request) {
if !a.authorizer.Authorize(r, policy.ActionRead, rbac.ResourceDeploymentConfig) {
func (api *API) deploymentDAUs(rw http.ResponseWriter, r *http.Request) {
if !api.Authorize(r, policy.ActionRead, rbac.ResourceDeploymentConfig) {
httpapi.Forbidden(rw)
return
}
a.DAUsForTemplates(rw, r, nil)
api.returnDAUsInternal(rw, r, nil)
}
func (a *API) DAUsForTemplates(rw http.ResponseWriter, r *http.Request, templateIDs []uuid.UUID) {
func (api *API) returnDAUsInternal(rw http.ResponseWriter, r *http.Request, templateIDs []uuid.UUID) {
ctx := r.Context()
p := httpapi.NewQueryParamParser()
@@ -66,7 +66,7 @@ func (a *API) DAUsForTemplates(rw http.ResponseWriter, r *http.Request, template
// Always return 60 days of data (2 months).
sixtyDaysAgo := nextHourInLoc.In(loc).Truncate(24*time.Hour).AddDate(0, 0, -60)
rows, err := a.database.GetTemplateInsightsByInterval(ctx, database.GetTemplateInsightsByIntervalParams{
rows, err := api.Database.GetTemplateInsightsByInterval(ctx, database.GetTemplateInsightsByIntervalParams{
StartTime: sixtyDaysAgo,
EndTime: nextHourInLoc,
IntervalDays: 1,
@@ -107,7 +107,7 @@ func (a *API) DAUsForTemplates(rw http.ResponseWriter, r *http.Request, template
// @Param template_ids query []string false "Template IDs" collectionFormat(csv)
// @Success 200 {object} codersdk.UserActivityInsightsResponse
// @Router /insights/user-activity [get]
func (a *API) UserActivity(rw http.ResponseWriter, r *http.Request) {
func (api *API) insightsUserActivity(rw http.ResponseWriter, r *http.Request) {
ctx := r.Context()
p := httpapi.NewQueryParamParser().
@@ -135,7 +135,7 @@ func (a *API) UserActivity(rw http.ResponseWriter, r *http.Request) {
return
}
rows, err := a.database.GetUserActivityInsights(ctx, database.GetUserActivityInsightsParams{
rows, err := api.Database.GetUserActivityInsights(ctx, database.GetUserActivityInsightsParams{
StartTime: startTime,
EndTime: endTime,
TemplateIDs: templateIDs,
@@ -210,7 +210,7 @@ func (a *API) UserActivity(rw http.ResponseWriter, r *http.Request) {
// @Param template_ids query []string false "Template IDs" collectionFormat(csv)
// @Success 200 {object} codersdk.UserLatencyInsightsResponse
// @Router /insights/user-latency [get]
func (a *API) UserLatency(rw http.ResponseWriter, r *http.Request) {
func (api *API) insightsUserLatency(rw http.ResponseWriter, r *http.Request) {
ctx := r.Context()
p := httpapi.NewQueryParamParser().
@@ -238,7 +238,7 @@ func (a *API) UserLatency(rw http.ResponseWriter, r *http.Request) {
return
}
rows, err := a.database.GetUserLatencyInsights(ctx, database.GetUserLatencyInsightsParams{
rows, err := api.Database.GetUserLatencyInsights(ctx, database.GetUserLatencyInsightsParams{
StartTime: startTime,
EndTime: endTime,
TemplateIDs: templateIDs,
@@ -301,7 +301,7 @@ func (a *API) UserLatency(rw http.ResponseWriter, r *http.Request) {
// @Param tz_offset query int true "Time-zone offset (e.g. -2)"
// @Success 200 {object} codersdk.GetUserStatusCountsResponse
// @Router /insights/user-status-counts [get]
func (a *API) UserStatusCounts(rw http.ResponseWriter, r *http.Request) {
func (api *API) insightsUserStatusCounts(rw http.ResponseWriter, r *http.Request) {
ctx := r.Context()
p := httpapi.NewQueryParamParser()
@@ -322,7 +322,7 @@ func (a *API) UserStatusCounts(rw http.ResponseWriter, r *http.Request) {
nextHourInLoc := dbtime.Now().Truncate(time.Hour).Add(time.Hour).In(loc)
sixtyDaysAgo := dbtime.StartOfDay(nextHourInLoc).AddDate(0, 0, -60)
rows, err := a.database.GetUserStatusCounts(ctx, database.GetUserStatusCountsParams{
rows, err := api.Database.GetUserStatusCounts(ctx, database.GetUserStatusCountsParams{
StartTime: sixtyDaysAgo,
EndTime: nextHourInLoc,
// #nosec G115 - Interval value is small and fits in int32 (typically days or hours)
@@ -366,7 +366,7 @@ func (a *API) UserStatusCounts(rw http.ResponseWriter, r *http.Request) {
// @Param template_ids query []string false "Template IDs" collectionFormat(csv)
// @Success 200 {object} codersdk.TemplateInsightsResponse
// @Router /insights/templates [get]
func (a *API) Templates(rw http.ResponseWriter, r *http.Request) {
func (api *API) insightsTemplates(rw http.ResponseWriter, r *http.Request) {
ctx := r.Context()
p := httpapi.NewQueryParamParser().
@@ -418,7 +418,7 @@ func (a *API) Templates(rw http.ResponseWriter, r *http.Request) {
eg.Go(func() error {
var err error
if interval != "" && slices.Contains(sections, codersdk.TemplateInsightsSectionIntervalReports) {
dailyUsage, err = a.database.GetTemplateInsightsByInterval(egCtx, database.GetTemplateInsightsByIntervalParams{
dailyUsage, err = api.Database.GetTemplateInsightsByInterval(egCtx, database.GetTemplateInsightsByIntervalParams{
StartTime: startTime,
EndTime: endTime,
TemplateIDs: templateIDs,
@@ -436,7 +436,7 @@ func (a *API) Templates(rw http.ResponseWriter, r *http.Request) {
}
var err error
usage, err = a.database.GetTemplateInsights(egCtx, database.GetTemplateInsightsParams{
usage, err = api.Database.GetTemplateInsights(egCtx, database.GetTemplateInsightsParams{
StartTime: startTime,
EndTime: endTime,
TemplateIDs: templateIDs,
@@ -452,7 +452,7 @@ func (a *API) Templates(rw http.ResponseWriter, r *http.Request) {
}
var err error
appUsage, err = a.database.GetTemplateAppInsights(egCtx, database.GetTemplateAppInsightsParams{
appUsage, err = api.Database.GetTemplateAppInsights(egCtx, database.GetTemplateAppInsightsParams{
StartTime: startTime,
EndTime: endTime,
TemplateIDs: templateIDs,
@@ -471,7 +471,7 @@ func (a *API) Templates(rw http.ResponseWriter, r *http.Request) {
}
var err error
parameterRows, err = a.database.GetTemplateParameterInsights(ctx, database.GetTemplateParameterInsightsParams{
parameterRows, err = api.Database.GetTemplateParameterInsights(ctx, database.GetTemplateParameterInsightsParams{
StartTime: startTime,
EndTime: endTime,
TemplateIDs: templateIDs,
@@ -1,4 +1,4 @@
package insightsapi
package coderd
import (
"context"
@@ -1,13 +1,11 @@
package insightsapi_test
package coderd_test
import (
"context"
"encoding/json"
"flag"
"fmt"
"io"
"net/http"
"net/http/httptest"
"os"
"path/filepath"
"strings"
@@ -18,12 +16,9 @@ import (
"github.com/google/uuid"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.uber.org/goleak"
"go.uber.org/mock/gomock"
"cdr.dev/slog"
"cdr.dev/slog/sloggers/slogtest"
"github.com/coder/coder/v2/agent/agenttest"
agentproto "github.com/coder/coder/v2/agent/proto"
"github.com/coder/coder/v2/coderd/coderdtest"
@@ -33,8 +28,6 @@ import (
"github.com/coder/coder/v2/coderd/database/dbgen"
"github.com/coder/coder/v2/coderd/database/dbrollup"
"github.com/coder/coder/v2/coderd/database/dbtestutil"
"github.com/coder/coder/v2/coderd/httpauthz"
"github.com/coder/coder/v2/coderd/insightsapi"
"github.com/coder/coder/v2/coderd/rbac"
"github.com/coder/coder/v2/coderd/workspaceapps"
"github.com/coder/coder/v2/coderd/workspacestats"
@@ -46,13 +39,6 @@ import (
"github.com/coder/coder/v2/testutil"
)
// updateGoldenFiles is a flag that can be set to update golden files.
var updateGoldenFiles = flag.Bool("update", false, "Update golden files")
func TestMain(m *testing.M) {
goleak.VerifyTestMain(m, testutil.GoleakOptions...)
}
func TestDeploymentInsights(t *testing.T) {
t.Parallel()
@@ -156,52 +142,6 @@ func TestDeploymentInsights(t *testing.T) {
}
}
func TestDeploymentDAUs(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitShort)
logger := testutil.Logger(t).Leveled(slog.LevelDebug)
tzOffset := 4
loc := time.FixedZone("", tzOffset*3600)
_, mDB, authDB, auth := coderdtest.MockedDatabaseWithAuthz(t, logger)
mDB.EXPECT().GetTemplateInsightsByInterval(gomock.Any(), gomock.Cond(func(arg database.GetTemplateInsightsByIntervalParams) bool {
return len(arg.TemplateIDs) == 0 &&
arg.IntervalDays == 1
})).
Times(1).
Return([]database.GetTemplateInsightsByIntervalRow{
{
StartTime: time.Date(2025, 12, 1, 0, 0, 0, 0, loc),
EndTime: time.Date(2025, 12, 1, 23, 59, 59, 0, loc),
ActiveUsers: 3,
},
{
StartTime: time.Date(2025, 12, 2, 0, 0, 0, 0, loc),
EndTime: time.Date(2025, 12, 2, 23, 59, 59, 0, loc),
ActiveUsers: 30,
},
}, nil)
uut := insightsapi.NewAPI(logger, authDB, &httpauthz.HTTPAuthorizer{
Authorizer: auth,
Logger: logger.Named("httpauth"),
})
rw := httptest.NewRecorder()
reqCtx := dbauthz.As(ctx, coderdtest.OwnerSubject())
req := httptest.NewRequestWithContext(reqCtx, http.MethodGet, "/api/v2/insights/daus?tz_offset=4", nil)
uut.DeploymentDAUs(rw, req)
daus, err := codersdk.DecodeResponse[codersdk.DAUsResponse](rw.Result())
require.NoError(t, err)
require.Equal(t, codersdk.DAUsResponse{
Entries: []codersdk.DAUEntry{
{Date: "2025-12-01", Amount: 3},
{Date: "2025-12-02", Amount: 30},
},
TZHourOffset: 4,
}, daus)
}
func TestUserActivityInsights_SanityCheck(t *testing.T) {
t.Parallel()
-27
View File
@@ -1,27 +0,0 @@
package insightsapi
import (
"cdr.dev/slog"
"github.com/coder/coder/v2/coderd/database"
"github.com/coder/coder/v2/coderd/httpauthz"
)
type API struct {
logger slog.Logger
authorizer *httpauthz.HTTPAuthorizer
database database.Store
}
func NewAPI(
logger slog.Logger,
db database.Store,
authorizer *httpauthz.HTTPAuthorizer,
) *API {
a := &API{
logger: logger.Named("insightsapi"),
authorizer: authorizer,
database: db,
}
return a
}
+3 -1
View File
@@ -87,7 +87,9 @@ func (c *Cache) refreshTemplateBuildTimes(ctx context.Context) error {
//nolint:gocritic // This is a system service.
ctx = dbauthz.AsSystemRestricted(ctx)
templates, err := c.database.GetTemplates(ctx)
templates, err := c.database.GetTemplatesWithFilter(ctx, database.GetTemplatesWithFilterParams{
Deleted: false,
})
if err != nil {
return err
}
+24 -8
View File
@@ -16,6 +16,8 @@ import (
agentproto "github.com/coder/coder/v2/agent/proto"
"github.com/coder/coder/v2/coderd/agentmetrics"
"github.com/coder/coder/v2/coderd/pproflabel"
"github.com/coder/quartz"
)
const (
@@ -47,6 +49,7 @@ type MetricsAggregator struct {
log slog.Logger
metricsCleanupInterval time.Duration
clock quartz.Clock
collectCh chan (chan []prometheus.Metric)
updateCh chan updateRequest
@@ -151,7 +154,7 @@ func (am *annotatedMetric) shallowCopy() annotatedMetric {
}
}
func NewMetricsAggregator(logger slog.Logger, registerer prometheus.Registerer, duration time.Duration, aggregateByLabels []string) (*MetricsAggregator, error) {
func NewMetricsAggregator(logger slog.Logger, registerer prometheus.Registerer, duration time.Duration, aggregateByLabels []string, options ...func(*MetricsAggregator)) (*MetricsAggregator, error) {
metricsCleanupInterval := defaultMetricsCleanupInterval
if duration > 0 {
metricsCleanupInterval = duration
@@ -192,9 +195,10 @@ func NewMetricsAggregator(logger slog.Logger, registerer prometheus.Registerer,
return nil, err
}
return &MetricsAggregator{
ma := &MetricsAggregator{
log: logger.Named(loggerName),
metricsCleanupInterval: metricsCleanupInterval,
clock: quartz.NewReal(),
store: map[metricKey]annotatedMetric{},
@@ -206,7 +210,19 @@ func NewMetricsAggregator(logger slog.Logger, registerer prometheus.Registerer,
cleanupHistogram: cleanupHistogram,
aggregateByLabels: aggregateByLabels,
}, nil
}
for _, option := range options {
option(ma)
}
return ma, nil
}
func WithClock(clock quartz.Clock) func(*MetricsAggregator) {
return func(ma *MetricsAggregator) {
ma.clock = clock
}
}
// labelAggregator is used to control cardinality of collected Prometheus metrics by pre-aggregating series based on given labels.
@@ -349,7 +365,7 @@ func (ma *MetricsAggregator) Run(ctx context.Context) func() {
ma.log.Debug(ctx, "clean expired metrics")
timer := prometheus.NewTimer(ma.cleanupHistogram)
now := time.Now()
now := ma.clock.Now()
for key, val := range ma.store {
if now.After(val.expiryDate) {
@@ -407,7 +423,7 @@ func (ma *MetricsAggregator) getOrCreateDesc(name string, help string, baseLabel
}
key := cacheKeyForDesc(name, baseLabelNames, extraLabels)
if d, ok := ma.descCache[key]; ok {
d.lastUsed = time.Now()
d.lastUsed = ma.clock.Now()
ma.descCache[key] = d
return d.desc
}
@@ -419,7 +435,7 @@ func (ma *MetricsAggregator) getOrCreateDesc(name string, help string, baseLabel
labels[nBase+i] = l.Name
}
d := prometheus.NewDesc(name, help, labels, nil)
ma.descCache[key] = descCacheEntry{d, time.Now()}
ma.descCache[key] = descCacheEntry{d, ma.clock.Now()}
return d
}
@@ -497,7 +513,7 @@ func (ma *MetricsAggregator) Update(ctx context.Context, labels AgentMetricLabel
templateName: labels.TemplateName,
metrics: metrics,
timestamp: time.Now(),
timestamp: ma.clock.Now(),
}:
case <-ctx.Done():
ma.log.Debug(ctx, "update request is canceled")
@@ -508,7 +524,7 @@ func (ma *MetricsAggregator) Update(ctx context.Context, labels AgentMetricLabel
// Move to a function for testability
func (ma *MetricsAggregator) cleanupDescCache() {
now := time.Now()
now := ma.clock.Now()
for key, entry := range ma.descCache {
if now.Sub(entry.lastUsed) > ma.metricsCleanupInterval {
delete(ma.descCache, key)
@@ -11,6 +11,7 @@ import (
agentproto "github.com/coder/coder/v2/agent/proto"
"github.com/coder/coder/v2/coderd/agentmetrics"
"github.com/coder/coder/v2/testutil"
"github.com/coder/quartz"
)
func TestDescCache_DescExpire(t *testing.T) {
@@ -62,8 +63,9 @@ func TestDescCache_DescExpire(t *testing.T) {
func TestDescCacheTimestampUpdate(t *testing.T) {
t.Parallel()
mClock := quartz.NewMock(t)
registry := prometheus.NewRegistry()
ma, err := NewMetricsAggregator(slogtest.Make(t, nil), registry, time.Hour, nil)
ma, err := NewMetricsAggregator(slogtest.Make(t, nil), registry, time.Hour, nil, WithClock(mClock))
require.NoError(t, err)
baseLabelNames := []string{"label1", "label2"}
@@ -78,6 +80,9 @@ func TestDescCacheTimestampUpdate(t *testing.T) {
initialEntry := ma.descCache[key]
initialTime := initialEntry.lastUsed
// Advance the mock clock to ensure a different timestamp
mClock.Advance(time.Second)
desc2 := ma.getOrCreateDesc("test_metric", "help text", baseLabelNames, extraLabels)
require.NotNil(t, desc2)
+3 -3
View File
@@ -648,9 +648,9 @@ func (a RegoAuthorizer) newPartialAuthorizer(ctx context.Context, subject Subjec
return pAuth, nil
}
// SQLAuthorizeFilter is a compiled partial query that can be converted to SQL.
// AuthorizeFilter is a compiled partial query that can be converted to SQL.
// This allows enforcing the policy on the database side in a WHERE clause.
type SQLAuthorizeFilter interface {
type AuthorizeFilter interface {
SQLString() string
}
@@ -681,7 +681,7 @@ func ConfigWorkspaces() regosql.ConvertConfig {
}
}
func Compile(cfg regosql.ConvertConfig, pa *PartialAuthorizer) (SQLAuthorizeFilter, error) {
func Compile(cfg regosql.ConvertConfig, pa *PartialAuthorizer) (AuthorizeFilter, error) {
root, err := regosql.ConvertRegoAst(cfg, pa.partialQueries)
if err != nil {
return nil, xerrors.Errorf("convert rego ast: %w", err)
-1
View File
@@ -1 +0,0 @@
package rbac
+1 -1
View File
@@ -994,7 +994,7 @@ func (api *API) notifyUsersOfTemplateDeprecation(ctx context.Context, template d
func (api *API) templateDAUs(rw http.ResponseWriter, r *http.Request) {
template := httpmw.TemplateParam(r)
api.insightsAPI.DAUsForTemplates(rw, r, []uuid.UUID{template.ID})
api.returnDAUsInternal(rw, r, []uuid.UUID{template.ID})
}
// @Summary Get template examples by organization

Some files were not shown because too many files have changed in this diff Show More