Skip to content

fix(ci): unbreak auto_deploy — container build, clippy, FCM test, staging CD vars - #386

Open
geekbrother wants to merge 3 commits into
mainfrom
fix/ci-toolchain-drift
Open

geekbrother wants to merge 3 commits into
mainfrom
fix/ci-toolchain-drift

Conversation

@geekbrother

@geekbrother geekbrother commented Sep 10, 2026 •

Copy link
Copy Markdown
Member

Unbreaks main's auto_deploy (run 34381941835), which fails in three independent ways. None is caused by a commit — the same failures are in the pre-#384 run 34351560435, and run-cd has been skipped in every retained run, so nothing has deployed from main.

1. build-container (both Dockerfiles)

error: failed to compile `cargo-chef v0.1.78`
  feature `edition2024` is required
  ... not stabilized in this version of Cargo (1.79.0 (ffa9cf99a 2024-06-03))

rust:buster is frozen at Rust 1.79 because Debian buster is EOL, while unpinned cargo install cargo-chef resolves the newest release, whose clap_derive needs edition 2024 — a moving dependency against a frozen toolchain. Both files move to bookworm (build and runtime stages together, so the binary and its libssl stay consistent) and cargo install gains --locked.

2. Clippy (all three feature variants)

9 errors under -D warnings from lints in the newer floating stable: unused import: debug in src/handlers/delete_fcm_v1.rs, and 8× useless_borrows_in_formatting (a redundant & in a format! arg) in src/error.rs and src/handlers/push_message.rs.

Fixing those surfaced two dead-code errors queued behind the lib failure: an empty unreferenced pub enum Error {} in tests/context/server.rs, removed; and the whole context harness being unused under default features, now gated behind functional_tests to match its only consumer, mod functional.

3. tenant_update_fcm_bad

Google decommissioned the legacy FCM HTTP API in June 2024. Probed directly:

POST https://fcm.googleapis.com/fcm/send  →  HTTP 404

update_fcm.rs validates a legacy key with a dry-run send and maps only FcmError::Unauthorized to BadFcmApiKey; a 404 hits the _ => Ok(()) arm, so every key is accepted. The assertion cannot hold while legacy FCM is offered.

Failing closed is the obvious fix and is wrong: tenant_update_fcm_valid, tenant_enabled_providers and tenant_delete each post a key from ECHO_TEST_FCM_KEY and assert success, passing only because validation falls open. Rejecting on any error turns one red test into four and makes legacy key registration impossible in production.

The test is therefore ignored with its reason, and the validation site records what it no longer does: any key is accepted and stored, a suspended tenant is restored on it, and src/providers/fcm.rs sends through the same dead endpoint — so legacy FCM pushes are already failing in production. Dropping legacy FCM in favour of the v1 path is the real fix and a product decision, deliberately not made here.

4. CD would have failed next

run-cd calls cd.yml, whose apply steps set TF_VAR_jwt_secret, TF_VAR_relay_public_key and TF_VAR_image_version — all ignored by TFC remote-execution runs, so the apply would fail on the two required variables just as the plan did. image_version is the subtle one: unset, coalesce() in main.tf falls back to the latest release instead of the image auto_deploy just pushed under github.sha. The staging job now injects them via apply.auto.tfvars.json and applies inline, matching ci_terraform.yml and keys-server's sub-infra-apply.yml.

Important

deploy-infra-prod still needs the identical change and is not included here. It is skipped by auto_deploy (deploy_to_prod: false), so it does not block this run; manual prod deploys stay broken exactly as they are today until it lands.

Verification

  • cargo clippy with -D warnings for --tests, --features=multitenant --tests, and --all-features --all-targets: clean
  • cargo fmt --check: clean
  • cargo test --features <the CI set> --test integration -- --list --ignored: exactly one ignored test
  • full docker build -f Dockerfile ., all stages: exit 0 — chef, plan, release compile with multitenant,analytics,cloud, and the bookworm-slim runtime
  • bookworm carries the build packages (protobuf-compiler, lld, llvm) and runtime libssl3

Note that no PR check builds the container: build-container exists only in auto_deploy.yml (push: main) and release.yml (workflow_dispatch). That is why the Dockerfile was verified locally, and arguably why this went unnoticed — a build-only PR job would have caught it at the commit that broke it.

🤖 Generated with Claude Code

Two of the three failures on main's auto_deploy, both from drift rather than
any commit:

build-container (Dockerfile and slim.Dockerfile) died in the chef stage:

    error: failed to compile `cargo-chef v0.1.78`
      feature `edition2024` is required ... not stabilized in this version
      of Cargo (1.79.0)

`rust:buster` is frozen at Rust 1.79 (buster is EOL), while unpinned
`cargo install cargo-chef` resolves the newest release, whose clap_derive
needs edition 2024. Moved both files to bookworm and added --locked so the
tool's own lockfile pins its deps. Verified: the chef stage builds, giving
rustc 1.98.1 and cargo-chef 0.1.78, and bookworm carries the build packages
(protobuf-compiler, lld, llvm) and runtime libssl3.

Clippy failed on all three feature variants with 9 errors under -D warnings,
from lints in the newer floating stable: one unused `debug` import and eight
`useless_borrows_in_formatting` (a redundant & in a format! arg). Fixing
those surfaced two dead-code errors behind them: an empty unused `Error` enum
in the test harness, removed, and the whole context harness being unused
under default features — gated behind functional_tests, like its only
consumer, mod functional.

cargo clippy passes for all three variants and cargo fmt --check is clean.
The third failure (tenant_update_fcm_bad) is untouched: it needs a decision
on legacy FCM, since validation now fails open against Google's decommissioned
legacy API.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Max and others added 2 commits September 10, 2026 10:25
…oned

Google decommissioned the legacy FCM HTTP API in June 2024. Probed directly:
POST https://fcm.googleapis.com/fcm/send now answers 404 for every key, so
update_fcm's dry-run check never sees FcmError::Unauthorized and its
`_ => Ok(())` arm accepts anything. The assertion cannot be made to hold
while legacy FCM is still offered.

Failing closed instead was the obvious move and is wrong: tenant_update_fcm_
valid, tenant_enabled_providers and tenant_delete all post a legacy key from
ECHO_TEST_FCM_KEY and assert success, and they pass only because validation
falls open. Rejecting on any error turns one red test into four and makes
legacy key registration impossible in production.

So the test is ignored with its reason, and the validation site records what
it no longer does: any key is accepted and stored, a suspended tenant is
restored on it, and src/providers/fcm.rs sends through the same dead
endpoint. Dropping legacy FCM for the v1 path is the real fix and a product
decision.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
run-cd calls cd.yml, whose apply steps set TF_VAR_jwt_secret,
TF_VAR_relay_public_key and TF_VAR_image_version — all ignored by TFC
remote-execution runs, so the apply would fail on the two required variables
exactly as the plan did before ci_terraform.yml was fixed. image_version is
the subtle one: unset, coalesce() in main.tf falls back to the latest release
rather than the image auto_deploy just built and pushed under github.sha.

Applies the ci_terraform.yml treatment to the staging job and drops
terraform/apply@1.0.3, which passes -var-file. Matches keys-server's
sub-infra-apply.yml.

deploy-infra-prod still needs the same change; it is skipped by auto_deploy
(deploy_to_prod: false) so it does not block this run, and prod deploys stay
broken exactly as they are today until it lands.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@geekbrother geekbrother changed the title fix(ci): unbreak container build and clippy after toolchain drift fix(ci): unbreak auto_deploy — container build, clippy, FCM test, staging CD vars Sep 10, 2026
@geekbrother geekbrother self-assigned this Sep 10, 2026

@arminx86-77616c arminx86-77616c left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for putting the vars into apply.auto.tfvars.json

This branch has not been deployed

No deployments
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.

2 participants