mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-25 16:14:26 +01:00
fix(e2e): wait for agreeing dependency run observations (#22802)
## Thinking Path > - Paperclip lets people manage AI agents and their work. > - A blocked task must start once after its blocker is complete. > - The dependency journey checks this through task and agent run reads. > - These independent reads can see the same run at different stages of completion. > - The collector can stop while the agent read still says `running`. > - This pull request waits for both reads to agree before it saves the finished and reopened points. > - The test can then measure the completed work with the existing strict rules. ## Linked Issues or Issue Description **What happened?** The dependency journey can report `dependency_one_automatic_resume` after one correct automatic run. Its completion wait accepts the task run as `succeeded` while the agent run read still says `running`. A later read agrees, but the saved finished point remains split. **Expected behavior** Wait for matching task and agent run facts within the existing campaign deadline. Keep the two observations independent. Fail if they never agree. **Steps to reproduce** Use the flow fixture to return a completed task run and a lagging agent run detail. Run the new `agent detail still running after task detail completed` case against the old collector. It fails with `dependency_one_automatic_resume`. **Paperclip version or commit** Base: `3ca9b6d471e100fe248c650f30453db4d3bc55fb`. Related: #21732 added valid wake producers. That repair is already present and does not address this read timing error. ## What Changed - Compare task and agent run facts with the same normalized facts used by the grader. - Require agreement before the collector ends its completion wait and after it reopens the result. - Tag fixture projections explicitly, with separate agent lag counters before and after reopening. - Share the full settled predicate between both waits; agreeing stale reads cannot count as completion. - Add temporary and permanent cases for agent lag, task-only and agreeing stale run views, task status, missing document, active locks and native phase. - Document the completion wait. Keep the grader, run budget and deadline unchanged. ## Verification - Red: the new lagging-read regression fails on the base collector with `dependency_one_automatic_resume`. - Green: three focused dependency suites pass, 126 tests. This includes permanent disagreement, duplicate or unrelated runs, early execution, history and output checks. - Command: `node /tmp/pap5740-test-tools/node_modules/vitest/vitest.mjs run --config /tmp/pap5740-test-tools/vitest.config.mjs`. The temporary config selects `tests/runner-e2e/product-journeys/task-dependency-resume*.test.ts`. Tools: Vitest 5.0.3, Playwright 1.62.1 and Zod 4. - `pnpm verify` could not run: the managed Git storage guard rejects `git ls-files` with `paperclip_git_storage_limit`. CI must supply broader checks. - No new paid journey was run. Staging acceptance remains open. No reviewed harness pin was changed. - Follow-up commit: `16bb94c256769fe76b014e865259b742b35773ea`. The reopened-only regression fails on the prior commit with `dependency_one_automatic_resume`; it passes after this repair. - Second follow-up: `45d60118fb36fd1f426e088f263d04c91484cfee`. Ten of twelve new stale-state cases fail on `16bb94c`; all pass after sharing the settled predicate. - Exact finished-run binding: `24d7b2f67a9f51ac6d996211f651a92772ff2a55`. Both reopened projections must match the normalized saved finished-run facts. Two additional agreeing-but-different run-facts cases fail before this change and pass afterward. - CI and Greptile passed on `16bb94c`; reviews also cleared `45d6011`. Fresh CI and reviews are pending on `24d7b2f`. ## Risks Low risk. A mismatch now uses the remaining campaign wait rather than reaching the grader early. Permanent disagreement still fails at the deadline. This change does not start another agent run, alter production state, replace either independent read, or relax the grader. ## Model Used OpenAI GPT-6 through Codex, with reasoning and code execution. The runtime did not expose a more specific model ID. ## 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 - [ ] All Paperclip CI gates are green - [ ] 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>
This commit is contained in:
1 parent
096060598d
commit
1a36a8f3c0
4 files changed
+138
-17
No files matched your search
@@ -36,6 +36,12 @@ export function dependencyNewAgentRuns(runs: Row[], startingRuns: Row[]) {
|
||||
const priorIds = new Set(startingRuns.map(run => run.id));
|
||||
return runs.filter(run => !priorIds.has(run.id));
|
||||
}
|
||||
export function dependencyRunProjectionsAgree(point: DependencyPoint, startingRuns: Row[], expectedRun?: Row) {
|
||||
const newRuns = dependencyNewAgentRuns(point.agentRuns, startingRuns);
|
||||
return point.dependentRuns.length === 1 && newRuns.length === 1
|
||||
&& runFacts(point.dependentRuns[0]!) === runFacts(newRuns[0]!)
|
||||
&& (!expectedRun || runFacts(point.dependentRuns[0]!) === runFacts(expectedRun));
|
||||
}
|
||||
export function dependencyRunIssueId(run: Row) {
|
||||
const ids = [run.issueId, run.nativeIssueId, run.contextSnapshot?.issueId, run.contextSnapshot?.taskId].filter(value => value != null);
|
||||
return ids.length && ids.every(nonempty) && new Set(ids).size === 1 ? ids[0] as string : undefined;
|
||||
|
||||
@@ -32,7 +32,14 @@ blocker completion audit. No agent work is permitted on the human-owned blocker.
|
||||
|
||||
The case requires `company`, `board-user`, `task-write`, and `agent`. It declares
|
||||
one work run, uses the existing bounded case budget, and shares the original
|
||||
campaign deadline. The native agent must have nonblank provider and model
|
||||
campaign deadline.
|
||||
The task and agent run reads can straddle completion. The completion wait requires
|
||||
both projections to agree on the same run facts before saving the finished point.
|
||||
After reopening, it applies the same settled check: done task, one succeeded and
|
||||
committed run, agreeing projections, saved document and revision, and no active locks.
|
||||
The reopened run facts must also match the already-settled finished run.
|
||||
It uses the original deadline and does not replace either independent observation.
|
||||
The native agent must have nonblank provider and model
|
||||
identifiers before any observation read or task creation. An incomplete execution
|
||||
identity returns `unsupported` without task or agent work.
|
||||
It saves the agent's starting run history and retains those
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { AsyncLocalStorage } from "node:async_hooks";
|
||||
import { mkdir, mkdtemp, readFile, rm } from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
@@ -20,12 +21,25 @@ vi.mock("@playwright/test", () => ({ expect: Object.assign((locator: any) => ({
|
||||
import { taskDependencyResume } from "./task-dependency-resume.js";
|
||||
|
||||
interface FixtureOptions { priorRuns?: number; unrelatedActivity?: number; ownedActivity?: number; agentActivity?: number; missingActivity?: boolean; activePrior?: boolean;
|
||||
closedPanel?: "properties" | "toggle"; missingProperty?: boolean; missingStatusChoice?: boolean }
|
||||
laggingAgentReads?: number; reopenedLaggingAgentReads?: number; reopenedStale?: "task-run" | "both-runs" | "task-status" | "document" | "locks" | "native-phase" | "run-facts"; reopenedStaleReads?: number; closedPanel?: "properties" | "toggle"; missingProperty?: boolean; missingStatusChoice?: boolean }
|
||||
async function fixture(premature = false, options: FixtureOptions = {}) {
|
||||
const directory = await mkdtemp(path.join(os.tmpdir(), "dependency-flow-"));
|
||||
const f = dependencyEvidenceFixture(), s = f.scope;
|
||||
const blocker = { ...f.created.blocker }, dependent = { ...f.created.dependent };
|
||||
const actions: string[] = [], owned: any[] = [], writes: unknown[] = [], reads: string[] = [];
|
||||
const projection = new AsyncLocalStorage<"task" | "agent">();
|
||||
const agentReads = { finished: 0, reopened: 0 };
|
||||
const detailReads: Array<{ projection: string; stage: string; status: string }> = [];
|
||||
let reopened = false;
|
||||
const staleReads: Record<string, number> = {};
|
||||
const stale = (key: string) => reopened && (staleReads[key] = (staleReads[key] ?? 0) + 1) <= (options.reopenedStaleReads ?? 0);
|
||||
// Carry the list's projection through both summary normalization and detail mapping.
|
||||
// The concurrent detail requests use the same URL; call order must not identify them.
|
||||
const projectedRows = (rows: any[], source: "task" | "agent"): any[] => {
|
||||
Object.defineProperty(rows, "map", { value: (callback: (...args: any[]) => any) =>
|
||||
projectedRows(Array.prototype.map.call(rows, (...args: any[]) => projection.run(source, () => callback(...args))), source) });
|
||||
return rows;
|
||||
};
|
||||
let completed = false, assigned = false, panelOpen = !options.closedPanel;
|
||||
const reference = () => /review reference is ([a-f0-9]{32})/.exec(blocker.description)?.[1];
|
||||
const output = () => JSON.stringify({ reference: reference(), blockerIdentifier: s.blockerIdentifier });
|
||||
@@ -89,23 +103,45 @@ async function fixture(premature = false, options: FixtureOptions = {}) {
|
||||
},
|
||||
getByPlaceholder(name: string) { return locator(name); },
|
||||
getByTestId(name: string) { return locator(name); },
|
||||
async goto(url: string) { actions.push(`goto:${url}`); }, async reload() { actions.push("reload"); },
|
||||
async goto(url: string) { actions.push(`goto:${url}`); }, async reload() { actions.push("reload"); if (completed) reopened = true; },
|
||||
};
|
||||
const api: any = { origin: "https://qa.example.test", async get(route: string) {
|
||||
reads.push(route);
|
||||
if (route === `/api/issues/${s.blockerId}`) return structuredClone(blocker);
|
||||
if (route === `/api/issues/${s.dependentId}`) return structuredClone(dependent);
|
||||
if (route === `/api/issues/${s.dependentId}`) {
|
||||
const task = structuredClone(dependent);
|
||||
if (options.reopenedStale === "task-status" && stale("task-status")) task.status = "in_progress";
|
||||
if (options.reopenedStale === "locks" && stale("locks")) task.executionRunId = "run";
|
||||
return task;
|
||||
}
|
||||
if (route === `/api/issues/${s.blockerId}/runs`) return [];
|
||||
if (route === `/api/issues/${s.dependentId}/runs`) return runs().map(r => ({ runId: r.id }));
|
||||
if (route.includes("/heartbeat-runs?")) return [...runs(), ...structuredClone(priorRuns)];
|
||||
if (route === "/api/heartbeat-runs/run") return runs()[0];
|
||||
if (route === `/api/issues/${s.dependentId}/runs`) return projectedRows(runs().map(r => ({ runId: r.id })), "task");
|
||||
if (route.includes("/heartbeat-runs?")) return projectedRows([...runs(), ...structuredClone(priorRuns)], "agent");
|
||||
if (route === "/api/heartbeat-runs/run") {
|
||||
const run = runs()[0], source = projection.getStore(), stage = reopened ? "reopened" : "finished";
|
||||
if (!source) throw new Error("run_detail_projection_missing");
|
||||
if (source === "agent") {
|
||||
agentReads[stage]++;
|
||||
const lag = reopened ? options.reopenedLaggingAgentReads : options.laggingAgentReads;
|
||||
if (agentReads[stage] <= (lag ?? 0)) run.status = "running";
|
||||
}
|
||||
if ((options.reopenedStale === "both-runs" || options.reopenedStale === "task-run" && source === "task")
|
||||
&& stale(source)) run.status = "running";
|
||||
if (options.reopenedStale === "native-phase" && stale(source)) run.nativePhase = "running";
|
||||
if (options.reopenedStale === "run-facts" && stale(source)) run.startedAt = "2019-12-31T23:59:00Z";
|
||||
detailReads.push({ projection: source, stage, status: run.status });
|
||||
return run;
|
||||
}
|
||||
if (route === `/api/issues/${s.blockerId}/activity`) return completed ? structuredClone(f.reopened.activity) : [];
|
||||
if (route === `/api/issues/${s.dependentId}/activity`) return activity(options.ownedActivity ?? 0, s.dependentId);
|
||||
if (route === `/api/companies/${s.companyId}/activity?agentId=${s.agentId}&limit=500`) {
|
||||
return options.missingActivity ? undefined : activity(options.agentActivity ?? 0, "prior-task", s.agentId);
|
||||
}
|
||||
if (route === `/api/companies/${s.companyId}/activity?limit=500`) return activity(options.unrelatedActivity ?? 0, "unrelated-task").slice(0, 500);
|
||||
if (route === `/api/issues/${s.dependentId}/documents`) return completed ? [taskDocument()] : [];
|
||||
if (route === `/api/issues/${s.dependentId}/documents`) {
|
||||
if (options.reopenedStale === "document" && stale("document")) return [];
|
||||
return completed ? [taskDocument()] : [];
|
||||
}
|
||||
if (route.endsWith("/documents/dependency-proof")) return taskDocument();
|
||||
if (route.endsWith("/revisions/revision")) return revision();
|
||||
throw new Error(`unexpected_read:${route}`);
|
||||
@@ -115,7 +151,7 @@ async function fixture(premature = false, options: FixtureOptions = {}) {
|
||||
capabilities: ["company", "board-user", "task-write", "agent"], agent: { id: s.agentId, name: "Fixture agent", provider: s.provider, model: s.model, runtimeMode: "native" } } as JourneyContext;
|
||||
const session = { own: vi.fn(async resource => { owned.push(resource); }) } as unknown as TargetSession;
|
||||
const evidence = { checks: [] } as unknown as JourneyEvidence;
|
||||
return { directory, context, session, evidence, actions, owned, writes, reads };
|
||||
return { directory, context, session, evidence, actions, owned, writes, reads, detailReads, staleReads };
|
||||
}
|
||||
afterEach(() => { vi.useRealTimers(); controls.create.mockReset(); });
|
||||
describe("dependency browser flow orchestration", () => {
|
||||
@@ -206,6 +242,7 @@ describe("dependency browser flow orchestration", () => {
|
||||
});
|
||||
it.each([
|
||||
["empty history", {}],
|
||||
["agent detail still running after task detail completed", { laggingAgentReads: 2 }],
|
||||
["completed earlier campaign runs", { priorRuns: 3 }],
|
||||
["more than 100 earlier campaign runs", { priorRuns: 150 }],
|
||||
["more than 500 unrelated company events", { unrelatedActivity: 800 }],
|
||||
@@ -218,6 +255,10 @@ describe("dependency browser flow orchestration", () => {
|
||||
{ deadlineAt: Date.now() + 60_000, directory: f.directory });
|
||||
await vi.advanceTimersByTimeAsync(11_000); await operation;
|
||||
expect(f.evidence.checks).toHaveLength(8); expect(f.evidence.checks.every(check => check.passed)).toBe(true);
|
||||
if ("laggingAgentReads" in options) {
|
||||
expect(f.detailReads.filter(read => read.projection === "agent" && read.status === "running")).toHaveLength(options.laggingAgentReads);
|
||||
expect(f.detailReads.filter(read => read.projection === "task").every(read => read.status === "succeeded")).toBe(true);
|
||||
}
|
||||
expect(f.writes).toEqual([]);
|
||||
expect(f.actions.indexOf("click:Blocked")).toBeLessThan(f.actions.indexOf("click:agent-choice"));
|
||||
expect(f.actions.indexOf("click:agent-choice")).toBeLessThan(f.actions.indexOf("click:Done"));
|
||||
@@ -235,6 +276,65 @@ describe("dependency browser flow orchestration", () => {
|
||||
expect(f.reads).not.toContain("/api/companies/company/activity?limit=500");
|
||||
} finally { await rm(f.directory, { recursive: true, force: true }); }
|
||||
});
|
||||
it.each([2, Infinity])("waits for reopened-only agent lag (%s reads) within the original deadline", async lag => {
|
||||
const f = await fixture(false, { reopenedLaggingAgentReads: lag });
|
||||
vi.useFakeTimers(); vi.setSystemTime(new Date("2020-01-01T00:00:00Z"));
|
||||
const startedAt = Date.now();
|
||||
try {
|
||||
const operation = taskDependencyResume(f.context, f.session, "journey-123-abcdef01", f.evidence,
|
||||
{ deadlineAt: startedAt + 13_000, directory: f.directory });
|
||||
const outcome = lag === Infinity
|
||||
? expect(operation).rejects.toMatchObject({ code: "dependency_reopen_deadline" })
|
||||
: expect(operation).resolves.toBeUndefined();
|
||||
await vi.advanceTimersByTimeAsync(13_000); await outcome;
|
||||
const saved = JSON.parse(await readFile(path.join(f.directory, "task-dependency-observations.json"), "utf8"));
|
||||
expect(saved.finished.dependentRuns[0].status).toBe("succeeded");
|
||||
expect(saved.finished.agentRuns[0].status).toBe("succeeded");
|
||||
expect(f.detailReads.filter(read => read.projection === "task").every(read => read.status === "succeeded")).toBe(true);
|
||||
expect(f.detailReads.filter(read => read.projection === "agent" && read.stage === "reopened" && read.status === "running")).toHaveLength(lag === Infinity ? 3 : lag);
|
||||
expect(saved.reopened.agentRuns[0].status).toBe(lag === Infinity ? "running" : "succeeded");
|
||||
expect(f.evidence.checks).toHaveLength(lag === Infinity ? 0 : 8);
|
||||
expect(f.evidence.checks.every(check => check.passed)).toBe(true);
|
||||
expect(f.writes).toEqual([]);
|
||||
} finally { await rm(f.directory, { recursive: true, force: true }); }
|
||||
});
|
||||
it.each((["task-run", "both-runs", "task-status", "document", "locks", "native-phase", "run-facts"] as const)
|
||||
.flatMap(stale => [2, Infinity].map(lag => ({ stale, lag }))))(
|
||||
"waits for reopened $stale staleness ($lag reads) within the original deadline", async ({ stale, lag }) => {
|
||||
const f = await fixture(false, { reopenedStale: stale, reopenedStaleReads: lag });
|
||||
vi.useFakeTimers(); vi.setSystemTime(new Date("2020-01-01T00:00:00Z"));
|
||||
try {
|
||||
const operation = taskDependencyResume(f.context, f.session, "journey-123-abcdef01", f.evidence,
|
||||
{ deadlineAt: Date.now() + 13_000, directory: f.directory });
|
||||
const outcome = lag === Infinity
|
||||
? expect(operation).rejects.toMatchObject({ code: "dependency_reopen_deadline" })
|
||||
: expect(operation).resolves.toBeUndefined();
|
||||
await vi.advanceTimersByTimeAsync(13_000); await outcome;
|
||||
const saved = JSON.parse(await readFile(path.join(f.directory, "task-dependency-observations.json"), "utf8"));
|
||||
expect(saved.finished.dependentRuns[0].status).toBe("succeeded");
|
||||
expect(saved.finished.agentRuns[0].status).toBe("succeeded");
|
||||
expect(Object.values(f.staleReads)).not.toHaveLength(0);
|
||||
expect(Object.values(f.staleReads).every(count => count === 3)).toBe(true);
|
||||
expect(f.evidence.checks).toHaveLength(lag === Infinity ? 0 : 8);
|
||||
expect(f.evidence.checks.every(check => check.passed)).toBe(true);
|
||||
expect(saved.stage).toBe(lag === Infinity ? "reopen_result" : "complete");
|
||||
expect(f.writes).toEqual([]);
|
||||
} finally { await rm(f.directory, { recursive: true, force: true }); }
|
||||
});
|
||||
it("keeps a permanently conflicting agent projection failed at the original deadline", async () => {
|
||||
const f = await fixture(false, { laggingAgentReads: Infinity });
|
||||
vi.useFakeTimers(); vi.setSystemTime(new Date("2020-01-01T00:00:00Z"));
|
||||
try {
|
||||
const operation = expect(taskDependencyResume(f.context, f.session, "journey-123-abcdef01", f.evidence,
|
||||
{ deadlineAt: Date.now() + 13_000, directory: f.directory })).rejects.toMatchObject({ code: "dependency_resume_deadline" });
|
||||
await vi.advanceTimersByTimeAsync(13_000); await operation;
|
||||
const saved = JSON.parse(await readFile(path.join(f.directory, "task-dependency-observations.json"), "utf8"));
|
||||
expect(saved.finished.dependentRuns[0].status).toBe("succeeded");
|
||||
expect(saved.finished.agentRuns[0].status).toBe("running");
|
||||
expect(f.evidence.checks).toEqual([]);
|
||||
expect(f.writes).toEqual([]);
|
||||
} finally { await rm(f.directory, { recursive: true, force: true }); }
|
||||
});
|
||||
it.each(["properties", "toggle"] as const)("opens a closed properties pane through its %s control before linking", async closedPanel => {
|
||||
const f = await fixture(false, { closedPanel }); vi.useFakeTimers(); vi.setSystemTime(new Date("2020-01-01T00:00:00Z"));
|
||||
try {
|
||||
|
||||
@@ -7,7 +7,7 @@ import { HEARTBEAT_RUN_LIST_MAX_LIMIT } from "../../../packages/shared/src/const
|
||||
import { createTaskThroughUi } from "../user-actions.js";
|
||||
import { createObservedReader } from "./observation-read.js";
|
||||
import { openDocumentAuthoring } from "./task-document-flow.js";
|
||||
import { DEPENDENCY_IDLE_MS, dependencyNewAgentRuns, gradeTaskDependencyResume, type DependencyEvidence, type DependencyPoint, type DependencyScope } from "./task-dependency-resume-evidence.js";
|
||||
import { DEPENDENCY_IDLE_MS, dependencyNewAgentRuns, dependencyRunProjectionsAgree, gradeTaskDependencyResume, type DependencyEvidence, type DependencyPoint, type DependencyScope } from "./task-dependency-resume-evidence.js";
|
||||
import { JourneyError, type JourneyContext, type JourneyEvidence, type TargetSession } from "./types.js";
|
||||
|
||||
type Row = Record<string, any>;
|
||||
@@ -189,24 +189,32 @@ export async function taskDependencyResume(context: JourneyContext, session: Tar
|
||||
await setStatus(context, "Done");
|
||||
await expect.poll(async () => (await read.get<Row>(`/api/issues/${blocker.issueId}`)).status).toBe("done");
|
||||
observations.released = await observe();
|
||||
const settled = (point: DependencyPoint | undefined, expectedRun?: Row): point is DependencyPoint => Boolean(point
|
||||
&& point.dependent.status === "done" && point.dependentRuns.length === 1
|
||||
&& point.dependentRuns[0]?.status === "succeeded" && point.dependentRuns[0]?.nativePhase === "committed"
|
||||
&& point.document && point.revision && dependencyRunProjectionsAgree(point, startingRuns, expectedRun)
|
||||
&& !point.dependent.executionRunId && !point.dependent.checkoutRunId);
|
||||
stage = "await_automatic_resume";
|
||||
while (Date.now() < options.deadlineAt) {
|
||||
const point = await observe(); observations.finished = point;
|
||||
if (point.dependent.status === "done" && point.dependentRuns.length === 1 && point.dependentRuns[0]?.status === "succeeded"
|
||||
&& point.dependentRuns[0]?.nativePhase === "committed" && point.document && point.revision
|
||||
&& !point.dependent.executionRunId && !point.dependent.checkoutRunId) break;
|
||||
if (settled(point)) break;
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
}
|
||||
if (!observations.finished || observations.finished.dependent.status !== "done" || observations.finished.dependentRuns[0]?.status !== "succeeded"
|
||||
|| observations.finished.dependentRuns[0]?.nativePhase !== "committed" || !observations.finished.document || !observations.finished.revision) {
|
||||
throw new JourneyError("failed", "dependency_resume_deadline");
|
||||
}
|
||||
if (!settled(observations.finished)) throw new JourneyError("failed", "dependency_resume_deadline");
|
||||
const finishedRun = observations.finished.dependentRuns[0]!;
|
||||
stage = "reopen_result";
|
||||
await page.goto(url(dependentSaved.identifier ?? dependent.issueId), { waitUntil: "domcontentloaded" });
|
||||
await page.reload(); await openDocumentAuthoring(context);
|
||||
const document = page.locator(`#document-${documentKey}`);
|
||||
await expect(document).toContainText(reference);
|
||||
observations.reopened = await observe();
|
||||
while (!settled(observations.reopened, finishedRun)) {
|
||||
const remaining = options.deadlineAt - Date.now();
|
||||
if (remaining <= 0) throw new JourneyError("failed", "dependency_reopen_deadline");
|
||||
await new Promise(resolve => setTimeout(resolve, Math.min(1000, remaining)));
|
||||
if (Date.now() >= options.deadlineAt) throw new JourneyError("failed", "dependency_reopen_deadline");
|
||||
observations.reopened = await observe();
|
||||
}
|
||||
observations.reopened.resultVisible = await document.isVisible() && (await document.textContent())?.includes(reference) === true;
|
||||
const checks = gradeTaskDependencyResume({ ...observations, scope } as DependencyEvidence);
|
||||
evidence.checks.push(...checks);
|
||||
|
||||
Reference in new issue
Block a user