Skip to content

feat(cf): degraded-aware CF snapshot (don't act on a partial view)#282

Merged
posix4e merged 1 commit into
mainfrom
feat/cf-snapshot-degraded
Jun 2, 2026
Merged

feat(cf): degraded-aware CF snapshot (don't act on a partial view)#282
posix4e merged 1 commit into
mainfrom
feat/cf-snapshot-degraded

Conversation

@posix4e
Copy link
Copy Markdown
Member

@posix4e posix4e commented Jun 2, 2026

PR-2 of the CF-reconcile arc.

Why

build_cf_state made three CF list calls (tunnels / dns / apps) with ?, so a single flaky endpoint blanked the entire snapshot (cf_api_reachable=false, everything empty) — indistinguishable from "account is empty". It's also unsafe ground for reconcile: a partial CF read would manufacture false orphans/missing and could drive bad deletes.

What

  • Each CF list call is now independently fallible; collect which sub-fetches failed.
  • New snapshot fields: degraded (any sub-fetch failed → cf_state is partial) and cf_fetch_errors (which ones).
  • cf_api_reachable now means "at least one call returned"; drift is computed only on a complete view (reachable && !degraded).
  • This is the guardrail the operator-gated reconcile (PR-6) will require: refuse to mutate in a degraded state.

Snapshot JSON gains two backward-compatible fields (the iOS Manage view can show "CF partially unreachable" instead of a misleading empty diff). compute_drift and its unit tests are unchanged.

Validation

  • cargo fmt clean; compiles locally (only the unrelated macOS sessiond.rs errors; CI builds musl).
  • CI build job (clippy/test) + preview deploy green; /admin/cf/snapshot returns the new fields with degraded:false in the normal case.

🤖 Generated with Claude Code

build_cf_state did three CF list calls (tunnels/dns/apps) with `?`, so a
single flaky endpoint blanked the entire snapshot (cf_api_reachable=false,
empty everything) — indistinguishable from "account is empty". That's
also unsafe ground for the upcoming reconcile: a partial CF read would
manufacture false orphans/missing.

Make each list call independently fallible; collect which sub-fetches
failed. Add `degraded` (any sub-fetch failed → cf_state is partial) and
`cf_fetch_errors` to the snapshot. `cf_api_reachable` now means "at least
one call returned"; drift is computed only on a complete view
(`reachable && !degraded`). This is the guardrail the operator-gated
reconcile will require — it must refuse to mutate in a degraded state.

Snapshot JSON gains two backward-compatible fields; the iOS Manage view
can surface "CF partially unreachable" instead of a misleading empty
diff. compute_drift and its tests are unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 2, 2026

DD preview ready

URL: https://pr-282.devopsdefender.com

Browser login: visit https://pr-282.devopsdefender.com — DD redirects you to
the GitHub App auth broker. A DD session cookie scoped
to .devopsdefender.com lets the preview, fleet, and
shell hosts share the same login.

Machine-to-machine: GitHub Actions workflows in the
DD_OWNER org pass their per-job OIDC JWT as
Authorization: Bearer … (audience dd-agent).

Register endpoint for a local agent: https://pr-282.devopsdefender.com/register
(authenticated by ITA attestation).

@posix4e posix4e merged commit 63db3cf into main Jun 2, 2026
3 checks passed
@posix4e posix4e deleted the feat/cf-snapshot-degraded branch June 2, 2026 23:41
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