Flaky e2e: status-config reports state=synced with resource_counts not yet populated
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 157
- Forks
- 32
- Avg merge
- 1h 25m
- Merged PRs (30d)
- 145
Description
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 == syncedimplyresource_countsis populated (publish atomically), OR - Test: additionally gate on
applied.resource_counts.models >= 1(not juststate === synced) before asserting.
The DP fix is preferable if synced is meant to be a consistent point-in-time view.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/cases/status-config-e2e.test.ts, especially the assertion at line 145, then inspect the /status/config implementation and how state and applied.resource_counts are produced. Run the status-config end-to-end test repeatedly, including on a slower runner. Done means the synced response consistently contains the expected resource counts, with the implementation or test behavior matching the intended contract.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, typescript
- Domain
- backend-api-design, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100