Skip to content

Flaky e2e: status-config reports state=synced with resource_counts not yet populated #793

Description

@moonming

Symptom

status-config-e2e.test.ts > status/config: etcd watch source > clean config reports synced with revisions and resource counts intermittently fails:

AssertionError: expected undefined to be 1 // Object.is equality
  at src/cases/status-config-e2e.test.ts:145  expect(cfg.applied.resource_counts.models).toBe(1)

The test waits until GET /status/config returns state === "synced", captures that response, then asserts applied.resource_counts.{models,provider_keys,api_keys} === 1. On the failing run, the same response had state: "synced" but applied.resource_counts.models was undefined — i.e. the state machine reported synced before/without the applied snapshot's resource_counts reflecting the loaded resources.

Frequency

Intermittent — passes ~3/3 on isolated local re-runs, failed once in isolation locally and once on a CI runner (slower runner makes it more likely). Pre-existing; not tied to any specific change (surfaced on an unrelated test-only PR's CI).

Suspected cause

/status/config may compute state and applied.resource_counts from a point where the derived state can read synced while resource_counts is empty/partial — i.e. the two fields aren't published atomically, or state flips to synced a beat before resource_counts is filled. Worth confirming whether state == synced should guarantee the applied snapshot (including resource_counts) is fully materialized in the same response.

Options

  • DP: make state == synced imply resource_counts is populated (publish atomically), OR
  • Test: additionally gate on applied.resource_counts.models >= 1 (not just state === synced) before asserting.

The DP fix is preferable if synced is meant to be a consistent point-in-time view.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions