Skip to content

github-backup: rename to developing-today-backup + just/nix deploy standard - #3280

Merged
dezren39 merged 1 commit into
mainfrom
github-backup/rename-developing-today-backup
Nov 1, 2026
Merged

dezren39 merged 1 commit into
mainfrom
github-backup/rename-developing-today-backup

Conversation

@dezren39

@dezren39 dezren39 commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Implements Drew's 2026-10-31 directives for the github-backup system (umbrella issue #3215).

1. Naming — developing-today-backup

The public name is now developing-today-backup everywhere repo-side:

  • infra/github-backup/config.json: app.name and worker.name (app_setup.py reads the App name from config, so the future App creation uses the new name automatically)
  • infra/github-backup/worker/wrangler.toml: Worker name
  • worker/src/index.js header, bin/app_setup.py docstring, README.md, docs/RUNBOOK.md (incl. the settings/apps install URLs and the Worker URL examples)

State of the world this lands on (verified 2026-10-31): the GitHub App was never created — GET /apps/hatch-repo-backup and GET /apps/developing-today-backup both 404 and no app-credential secrets exist in Bitwarden — so nothing needs renaming on GitHub; developing-today-backup is simply the name the App will be created under (slug checked available; the developing-today-repo-backup fallback is not needed). The Worker, however, WAS live under the old name hatch-repo-backup-webhook; this PR renames it and the renamed Worker is deployed from this branch (evidence in a follow-up comment). The old Worker is deleted after the rename verifies live and the laptop drainer is repointed (Bitwarden github-app.backup-worker-url).

2. Deploy method — just → nix run, versions upload/deploy

Before this PR, the Worker deployed by bare wrangler commands typed from RUNBOOK §5. Now it follows the shape of the repo's Cloudflare Worker deployment standard (doc/2026-10-31T23-00-00Z_design_cloudflare_worker_deployment_standard.md):

  • just deploy-developing-today-backup (root.just, group github-backup) → nix run .#developing-today-backup-deploy (new flake app in lib/default.nix, writeShellApplication in infra/github-backup/deploy.nix, mirroring pkgs/pkarr-worker/deploy.nix and the wrangler-based nixos/services/id-mail/worker/deploy.nix)
  • the app runs worker/deploy.sh (sources lib/bitwarden-env.sh, SOPS-extracts the Cloudflare account id) → worker/deploy.mjs: API token from Bitwarden by name (cloudflare.api-token-day-to-day), version uploaded first tagged git-<sha12>, then a separate deployment at 100%; --deploy-version <id> is the rollback path; --dry-run validates without uploading
  • after a live deploy, the Worker secrets DRAIN_BEARER and GITHUB_WEBHOOK_SECRET are (re)set from Bitwarden by name — values pass via wrangler stdin only, never printed or written to disk

Tool gap (per the standard's fallback rule): the script drives wrangler's versions commands rather than the cf CLI. cf's flow is built around a TypeScript cf/config project with npm dependencies; this Worker is a dependency-free plain-JS worker configured by wrangler.toml. Drew's 2026-10-31 directive for this system also specified wrangler via the flake app. Converting this Worker to the cf config format is a possible follow-up; the upload/deploy separation, SHA tagging, and secret handling are identical either way.

Also in root.just (group github-backup), per the same directive: github-backup-units (install/refresh the laptop systemd units), github-backup-fetch and github-backup-reconcile (run the daily fetch / weekly sweep on demand via the installed units). just-recipes.json regenerated (just just-recipes) so the new recipes also exist as nix run .#<recipe> apps; note the generated file's source paths now point at the worktree this was generated in, the same churn the file already carried (previously a pkarr worktree).

Verification (laptop)

  • just --list: all four recipes parse and list under [github-backup]
  • nix eval .#apps.x86_64-linux.developing-today-backup-deploy.program and nix build .#developingTodayBackupDeploy: OK; recipe app github-backup-fetch also evaluates
  • deploy --dry-run end to end: Bitwarden token resolved, SOPS account id decrypted, wrangler validated the renamed config (upload 2.92 KiB, KV binding GHB_EVENTS 46b1fe46…), nothing uploaded
  • live rename deploy + drainer repoint + old-Worker deletion: evidence in the follow-up comment

Related: #3215 (umbrella), #3219 and #3229 (known defects, untouched by this PR).


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 1, 2026 01:29
@coderabbitai

coderabbitai Bot commented Nov 1, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 47 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a8e00c70-411c-42e8-9af3-64c0bedaabc9
Commits

Reviewing files that changed from the base of the PR and between 558cc1d and 307a250.

Files selected for processing: 12
  • infra/github-backup/README.md
  • infra/github-backup/bin/app_setup.py
  • infra/github-backup/config.json
  • infra/github-backup/deploy.nix
  • infra/github-backup/docs/RUNBOOK.md
  • infra/github-backup/worker/deploy.mjs
  • infra/github-backup/worker/deploy.sh
  • infra/github-backup/worker/src/index.js
  • infra/github-backup/worker/wrangler.toml
  • just-recipes.json
  • lib/default.nix
  • root.just
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T01:33:22.128585Z 307a250 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 307a2501ca

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +12 to +16
bws
git
nodejs
sops
wrangler

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include jq in the deploy application's runtime inputs

On a machine without a globally installed jq, the new flake deployment entrypoint exits before reaching Wrangler. worker/deploy.sh sources lib/bitwarden-env.sh, which explicitly checks for jq and returns 1 when it is unavailable, but this runtime dependency list does not provide it. This was reproduced with the helper's other prerequisites available and jq absent from PATH. Add jq to the application arguments and runtimeInputs, as the existing id-mail-deploy package does, so both normal deployments and dry runs work outside the development shell.

Useful? React with 👍 / 👎.

Comment on lines +99 to +101
setWorkerSecrets();
reportLive();
console.log(`live: ${WORKER_URL} at version ${version.id} (${tag})`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include secrets in the version advertised for rollback

On a fresh Worker, the tagged version is uploaded before either required secret exists. This subsequent call changes the deployed version: Cloudflare documents that wrangler secret put “creates a new version of the Worker and deploys it immediately.” Consequently, the version ID printed as live below is not the final secret-bearing version. The --deploy-version path deploys that advertised ID without provisioning secrets, so it does not restore the working configuration: the tagged bootstrap version lacks the bearer required by /queue and the HMAC secret required by /github. Include the secrets before selecting the tagged deployment version, or retain and advertise the final configured version for rollback.

Useful? React with 👍 / 👎.

Comment on lines +54 to +55
if (deployVersion !== null) {
createDeployment(deployVersion);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Honor dry-run when deploying an existing version

When an operator combines --dry-run with --deploy-version <id> to preview a rollback, this branch runs before the dry-run check and immediately changes the production deployment. Running the actual script with mocked executables confirmed that it invokes wrangler versions deploy <id>@100% --name developing-today-backup --yes, without forwarding --dry-run. Wrangler documents the deployment command's --dry-run option as “Don't actually deploy,” but the wrapper silently discards that protection and bypasses confirmation. Forward the dry-run flag for existing-version deployments, or reject the combination before making any changes.

Useful? React with 👍 / 👎.

@dezren39
dezren39 merged commit cf1b243 into main Nov 1, 2026
1 check passed
@dezren39
dezren39 deleted the github-backup/rename-developing-today-backup branch November 1, 2026 01:37
@dezren39

dezren39 commented Nov 1, 2026

Copy link
Copy Markdown
Member Author

Deployment evidence (laptop, 2026-10-31 evening CDT):

  • Rename deploy ran through the new path itself: just deploy-developing-today-backup → nix run .#developing-today-backup-deploy → wrangler versions flow from this branch's commit 307a2501c.
  • Live: https://developing-today-backup.developing-today.workers.dev — version 28e98019-8bcd-4271-a2b5-24ef123d9fb4 tagged git-307a2501ca65 deployed at 100% (2026-11-01T01:30:10Z); the deploy then (re)set the Worker secrets DRAIN_BEARER and GITHUB_WEBHOOK_SECRET from Bitwarden by name (each secret put rolled a same-code version; final live version a0e27b44-b1e0-4506-afcf-f042c6e49ab6).
  • Checks: GET /health → ok; GET /queue with the drain bearer → {"events":[]} (auth + KV binding to the same namespace 46b1fe46… verified).
  • Drainer repointed: Bitwarden github-app.backup-worker-url updated to the new URL via the system's own app_setup.bws_set; the next scheduled drain tick (20:32:58 CDT) ran against the renamed Worker and finished clean (queue empty, 20:33:01).
  • Old Worker deleted: wrangler delete --name hatch-repo-backup-webhook → "Successfully deleted"; old URL now returns 404, new URL still ok. (Note: deletion needed the deploy credentials — Bitwarden cloudflare.api-token-day-to-day + SOPS account id; the laptop profile's ambient Cloudflare token could list but got 'No access to the specified service' on delete.)
  • Pre-merge verification: just --list (4 recipes, group github-backup), nix eval of the deploy app + a recipe app, nix build .#developingTodayBackupDeploy, and a full --dry-run (token from Bitwarden, account id from SOPS, wrangler validated the renamed config, nothing uploaded).

Merged as cf1b243f. Remaining for the system (unchanged from #3215): create the GitHub App — now under the name developing-today-backup — per RUNBOOK §3, install it, and take the first genuine GitHub webhook delivery.

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