mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-20 09:50:48 +01:00
fix(tasks): require merged PR deliverables before native completion (#22244)
Keep native tasks with declared pull request deliverables active until
GitHub verifies every deliverable is merged. Preserve delivery guidance
in follow-up contracts and recheck the current outputs under task locks.
Use bounded incomplete-work feedback during reassessment, including for
saved non-Done reports. Serialize work-product restoration and identity
changes with completion. Preserve configured reviews and conversations.
Add regression coverage and repair the CI fixtures exposed during
qualification. All CI checks pass on afee630120. Greptile is 5/5 with no
unresolved review threads.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
673742bfc6
commit
d4b7ae5532
17 files changed
+536
-32
No files matched your search
@@ -3,7 +3,7 @@ import { spawnSync } from "node:child_process";
|
||||
import { mkdtempSync, realpathSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { fileURLToPath, pathToFileURL } from "node:url";
|
||||
import test from "node:test";
|
||||
import StalledFileReporter, { defaultStallMs, stallAnnotation, stalledFileReporterEnabled, stallLimitMs }
|
||||
from "./stalled-file-reporter.mjs";
|
||||
@@ -83,9 +83,9 @@ test("a file that never finishes loading is named from the moment it is queued",
|
||||
// The failure this guards: a test awaiting a promise that never settles, with
|
||||
// a test timeout longer than the CI job, holds Vitest until the job is
|
||||
// cancelled and never prints the file's name.
|
||||
for (const [label, body, step] of [
|
||||
["a test that never settles", 'import { test } from "vitest";\ntest("waits forever", () => new Promise(() => {}), 600_000);\n', 'test "waits forever"'],
|
||||
["a top-level await that never settles", 'import { test } from "vitest";\nawait new Promise(() => {});\ntest("never collected", () => {});\n', "loading the file"],
|
||||
for (const [label, body, steps] of [
|
||||
["a test that never settles", 'import { test } from "vitest";\nimport { writeFileSync } from "node:fs";\ntest("waits forever", () => { writeFileSync(process.env.PAPERCLIP_WATCHDOG_TEST_STARTED, "started"); return new Promise(() => {}); }, 600_000);\n', ['test "waits forever"']],
|
||||
["a top-level await that never settles", 'import { test } from "vitest";\nawait new Promise(() => {});\ntest("never collected", () => {});\n', ["loading the file"]],
|
||||
]) test(`a real Vitest run with ${label} fails fast and names the file`, () => {
|
||||
const directory = realpathSync(mkdtempSync(path.join(tmpdir(), "stalled-file-reporter-")));
|
||||
try {
|
||||
@@ -93,21 +93,27 @@ for (const [label, body, step] of [
|
||||
writeFileSync(path.join(directory, "quick.test.mjs"), `import { test } from "vitest";
|
||||
test("passes", () => {});
|
||||
`);
|
||||
const startedMarker = path.join(directory, "started");
|
||||
let fixtureReporter = reporterPath;
|
||||
if (label === "a test that never settles") {
|
||||
fixtureReporter = path.join(directory, "after-test-start.mjs");
|
||||
writeFileSync(fixtureReporter, 'import Base from ' + JSON.stringify(pathToFileURL(reporterPath).href) + ';\nimport { existsSync } from "node:fs";\nexport default class extends Base { check() { if (!existsSync(' + JSON.stringify(startedMarker) + ')) return; super.check(); } }\n');
|
||||
}
|
||||
const configFile = path.join(directory, "vitest.config.mjs");
|
||||
writeFileSync(configFile, `export default ${JSON.stringify({ test: { include: ["*.test.mjs"],
|
||||
reporters: ["default", [reporterPath, { limitMs: 1500, graceMs: 5000, root: directory }]] } })};`);
|
||||
reporters: ["default", [fixtureReporter, { limitMs: 1500, graceMs: 5000, root: directory }]] } })};`);
|
||||
const started = Date.now();
|
||||
const result = spawnSync(process.execPath, [path.join(root, "node_modules/vitest/vitest.mjs"), "run",
|
||||
"--config", configFile, "--root", directory], {
|
||||
cwd: directory, encoding: "utf8", timeout: 60_000,
|
||||
env: { ...process.env, GITHUB_ACTIONS: "", PAPERCLIP_VITEST_FILE_STALL_MS: "" },
|
||||
env: { ...process.env, GITHUB_ACTIONS: "", PAPERCLIP_VITEST_FILE_STALL_MS: "", PAPERCLIP_WATCHDOG_TEST_STARTED: startedMarker },
|
||||
});
|
||||
const output = `${result.stdout}\n${result.stderr}`;
|
||||
assert.equal(result.signal, null, `Vitest was still running after 60 s:\n${output}`);
|
||||
assert.notEqual(result.status, 0, output);
|
||||
assert.ok(Date.now() - started < 30_000, `took ${Date.now() - started} ms:\n${output}`);
|
||||
assert.match(output, /::error file=stuck\.test\.mjs,title=Test file stopped making progress::stuck\.test\.mjs made no progress/);
|
||||
assert.ok(output.includes(`while in: ${step}.`), output);
|
||||
assert.ok(steps.some(step => output.includes(`while in: ${step}.`)), output);
|
||||
} finally {
|
||||
rmSync(directory, { recursive: true, force: true });
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user