Repository navigation
fix(pm-dispatch): sops-managed Supabase config; SUPABASE_URL required (#5120) - #5129
Merged
Merged
Conversation
developing-today
Bot
requested review from
a team and
dezren39
as code owners
November 3, 2026 20:38
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
On 2026-11-03 pm-dispatch's queue writes failed fleet-wide: its Supabase config resolved to the legacy muse-dev project, which has been deleted (public DNS NXDOMAIN; Management API 404 "Resource has been removed"). Two layers pointed there:
pm-stack/dispatch/src/config.tsdefaultedSUPABASE_URLto the legacy host whenever the env var was unset;~/secrets/dispatch.env, placed there from Bitwarden's un-namespacedsupabase.service-role-key— which is the legacy project's key.The hot fix repointed the live env file at muse-dev2 (
keihfchslgjetkmnmzra) and the service is healthy again, but the fix lived only in a hand-edited file. Per Drew's ruling ("NixOS should manage it"), this PR moves pm-dispatch's Supabase config into the pm-stack SOPS layer, rendered by install.sh like the stack's other secrets.Refs #5120 — this PR fixes the pm-dispatch scope of that issue; the
pm-stack/supabase-exportlegacy refs audited there are a separate remainder.Changes
secrets/pm-stack.sops.yaml— addsupabase_url+supabase_service_role_key(muse-dev2). The key's source of truth is Bitwardensupabase.muse-dev2.service-role-key; its JWTrefclaim was verified against the project before the edit and again from the re-encrypted file after it, and all 20 pre-existing keys decrypt byte-identically after the edit.pm-stack/dispatch/install.sh— renderSUPABASE_URL+SUPABASE_SERVICE_ROLE_KEYinto~/pm-stack/dispatch/.envfrom the SOPS file, with the GitHub App material (samesops -d --extractpattern). The operator file is DISPATCH_API_TOKEN-only by design now; install.sh warns loudly if staleSUPABASE_*lines remain there (the unit reads that file after the rendered one, so leftovers would override the managed values). The header also documents the Bitwarden trap: the un-namespacedsupabase.*secrets are the deleted legacy project's.pm-stack/dispatch/src/config.ts—SUPABASE_URLis required; there is no default.loadConfigthrows at startup when it is unset or blank. Fail-loud over defaulting to the muse-dev2 URL: a silent default is exactly what turned a deleted project into a fleet-wide outage, and the deployment always renders the value.config.test.tsgains a fixture env plus SUPABASE_URL required / trailing-slash tests; the three server-importing suites pin a fixture URL before importingsrc/server.ts(the package's existing dynamic-import idiom), since config now loads at import time.pm-stack/systemd/pm-dispatch.service),pm-stack/dispatch/README.md,pm-stack/README.md. The unit's EnvironmentFile wiring already pointed at the rendered path first; the module change is comments only.No behavior change today
The running service reads
~/secrets/dispatch.env, which already carries the same muse-dev2 URL and key from the hot fix (identical key value — same Bitwarden source). Nothing in this PR restarts or reconfigures the live service.Deploy (with the next switch / deploy round)
secrets/pm-stack.sops.yamllands at~/secrets/pm-stack.sops.yamlon the laptop by the usual flow.pm-stack/dispatch/install.sh(or let pm-git-sync's redeploy do it — the SOPS ciphertext is a hashed deploy input, so the change re-renders and restarts automatically).SUPABASE_URL/SUPABASE_SERVICE_ROLE_KEYlines from~/secrets/dispatch.env(install.sh warns until this is done).DISPATCH_API_TOKENstays in the operator file, as before.Until that deploy runs, the interim state is the hot-fixed operator file: correct values, hand-maintained.
Verification (on the laptop)
bun test: 131 pass / 0 fail (origin/main baseline: 129 pass; +2 new tests).bunx tsc --noEmit: only the pre-existingtest/queue.test.tsTS2352, byte-identical on origin/main.bash -n install.shclean. Extraction of both new keys from the updated SOPS file verified (URL value; key JWTref=keihfchslgjetkmnmzra).home.activationPackagefor hostamdbuilds with these changes; the generatedpm-dispatch.servicein the built generation carriesEnvironmentFile=/home/user/pm-stack/dispatch/.envthenEnvironmentFile=-/home/user/secrets/dispatch.env, unchanged, and the eval ofsystemd.user.services.pm-dispatch.Service.EnvironmentFilereturns exactly that pair.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.