Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: add deployment setting to disable the Codernauts game (#27662) - #28901

Merged
mtojek merged 2 commits into
release/2.37from
bartek/backport-27662-2.37
Sep 2, 2026
Merged

feat: add deployment setting to disable the Codernauts game (#27662)#28901
mtojek merged 2 commits into
release/2.37from
bartek/backport-27662-2.37

Conversation

@bartekgatzcoder

Copy link
Copy Markdown
Contributor

Backport of #27662 (55340de360) to release/2.37.

Adds a codernauts_enabled runtime setting (default: enabled) that controls whether the Codernauts game link appears in the user dropdown menu. A toggle at the bottom of the Deployment > Appearance page controls it, and the value persists as a single row in the existing site_configs table, so it survives restarts and upgrades. There is no database migration; the setting works on all licenses.

The only conflict was in UserDropdownContent.tsx: release/2.37 does not yet have the extracted CodernautsSVG component or the Premium trial CTA from main, so the codernautsEnabled guard wraps the inline SVG that 2.37 already has. Everything else applied cleanly.


🤖 This PR was generated by Coder Agents on behalf of @bartekgatzcoder.

Adds a `codernauts_enabled` runtime setting (default: enabled) that
controls whether the Codernauts game link appears in the user dropdown
menu. A toggle at the bottom of the Deployment > Appearance page
controls it, and the value persists in `site_configs`, so it survives
restarts and upgrades without any CLI flags or environment variables.

The setting works on all licenses: `GET /api/v2/appearance` reports it
from both the enterprise and the default (AGPL) appearance fetchers, and
`PUT /api/v2/appearance` persists it gated only by the deployment-config
RBAC permission, not by an entitlement. On the Appearance page the
toggle renders outside the Premium paywall introduced in #27948; the
other appearance fields keep their existing licensing behavior.

Note: a pure AGPL-only build of coderd does not register the
`/api/v2/appearance` routes at all, so the toggle cannot be saved there.
The standard `coder server` binary is unaffected regardless of license
state.

<details>
<summary>Implementation notes</summary>

- `coderd/database/queries/siteconfig.sql`: new `GetCodernautsEnabled` /
`UpsertCodernautsEnabled` queries backed by a `codernauts_enabled` key
in `site_configs`; defaults to `true` when unset (no migration needed).
- `coderd/database/dbauthz`: read has no authz checks (matching other
appearance reads); write requires `ResourceDeploymentConfig` update.
Coverage added to `dbauthz_test.go`.
- `codersdk`: `codernauts_enabled` added to `AppearanceConfig` and
`UpdateAppearanceConfig`.
- `coderd/appearance`: the default fetcher takes a `database.Store` and
reads the setting from the database so unlicensed deployments serve it
too.
- `enterprise/coderd/appearance.go`: fetches the value in `Fetch` and
persists it in `putAppearance`.
- Frontend: "Codernauts game" toggle section on Deployment > Appearance
saving immediately via the existing appearance mutation;
`codernauts_enabled` threaded from `useDashboard().appearance` through
Navbar to `UserDropdownContent`, which renders the menu item only when
enabled. Storybook stories with `play` functions cover toggling
(entitled and not) and the dropdown hiding the link when disabled.

</details>

---

🤖 This PR was generated by Coder Agents on behalf of @bartekgatzcoder.

(cherry picked from commit 55340de)
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Docs preview

Check off each page once it's been reviewed. If a page changes in a later push, its checkbox clears automatically so it gets a fresh look. Pages not yet wired into the docs navigation aren't listed here.

@bartekgatzcoder bartekgatzcoder added the backport/v2.37 Backport PR targeting release/2.37 label Sep 2, 2026 — with Coder
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

👋 Hey @bartekgatzcoder!

This PR is targeting the release/2.37 release branch, but its title does not start with fix: or fix(scope):.

Only bug fixes should be cherry-picked to release branches. If this is a bug fix, please update the PR title to match the conventional commit format:

fix: description of the bug fix
fix(scope): description of the bug fix

If this is not a bug fix, it likely should not target a release branch.

@coderagents

coderagents Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Documentation Check

Updates Needed

  • docs/admin/setup/appearance.md - The Deployment > Appearance page gains a new toggle (codernauts_enabled) that controls whether the Codernauts game link appears in the user dropdown menu. This page documents every other setting on that screen (Application Name, Logo URL, Announcement Banners, Support Links), so it should gain a short section for this toggle. Worth noting it works on all licenses, unlike the rest of the Premium Appearance page.

Note

This is a backport of #27662 to release/2.37. Documentation lives on main, so any doc update should land there via the original PR rather than on this backport branch. The API reference changes in this diff (docs/reference/api/*.md) are auto-generated and already regenerated here; no manual edits needed.


Automated review via Coder Agents

@mtojek
mtojek self-requested a review September 2, 2026 21:38
@mtojek
mtojek merged commit f3fca7d into release/2.37 Sep 2, 2026
21 of 23 checks passed
@mtojek
mtojek deleted the bartek/backport-27662-2.37 branch September 2, 2026 21:44
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

backport/v2.37 Backport PR targeting release/2.37

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants