test: reduce brittle assertions and test-only runtime paths (#9289)

* test: focus assertions on behavioral evidence

Prune redundant and wording-coupled checks while retaining diagnostic, parser, recovery, and cleanup coverage.

* refactor: remove test-only wrappers and duplicate checks

Exercise production operations through test fixtures, remove unused adapters, and keep managed-member uncertainty guidance under its existing owner.

* test: focus process validation on diagnostic facts

* refactor: remove test-only runtime helpers

Move semantic evidence fixture setup out of runtime and remove unused Windows settle recovery helpers while checking configured defaults independently.

* test: focus artifact diagnostics on format facts

* test: verify retained cleanup guidance delivery
This commit is contained in:
morluto authored and GitHub committed 2026-11-08 02:02:31 +08:00
1 parent 5679ed66f4
commit 352a846127
268 files changed
+586 -1141

No files matched your search

@@ -394,7 +394,6 @@ it.each([false, true])(
releaseClose();
const result = await opening;
expect(result.ok).toBe(false);
if (result.ok) throw new Error("Expected failed resource switch");
expect(result.error.cleanupPrimary).toBeInstanceOf(AnalysisCancelledError);
expect(result.error.cleanupPrimary?.cause).toBe(reason);
@@ -480,7 +479,6 @@ it("keeps an earlier resource close failure primary when a later cleanup is canc
releaseCandidateClose();
const result = await opening;
expect(result.ok).toBe(false);
if (result.ok) throw new Error("Expected failed resource switch");
expect(result.error).toBe(originalFailure);
expect(result.error.cleanupPrimary).toBeUndefined();
@@ -569,7 +567,6 @@ it("keeps cancellation primary when binary retirement fails before opening resou
releaseClose();
const result = await opening;
expect(result.ok).toBe(false);
if (result.ok) throw new Error("Expected failed resource open");
expect(result.error.cleanupPrimary).toBeInstanceOf(AnalysisCancelledError);
expect(result.error.cleanupPrimary?.cause).toBe(reason);
@@ -661,7 +658,6 @@ it("keeps an earlier resource close failure primary when binary candidate cleanu
releaseCandidateClose();
const result = await opening;
expect(result.ok).toBe(false);
if (result.ok) throw new Error("Expected failed binary open");
expect(result.selection).toEqual({ kind: "none" });
expect(result.error).toBe(originalFailure);
@@ -765,7 +761,6 @@ it("keeps an earlier binary close failure primary when candidate cleanup is canc
releaseCandidateClose();
const result = await opening;
expect(result.ok).toBe(false);
if (result.ok) throw new Error("Expected failed resource open");
expect(result.error).toBe(originalFailure);
expect(result.error.cleanupPrimary).toBeUndefined();
@@ -866,7 +861,6 @@ it("cancels a binary switch during resource retirement and retains null-subject
releaseResourceClose();
const result = await opening;
expect(result.ok).toBe(false);
if (result.ok) throw new Error("Expected cancelled binary open");
expect(result.error.cleanupPrimary).toBeInstanceOf(AnalysisCancelledError);
expect(result.error.cleanupPrimary?.cause).toBe(reason);
@@ -97,7 +97,6 @@ it("reports the first mixed child failure before awaiting the other owner and re
await Promise.all([nativeStarted, failureObserved]);
releaseNativeClose();
const first = await closing;
expect(first.ok).toBe(false);
if (first.ok) throw new Error("Expected mixed close failure");
expect(first.error.cleanupIncomplete).toBe(true);
@@ -113,7 +113,6 @@ it("retains every failed child resource across composite cleanup retries", async
for (let attempt = 0; attempt < 2; attempt += 1) {
const closed = await client.close();
expect(closed.ok).toBe(false);
if (closed.ok) throw new Error("Expected composite cleanup failure");
expect(closed.error).toMatchObject({
cleanupIncomplete: true,
@@ -158,7 +157,6 @@ it("preserves one child's typed cleanup error unchanged", async () => {
const closed = await client.close();
expect(closed.ok).toBe(false);
if (closed.ok) throw new Error("Expected child cleanup failure");
expect(closed.error).toBe(child.cleanupError);
});
@@ -306,7 +304,6 @@ it.each([1, 2])(
release();
}
const first = await closing;
expect(first.ok).toBe(false);
if (first.ok) throw new Error("Expected retained child cleanup");
expect(notifications).toEqual([
...children.map((child) => child.cleanupError),
@@ -318,7 +315,6 @@ it.each([1, 2])(
notifications.length = 0;
const retried = await closeAnalysisClient(client, "composite", options);
expect(retried.ok).toBe(false);
if (retried.ok) throw new Error("Expected failed cleanup retry");
expect(notifications).toEqual([
...children.map((child) => child.cleanupError),