Skip to content

fix(observe): blame a failed server only on the apps planned for it - #17

Merged
devalade merged 1 commit into
v3from
fix/observe-unreachable-attribution
Oct 1, 2026
Merged

devalade merged 1 commit into
v3from
fix/observe-unreachable-attribution

Conversation

@devalade

@devalade devalade commented Oct 1, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes the fleet view blaming an unreachable server on apps that don't run there (raised by CodeRabbit on #16).

A server whose poll fails reports no apps, so pivotByApp attributed it to every app another replica proved existed. With web on server A, api on A and B, and a database on C:

  • B or C going down made web render as a two-server fleet with an "Unreachable" warning, and put the wrong list in --json.
  • An app whose only server failed disappeared from the fleet view entirely.

Change

  • ServerSnapshot.plannedApps (new, set only on failed polls): the apps the server is configured to run. Both places that build a failed snapshot (MetricsCollector.unreachable, unreachableObserver) already hold the host plan, so they fill it in.
  • pivotByApp blames a failed server only on its planned apps, and creates a view (with no replicas) for an app whose every server failed.
  • Snapshots without plannedApps keep the previous attribute-to-everything behaviour, so existing consumers and tests are unaffected.

Verification

  • 684 tests pass; typecheck clean.
  • 3 of the 4 new pivot tests fail against the old pivot.ts (the 4th is a sanity case that passes either way).
  • Not run against a real multi-server fleet. status on a single server is unchanged.

🤖 Generated with Claude Code

A server whose poll failed reports no apps, so the fleet view attributed it to
every app another replica proved existed. A single-server app then rendered as
a fleet with a missing replica whenever an unrelated server was down, and an
app whose only server failed vanished from the view.

A failed snapshot now carries plannedApps, taken from the host plan the caller
already holds, and the pivot attributes the failure to exactly those apps. The
old attribute-to-everything behaviour remains for snapshots without the field.
@coderabbitai

coderabbitai Bot commented Oct 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 39 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

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 0d02c971-10fa-4f3e-a416-ac40ffcef17c

📥 Commits

Reviewing files that changed from the base of the PR and between 887e938 and de48595.

📒 Files selected for processing (6)
  • src/cli/observe.ts
  • src/domain/observe/collector.ts
  • src/domain/observe/pivot.ts
  • src/domain/observe/snapshot.ts
  • tests/unit/observe-collector.test.ts
  • tests/unit/observe-pivot.test.ts
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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

Comment @coderabbitai help to get the list of available commands.

@devalade
devalade merged commit 93a0b5b into v3 Oct 1, 2026
5 checks passed
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