Skip to content

infra(deploy): fix nixos-changed alert, /etc/nixos drift, stale smoke check - #141

Merged
danielnaab merged 2 commits into
mainfrom
infra/2026-12-04-deploy-drift-fixes
Dec 4, 2026
Merged

danielnaab merged 2 commits into
mainfrom
infra/2026-12-04-deploy-drift-fixes

Conversation

@danielnaab

Copy link
Copy Markdown
Member

Context

Main deploys failed on every push from May 7 to Dec 4 with fatal: refusing to fetch into branch 'refs/heads/main' checked out at '/srv/forms-lab/main'. The fix (4c91e36) was merged but never applied with cli nixos apply, because deploy-main deliberately skips NixOS rebuilds. Three issues kept this from being noticed or made it confusing:

  1. The alert was never delivered. deploy-main posted deploy.nixos-changed with "status":"warning", which the notify service rejects (status must be one of: success, failure, info).
  2. The "NixOS config changes detected" message is a false positive. deploy-main diffs against /etc/nixos, but cli nixos apply rebuilds from the worktree and never updated /etc/nixos. It had been frozen since May 6, so the warning fired after every deploy, even after a successful apply.
  3. One smoke check failed on every deploy. It expected /projects to redirect to sign-in, but /projects has been a public page since ef11e37.

The server has since been fixed by hand: nixos apply was run, main was redeployed, and /etc/nixos was synced once.

Changes

  • deploy.nix: the nixos-changed notification now uses status: failure.
  • cli nixos apply: after a successful rebuild, copies infrastructure/nixos into /etc/nixos (cp -rT).
  • smoke-check.ts: the auth guard check now targets /new (protected by requireAuth) instead of /projects.

Testing

  • bun run check passes (1424 tests)
  • Confirmed https://forms.labs.flexion.us/main/new returns 302 to /auth/signin
  • Webhook deploy of fix(auth): link access-request notifications to the right deployment #140 succeeded after the manual apply
  • After merge: run bun run cli nixos apply (this PR changes deploy.nix), then check that the next main deploy reports "No NixOS config changes" and 5/5 smoke checks pass

danielnaab and others added 2 commits December 4, 2026 08:16
… check

Main deploys were broken from May 7 to Dec 4 because the deploy.nix
fix (4c91e36) was never applied, and nothing surfaced that:

- deploy-main posted the nixos-changed notification with status
  "warning", which the notify service rejects (success|failure|info),
  so the alert was never delivered. Use "failure".
- `cli nixos apply` rebuilds from the worktree but never updated
  /etc/nixos, which deploy-main diffs against, so the "manual apply
  required" message fired even after an apply. Sync /etc/nixos after a
  successful rebuild.
- The smoke check expected /projects to redirect to sign-in, but
  /projects has been public since ef11e37. Check /new instead.

Pot-Run: 7979
@danielnaab
danielnaab temporarily deployed to infra-2026-12-04-deploy-drift-fixes December 4, 2026 17:48 Inactive
@danielnaab
danielnaab merged commit c452407 into main Dec 4, 2026
4 checks passed
@danielnaab
danielnaab deleted the infra/2026-12-04-deploy-drift-fixes branch December 4, 2026 18:05

This branch was previously deployed

1 inactive deployment
infra-2026-12-04-deploy-drift-fixes — affcbd3b Deployed Dec 4, 2026 by danielnaab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant