Skip to content

Tighten test fidelity in connection, proxy, and session storage tests - #2389

Merged
kmcginnes merged 6 commits into
mainfrom
tighten-test-fidelity
Oct 9, 2026
Merged

kmcginnes merged 6 commits into
mainfrom
tighten-test-fidelity

Conversation

@kmcginnes

@kmcginnes kmcginnes commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

A few tests either couldn't fail or checked less than their names claimed, so this tightens them.

  • Restored test: a legacy direct defaultConnection.json keeps the full path of its GRAPH_EXP_PUBLIC_OR_PROXY_ENDPOINT. The Docker image unification PR (#1773) deleted this check without a replacement.
  • Stronger proxy test: the username-only database URL test now asserts the error message and that the database was never fetched, not just the 400 status.
  • Stronger connection link test: the "reports every offending parameter" test asserts the three exact problems instead of a count.
  • Cross-tab isolation tests can now fail: the four "...does not change an already-open tab" tests (sessionScopedStorage.test.ts and activeConnectionStorage.test.ts) never mounted the open tab's atom. A cross-tab sync wired through onMount, the usual Jotai pattern, never reached it, so they passed either way. The harnesses now expose subscribe(), and each test subscribes the open tab first.
  • Doc comment: removed the change-history paragraph from mapWithConcurrency.

Evidence

Before: with an onMount BroadcastChannel sync injected into createWriteThroughAtom, the already-open tab test still passed.
After: with the same injection, the subscribed test fails on every run, and it passes against the real code.

Merge Danger

Door: two-way

This only touches tests and one doc comment. No production code changes.

Impact: none

Each simulated tab gets its own Jotai store, and createSessionScopedAtom
reads the breadcrumb only at creation with no cross-tab listener, so with
this harness an open tab never observes another tab's write and the tests
pass trivially. The reload tests cover the isolation that can regress.
Restores the already-open tab tests removed earlier. They could not fail
because the open tab was never mounted, so a cross-tab sync wired through
onMount would not reach it. Subscribing the tab first makes each test fail
under such a sync, which was confirmed by injecting one.

@kmcginnes kmcginnes left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

@kmcginnes
kmcginnes merged commit 3f244d1 into main Oct 9, 2026
4 checks passed
@kmcginnes
kmcginnes deleted the tighten-test-fidelity branch October 9, 2026 01:32
kmcginnes added a commit that referenced this pull request Oct 9, 2026
## Summary

A review recommended deleting cross-tab isolation tests as "can't fail"
after reasoning about the current code, when the tests only needed to
mount the open tab's atom. These two rules make that verdict something a
reviewer proves rather than argues.

```diff
 REVIEW.md › Tests that can't fail
-  Ask whether the test would fail if the change were reverted.
+  Name a plausible regression of the behavior the test's name promises,
+  and prove the verdict with a mutation. A test that stays green is the
+  finding; tighten it until the mutation turns it red. Delete only when
+  no regression of that behavior could reach the test.

 docs/agents/testing.md › Special cases
+  Jotai mount effects: store.get doesn't mount an atom, so onMount never
+  runs. Mount it with store.sub(atom, () => {}) when the behavior depends on it.
```

The Jotai note is the gotcha behind the near-miss: [the test fidelity PR
(#2389)](#2389) showed that an
`onMount` cross-tab sync left the old tests green and turned the
subscribed ones red.

## Merge Danger

**Door:** two-way

**Impact:** none

Review and testing guidance only.

## Related

- Related to #2389
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