Repository navigation
Conversation
Layer: 3-schema-sync-edge-test-race
kmcginnes
deleted the
fix-tests-for-minor-and-patch-bumps-schema-sync-edge-test-race
branch
November 24, 2026 01:41
This was referenced Nov 24, 2026
kmcginnes
added a commit
that referenced
this pull request
Nov 25, 2026
## Summary
The test "should not fetch edge connections when no active schema
exists" couldn't always tell "the edge query never ran" from "the query
ran and found no edge types to fetch", so removing the query's `enabled`
gate could slip past it.
**User-facing:** none
```diff
expect(result.current.edgeDiscoveryQuery.fetchStatus).toBe("idle");
+expect(result.current.edgeDiscoveryQuery.status).toBe("pending");
expect(fetchEdgeConnectionsSpy).not.toHaveBeenCalled();
```
## Evidence
**Before:** with the gate in `edgeConnectionsQuery` replaced by
`enabled: true` and the query allowed to settle, the test passed:
`fetchStatus` returns to `"idle"` and the query function takes its
empty-edge-list branch without calling `fetchEdgeConnections`.
**After:** agent-tested by mutating the gate locally and reverting:
```text
gate in place -> pass
enabled: true, query still in flight -> fail: fetchStatus expected "idle", received "fetching"
enabled: true, query settled -> fail: status expected "pending", received "success"
enabled: true, settled, old test -> pass (the gap this closes)
```
With the test's current timing, the existing `fetchStatus` check already
catches the mutation, because the query is still fetching when it runs.
The new `status` check covers the settled case, so the test no longer
depends on the query being in flight at the assertion. Both checks stay.
## Merge Danger
**Door:** two-way
**Impact:** none. Test-only.
## Changelog entry
None needed. Test-only change.
## Related
- Closes #2662
- Related to #2654
---
<sub>🤖 Written by an AI agent on my behalf.</sub>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
With @tanstack/react-query 5.108.2, the schema discovery query in the "should not fetch edge connections when no active schema exists" test can finish within one
actflush, which enables the edge query and fails the test on Bump the minor-and-patch group (#2649). The test now keepsfetchSchemapending, as other tests in the file already do, so no schema arrives and the result no longer depends on timing.User-facing: none
it("should not fetch edge connections when no active schema exists", async () => { const state = new DbState(explorer).withNoActiveSchema(); + vi.spyOn(explorer, "fetchSchema").mockImplementation( + () => new Promise(() => {}), + );Evidence
Before: with react-query 5.108.2 the test fails intermittently (2 of 5 runs) with
expected 'fetching' to be 'idle'. Pinned back to 5.105.0, it passes.After: agent-tested: the test passes with react-query 5.105.0 (current
main) and with 5.108.2 (the #2649 lockfile), with 15 repeated runs of the file and no failure.Merge Danger
Door: two-way
Impact: none, test only
🤖 Written by an AI agent on my behalf.