Skip to content

OpenAI's Codex Security CLI and TypeScript SDK for finding, validating, and fixing security vulnerabilities. npm: https://www.npmjs.com/package/@openai/codex-security

test(ci): balance MCP receipt coverage across two shards (#1924)

Michael D'Angelob871240092dc
diff --git a/.github/workflows/node-ci.yml b/.github/workflows/node-ci.yml
index 683389268..aee89a0f2 100644
--- a/.github/workflows/node-ci.yml
+++ b/.github/workflows/node-ci.yml
@@ -257,7 +257,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- shard: [1, 2, 3]
+ shard: [1, 2]
steps:
- *checkout-repository
- &set-up-mcp-tools
diff --git a/plugins/codex-security/mcp-app/tests/deep_scan_coverage_fixture.ts b/plugins/codex-security/mcp-app/tests/deep_scan_coverage_fixture.ts
index 44d8e4e75..63c9d0967 100644
--- a/plugins/codex-security/mcp-app/tests/deep_scan_coverage_fixture.ts
+++ b/plugins/codex-security/mcp-app/tests/deep_scan_coverage_fixture.ts
@@ -1,7 +1,7 @@
import assert from "node:assert/strict";
import { execFile } from "node:child_process";
import { randomUUID } from "node:crypto";
-import { mkdir, readFile, readdir, writeFile } from "node:fs/promises";
+import { mkdir, readFile, readdir, rm, writeFile } from "node:fs/promises";
import path from "node:path";
import { fileURLToPath, pathToFileURL } from "node:url";
import { promisify } from "node:util";
@@ -10,6 +10,7 @@ import { build } from "esbuild";
import type { JsonObject } from "../src/types.js";
import type { CodexWorkerRequest } from "../src/deep-scan/types.js";
import { readJson } from "./support/json.ts";
+import { temporaryDirectory } from "./support/temporary-directories.ts";
type FixtureRuntime = typeof import("../src/deep-scan/artifacts.js") &
typeof import("../src/deep-scan/coordinator.js") &
@@ -101,6 +102,15 @@ const bundled = await build({
loader: { ".md": "text" },
write: false,
});
+export async function publishReceiptFixture(options: CoverageFixtureOptions) {
+ const root = await temporaryDirectory("retry-coverage-receipts-");
+ try {
+ await publishCoverageFixture(root, "complete", options);
+ } finally {
+ await rm(root, { recursive: true, force: true });
+ }
+}
+
export async function publishCoverageFixture(
root: string,
completeness: string,
diff --git a/plugins/codex-security/mcp-app/tests/test_retry_coverage_receipts.ts b/plugins/codex-security/mcp-app/tests/test_retry_coverage_receipts.ts
deleted file mode 100644
index f0e958465..000000000
--- a/plugins/codex-security/mcp-app/tests/test_retry_coverage_receipts.ts
+++ /dev/null
@@ -1,394 +0,0 @@
-import { mkdtemp, rm } from "node:fs/promises";
-import { tmpdir } from "node:os";
-import path from "node:path";
-import test from "node:test";
-import { publishCoverageFixture } from "./deep_scan_coverage_fixture.ts";
-
-for (const resume of [false, true]) {
- for (const outcome of ["completion", "recovery", "no parent"]) {
- for (const retryPending of [false, true]) {
- test(`archived receipt and pending records survive ${resume ? "reconstruction" : "live retry"} and ${outcome} with ${retryPending ? "an updated gap" : "a clean retry"}`, async () => {
- const root = await mkdtemp(path.join(tmpdir(), "retry-coverage-"));
- try {
- await publishCoverageFixture(root, "complete", {
- receiptRetry: true,
- retryPending,
- stopAfterDraft: outcome === "recovery",
- stopBeforeDraft: outcome === "no parent",
- resume,
- });
- } finally {
- await rm(root, { recursive: true, force: true });
- }
- });
- }
- }
-}
-
-for (const resume of [false, true]) {
- for (const outcome of ["completion", "recovery", "no parent"]) {
- for (const receiptSpelling of ["scan", "equivalent scan"] as const) {
- test(`receipt namespace survives ${resume ? "reconstruction" : "live retry"} and ${outcome} with ${receiptSpelling} spelling`, async () => {
- const root = await mkdtemp(path.join(tmpdir(), "receipt-namespace-"));
- try {
- await publishCoverageFixture(root, "complete", {
- receiptRetry: true,
- receiptSpelling,
- stopAfterDraft: outcome === "recovery",
- stopBeforeDraft: outcome === "no parent",
- resume,
- });
- } finally {
- await rm(root, { recursive: true, force: true });
- }
- });
- }
- }
-}
-
-for (const resume of [false, true]) {
- for (const outcome of ["completion", "recovery", "no parent"]) {
- for (const activeReceiptSpelling of ["scan", "equivalent scan"] as const) {
- test(`active receipt namespace survives ${resume ? "reconstruction" : "live retry"} and ${outcome} with ${activeReceiptSpelling} spelling`, async () => {
- const root = await mkdtemp(
- path.join(tmpdir(), "active-receipt-namespace-"),
- );
- try {
- await publishCoverageFixture(root, "complete", {
- receiptRetry: true,
- activeReceiptSpelling,
- stopAfterDraft: outcome === "recovery",
- stopBeforeDraft: outcome === "no parent",
- resume,
- });
- } finally {
- await rm(root, { recursive: true, force: true });
- }
- });
- }
- }
-}
-
-for (const resume of [false, true]) {
- for (const outcome of ["completion", "recovery", "no parent"]) {
- for (const receiptSpelling of [
- "active scan",
- "equivalent active scan",
- ] as const) {
- test(`linked archived receipts survive ${resume ? "reconstruction" : "live retry"} and ${outcome} with ${receiptSpelling} spelling`, async () => {
- const root = await mkdtemp(path.join(tmpdir(), "receipt-namespace-"));
- try {
- await publishCoverageFixture(root, "complete", {
- receiptRetry: true,
- receiptSpelling,
- stopAfterDraft: outcome === "recovery",
- stopBeforeDraft: outcome === "no parent",
- resume,
- });
- } finally {
- await rm(root, { recursive: true, force: true });
- }
- });
- }
- }
-}
-
-for (const resume of [false, true]) {
- for (const outcome of ["completion", "recovery", "no parent"]) {
- test(`shared scan receipts survive ${resume ? "reconstruction" : "live retry"} and ${outcome}`, async () => {
- const root = await mkdtemp(path.join(tmpdir(), "shared-scan-receipts-"));
- try {
- await publishCoverageFixture(root, "complete", {
- receiptRetry: true,
- sharedReceipt: true,
- stopAfterDraft: outcome === "recovery",
- stopBeforeDraft: outcome === "no parent",
- resume,
- });
- } finally {
- await rm(root, { recursive: true, force: true });
- }
- });
- }
-}
-
-for (const resume of [false, true]) {
- for (const outcome of ["completion", "recovery", "no parent"]) {
- for (const receiptSpelling of [
- "shared scan",
- "equivalent shared scan",
- ] as const) {
- test(`archived shared receipts survive ${resume ? "reconstruction" : "live retry"} and ${outcome} with ${receiptSpelling} spelling`, async () => {
- const root = await mkdtemp(
- path.join(tmpdir(), "archived-shared-receipts-"),
- );
- try {
- await publishCoverageFixture(root, "complete", {
- receiptRetry: true,
- receiptSpelling,
- stopAfterDraft: outcome === "recovery",
- stopBeforeDraft: outcome === "no parent",
- resume,
- });
- } finally {
- await rm(root, { recursive: true, force: true });
- }
- });
- }
- }
-}
-
-for (const resume of [false, true]) {
- for (const outcome of ["completion", "recovery", "no parent"]) {
- for (const sharedReceipt of [false, true]) {
- test(`empty receipt survives ${resume ? "reconstruction" : "live retry"} and ${outcome} with ${sharedReceipt ? "shared" : "worker"} current evidence`, async () => {
- const root = await mkdtemp(
- path.join(tmpdir(), "empty-current-receipts-"),
- );
- try {
- await publishCoverageFixture(root, "complete", {
- receiptRetry: true,
- sharedReceipt,
- emptyReceipt: true,
- stopAfterDraft: outcome === "recovery",
- stopBeforeDraft: outcome === "no parent",
- resume,
- });
- } finally {
- await rm(root, { recursive: true, force: true });
- }
- });
- }
- for (const receiptSpelling of [
- "shared scan",
- "equivalent shared scan",
- ] as const) {
- test(`empty receipt survives ${resume ? "reconstruction" : "live retry"} and ${outcome} with archived ${receiptSpelling} evidence`, async () => {
- const root = await mkdtemp(
- path.join(tmpdir(), "empty-archived-receipts-"),
- );
- try {
- await publishCoverageFixture(root, "complete", {
- receiptRetry: true,
- receiptSpelling,
- emptyReceipt: true,
- stopAfterDraft: outcome === "recovery",
- stopBeforeDraft: outcome === "no parent",
- resume,
- });
- } finally {
- await rm(root, { recursive: true, force: true });
- }
- });
- }
- }
-}
-
-for (const resume of [false, true]) {
- for (const outcome of ["completion", "recovery", "no parent"]) {
- test(`worker-local receipts win parent collisions during ${resume ? "reconstruction" : "live retry"} and ${outcome}`, async () => {
- const root = await mkdtemp(
- path.join(tmpdir(), "worker-receipt-collision-"),
- );
- try {
- await publishCoverageFixture(root, "complete", {
- receiptRetry: true,
- receiptCollision: true,
- stopAfterDraft: outcome === "recovery",
- stopBeforeDraft: outcome === "no parent",
- resume,
- });
- } finally {
- await rm(root, { recursive: true, force: true });
- }
- });
- }
-}
-
-for (const resume of [false, true]) {
- for (const outcome of ["completion", "recovery", "no parent"]) {
- test(`inherited shared receipts retain their owner across retry collisions during ${resume ? "reconstruction" : "live retry"} and ${outcome}`, async () => {
- const root = await mkdtemp(
- path.join(tmpdir(), "shared-receipt-collision-"),
- );
- try {
- await publishCoverageFixture(root, "complete", {
- receiptRetry: true,
- receiptSpelling: "shared scan",
- receiptCollision: true,
- stopAfterDraft: outcome === "recovery",
- stopBeforeDraft: outcome === "no parent",
- resume,
- });
- } finally {
- await rm(root, { recursive: true, force: true });
- }
- });
- }
-}
-
-const receiptOwnershipCases = [
- [
- "third attempt shared collision",
- {
- extraReceiptRetry: true,
- receiptSpelling: "shared scan",
- receiptCollision: true,
- },
- ],
- [
- "returned shared coverage rewrite collision",
- {
- rewriteReturnedCoverage: true,
- receiptSpelling: "shared scan",
- receiptCollision: true,
- },
- ],
- [
- "shared and new local same spelling",
- {
- sameNamedNewSurface: true,
- receiptSpelling: "shared scan",
- receiptCollision: true,
- },
- ],
- [
- "third attempt shared no collision control",
- {
- extraReceiptRetry: true,
- receiptSpelling: "shared scan",
- receiptCollision: false,
- },
- ],
- [
- "returned worker-local coverage control",
- {
- rewriteReturnedCoverage: true,
- receiptSpelling: "worker",
- receiptCollision: true,
- },
- ],
- [
- "worker-local same spelling control",
- {
- sameNamedNewSurface: true,
- receiptSpelling: "worker",
- receiptCollision: true,
- },
- ],
-] as const;
-for (const [name, options] of receiptOwnershipCases)
- test(name, async () => {
- const root = await mkdtemp(path.join(tmpdir(), "supported-receipt-owner-"));
- try {
- await publishCoverageFixture(root, "complete", {
- receiptRetry: true,
- ...options,
- });
- } finally {
- await rm(root, { recursive: true, force: true });
- }
- });
-
-for (const resume of [false, true]) {
- for (const [name, receiptSpelling, receiptCollision] of [
- ["shared same-name collision", "shared scan", true],
- ["shared distinct-name control", "shared scan", false],
- ["worker-local same-name control", "worker", true],
- ] as const) {
- test(`same surface generic closeout retains both receipt owners: ${name}, ${resume ? "reconstructed" : "live"}`, async () => {
- const root = await mkdtemp(path.join(tmpdir(), "same-surface-closeout-"));
- try {
- await publishCoverageFixture(root, "complete", {
- receiptRetry: true,
- closeRetriedSurface: true,
- receiptSpelling,
- receiptCollision,
- resume,
- });
- } finally {
- await rm(root, { recursive: true, force: true });
- }
- });
- }
-}
-
-for (const resume of [false, true]) {
- for (const receiptOwnershipRetry of [
- "ordinary",
- "candidate",
- "unrelated",
- ] as const) {
- for (const [name, receiptSpelling, receiptCollision] of [
- ["shared same-name collision", "shared scan", true],
- ["shared distinct-name control", "shared scan", false],
- ["worker-local control", "worker", true],
- ] as const) {
- test(`receipt ownership follows the authored observation: ${receiptOwnershipRetry}, ${name}, ${resume ? "reconstructed" : "live"}`, async () => {
- const root = await mkdtemp(
- path.join(tmpdir(), "receipt-owner-observation-"),
- );
- try {
- await publishCoverageFixture(root, "complete", {
- receiptRetry: true,
- receiptOwnershipRetry,
- receiptSpelling,
- receiptCollision,
- resume,
- });
- } finally {
- await rm(root, { recursive: true, force: true });
- }
- });
- }
- }
-}
-
-for (const resume of [false, true]) {
- for (const outcome of ["completion", "recovery", "no parent"]) {
- for (const [name, firstCheckpointReceipt, receiptCollision] of [
- ["shared same-name collision", "shared", true],
- ["shared distinct-name control", "shared", false],
- ["worker-local priority control", "worker", false],
- ] as const) {
- test(`first checkpoint receipt ownership survives ${resume ? "reconstruction" : "live execution"} and ${outcome}: ${name}`, async () => {
- const root = await mkdtemp(
- path.join(tmpdir(), "first-checkpoint-owner-"),
- );
- try {
- await publishCoverageFixture(root, "complete", {
- firstCheckpointReceipt,
- receiptCollision,
- resume,
- stopAfterDraft: outcome === "recovery",
- stopBeforeDraft: outcome === "no parent",
- });
- } finally {
- await rm(root, { recursive: true, force: true });
- }
- });
- }
- }
-}
-
-for (const resume of [false, true]) {
- for (const [name, firstCheckpointReceipt, receiptCollision] of [
- ["shared same-name collision", "shared", true],
- ["shared distinct-name control", "shared", false],
- ["worker-local priority control", "worker", false],
- ] as const) {
- test(`same attempt closeout retains both receipt owners: ${name}, ${resume ? "reconstructed" : "live"}`, async () => {
- const root = await mkdtemp(path.join(tmpdir(), "same-attempt-closeout-"));
- try {
- await publishCoverageFixture(root, "complete", {
- firstCheckpointReceipt,
- sameAttemptCloseout: true,
- receiptCollision,
- resume,
- });
- } finally {
- await rm(root, { recursive: true, force: true });
- }
- });
- }
-}
diff --git a/plugins/codex-security/mcp-app/tests/test_retry_coverage_receipts_namespaces.ts b/plugins/codex-security/mcp-app/tests/test_retry_coverage_receipts_namespaces.ts
new file mode 100644
index 000000000..868924474
--- /dev/null
+++ b/plugins/codex-security/mcp-app/tests/test_retry_coverage_receipts_namespaces.ts
@@ -0,0 +1,65 @@
+import test from "node:test";
+import { publishReceiptFixture } from "./deep_scan_coverage_fixture.ts";
+
+for (const resume of [false, true]) {
+ for (const outcome of ["completion", "recovery", "no parent"]) {
+ for (const retryPending of [false, true]) {
+ test(`archived receipt and pending records survive ${resume ? "reconstruction" : "live retry"} and ${outcome} with ${retryPending ? "an updated gap" : "a clean retry"}`, () =>
+ publishReceiptFixture({
+ receiptRetry: true,
+ retryPending,
+ stopAfterDraft: outcome === "recovery",
+ stopBeforeDraft: outcome === "no parent",
+ resume,
+ }));
+ }
+ }
+}
+
+for (const resume of [false, true]) {
+ for (const outcome of ["completion", "recovery", "no parent"]) {
+ for (const receiptSpelling of ["scan", "equivalent scan"] as const) {
+ test(`receipt namespace survives ${resume ? "reconstruction" : "live retry"} and ${outcome} with ${receiptSpelling} spelling`, () =>
+ publishReceiptFixture({
+ receiptRetry: true,
+ receiptSpelling,
+ stopAfterDraft: outcome === "recovery",
+ stopBeforeDraft: outcome === "no parent",
+ resume,
+ }));
+ }
+ }
+}
+
+for (const resume of [false, true]) {
+ for (const outcome of ["completion", "recovery", "no parent"]) {
+ for (const activeReceiptSpelling of ["scan", "equivalent scan"] as const) {
+ test(`active receipt namespace survives ${resume ? "reconstruction" : "live retry"} and ${outcome} with ${activeReceiptSpelling} spelling`, () =>
+ publishReceiptFixture({
+ receiptRetry: true,
+ activeReceiptSpelling,
+ stopAfterDraft: outcome === "recovery",
+ stopBeforeDraft: outcome === "no parent",
+ resume,
+ }));
+ }
+ }
+}
+
+for (const resume of [false, true]) {
+ for (const outcome of ["completion", "recovery", "no parent"]) {
+ for (const receiptSpelling of [
+ "active scan",
+ "equivalent active scan",
+ ] as const) {
+ test(`linked archived receipts survive ${resume ? "reconstruction" : "live retry"} and ${outcome} with ${receiptSpelling} spelling`, () =>
+ publishReceiptFixture({
+ receiptRetry: true,
+ receiptSpelling,
+ stopAfterDraft: outcome === "recovery",
+ stopBeforeDraft: outcome === "no parent",
+ resume,
+ }));
+ }
+ }
+}
diff --git a/plugins/codex-security/mcp-app/tests/test_retry_coverage_receipts_ownership.ts b/plugins/codex-security/mcp-app/tests/test_retry_coverage_receipts_ownership.ts
new file mode 100644
index 000000000..10d6d961f
--- /dev/null
+++ b/plugins/codex-security/mcp-app/tests/test_retry_coverage_receipts_ownership.ts
@@ -0,0 +1,135 @@
+import test from "node:test";
+import { publishReceiptFixture } from "./deep_scan_coverage_fixture.ts";
+
+const receiptOwnershipCases = [
+ [
+ "third attempt shared collision",
+ {
+ extraReceiptRetry: true,
+ receiptSpelling: "shared scan",
+ receiptCollision: true,
+ },
+ ],
+ [
+ "returned shared coverage rewrite collision",
+ {
+ rewriteReturnedCoverage: true,
+ receiptSpelling: "shared scan",
+ receiptCollision: true,
+ },
+ ],
+ [
+ "shared and new local same spelling",
+ {
+ sameNamedNewSurface: true,
+ receiptSpelling: "shared scan",
+ receiptCollision: true,
+ },
+ ],
+ [
+ "third attempt shared no collision control",
+ {
+ extraReceiptRetry: true,
+ receiptSpelling: "shared scan",
+ receiptCollision: false,
+ },
+ ],
+ [
+ "returned worker-local coverage control",
+ {
+ rewriteReturnedCoverage: true,
+ receiptSpelling: "worker",
+ receiptCollision: true,
+ },
+ ],
+ [
+ "worker-local same spelling control",
+ {
+ sameNamedNewSurface: true,
+ receiptSpelling: "worker",
+ receiptCollision: true,
+ },
+ ],
+] as const;
+for (const [name, options] of receiptOwnershipCases)
+ test(name, () =>
+ publishReceiptFixture({
+ receiptRetry: true,
+ ...options,
+ }),
+ );
+
+for (const resume of [false, true]) {
+ for (const [name, receiptSpelling, receiptCollision] of [
+ ["shared same-name collision", "shared scan", true],
+ ["shared distinct-name control", "shared scan", false],
+ ["worker-local same-name control", "worker", true],
+ ] as const) {
+ test(`same surface generic closeout retains both receipt owners: ${name}, ${resume ? "reconstructed" : "live"}`, () =>
+ publishReceiptFixture({
+ receiptRetry: true,
+ closeRetriedSurface: true,
+ receiptSpelling,
+ receiptCollision,
+ resume,
+ }));
+ }
+}
+
+for (const resume of [false, true]) {
+ for (const receiptOwnershipRetry of [
+ "ordinary",
+ "candidate",
+ "unrelated",
+ ] as const) {
+ for (const [name, receiptSpelling, receiptCollision] of [
+ ["shared same-name collision", "shared scan", true],
+ ["shared distinct-name control", "shared scan", false],
+ ["worker-local control", "worker", true],
+ ] as const) {
+ test(`receipt ownership follows the authored observation: ${receiptOwnershipRetry}, ${name}, ${resume ? "reconstructed" : "live"}`, () =>
+ publishReceiptFixture({
+ receiptRetry: true,
+ receiptOwnershipRetry,
+ receiptSpelling,
+ receiptCollision,
+ resume,
+ }));
+ }
+ }
+}
+
+for (const resume of [false, true]) {
+ for (const outcome of ["completion", "recovery", "no parent"]) {
+ for (const [name, firstCheckpointReceipt, receiptCollision] of [
+ ["shared same-name collision", "shared", true],
+ ["shared distinct-name control", "shared", false],
+ ["worker-local priority control", "worker", false],
+ ] as const) {
+ test(`first checkpoint receipt ownership survives ${resume ? "reconstruction" : "live execution"} and ${outcome}: ${name}`, () =>
+ publishReceiptFixture({
+ firstCheckpointReceipt,
+ receiptCollision,
+ resume,
+ stopAfterDraft: outcome === "recovery",
+ stopBeforeDraft: outcome === "no parent",
+ }));
+ }
+ }
+}
+
+for (const resume of [false, true]) {
+ for (const [name, firstCheckpointReceipt, receiptCollision] of [
+ ["shared same-name collision", "shared", true],
+ ["shared distinct-name control", "shared", false],
+ ["worker-local priority control", "worker", false],
+ ] as const) {
+ test(`same attempt closeout retains both receipt owners: ${name}, ${resume ? "reconstructed" : "live"}`, () =>
+ publishReceiptFixture({
+ firstCheckpointReceipt,
+ sameAttemptCloseout: true,
+ receiptCollision,
+ resume,
+ }));
+ }
+}
diff --git a/plugins/codex-security/mcp-app/tests/test_retry_coverage_receipts_shared.ts b/plugins/codex-security/mcp-app/tests/test_retry_coverage_receipts_shared.ts
new file mode 100644
index 000000000..0fa19383d
--- /dev/null
+++ b/plugins/codex-security/mcp-app/tests/test_retry_coverage_receipts_shared.ts
@@ -0,0 +1,90 @@
+import test from "node:test";
+import { publishReceiptFixture } from "./deep_scan_coverage_fixture.ts";
+
+for (const resume of [false, true]) {
+ for (const outcome of ["completion", "recovery", "no parent"]) {
+ test(`shared scan receipts survive ${resume ? "reconstruction" : "live retry"} and ${outcome}`, () =>
+ publishReceiptFixture({
+ receiptRetry: true,
+ sharedReceipt: true,
+ stopAfterDraft: outcome === "recovery",
+ stopBeforeDraft: outcome === "no parent",
+ resume,
+ }));
+ }
+}
+
+for (const resume of [false, true]) {
+ for (const outcome of ["completion", "recovery", "no parent"]) {
+ for (const receiptSpelling of [
+ "shared scan",
+ "equivalent shared scan",
+ ] as const) {
+ test(`archived shared receipts survive ${resume ? "reconstruction" : "live retry"} and ${outcome} with ${receiptSpelling} spelling`, () =>
+ publishReceiptFixture({
+ receiptRetry: true,
+ receiptSpelling,
+ stopAfterDraft: outcome === "recovery",
+ stopBeforeDraft: outcome === "no parent",
+ resume,
+ }));
+ }
+ }
+}
+
+for (const resume of [false, true]) {
+ for (const outcome of ["completion", "recovery", "no parent"]) {
+ for (const sharedReceipt of [false, true]) {
+ test(`empty receipt survives ${resume ? "reconstruction" : "live retry"} and ${outcome} with ${sharedReceipt ? "shared" : "worker"} current evidence`, () =>
+ publishReceiptFixture({
+ receiptRetry: true,
+ sharedReceipt,
+ emptyReceipt: true,
+ stopAfterDraft: outcome === "recovery",
+ stopBeforeDraft: outcome === "no parent",
+ resume,
+ }));
+ }
+ for (const receiptSpelling of [
+ "shared scan",
+ "equivalent shared scan",
+ ] as const) {
+ test(`empty receipt survives ${resume ? "reconstruction" : "live retry"} and ${outcome} with archived ${receiptSpelling} evidence`, () =>
+ publishReceiptFixture({
+ receiptRetry: true,
+ receiptSpelling,
+ emptyReceipt: true,
+ stopAfterDraft: outcome === "recovery",
+ stopBeforeDraft: outcome === "no parent",
+ resume,
+ }));
+ }
+ }
+}
+
+for (const resume of [false, true]) {
+ for (const outcome of ["completion", "recovery", "no parent"]) {
+ test(`worker-local receipts win parent collisions during ${resume ? "reconstruction" : "live retry"} and ${outcome}`, () =>
+ publishReceiptFixture({
+ receiptRetry: true,
+ receiptCollision: true,
+ stopAfterDraft: outcome === "recovery",
+ stopBeforeDraft: outcome === "no parent",
+ resume,
+ }));
+ }
+}
+
+for (const resume of [false, true]) {
+ for (const outcome of ["completion", "recovery", "no parent"]) {
+ test(`inherited shared receipts retain their owner across retry collisions during ${resume ? "reconstruction" : "live retry"} and ${outcome}`, () =>
+ publishReceiptFixture({
+ receiptRetry: true,
+ receiptSpelling: "shared scan",
+ receiptCollision: true,
+ stopAfterDraft: outcome === "recovery",
+ stopBeforeDraft: outcome === "no parent",
+ resume,
+ }));
+ }
+}
diff --git a/sdk/typescript/TESTING.md b/sdk/typescript/TESTING.md
index 26b5e823c..0f5ba89cb 100644
--- a/sdk/typescript/TESTING.md
+++ b/sdk/typescript/TESTING.md
@@ -151,7 +151,7 @@ Source qualification runs the full Bun suite once per OS under Node 22: six
file shards on Linux and macOS, and fourteen on Windows. GitHub runs the shards
as separate jobs; each job uses Bun's default serial runner. The other selected
Node versions run the installed-package checks instead of repeating the same
-Bun suite. MCP tests run in three required jobs using Node's native file sharding,
+Bun suite. MCP tests run in two required jobs using Node's native file sharding,
with two isolated test file processes per job. Local and release `test:mcp`
commands still run the full suite. Python tests run separately and use four
isolated pytest-xdist workers with work stealing; worker crashes fail the run