executable-stories-e2e 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs ADDED
@@ -0,0 +1,542 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ phraseStep: () => phraseStep,
34
+ story: () => story,
35
+ storyReporter: () => storyReporter,
36
+ toRawRun: () => toRawRun
37
+ });
38
+ module.exports = __toCommonJS(index_exports);
39
+ var import_node_fs2 = require("fs");
40
+ var import_promises = require("fs/promises");
41
+ var path2 = __toESM(require("path"), 1);
42
+
43
+ // src/phrase.ts
44
+ var ROLE_NOUNS = {
45
+ textbox: "field",
46
+ searchbox: "search field",
47
+ combobox: "dropdown",
48
+ spinbutton: "number field",
49
+ img: "image"
50
+ };
51
+ var SIMPLE_QUERY = /^getBy(\w+)\(("(?:[^"\\]|\\.)*")(?:, name: ("(?:[^"\\]|\\.)*"))?\)$/;
52
+ function unquote(json) {
53
+ try {
54
+ return JSON.parse(json);
55
+ } catch {
56
+ return json;
57
+ }
58
+ }
59
+ function describeTarget(label) {
60
+ const match = SIMPLE_QUERY.exec(label);
61
+ if (!match) return void 0;
62
+ const [, kind, rawValue, rawName] = match;
63
+ const value = unquote(rawValue);
64
+ const name = rawName === void 0 ? void 0 : unquote(rawName);
65
+ switch (kind) {
66
+ case "Role": {
67
+ const noun = ROLE_NOUNS[value] ?? value;
68
+ return name === void 0 ? `the ${noun}` : `the "${name}" ${noun}`;
69
+ }
70
+ case "Text":
71
+ return `the text "${value}"`;
72
+ case "Label":
73
+ case "Placeholder":
74
+ return `the "${value}" field`;
75
+ case "AltText":
76
+ return `the "${value}" image`;
77
+ case "TestId":
78
+ case "Title":
79
+ return `the "${value}" element`;
80
+ default:
81
+ return void 0;
82
+ }
83
+ }
84
+ var ACTIONS = {
85
+ click: "click",
86
+ tap: "tap",
87
+ dblclick: "double-click",
88
+ hover: "hover over",
89
+ check: "check",
90
+ uncheck: "uncheck",
91
+ fill: "fill in",
92
+ clear: "clear",
93
+ press: "press a key on",
94
+ pressSequentially: "type into",
95
+ selectOption: "choose an option in",
96
+ longPress: "long-press",
97
+ swipe: "swipe",
98
+ focus: "focus"
99
+ };
100
+ var CLAIMS = {
101
+ toBeVisible: ["is visible", "is not visible"],
102
+ toBeHidden: ["is hidden", "is not hidden"],
103
+ toBeEnabled: ["is enabled", "is not enabled"],
104
+ toBeDisabled: ["is disabled", "is not disabled"],
105
+ toBeChecked: ["is checked", "is not checked"],
106
+ toBeFocused: ["is focused", "is not focused"],
107
+ toBeSelected: ["is selected", "is not selected"],
108
+ toBeExpanded: ["is expanded", "is not expanded"],
109
+ toBeAttached: ["is on the page", "is not on the page"],
110
+ toHaveText: ["shows the expected text", "does not show the given text"],
111
+ toContainText: [
112
+ "contains the expected text",
113
+ "does not contain the given text"
114
+ ],
115
+ toHaveValue: ["has the expected value", "does not have the given value"],
116
+ toHaveCount: [
117
+ "appears the expected number of times",
118
+ "does not appear the given number of times"
119
+ ],
120
+ toHaveAccessibleName: [
121
+ "has the expected accessible name",
122
+ "does not have the given accessible name"
123
+ ],
124
+ toHaveAttribute: [
125
+ "has the expected attribute",
126
+ "does not have the given attribute"
127
+ ]
128
+ };
129
+ var APP = {
130
+ "app.back": "go back",
131
+ "app.restart": "restart the app",
132
+ "app.clearState": "clear the app state",
133
+ "session.launch": "launch the app session",
134
+ "session.close": "close the app session"
135
+ };
136
+ function phraseStep(api, label) {
137
+ const raw = label ? `${api} ${label}` : api;
138
+ if (api === "app.open") return label ? `open ${label}` : "open the app";
139
+ if (api === "app.screenshot")
140
+ return label ? `take a screenshot: ${label}` : "take a screenshot";
141
+ if (api === "session.save")
142
+ return label ? `save the session as ${label}` : "save the session";
143
+ if (APP[api]) return APP[api];
144
+ const action = /^locator\.(\w+)$/.exec(api)?.[1];
145
+ if (action !== void 0) {
146
+ if (action === "waitFor") {
147
+ const [target, state] = label.split(" \u2192 ");
148
+ const noun2 = target === void 0 ? void 0 : describeTarget(target);
149
+ return noun2 && state ? `wait until ${noun2} is ${state}` : raw;
150
+ }
151
+ const verb = ACTIONS[action];
152
+ const noun = describeTarget(label);
153
+ return verb && noun ? `${verb} ${noun}` : raw;
154
+ }
155
+ const claim = /^expect\.(not\.)?(\w+)$/.exec(api);
156
+ if (claim) {
157
+ const words = CLAIMS[claim[2]];
158
+ const noun = describeTarget(label);
159
+ return words && noun ? `${noun} ${words[claim[1] ? 1 : 0]}` : raw;
160
+ }
161
+ return raw;
162
+ }
163
+
164
+ // src/story.ts
165
+ var import_node_fs = require("fs");
166
+ var path = __toESM(require("path"), 1);
167
+ var import_node_url = require("url");
168
+ var MARKERS_DIR = ".executable-stories/e2e-markers";
169
+ var FRAME = /\(?((?:file:\/\/)?[^\s()]+?):(\d+):(\d+)\)?$/;
170
+ function callSite() {
171
+ const frames = (new Error().stack ?? "").split("\n").slice(1);
172
+ let own;
173
+ for (const frame of frames) {
174
+ const match = FRAME.exec(frame.trim());
175
+ if (!match) continue;
176
+ const file = match[1].startsWith("file://") ? (0, import_node_url.fileURLToPath)(match[1]) : match[1];
177
+ own ??= file;
178
+ if (file !== own)
179
+ return { file, line: Number(match[2]), column: Number(match[3]) };
180
+ }
181
+ return void 0;
182
+ }
183
+ function mark(keyword, text) {
184
+ const site = callSite();
185
+ if (site === void 0) return;
186
+ const marker = { keyword, text, ...site, at: Date.now() };
187
+ const dir = path.resolve(MARKERS_DIR);
188
+ (0, import_node_fs.mkdirSync)(dir, { recursive: true });
189
+ (0, import_node_fs.appendFileSync)(
190
+ path.join(dir, `${process.pid}.jsonl`),
191
+ `${JSON.stringify(marker)}
192
+ `
193
+ );
194
+ }
195
+ var story = {
196
+ given: (text) => mark("Given", text),
197
+ when: (text) => mark("When", text),
198
+ then: (text) => mark("Then", text),
199
+ and: (text) => mark("And", text),
200
+ but: (text) => mark("But", text)
201
+ };
202
+
203
+ // src/index.ts
204
+ function unknownValue(_value, fallback) {
205
+ return fallback;
206
+ }
207
+ function resultStatus(status) {
208
+ switch (status) {
209
+ case "passed":
210
+ case "flaky":
211
+ return "pass";
212
+ case "failed":
213
+ return "fail";
214
+ case "skipped":
215
+ return "skip";
216
+ case "timed-out":
217
+ return "timeout";
218
+ case "interrupted":
219
+ return "interrupted";
220
+ default:
221
+ return unknownValue(status, "unknown");
222
+ }
223
+ }
224
+ function stepStatus(status) {
225
+ switch (status) {
226
+ case "passed":
227
+ return "pass";
228
+ // Blocked and timed-out steps stopped the scenario, so they read as fail;
229
+ // the error message keeps e2e's code.
230
+ case "failed":
231
+ case "blocked":
232
+ case "timed-out":
233
+ return "fail";
234
+ // A cancelled step did not finish, so it reads as not run.
235
+ case "cancelled":
236
+ return "skip";
237
+ default:
238
+ return unknownValue(status, "unknown");
239
+ }
240
+ }
241
+ function primaryKeyword(step) {
242
+ switch (step.kind) {
243
+ case "app":
244
+ case "session":
245
+ case "resource":
246
+ return "Given";
247
+ case "locator":
248
+ case "screen":
249
+ return "When";
250
+ case "assertion":
251
+ return "Then";
252
+ case "agent":
253
+ return step.api === "agent.assert" ? "Then" : "When";
254
+ default:
255
+ return unknownValue(step.kind, "When");
256
+ }
257
+ }
258
+ function stepText(step) {
259
+ if (step.kind === "agent" && step.label) return step.label;
260
+ return phraseStep(step.api, step.label);
261
+ }
262
+ function errorMessage(error) {
263
+ return `${error.code}: ${error.message}`;
264
+ }
265
+ function toGroups(steps, markers, projectRoot) {
266
+ const groups = [];
267
+ let pending = 0;
268
+ let current;
269
+ const before = (m, step) => {
270
+ if (step === void 0) return true;
271
+ const at = Date.parse(step.startedAt);
272
+ if (m.at !== at) return m.at < at;
273
+ if (m.file !== path2.resolve(projectRoot, step.source.file)) return true;
274
+ return m.line < step.source.line || m.line === step.source.line && (m.column ?? 0) < step.source.column;
275
+ };
276
+ const takeMarkersBefore = (step) => {
277
+ while (pending < markers.length && before(markers[pending], step)) {
278
+ const m = markers[pending++];
279
+ current = {
280
+ keyword: m.keyword,
281
+ text: m.text,
282
+ marker: true,
283
+ children: []
284
+ };
285
+ groups.push(current);
286
+ }
287
+ };
288
+ for (const step of steps) {
289
+ takeMarkersBefore(step);
290
+ if (current) current.children.push(step);
291
+ else
292
+ groups.push({
293
+ keyword: primaryKeyword(step),
294
+ text: stepText(step),
295
+ marker: false,
296
+ children: [step]
297
+ });
298
+ }
299
+ takeMarkersBefore(void 0);
300
+ return groups;
301
+ }
302
+ function isObservedClaim(step) {
303
+ return primaryKeyword(step) === "Then" && (step.status === "passed" || step.status === "failed");
304
+ }
305
+ function groupStatus(group) {
306
+ const statuses = group.children.map((c) => stepStatus(c.status));
307
+ for (const worst of ["fail", "unknown", "skip"])
308
+ if (statuses.includes(worst)) return worst;
309
+ return "pass";
310
+ }
311
+ function agentExplanation(step) {
312
+ const why = step.explanation?.trim();
313
+ if (!why || step.error?.message.includes(why)) return [];
314
+ return [{ kind: "note", text: `Agent: ${why}`, phase: "runtime" }];
315
+ }
316
+ function toSteps(groups) {
317
+ const out = [];
318
+ groups.forEach((group, index) => {
319
+ const repeat = group.keyword !== "And" && group.keyword !== "But" && out.some((s) => s.keyword === group.keyword);
320
+ const keyword = repeat ? "And" : group.keyword;
321
+ const claims = group.children.filter(isObservedClaim).length;
322
+ const assertions = claims > 0 ? { assertions: claims } : {};
323
+ const docs = group.children.flatMap((c) => [
324
+ ...group.marker ? [
325
+ {
326
+ kind: "note",
327
+ text: stepText(c),
328
+ phase: "runtime"
329
+ }
330
+ ] : [],
331
+ ...agentExplanation(c)
332
+ ]);
333
+ out.push({
334
+ id: `step-${index}`,
335
+ keyword,
336
+ text: group.text,
337
+ durationMs: group.children.reduce((sum, c) => sum + c.durationMs, 0),
338
+ ...assertions,
339
+ ...docs.length > 0 ? { docs } : {}
340
+ });
341
+ });
342
+ return out;
343
+ }
344
+ function toMedia(attempt, groups, artifactsRoot) {
345
+ const attachments = [];
346
+ const docs = [];
347
+ for (const artifact of attempt.artifacts) {
348
+ if (artifact.path === void 0) {
349
+ if (artifact.kind === "video" && artifact.url !== void 0 && /^https?:\/\//.test(artifact.url)) {
350
+ docs.push({ kind: "video", path: artifact.url, phase: "runtime" });
351
+ }
352
+ continue;
353
+ }
354
+ const stepIndex = groups.findIndex(
355
+ (group) => group.children.some(
356
+ (step) => step.artifacts.includes(artifact.id) || artifact.producer?.kind === "step" && artifact.producer.stepId === step.id
357
+ )
358
+ );
359
+ attachments.push({
360
+ name: artifact.kind,
361
+ mediaType: artifact.mediaType,
362
+ path: path2.join(artifactsRoot, artifact.path),
363
+ fileName: path2.basename(artifact.path),
364
+ ...artifact.size !== void 0 ? { byteLength: artifact.size } : {},
365
+ ...stepIndex >= 0 ? { stepIndex, stepId: `step-${stepIndex}` } : {}
366
+ });
367
+ }
368
+ return { attachments, docs };
369
+ }
370
+ function finalAttempt(result, report) {
371
+ if (result.serialGroupId === void 0) {
372
+ return { attempt: result.attempts.at(-1), count: result.attempts.length };
373
+ }
374
+ const attempts = report.run.serialGroups.find((g) => g.id === result.serialGroupId)?.attempts ?? [];
375
+ const last = attempts.at(-1);
376
+ const member = last?.members.find((m) => m.testId === result.testId);
377
+ if (last === void 0) return { count: 0 };
378
+ return {
379
+ attempt: {
380
+ error: member?.error ?? last.error,
381
+ startedAt: member?.startedAt ?? last.startedAt,
382
+ durationMs: member?.durationMs ?? last.durationMs,
383
+ artifacts: last.artifacts,
384
+ steps: member?.steps ?? []
385
+ },
386
+ count: attempts.length
387
+ };
388
+ }
389
+ function markersFor(result, attempt, report, markers, projectRoot) {
390
+ if (attempt === void 0 || markers.length === 0) return [];
391
+ const file = path2.resolve(projectRoot, result.file);
392
+ const from = result.source.line;
393
+ const to = Math.min(
394
+ ...report.run.results.filter((r) => r.file === result.file && r.source.line > from).map((r) => r.source.line)
395
+ );
396
+ const start = Date.parse(attempt.startedAt);
397
+ const end = start + attempt.durationMs + 1e3;
398
+ return markers.filter(
399
+ (m) => m.file === file && m.line >= from && m.line < to && m.at >= start && m.at <= end
400
+ ).sort((a, b) => a.at - b.at);
401
+ }
402
+ function toTestCase(result, report, artifactsRoot, markers, projectRoot) {
403
+ const scenario = result.titlePath.at(-1) ?? result.testId;
404
+ const suitePath = result.titlePath.slice(0, -1);
405
+ const { attempt, count } = finalAttempt(result, report);
406
+ const steps = attempt?.steps ?? [];
407
+ const groups = toGroups(
408
+ steps,
409
+ markersFor(result, attempt, report, markers, projectRoot),
410
+ projectRoot
411
+ );
412
+ const { attachments, docs } = toMedia(
413
+ { artifacts: attempt?.artifacts ?? [], steps },
414
+ groups,
415
+ artifactsRoot
416
+ );
417
+ const error = attempt?.error;
418
+ const details = error?.details;
419
+ const stepEvents = groups.map((group, index) => {
420
+ const failed = group.children.find((c) => c.error !== void 0);
421
+ return {
422
+ index,
423
+ stepId: `step-${index}`,
424
+ title: group.text,
425
+ status: groupStatus(group),
426
+ durationMs: group.children.reduce((sum, c) => sum + c.durationMs, 0),
427
+ ...failed?.error ? { errorMessage: errorMessage(failed.error) } : {}
428
+ };
429
+ });
430
+ return {
431
+ externalId: result.id,
432
+ title: scenario,
433
+ titlePath: [...result.titlePath],
434
+ story: {
435
+ scenario,
436
+ steps: toSteps(groups),
437
+ ...result.tags.length > 0 ? { tags: [...result.tags] } : {},
438
+ ...suitePath.length > 0 ? { suitePath } : {},
439
+ ...docs.length > 0 ? { docs } : {}
440
+ },
441
+ sourceFile: result.file,
442
+ sourceLine: Math.max(1, result.source.line),
443
+ status: resultStatus(result.status),
444
+ durationMs: attempt?.durationMs ?? 0,
445
+ ...error ? {
446
+ error: {
447
+ message: errorMessage(error),
448
+ ...details?.expected !== void 0 ? { expected: details.expected } : {},
449
+ ...details?.observed !== void 0 ? { actual: details.observed } : {}
450
+ }
451
+ } : {},
452
+ ...stepEvents.length > 0 ? { stepEvents } : {},
453
+ ...attachments.length > 0 ? { attachments } : {},
454
+ retry: Math.max(0, count - 1),
455
+ projectName: result.targetId
456
+ };
457
+ }
458
+ function toRawRun(args) {
459
+ const { report, projectRoot, artifactsRoot } = args;
460
+ const results = report.run.results.filter((r) => r.selected !== false);
461
+ const filtered = args.lastRun !== void 0 || results.length < report.run.results.length;
462
+ return {
463
+ testCases: results.map(
464
+ (r) => toTestCase(r, report, artifactsRoot, args.markers ?? [], projectRoot)
465
+ ),
466
+ startedAtMs: Date.parse(report.run.startedAt),
467
+ finishedAtMs: Date.parse(report.run.finishedAt),
468
+ projectRoot,
469
+ // Only "filtered" is claimed: e2e can narrow a run in ways the report
470
+ // does not record, so "full" (which retires scenarios) is never guessed.
471
+ ...filtered ? { runScope: "filtered" } : {},
472
+ coveredSourceFiles: [...new Set(results.map((r) => r.file))].sort(),
473
+ ...report.run.vcs?.commit ? { gitSha: report.run.vcs.commit } : {}
474
+ };
475
+ }
476
+ async function readMarkers(dir) {
477
+ const files = await (0, import_promises.readdir)(dir).catch(() => []);
478
+ const markers = [];
479
+ for (const file of files.filter((f) => f.endsWith(".jsonl"))) {
480
+ for (const line of (await (0, import_promises.readFile)(path2.join(dir, file), "utf8")).split(
481
+ "\n"
482
+ )) {
483
+ if (!line) continue;
484
+ try {
485
+ markers.push(JSON.parse(line));
486
+ } catch {
487
+ }
488
+ }
489
+ }
490
+ return markers;
491
+ }
492
+ function storyReporter(options = {}) {
493
+ return {
494
+ name: "executable-stories",
495
+ onEvent(event) {
496
+ if (event.type === "run-started")
497
+ (0, import_node_fs2.rmSync)(path2.resolve(event.projectRoot, MARKERS_DIR), {
498
+ recursive: true,
499
+ force: true
500
+ });
501
+ },
502
+ async onRunFinished(run) {
503
+ const markersDir = path2.resolve(run.projectRoot, MARKERS_DIR);
504
+ if (run.report.run.explore !== void 0) {
505
+ await (0, import_promises.rm)(markersDir, { recursive: true, force: true });
506
+ return [{ label: "Stories", text: "skipped (explore run)" }];
507
+ }
508
+ const rawRun = toRawRun({
509
+ report: run.report,
510
+ projectRoot: run.projectRoot,
511
+ artifactsRoot: run.artifactsRoot,
512
+ markers: await readMarkers(markersDir),
513
+ ...run.lastRun ? { lastRun: run.lastRun } : {}
514
+ });
515
+ await (0, import_promises.rm)(markersDir, { recursive: true, force: true });
516
+ if (rawRun.testCases.length === 0) {
517
+ return [{ label: "Stories", text: "skipped (no tests ran)" }];
518
+ }
519
+ const target = path2.resolve(
520
+ run.projectRoot,
521
+ options.rawRunPath ?? ".executable-stories/raw-run.json"
522
+ );
523
+ await (0, import_promises.mkdir)(path2.dirname(target), { recursive: true });
524
+ await (0, import_promises.writeFile)(
525
+ target,
526
+ JSON.stringify({ schemaVersion: 1, ...rawRun }, null, 2),
527
+ "utf8"
528
+ );
529
+ return [
530
+ { label: "Stories", text: path2.relative(run.projectRoot, target) }
531
+ ];
532
+ }
533
+ };
534
+ }
535
+ // Annotate the CommonJS export names for ESM import in node:
536
+ 0 && (module.exports = {
537
+ phraseStep,
538
+ story,
539
+ storyReporter,
540
+ toRawRun
541
+ });
542
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/phrase.ts","../src/story.ts"],"sourcesContent":["/**\n * executable-stories reporter for the `e2e` agentic test runner.\n *\n * The reporter reads the finished `report-1` document and writes the RawRun\n * JSON every other adapter writes. `executable-stories format` takes it from\n * there. Optional `story.given/when/then` markers in a test name the steps in\n * the test's own words; without them, step text is phrased from e2e's record.\n */\n\nimport { rmSync } from 'node:fs';\nimport { mkdir, readdir, readFile, rm, writeFile } from 'node:fs/promises';\nimport * as path from 'node:path';\nimport type { FinishedRun, Report, Reporter, ReporterSummary } from 'e2e';\nimport type {\n RawAttachment,\n RawRun,\n RawStatus,\n RawStepEvent,\n RawTestCase,\n} from 'executable-stories-core/types/raw';\nimport type {\n DocEntry,\n StepKeyword,\n StoryStep,\n} from 'executable-stories-core/types/story';\nimport { phraseStep } from './phrase';\nimport { MARKERS_DIR, type Marker } from './story';\n\nexport { story, type Marker, type MarkerKeyword } from './story';\nexport { phraseStep } from './phrase';\n\ntype ReportResult = Report['run']['results'][number];\ntype ReportAttempt = ReportResult['attempts'][number];\ntype ReportStep = ReportAttempt['steps'][number];\ntype ReportArtifact = ReportAttempt['artifacts'][number];\ntype ReportError = NonNullable<ReportAttempt['error']>;\n\nexport interface StoryReporterOptions {\n /** Where to write the RawRun JSON, relative to the project root. Default: `.executable-stories/raw-run.json`, where `executable-stories format` looks first. */\n rawRunPath?: string;\n}\n\n/**\n * Exhaustive over e2e's unions at compile time, forgiving at run time: a newer\n * e2e may report a kind or status this version has never seen, and its\n * contract says to ignore what you do not know rather than fail the reporter.\n */\nfunction unknownValue<T>(_value: never, fallback: T): T {\n return fallback;\n}\n\nfunction resultStatus(status: ReportResult['status']): RawStatus {\n switch (status) {\n case 'passed':\n case 'flaky': // the final attempt passed; `retry` records the failed ones\n return 'pass';\n case 'failed':\n return 'fail';\n case 'skipped':\n return 'skip';\n case 'timed-out':\n return 'timeout';\n case 'interrupted':\n return 'interrupted';\n default:\n return unknownValue(status, 'unknown');\n }\n}\n\nfunction stepStatus(status: ReportStep['status']): RawStatus {\n switch (status) {\n case 'passed':\n return 'pass';\n // Blocked and timed-out steps stopped the scenario, so they read as fail;\n // the error message keeps e2e's code.\n case 'failed':\n case 'blocked':\n case 'timed-out':\n return 'fail';\n // A cancelled step did not finish, so it reads as not run.\n case 'cancelled':\n return 'skip';\n default:\n return unknownValue(status, 'unknown');\n }\n}\n\n/** Arrange, act or assert, by what the step did. Repeats become `And` in {@link toSteps}. */\nfunction primaryKeyword(step: ReportStep): 'Given' | 'When' | 'Then' {\n switch (step.kind) {\n case 'app':\n case 'session':\n case 'resource':\n return 'Given';\n case 'locator':\n case 'screen':\n return 'When';\n case 'assertion':\n return 'Then';\n case 'agent':\n return step.api === 'agent.assert' ? 'Then' : 'When';\n default:\n return unknownValue(step.kind, 'When');\n }\n}\n\n/** Agent steps are prose already; the rest are phrased from the API they called on what. */\nfunction stepText(step: ReportStep): string {\n if (step.kind === 'agent' && step.label) return step.label;\n return phraseStep(step.api, step.label);\n}\n\nfunction errorMessage(error: ReportError): string {\n return `${error.code}: ${error.message}`;\n}\n\n/**\n * One rendered step: a marker with the e2e steps that ran under it, or a\n * single e2e step when the test has no markers before it.\n */\ninterface Group {\n keyword: Marker['keyword'];\n text: string;\n marker: boolean;\n children: ReportStep[];\n}\n\nfunction toGroups(\n steps: readonly ReportStep[],\n markers: readonly Marker[],\n projectRoot: string,\n): Group[] {\n const groups: Group[] = [];\n let pending = 0;\n let current: Group | undefined;\n // A marker goes before a step that started after it. Timestamps are whole\n // milliseconds, so on a tie the source position decides: a marker written\n // before the step in the same file, on an earlier line or earlier on the\n // same line, came first. Elsewhere, the marker wins.\n const before = (m: Marker, step: ReportStep | undefined): boolean => {\n if (step === undefined) return true;\n const at = Date.parse(step.startedAt);\n if (m.at !== at) return m.at < at;\n if (m.file !== path.resolve(projectRoot, step.source.file)) return true;\n return (\n m.line < step.source.line ||\n (m.line === step.source.line && (m.column ?? 0) < step.source.column)\n );\n };\n const takeMarkersBefore = (step: ReportStep | undefined): void => {\n while (pending < markers.length && before(markers[pending]!, step)) {\n const m = markers[pending++]!;\n current = {\n keyword: m.keyword,\n text: m.text,\n marker: true,\n children: [],\n };\n groups.push(current);\n }\n };\n for (const step of steps) {\n takeMarkersBefore(step);\n if (current) current.children.push(step);\n else\n groups.push({\n keyword: primaryKeyword(step),\n text: stepText(step),\n marker: false,\n children: [step],\n });\n }\n takeMarkersBefore(undefined);\n return groups;\n}\n\n/** A step that never reached a verdict (blocked, timed out, cancelled) asserted nothing we can see. */\nfunction isObservedClaim(step: ReportStep): boolean {\n return (\n primaryKeyword(step) === 'Then' &&\n (step.status === 'passed' || step.status === 'failed')\n );\n}\n\nfunction groupStatus(group: Group): RawStatus {\n const statuses = group.children.map((c) => stepStatus(c.status));\n for (const worst of ['fail', 'unknown', 'skip'] as const)\n if (statuses.includes(worst)) return worst;\n return 'pass';\n}\n\n/** The agent's explanation, unless the error the report shows already says it. */\nfunction agentExplanation(step: ReportStep): DocEntry[] {\n const why = step.explanation?.trim();\n if (!why || step.error?.message.includes(why)) return [];\n return [{ kind: 'note', text: `Agent: ${why}`, phase: 'runtime' }];\n}\n\nfunction toSteps(groups: readonly Group[]): StoryStep[] {\n const out: StoryStep[] = [];\n groups.forEach((group, index) => {\n const repeat =\n group.keyword !== 'And' &&\n group.keyword !== 'But' &&\n out.some((s) => s.keyword === group.keyword);\n const keyword: StepKeyword = repeat ? 'And' : group.keyword;\n const claims = group.children.filter(isObservedClaim).length;\n // e2e records locator and agent claims as steps. A plain value matcher\n // such as `expect(2).toBe(2)` records none, so a group without a recorded\n // claim leaves the count out.\n const assertions = claims > 0 ? { assertions: claims } : {};\n // A marker lists the e2e steps under it; any step adds the agent's own\n // account of what it did or why it judged a claim true.\n const docs: DocEntry[] = group.children.flatMap((c): DocEntry[] => [\n ...(group.marker\n ? [\n {\n kind: 'note' as const,\n text: stepText(c),\n phase: 'runtime' as const,\n },\n ]\n : []),\n ...agentExplanation(c),\n ]);\n out.push({\n id: `step-${index}`,\n keyword,\n text: group.text,\n durationMs: group.children.reduce((sum, c) => sum + c.durationMs, 0),\n ...assertions,\n ...(docs.length > 0 ? { docs } : {}),\n });\n });\n return out;\n}\n\n/**\n * Artifacts become attachments, the shape the Playwright adapter gives\n * screenshots, videos and traces. A step-produced artifact is pinned to its\n * step. A hosted video has a URL and no file, so it becomes a video doc.\n */\nfunction toMedia(\n attempt: {\n artifacts: readonly ReportArtifact[];\n steps: readonly ReportStep[];\n },\n groups: readonly Group[],\n artifactsRoot: string,\n): { attachments: RawAttachment[]; docs: DocEntry[] } {\n const attachments: RawAttachment[] = [];\n const docs: DocEntry[] = [];\n for (const artifact of attempt.artifacts) {\n if (artifact.path === undefined) {\n if (\n artifact.kind === 'video' &&\n artifact.url !== undefined &&\n /^https?:\\/\\//.test(artifact.url)\n ) {\n docs.push({ kind: 'video', path: artifact.url, phase: 'runtime' });\n }\n continue;\n }\n const stepIndex = groups.findIndex((group) =>\n group.children.some(\n (step) =>\n step.artifacts.includes(artifact.id) ||\n (artifact.producer?.kind === 'step' &&\n artifact.producer.stepId === step.id),\n ),\n );\n attachments.push({\n name: artifact.kind,\n mediaType: artifact.mediaType,\n path: path.join(artifactsRoot, artifact.path),\n fileName: path.basename(artifact.path),\n ...(artifact.size !== undefined ? { byteLength: artifact.size } : {}),\n ...(stepIndex >= 0 ? { stepIndex, stepId: `step-${stepIndex}` } : {}),\n });\n }\n return { attachments, docs };\n}\n\n/** The final attempt, wherever the report keeps it: a serial member's lives on its group. */\nfunction finalAttempt(\n result: ReportResult,\n report: Report,\n): {\n attempt?: Pick<\n ReportAttempt,\n 'error' | 'startedAt' | 'durationMs' | 'artifacts' | 'steps'\n >;\n count: number;\n} {\n if (result.serialGroupId === undefined) {\n return { attempt: result.attempts.at(-1), count: result.attempts.length };\n }\n const attempts =\n report.run.serialGroups.find((g) => g.id === result.serialGroupId)\n ?.attempts ?? [];\n const last = attempts.at(-1);\n const member = last?.members.find((m) => m.testId === result.testId);\n if (last === undefined) return { count: 0 };\n return {\n attempt: {\n error: member?.error ?? last.error,\n startedAt: member?.startedAt ?? last.startedAt,\n durationMs: member?.durationMs ?? last.durationMs,\n artifacts: last.artifacts,\n steps: member?.steps ?? [],\n },\n count: attempts.length,\n };\n}\n\n/**\n * The markers one attempt recorded: called from the test's own file, below its\n * declaration and above the next test's, while the attempt ran.\n */\nfunction markersFor(\n result: ReportResult,\n attempt: Pick<ReportAttempt, 'startedAt' | 'durationMs'> | undefined,\n report: Report,\n markers: readonly Marker[],\n projectRoot: string,\n): Marker[] {\n if (attempt === undefined || markers.length === 0) return [];\n const file = path.resolve(projectRoot, result.file);\n const from = result.source.line;\n const to = Math.min(\n ...report.run.results\n .filter((r) => r.file === result.file && r.source.line > from)\n .map((r) => r.source.line),\n );\n const start = Date.parse(attempt.startedAt);\n const end = start + attempt.durationMs + 1000; // slack for clock reads on either side\n return markers\n .filter(\n (m) =>\n m.file === file &&\n m.line >= from &&\n m.line < to &&\n m.at >= start &&\n m.at <= end,\n )\n .sort((a, b) => a.at - b.at);\n}\n\nfunction toTestCase(\n result: ReportResult,\n report: Report,\n artifactsRoot: string,\n markers: readonly Marker[],\n projectRoot: string,\n): RawTestCase {\n const scenario = result.titlePath.at(-1) ?? result.testId;\n const suitePath = result.titlePath.slice(0, -1);\n const { attempt, count } = finalAttempt(result, report);\n const steps = attempt?.steps ?? [];\n const groups = toGroups(\n steps,\n markersFor(result, attempt, report, markers, projectRoot),\n projectRoot,\n );\n const { attachments, docs } = toMedia(\n { artifacts: attempt?.artifacts ?? [], steps },\n groups,\n artifactsRoot,\n );\n const error = attempt?.error;\n const details = error?.details;\n const stepEvents: RawStepEvent[] = groups.map((group, index) => {\n const failed = group.children.find((c) => c.error !== undefined);\n return {\n index,\n stepId: `step-${index}`,\n title: group.text,\n status: groupStatus(group),\n durationMs: group.children.reduce((sum, c) => sum + c.durationMs, 0),\n ...(failed?.error ? { errorMessage: errorMessage(failed.error) } : {}),\n };\n });\n\n return {\n externalId: result.id,\n title: scenario,\n titlePath: [...result.titlePath],\n story: {\n scenario,\n steps: toSteps(groups),\n ...(result.tags.length > 0 ? { tags: [...result.tags] } : {}),\n ...(suitePath.length > 0 ? { suitePath } : {}),\n ...(docs.length > 0 ? { docs } : {}),\n },\n sourceFile: result.file,\n sourceLine: Math.max(1, result.source.line),\n status: resultStatus(result.status),\n durationMs: attempt?.durationMs ?? 0,\n ...(error\n ? {\n error: {\n message: errorMessage(error),\n ...(details?.expected !== undefined\n ? { expected: details.expected }\n : {}),\n ...(details?.observed !== undefined\n ? { actual: details.observed }\n : {}),\n },\n }\n : {}),\n ...(stepEvents.length > 0 ? { stepEvents } : {}),\n ...(attachments.length > 0 ? { attachments } : {}),\n retry: Math.max(0, count - 1),\n projectName: result.targetId,\n };\n}\n\n/**\n * Map an e2e `report-1` document to a RawRun. Pure: artifact paths resolve\n * against `artifactsRoot` and nothing is read from disk.\n */\nexport function toRawRun(args: {\n report: Report;\n projectRoot: string;\n artifactsRoot: string;\n /** Set when the run was `--last-failed`: it then covered only part of the suite. */\n lastRun?: Report;\n /** Step markers the run's tests recorded with `story.given/when/then`. */\n markers?: readonly Marker[];\n}): RawRun {\n const { report, projectRoot, artifactsRoot } = args;\n // Unselected results stay out of the docs.\n const results = report.run.results.filter((r) => r.selected !== false);\n const filtered =\n args.lastRun !== undefined || results.length < report.run.results.length;\n return {\n testCases: results.map((r) =>\n toTestCase(r, report, artifactsRoot, args.markers ?? [], projectRoot),\n ),\n startedAtMs: Date.parse(report.run.startedAt),\n finishedAtMs: Date.parse(report.run.finishedAt),\n projectRoot,\n // Only \"filtered\" is claimed: e2e can narrow a run in ways the report\n // does not record, so \"full\" (which retires scenarios) is never guessed.\n ...(filtered ? { runScope: 'filtered' as const } : {}),\n coveredSourceFiles: [...new Set(results.map((r) => r.file))].sort(),\n ...(report.run.vcs?.commit ? { gitSha: report.run.vcs.commit } : {}),\n };\n}\n\nasync function readMarkers(dir: string): Promise<Marker[]> {\n const files = await readdir(dir).catch(() => [] as string[]);\n const markers: Marker[] = [];\n for (const file of files.filter((f) => f.endsWith('.jsonl'))) {\n for (const line of (await readFile(path.join(dir, file), 'utf8')).split(\n '\\n',\n )) {\n if (!line) continue;\n try {\n markers.push(JSON.parse(line) as Marker);\n } catch {\n // a worker killed mid-write leaves a torn last line; skip it\n }\n }\n }\n return markers;\n}\n\n/** An e2e reporter that writes the run as RawRun JSON for the executable-stories CLI. */\nexport function storyReporter(options: StoryReporterOptions = {}): Reporter {\n return {\n name: 'executable-stories',\n onEvent(event) {\n // Start each run with an empty markers folder. The delete is small and\n // synchronous, which suits onEvent.\n if (event.type === 'run-started')\n rmSync(path.resolve(event.projectRoot, MARKERS_DIR), {\n recursive: true,\n force: true,\n });\n },\n async onRunFinished(run: FinishedRun): Promise<ReporterSummary> {\n const markersDir = path.resolve(run.projectRoot, MARKERS_DIR);\n // An explore run records findings, which the bug-bash skill turns into\n // scenarios. The last test run's raw-run.json stays as it is.\n if (run.report.run.explore !== undefined) {\n await rm(markersDir, { recursive: true, force: true });\n return [{ label: 'Stories', text: 'skipped (explore run)' }];\n }\n const rawRun = toRawRun({\n report: run.report,\n projectRoot: run.projectRoot,\n artifactsRoot: run.artifactsRoot,\n markers: await readMarkers(markersDir),\n ...(run.lastRun ? { lastRun: run.lastRun } : {}),\n });\n await rm(markersDir, { recursive: true, force: true });\n // A run that reached no test keeps the last test run's raw-run.json.\n if (rawRun.testCases.length === 0) {\n return [{ label: 'Stories', text: 'skipped (no tests ran)' }];\n }\n const target = path.resolve(\n run.projectRoot,\n options.rawRunPath ?? '.executable-stories/raw-run.json',\n );\n await mkdir(path.dirname(target), { recursive: true });\n await writeFile(\n target,\n JSON.stringify({ schemaVersion: 1, ...rawRun }, null, 2),\n 'utf8',\n );\n return [\n { label: 'Stories', text: path.relative(run.projectRoot, target) },\n ];\n },\n };\n}\n","/**\n * Plain-language step text for e2e's non-agent steps.\n *\n * e2e records a step as `api` + `label`, where the label is the locator's own\n * description (`getByRole(\"button\", name: \"Increment\")`). This module\n * rephrases the common shapes for a living-docs page. Other shapes keep the\n * raw `api label`.\n */\n\nconst ROLE_NOUNS: Record<string, string> = {\n textbox: 'field',\n searchbox: 'search field',\n combobox: 'dropdown',\n spinbutton: 'number field',\n img: 'image',\n};\n\n/** `getByKind(\"value\"[, name: \"name\"])` with plain string arguments only; scopes, filters, regexes and nth() stay raw. */\nconst SIMPLE_QUERY =\n /^getBy(\\w+)\\((\"(?:[^\"\\\\]|\\\\.)*\")(?:, name: (\"(?:[^\"\\\\]|\\\\.)*\"))?\\)$/;\n\nfunction unquote(json: string): string {\n try {\n return JSON.parse(json) as string;\n } catch {\n return json;\n }\n}\n\n/** A locator description as a noun phrase, or `undefined` when it is not a simple query. */\nexport function describeTarget(label: string): string | undefined {\n const match = SIMPLE_QUERY.exec(label);\n if (!match) return undefined;\n const [, kind, rawValue, rawName] = match;\n const value = unquote(rawValue!);\n const name = rawName === undefined ? undefined : unquote(rawName);\n switch (kind) {\n case 'Role': {\n const noun = ROLE_NOUNS[value] ?? value;\n return name === undefined ? `the ${noun}` : `the \"${name}\" ${noun}`;\n }\n case 'Text':\n return `the text \"${value}\"`;\n case 'Label':\n case 'Placeholder':\n return `the \"${value}\" field`;\n case 'AltText':\n return `the \"${value}\" image`;\n case 'TestId':\n case 'Title':\n return `the \"${value}\" element`;\n default:\n return undefined;\n }\n}\n\nconst ACTIONS: Record<string, string> = {\n click: 'click',\n tap: 'tap',\n dblclick: 'double-click',\n hover: 'hover over',\n check: 'check',\n uncheck: 'uncheck',\n fill: 'fill in',\n clear: 'clear',\n press: 'press a key on',\n pressSequentially: 'type into',\n selectOption: 'choose an option in',\n longPress: 'long-press',\n swipe: 'swipe',\n focus: 'focus',\n};\n\n/** `expect.toX` → what it claims about the target. */\nconst CLAIMS: Record<string, [positive: string, negative: string]> = {\n toBeVisible: ['is visible', 'is not visible'],\n toBeHidden: ['is hidden', 'is not hidden'],\n toBeEnabled: ['is enabled', 'is not enabled'],\n toBeDisabled: ['is disabled', 'is not disabled'],\n toBeChecked: ['is checked', 'is not checked'],\n toBeFocused: ['is focused', 'is not focused'],\n toBeSelected: ['is selected', 'is not selected'],\n toBeExpanded: ['is expanded', 'is not expanded'],\n toBeAttached: ['is on the page', 'is not on the page'],\n toHaveText: ['shows the expected text', 'does not show the given text'],\n toContainText: [\n 'contains the expected text',\n 'does not contain the given text',\n ],\n toHaveValue: ['has the expected value', 'does not have the given value'],\n toHaveCount: [\n 'appears the expected number of times',\n 'does not appear the given number of times',\n ],\n toHaveAccessibleName: [\n 'has the expected accessible name',\n 'does not have the given accessible name',\n ],\n toHaveAttribute: [\n 'has the expected attribute',\n 'does not have the given attribute',\n ],\n};\n\nconst APP: Record<string, string> = {\n 'app.back': 'go back',\n 'app.restart': 'restart the app',\n 'app.clearState': 'clear the app state',\n 'session.launch': 'launch the app session',\n 'session.close': 'close the app session',\n};\n\n/** Step text for one non-agent step. */\nexport function phraseStep(api: string, label: string): string {\n const raw = label ? `${api} ${label}` : api;\n\n if (api === 'app.open') return label ? `open ${label}` : 'open the app';\n if (api === 'app.screenshot')\n return label ? `take a screenshot: ${label}` : 'take a screenshot';\n if (api === 'session.save')\n return label ? `save the session as ${label}` : 'save the session';\n if (APP[api]) return APP[api];\n\n const action = /^locator\\.(\\w+)$/.exec(api)?.[1];\n if (action !== undefined) {\n if (action === 'waitFor') {\n // `<target> → <state>`\n const [target, state] = label.split(' → ');\n const noun = target === undefined ? undefined : describeTarget(target);\n return noun && state ? `wait until ${noun} is ${state}` : raw;\n }\n const verb = ACTIONS[action];\n const noun = describeTarget(label);\n return verb && noun ? `${verb} ${noun}` : raw;\n }\n\n const claim = /^expect\\.(not\\.)?(\\w+)$/.exec(api);\n if (claim) {\n const words = CLAIMS[claim[2]!];\n const noun = describeTarget(label);\n return words && noun ? `${noun} ${words[claim[1] ? 1 : 0]}` : raw;\n }\n\n return raw;\n}\n","/**\n * Step markers for e2e tests.\n *\n * A marker records where and when the test called it. The reporter groups\n * the e2e steps that ran after a marker under the marker's text:\n *\n * ```ts\n * test('incrementing shows the new count', async ({ app, screen }) => {\n * story.given('the counter page is open');\n * await app.open('/');\n * story.when('the user presses Increment twice');\n * await screen.getByRole('button', { name: 'Increment' }).click();\n * await screen.getByRole('button', { name: 'Increment' }).click();\n * story.then('the count reads 2');\n * await expect(screen.getByRole('status')).toHaveText('2');\n * });\n * ```\n */\n\nimport { appendFileSync, mkdirSync } from 'node:fs';\nimport * as path from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nexport type MarkerKeyword = 'Given' | 'When' | 'Then' | 'And' | 'But';\n\n/** One line of a markers file. */\nexport interface Marker {\n keyword: MarkerKeyword;\n text: string;\n /** Absolute path of the test file that called the marker. */\n file: string;\n line: number;\n /** Orders a marker before a step on its own line; absent reads as the line's start. */\n column?: number;\n /** Epoch milliseconds. */\n at: number;\n}\n\n/** Workers and the reporter both resolve this against the project root e2e runs from. */\nexport const MARKERS_DIR = '.executable-stories/e2e-markers';\n\nconst FRAME = /\\(?((?:file:\\/\\/)?[^\\s()]+?):(\\d+):(\\d+)\\)?$/;\n\n/** The first stack frame outside this module: the test line that called the marker. */\nfunction callSite():\n { file: string; line: number; column: number } | undefined {\n const frames = (new Error().stack ?? '').split('\\n').slice(1);\n let own: string | undefined;\n for (const frame of frames) {\n const match = FRAME.exec(frame.trim());\n if (!match) continue;\n const file = match[1]!.startsWith('file://')\n ? fileURLToPath(match[1]!)\n : match[1]!;\n own ??= file;\n if (file !== own)\n return { file, line: Number(match[2]), column: Number(match[3]) };\n }\n return undefined;\n}\n\nfunction mark(keyword: MarkerKeyword, text: string): void {\n const site = callSite();\n if (site === undefined) return;\n const marker: Marker = { keyword, text, ...site, at: Date.now() };\n const dir = path.resolve(MARKERS_DIR);\n mkdirSync(dir, { recursive: true });\n // One file per worker process; appends from one process stay in order.\n appendFileSync(\n path.join(dir, `${process.pid}.jsonl`),\n `${JSON.stringify(marker)}\\n`,\n );\n}\n\n/** Step markers. Call before the e2e steps the marker describes; they render under its text. */\nexport const story = {\n given: (text: string): void => mark('Given', text),\n when: (text: string): void => mark('When', text),\n then: (text: string): void => mark('Then', text),\n and: (text: string): void => mark('And', text),\n but: (text: string): void => mark('But', text),\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,IAAAA,kBAAuB;AACvB,sBAAwD;AACxD,IAAAC,QAAsB;;;ACFtB,IAAM,aAAqC;AAAA,EACzC,SAAS;AAAA,EACT,WAAW;AAAA,EACX,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,KAAK;AACP;AAGA,IAAM,eACJ;AAEF,SAAS,QAAQ,MAAsB;AACrC,MAAI;AACF,WAAO,KAAK,MAAM,IAAI;AAAA,EACxB,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAGO,SAAS,eAAe,OAAmC;AAChE,QAAM,QAAQ,aAAa,KAAK,KAAK;AACrC,MAAI,CAAC,MAAO,QAAO;AACnB,QAAM,CAAC,EAAE,MAAM,UAAU,OAAO,IAAI;AACpC,QAAM,QAAQ,QAAQ,QAAS;AAC/B,QAAM,OAAO,YAAY,SAAY,SAAY,QAAQ,OAAO;AAChE,UAAQ,MAAM;AAAA,IACZ,KAAK,QAAQ;AACX,YAAM,OAAO,WAAW,KAAK,KAAK;AAClC,aAAO,SAAS,SAAY,OAAO,IAAI,KAAK,QAAQ,IAAI,KAAK,IAAI;AAAA,IACnE;AAAA,IACA,KAAK;AACH,aAAO,aAAa,KAAK;AAAA,IAC3B,KAAK;AAAA,IACL,KAAK;AACH,aAAO,QAAQ,KAAK;AAAA,IACtB,KAAK;AACH,aAAO,QAAQ,KAAK;AAAA,IACtB,KAAK;A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