mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-23 09:07:46 +02:00
## Thinking Path > - Paperclip lets people manage agents that do useful work. > - Users need complete tasks, clear questions, retained context, and dependable recovery. > - Separate run tests do not prove that the complete user experience works. > - Successful retries can hide earlier failures and missing evidence. > - This PR extends the existing Product E2E harness with three explicit journeys. > - It adds a qualification checkpoint over the full retained result pool. > - Independent artifacts, state, rendered conversations, and delivery receipts establish each outcome. ## Linked Issues or Issue Description Refs #17088, #17089, and #17046. This PR repairs two Stop lifecycle defects and combines the qualification changes previously reviewed in #17095, #17090, and #17099. Daily operations remain with #17051. It adds no second scheduler or recovery engine. **What happened?** A completed run can still leave a user without useful output, an understandable question, or a working continuation. Existing isolated tests and best-attempt reports do not establish the combined behavior. **Expected behavior** A necessary question includes its explanation and resumes once after an answer. Stop prevents automatic continuation until the user resumes. Restart during finalization preserves the accepted provider result and delivers it once. Qualification requires independent evidence for six journeys on both agents through Slack and Paperclip. **Steps to reproduce** List the necessary-question, followup-stop-resume, and finalization-recovery suites using the documented selectors. Run one exact cell with the configured model and target. Supply a private qualification manifest to the existing report command to grade all retained attempts. Missing proof and incomplete coverage must fail. ## What Changed - Wake existing accounting in the same committed native Stop closure. A receipt that arrives before closure must still settle once; incomplete receipts remain held. - Require a later user message before native Stop can promote earlier saved input. Preserve those earlier messages for the authorized resumption. - Add explicit necessary-question cells. Verify the actual prompt and context, answer, one bound continuation, and the delivered document link and revision. - Add explicit follow-up, Stop, and later resumption cells. Verify a live owned provider turn, cancellation acknowledgement, at least five seconds without an automatic path, retained direction and workspace context, and an actual browser download. - Add explicit Daytona finalization-recovery cells. Stop the owned controller after public result acceptance and during workspace finalization. Require the original result, restored file hash, resumed operation, one provider turn, and one receipt-bound delivery. - Share the receipt-based delivery observer across both recovery journeys. Keep model prose separate from the authoritative delivered comment identity. - Add a 24-cell qualification checkpoint over every retained attempt. Require three fresh candidate passes per cell and later staging proof with exact source, runtime, model, settings, instructions, and independent evidence. - Reject absent or unsafe manifest evidence. Preserve failed attempts and incomplete observations in the normal reports. - Provide four explicit rotating daily selections. Refuse daily selection until all required live drivers exist. Keep scheduling and spending with the existing operations owner. - Document the exact selectors, evidence contract, limitations, and remaining staging work. ## Verification - Local Product E2E support: 3,554 passed with two existing skips; source prerequisites: 128 passed. E2E typecheck passes. The actual file-chip and Download-control browser regression passes. - Two real-database regressions fail before the production repair. The stopped coordinator leaves accounting asleep after a complete receipt; the saved queue can restart from pre-Stop input. The repaired settlement and cancellation cohort passes 66 checks. The complete 256-case continuation suite passes with stronger two-phase Stop expectations, and 66 native executor accounting/Stop safety cases pass. Server typecheck passes. - All required CI, repository build/typecheck/tests, and fresh Greptile 5/5 pass at the final head232d3c52d0, with no unresolved findings. - Both actual-model necessary-question development cells passed on the earlier recordedc4e409d819source. This is supporting evidence for that revision, not current qualification. - Both fresh Stop development cells at6036cee2f4stopped, remained idle, resumed once, reached Done, and settled original and successor accounting. Their original machine grades remain failed: the observer counted the generated file-preparation carrier as another final reply. The corrected observer independently correlates the applied preparation receipt with the actual attachment/comment binding. Retained-wire diagnostic replay finds one final delivery for each model without changing either grade. Those original failures remain retained: https://github.com/paperclipai/paperclip/actions/runs/39644220458. - Both fresh actual-model Stop/resume cells pass all five checks at232d3c52d0: https://github.com/paperclipai/paperclip/actions/runs/39647010372. Independent inspection confirms exactly one cancelled original and one committed successor on the same task, 5.091/5.513-second quiet intervals before the user resumes, retained workspace/instructions/tool identities, and one receipt-bound final response. Each visible JSON chip opens in a tab and its Download control yields verified bytes. The rendered reference and changed label independently reconstruct the registered file hash and the original context hash. Both cleanups pass. These remain local API-key/per-turn development results, not the required staging/Slack qualification. - Other retained Stop failures include missed active boundaries, the real accounting admission failure, and a preparation observer that required nativeIssueId before runtime selection. They remain recorded at https://github.com/paperclipai/paperclip/actions/runs/39636796645 and https://github.com/paperclipai/paperclip/actions/runs/39642060165. The preparation observer now validates all present task IDs and still requires selected native execution at the active checkpoint. - The remote finalization attempt failed during image export with no disk space before a provider started. Remote crash acceptance remains unverified. - Negative calibration rejects wrong or absent ownership/evidence, stale settings, unsafe files, repeated admissions, unacknowledged Stop, premature resumption, incomplete receipts, lost context, genuine duplicate final replies, and missing delivery. A prepared-looking body cannot suppress a comment; absent, rejected, foreign, or mismatched file receipts and attachment bindings also cannot suppress it. - Core staging/Slack drivers, 72 fresh candidate passes, deployed staging proof, and recovery of the original user-visible task remain incomplete. No measured reliability percentage or completed qualification is claimed. ## Risks These are explicit development cells. Their API-key and per-turn runs do not qualify deployed subscription authentication, warm reuse, or Slack. A fast provider can miss the Stop boundary; that attempt fails. The remote crash boundary depends on independently observed public state and an owned controller. The checkpoint is opt-in through a private manifest and cannot replace the missing live observers. The two production changes affect native Stop settlement and saved-input promotion. They use the existing transaction signals and admission path. A complete receipt can settle without another provider turn. Partial accounting and all ownership, cleanup, pause, and budget gates remain authoritative. ## Model Used OpenAI Codex, GPT-6 family, with repository tools and code execution. The runtime does not expose its exact deployment ID or context-window size. Those values are not inferred. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip <noreply@paperclip.ing> Co-authored-by: Paperclip <paperclip@paperclip.ing>
233 lines
17 KiB
TypeScript
233 lines
17 KiB
TypeScript
import { expect, it } from "vitest";
|
|
import { execFile } from "node:child_process";
|
|
import { mkdtemp, mkdir, readFile, rm, symlink, writeFile } from "node:fs/promises";
|
|
import os from "node:os";
|
|
import path from "node:path";
|
|
import { promisify } from "node:util";
|
|
import { DEPENDABLE_CELLS, dependableDailySelection, dependableDailyExecutions, dependableExecutionId, dependableRequiredChecks, gradeDependableQualification, gradeRetainedDependableResults,
|
|
type DependableAttempt, type DependableCell, type DependableQualification } from "./dependable-qualification.js";
|
|
import { validateRetainedRunnerResult } from "./result-validation.js";
|
|
|
|
const hash = "a".repeat(64);
|
|
const config: DependableQualification = { revision: "b".repeat(40), startedAt: "2026-10-20T00:00:00Z", candidatePassesPerCell: 3,
|
|
settingsHashes: { codie: hash, claude: hash }, models: { codie: "codie-recorded-model", claude: "claude-recorded-model" },
|
|
instructionsHash: hash, definitionHash: hash, runnerArtifact: `sha256:${hash}` };
|
|
function attempt(cell: DependableCell, index: number, phase: "candidate" | "staging" = "candidate"): DependableAttempt {
|
|
const identity = `${cell}-${index}-${phase}`;
|
|
return { campaignId: `campaign-${identity}`, cell, phase,
|
|
result: { schema: "paperclip.runner-e2e.result/v2", executionId: dependableExecutionId(cell), suiteId: "dependable-work",
|
|
suiteDefinitionHash: hash, source: { sha: config.revision, ref: "refs/heads/candidate", workflowRunUrl: null },
|
|
attempt: 1, status: "passed", profileId: cell.startsWith("codie.") ? "codie" : "claude", environmentId: "daytona",
|
|
caseId: cell.split(".").slice(1).join("-"), provider: cell.startsWith("codie.") ? "codex" : "acpx", model: config.models[cell.startsWith("codie.") ? "codie" : "claude"],
|
|
runtimeMode: "native", issueId: `issue-${identity}`, runIds: [`run-${identity}`],
|
|
startedAt: `2026-10-20T00:0${index}:00Z`, finishedAt: `2026-10-20T00:0${index}:30Z`, durationMs: 30_000, cleanup: "passed",
|
|
matcherResults: dependableRequiredChecks(cell).map(path => ({ matcher: { kind: "json_path", path, expected: true }, passed: true, detail: "Independent observer receipt" })) },
|
|
evidence: { manifestVerified: true, secretScanPassed: true, definitionHash: hash, settingsHash: hash, instructionsHash: hash,
|
|
runnerArtifact: `sha256:${hash}`, revisionAtStart: config.revision, revisionAtEnd: config.revision,
|
|
target: phase === "staging" ? "isolated-staging" : "isolated-candidate" } };
|
|
}
|
|
const complete = () => DEPENDABLE_CELLS.flatMap(cell => [attempt(cell, 1), attempt(cell, 2), attempt(cell, 3), attempt(cell, 4, "staging")]);
|
|
|
|
it("requires 72 fresh candidate passes plus subsequent deployed proof for all 24 cells", () => {
|
|
expect(DEPENDABLE_CELLS).toHaveLength(24);
|
|
const report = gradeDependableQualification(config, complete());
|
|
expect(report.complete).toBe(true);
|
|
expect(report.cells.every(cell => cell.candidatePassed === 3 && cell.stagingPassedAfterCheckpoint === 1)).toBe(true);
|
|
});
|
|
|
|
it("does not convert a partial green pilot into full qualification", () => {
|
|
const report = gradeDependableQualification(config, [attempt(DEPENDABLE_CELLS[0]!, 1)]);
|
|
expect(report.complete).toBe(false);
|
|
expect(report.observations[0]!.qualified).toBe(true);
|
|
expect(report.cells.filter(cell => cell.candidatePassed > 0)).toHaveLength(1);
|
|
});
|
|
|
|
it("does not treat candidate passes or an earlier deployment as subsequent staging proof", () => {
|
|
const rows = complete().map(row => row.phase === "staging" ? attempt(row.cell, 0, "staging") : row);
|
|
expect(gradeDependableQualification(config, rows).complete).toBe(false);
|
|
expect(gradeDependableQualification(config, rows.filter(row => row.phase === "candidate")).complete).toBe(false);
|
|
});
|
|
|
|
it("retains a failed original attempt after fresh passing attempts", () => {
|
|
const failed = attempt(DEPENDABLE_CELLS[0]!, 0); failed.result.status = "failed";
|
|
const report = gradeDependableQualification(config, [failed, ...complete()]);
|
|
expect(report.complete).toBe(true);
|
|
expect(report.failedAttempts).toBe(1);
|
|
expect(report.observations[0]!.originalStatus).toBe("failed");
|
|
expect(report.observations[0]!.problems).toContain("failed-attempt");
|
|
});
|
|
|
|
it.each([
|
|
["green badge without independent checks", (row: DependableAttempt) => { row.result.matcherResults = []; }],
|
|
["agent claim instead of a receipt", (row: DependableAttempt) => { row.result.matcherResults = [{ matcher: { kind: "message_contains", expected: "all passed" }, passed: true, detail: "all passed" }]; }],
|
|
["missing delivery receipt", (row: DependableAttempt) => { row.result.matcherResults!.splice(2, 1); }],
|
|
["failed output oracle", (row: DependableAttempt) => { row.result.matcherResults![3]!.passed = false; }],
|
|
["different provider model", (row: DependableAttempt) => { row.result.model = "development-default"; }],
|
|
["legacy execution", (row: DependableAttempt) => { row.result.runtimeMode = "legacy"; }],
|
|
["relabeled development execution", (row: DependableAttempt) => { row.result.executionId = "automatic-repository.runner-codex.local.automatic-repository-resume"; }],
|
|
["stale effective settings", (row: DependableAttempt) => { row.evidence.settingsHash = "c".repeat(64); }],
|
|
["different instructions", (row: DependableAttempt) => { row.evidence.instructionsHash = "c".repeat(64); }],
|
|
["unidentified runner artifact", (row: DependableAttempt) => { row.evidence.runnerArtifact = "unknown"; }],
|
|
["deployment drift during work", (row: DependableAttempt) => { row.evidence.revisionAtEnd = "c".repeat(40); }],
|
|
["wrong source", (row: DependableAttempt) => { row.result.source!.sha = "c".repeat(40); }],
|
|
["dirty source", (row: DependableAttempt) => { row.result.source!.ref += " (working tree)"; }],
|
|
["different case definition", (row: DependableAttempt) => { row.result.suiteDefinitionHash = "c".repeat(64); }],
|
|
["missing manifest validation", (row: DependableAttempt) => { row.evidence.manifestVerified = false; }],
|
|
["credential leak", (row: DependableAttempt) => { row.evidence.secretScanPassed = false; }],
|
|
["unfinished cleanup", (row: DependableAttempt) => { row.result.cleanup = "failed"; }],
|
|
["historical attempt", (row: DependableAttempt) => { row.result.startedAt = "2026-10-19T23:59:00Z"; }],
|
|
] as const)("rejects %s", (_name, mutate) => {
|
|
const rows = complete(); mutate(rows[0]!);
|
|
const report = gradeDependableQualification(config, rows);
|
|
expect(report.complete).toBe(false);
|
|
expect(report.observations[0]!.qualified).toBe(false);
|
|
});
|
|
|
|
it("rejects duplicate receipts instead of counting one run twice", () => {
|
|
const row = attempt(DEPENDABLE_CELLS[0]!, 1);
|
|
const report = gradeDependableQualification(config, [row, structuredClone(row)]);
|
|
expect(report.complete).toBe(false);
|
|
expect(report.observations).toHaveLength(2);
|
|
expect(report.observations.every(value => !value.qualified && value.problems.includes("duplicate-attempt-receipt"))).toBe(true);
|
|
});
|
|
|
|
it("does not count an existing task or run as a fresh attempt under a new receipt", () => {
|
|
const rows = complete(); rows[1]!.result.issueId = rows[0]!.result.issueId;
|
|
rows[2]!.result.runIds = rows[0]!.result.runIds;
|
|
const report = gradeDependableQualification(config, rows);
|
|
expect(report.complete).toBe(false);
|
|
expect(report.observations.slice(0, 3).every(row => row.problems.includes("reused-task-or-run"))).toBe(true);
|
|
});
|
|
|
|
it("rotates explicit selections through every cell once in six UTC days", () => {
|
|
const selections = Array.from({ length: 6 }, (_, i) => dependableDailySelection(`2026-10-${20 + i}`));
|
|
expect(selections.every(rows => rows.length === 4)).toBe(true);
|
|
expect([...new Set(selections.flat())].sort()).toEqual([...DEPENDABLE_CELLS].sort());
|
|
});
|
|
|
|
it.each(["2026-02-30", "today", "2026-10-20T00:00:00Z"])("rejects ambiguous rotation date %s", date => {
|
|
expect(() => dependableDailySelection(date)).toThrow();
|
|
});
|
|
|
|
it("retains the complete report pool, including failures shadowed by later successes", () => {
|
|
const failed = attempt(DEPENDABLE_CELLS[0]!, 0); failed.result.status = "failed";
|
|
const entries = [failed, ...complete()].map(row => {
|
|
const { result, ...receipt } = row;
|
|
const { manifestVerified: _manifest, secretScanPassed: _scan, ...evidence } = receipt.evidence;
|
|
return { result: { ...result, dependableWork: { ...receipt, evidence } }, evidence: { files: ["final-state.png"], leaks: [], missing: [] }, errors: [] };
|
|
});
|
|
const report = gradeRetainedDependableResults(config, entries);
|
|
expect(report.complete).toBe(true); expect(report.observations).toHaveLength(97); expect(report.failedAttempts).toBe(1);
|
|
entries[0]!.result.dependableWork = undefined as any;
|
|
const incomplete = gradeRetainedDependableResults(config, entries);
|
|
expect(incomplete.complete).toBe(false); expect(incomplete.unclassifiedResults).toHaveLength(1);
|
|
});
|
|
|
|
it("blocks scheduling until every exact daily execution exists in the catalog", () => {
|
|
expect(() => dependableDailyExecutions("2026-10-20", [])).toThrow("not registered");
|
|
expect(dependableDailyExecutions("2026-10-20", DEPENDABLE_CELLS.map(dependableExecutionId))).toHaveLength(4);
|
|
});
|
|
|
|
it("rejects unexpected credential-bearing metadata before retained report processing", () => {
|
|
const row = attempt(DEPENDABLE_CELLS[0]!, 1);
|
|
const { manifestVerified: _manifest, secretScanPassed: _scan, ...evidence } = row.evidence;
|
|
const result = { ...row.result, dependableWork: { campaignId: row.campaignId, cell: row.cell, phase: row.phase, evidence } };
|
|
expect(() => validateRetainedRunnerResult(result)).not.toThrow();
|
|
expect(() => validateRetainedRunnerResult({ ...result, dependableWork: { ...result.dependableWork, credential: "not-allowed" } })).toThrow("result.dependableWork");
|
|
expect(() => validateRetainedRunnerResult({ ...result, dependableWork: { ...result.dependableWork, evidence: { ...evidence, callbackUrl: "https://invalid.example" } } })).toThrow("result.dependableWork.evidence");
|
|
});
|
|
|
|
it("makes the actual report command fail an incomplete checkpoint while retaining an earlier failure", async () => {
|
|
const root = await mkdtemp(path.join(os.tmpdir(), "dependable-report-"));
|
|
try {
|
|
const rows = [attempt(DEPENDABLE_CELLS[0]!, 0), attempt(DEPENDABLE_CELLS[0]!, 1)];
|
|
rows[0]!.result.status = "failed";
|
|
for (const [index, row] of rows.entries()) {
|
|
const directory = path.join(root, `campaign-${index}`, "attempt-1"); await mkdir(directory, { recursive: true });
|
|
const { manifestVerified: _manifest, secretScanPassed: _scan, ...evidence } = row.evidence;
|
|
await writeFile(path.join(directory, "result.json"), JSON.stringify({ ...row.result,
|
|
dependableWork: { campaignId: row.campaignId, cell: row.cell, phase: row.phase, evidence } }));
|
|
await writeFile(path.join(directory, "evidence-manifest.json"), JSON.stringify({ files: ["final-state.png"], leaks: [], missing: [] }));
|
|
await writeFile(path.join(directory, "final-state.png"), Buffer.from("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+aK1cAAAAASUVORK5CYII=", "base64"));
|
|
}
|
|
const manifest = path.join(root, "qualification.json"); await writeFile(manifest, JSON.stringify(config));
|
|
const repository = path.resolve(import.meta.dirname, "../..");
|
|
const output = path.join(root, "report");
|
|
await expect(promisify(execFile)(process.execPath, [path.join(repository, "cli/node_modules/tsx/dist/cli.mjs"),
|
|
path.join(repository, "tests/runner-e2e/report.ts")], { cwd: repository, timeout: 25_000,
|
|
env: { PATH: process.env.PATH, HOME: process.env.HOME, PAPERCLIP_RUNNER_E2E_REPORT_ROOT: root,
|
|
PAPERCLIP_RUNNER_E2E_REPORT_OUT: output, PAPERCLIP_RUNNER_E2E_EXPECTED_IDS: JSON.stringify([rows[0]!.result.executionId]),
|
|
PAPERCLIP_DEPENDABLE_QUALIFICATION_MANIFEST: manifest } })).rejects.toMatchObject({ code: 1 });
|
|
const report = JSON.parse(await readFile(path.join(output, "dependable-qualification.json"), "utf8"));
|
|
expect(report.complete).toBe(false); expect(report.observations).toHaveLength(2); expect(report.failedAttempts).toBe(1);
|
|
expect(report.cells[0].candidatePassed).toBe(1);
|
|
expect(await readFile(path.join(output, "summary.md"), "utf8")).toContain("checkpoint: incomplete");
|
|
} finally { await rm(root, { recursive: true, force: true }); }
|
|
});
|
|
|
|
it.each(["constructor", "toString", "__proto__", "secret-value-in-a-field-name"])("rejects unexpected metadata keys without echoing %s", key => {
|
|
const row = attempt(DEPENDABLE_CELLS[0]!, 1);
|
|
const { manifestVerified: _manifest, secretScanPassed: _scan, ...evidence } = row.evidence;
|
|
const receipt = { campaignId: row.campaignId, cell: row.cell, phase: row.phase, evidence };
|
|
for (const dependableWork of [{ ...receipt, [key]: "untrusted" }, { ...receipt, evidence: { ...evidence, [key]: "untrusted" } }]) {
|
|
let error: unknown;
|
|
try { validateRetainedRunnerResult({ ...row.result, dependableWork }); } catch (caught) { error = caught; }
|
|
expect(error).toBeInstanceOf(Error);
|
|
expect((error as Error).message).toContain("result.dependableWork");
|
|
expect((error as Error).message).not.toContain(key);
|
|
}
|
|
});
|
|
|
|
it("keeps a complete rotation for valid UTC dates before the Unix epoch", () => {
|
|
const dates = ["1969-12-26", "1969-12-27", "1969-12-28", "1969-12-29", "1969-12-30", "1969-12-31"];
|
|
expect(dates.every(date => dependableDailySelection(date).length === 4)).toBe(true);
|
|
expect([...new Set(dates.flatMap(dependableDailySelection))].sort()).toEqual([...DEPENDABLE_CELLS].sort());
|
|
});
|
|
|
|
it.each(["missing", "duplicate", "linked", "unsafe"])("writes an incomplete report for %s retained proof", async defect => {
|
|
const root = await mkdtemp(path.join(os.tmpdir(), "dependable-retained-proof-"));
|
|
try {
|
|
const rows = complete();
|
|
if (defect === "duplicate") rows.push(structuredClone(rows[0]!));
|
|
for (const [index, row] of rows.entries()) {
|
|
const directory = path.join(root, `campaign-${index}`, "attempt-1"); await mkdir(directory, { recursive: true });
|
|
const { manifestVerified: _manifest, secretScanPassed: _scan, ...evidence } = row.evidence;
|
|
await writeFile(path.join(directory, "result.json"), JSON.stringify({ ...row.result,
|
|
dependableWork: { campaignId: row.campaignId, cell: row.cell, phase: row.phase, evidence } }));
|
|
const files = defect === "unsafe" && index === 0 ? ["final-state.png", "../outside.png"] : ["final-state.png"];
|
|
await writeFile(path.join(directory, "evidence-manifest.json"), JSON.stringify({ files, leaks: [], missing: [] }));
|
|
if (defect === "linked" && index === 0) {
|
|
const outside = path.join(root, "outside.png"); await writeFile(outside, "external proof");
|
|
await symlink(outside, path.join(directory, "final-state.png"));
|
|
} else if (defect !== "missing" || index !== 0) await writeFile(path.join(directory, "final-state.png"), Buffer.from("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+aK1cAAAAASUVORK5CYII=", "base64"));
|
|
}
|
|
const manifest = path.join(root, "qualification.json"); await writeFile(manifest, JSON.stringify(config));
|
|
const repository = path.resolve(import.meta.dirname, "../.."), output = path.join(root, "report");
|
|
let exitCode = 0;
|
|
try {
|
|
await promisify(execFile)(process.execPath, [path.join(repository, "cli/node_modules/tsx/dist/cli.mjs"), path.join(repository, "tests/runner-e2e/report.ts")], {
|
|
cwd: repository, timeout: 25_000, env: { PATH: process.env.PATH, HOME: process.env.HOME, PAPERCLIP_RUNNER_E2E_REPORT_ROOT: root,
|
|
PAPERCLIP_RUNNER_E2E_REPORT_OUT: output, PAPERCLIP_RUNNER_E2E_EXPECTED_IDS: JSON.stringify([rows[0]!.result.executionId]),
|
|
PAPERCLIP_DEPENDABLE_QUALIFICATION_MANIFEST: manifest },
|
|
});
|
|
} catch (error) { exitCode = (error as { code: number }).code; }
|
|
expect(exitCode).toBe(1);
|
|
const report = JSON.parse(await readFile(path.join(output, "dependable-qualification.json"), "utf8"));
|
|
expect(report.complete).toBe(false);
|
|
expect(report.observations).toHaveLength(rows.length);
|
|
const original = report.observations.find((value: Record<string, any>) => value.campaignId === rows[0]!.campaignId);
|
|
expect(original?.problems).toContain(defect === "duplicate" ? "duplicate-attempt-receipt" : "evidence-unverified");
|
|
expect(await readFile(path.join(output, "summary.md"), "utf8")).toContain("checkpoint: incomplete");
|
|
expect(await readFile(path.join(output, "index.html"), "utf8")).toContain("html");
|
|
} finally { await rm(root, { recursive: true, force: true }); }
|
|
});
|
|
|
|
it("does not start a daily rotation when only today's journeys are registered", () => {
|
|
const today = dependableDailySelection("2026-10-20").map(dependableExecutionId);
|
|
expect(() => dependableDailyExecutions("2026-10-20", today)).toThrow("not registered");
|
|
const all = DEPENDABLE_CELLS.map(dependableExecutionId);
|
|
const later = all.find(id => !today.includes(id))!;
|
|
const missingLater = all.filter(id => id !== later);
|
|
expect(() => dependableDailyExecutions("2026-10-20", missingLater)).toThrow("not registered");
|
|
});
|