Skip to content

Commit 6596a6d

Browse files
cliffhallclaude
andcommitted
test(web): final comment/string polish on the auto-settle guard (round 13)
Round-13 review of PR #1793 (merge-verdict; string/comment polish only): - Finding 1: the console.error text claimed the drain error was "reported as the liveness error's cause" unconditionally, but the cause is only attached when the liveness error is an Error — misleading on the very non-Error path the hoisted log exists to serve. Dropped that parenthetical so the log is true on both paths. - Nit: trimmed the now-duplicated outer comment to just the priority rationale (the inner comment, which mentions the log + instanceof conditional, is the accurate one). - Nit: guard message says "drained against a dead tree" (exact for both the before- and during-settle detach) instead of "drained nothing". - Nit: the message now names renderWithMantine.tsx rather than "the ordering note here", so it's self-contained out of context. eslint clean; ViewHeader unchanged; npm run ci green. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01XNdjEPKLG637X8YmhDiEk5
1 parent fd71da2 commit 6596a6d

1 file changed

Lines changed: 16 additions & 18 deletions

File tree

‎clients/web/src/test/renderWithMantine.tsx‎

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -217,21 +217,18 @@ afterEach(async () => {
217217
drainError = error;
218218
}
219219
if (livenessError === undefined) captureLiveness("after");
220-
// A liveness error explains the actual regression; a drain-time throw
221-
// (realistically only `act` surfacing an error flushed during the settle) is a
222-
// downstream symptom — so prefer the liveness error. Preserve the drain error
223-
// as its `cause` rather than dropping it, so a component error flushed during
224-
// the settle isn't lost when both fire. Otherwise rethrow the drain's.
220+
// A liveness error explains the actual regression; a drain-time throw is a
221+
// downstream symptom — so prefer the liveness error, else rethrow the drain's.
225222
if (livenessError !== undefined) {
226223
if (drainError !== undefined) {
227-
// Preserve the drain error rather than dropping it, so a component error
228-
// flushed during the settle isn't lost when both fire. Attach it as the
229-
// liveness error's `cause` (when that's an Error) *and* log it, so it's
230-
// readable regardless of whether the test reporter renders `cause`.
224+
// Preserve the drain error rather than dropping it when both fire: attach
225+
// it as the liveness error's `cause` (when that's an Error) *and* log it,
226+
// so it's readable regardless of whether the reporter renders `cause` and
227+
// on the (currently unreachable) path where the liveness error isn't an
228+
// Error and no cause can be set.
231229
if (livenessError instanceof Error) livenessError.cause = drainError;
232230
console.error(
233-
"renderWithMantineTransitions auto-settle: the drain also threw " +
234-
"(reported as the liveness error's cause):",
231+
"renderWithMantineTransitions auto-settle: the drain also threw:",
235232
drainError,
236233
);
237234
}
@@ -256,13 +253,14 @@ function assertLiveContainersConnected(
256253
throw new Error(
257254
`renderWithMantineTransitions auto-settle: a still-mounted armed tree was ` +
258255
`detached ${when === "before" ? "before the settle started" : "while the settle was in flight"}, ` +
259-
"so the settle drained nothing and the #1760 leak is reopened. Candidate " +
260-
"causes: (a) a bare mid-body `cleanup()` in the test — use the " +
261-
"`unmount()` returned by renderWithMantineTransitions instead (it drops " +
262-
"the tree from the liveness set); or (b) `cleanup()` moved off setup.ts's " +
263-
"setupFile (outer) hook to a same-level afterEach, so it no longer runs " +
264-
"after this one (the `sequence.hooks` pin is defense-in-depth, not the " +
265-
"guarantee — see the ordering note here).",
256+
"so the settle drained against a dead tree and the #1760 leak is " +
257+
"reopened. Candidate causes: (a) a bare mid-body `cleanup()` in the test " +
258+
"— use the `unmount()` returned by renderWithMantineTransitions instead " +
259+
"(it drops the tree from the liveness set); or (b) `cleanup()` moved off " +
260+
"setup.ts's setupFile (outer) hook to a same-level afterEach, so it no " +
261+
"longer runs after this one (the `sequence.hooks` pin is defense-in-" +
262+
"depth, not the guarantee — see the auto-settle ordering note in " +
263+
"renderWithMantine.tsx).",
266264
);
267265
}
268266
}

0 commit comments

Comments
 (0)