@plune-ai/cli 0.39.0 → 0.39.2
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/README.md +1 -1
- package/dist/cli.cjs +75 -38
- package/dist/index.cjs +54 -17
- package/dist/index.d.cts +19 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +54 -17
- package/dist/reporter-core.cjs +1 -1
- package/dist/reporter-core.js +1 -1
- package/package.json +1 -1
- package/skills/qa-mission/SKILL.md +13 -4
- package/skills/qa-mission/references/llm-evals.md +122 -0
- package/skills/qa-mission/references/tool-calls.md +7 -6
package/README.md
CHANGED
|
@@ -138,7 +138,7 @@ the last resort, used only when `PLUNE_TOKEN` is set nowhere else. Nothing write
|
|
|
138
138
|
| `plune run exec -- <command>` | Open a run, run the command inside it, close the run — and exit with whatever the command returned. Sets `PLUNE_SHARED_RUN` for you, so anything reporting inside joins that run. Flags: `--key <externalKey>`, `--name <text>` (as on `run start`), `--fail-on-failures` to exit with [the gate](#a-release-gate---fail-on-failures)'s code instead — or with the command's own when no result reached the run. |
|
|
139
139
|
| `plune run delete <id>` | Delete a run and everything it produced — its results and the review-queue entries it raised. Approved test cases and the audit log stay. **Recoverable for 30 days** (an owner of the project can put it back from Settings → Bin), then gone for good. No prompt: it is your data, and this command belongs in scripts. |
|
|
140
140
|
| `plune run report` | Replay `.plune/pending-results.jsonl` — send what the reporter could not. The lines of one reporter run go back as one run, with the commit and branch the reporter recorded. Once every result has gone the file is renamed to `pending-results.<time>.sent.jsonl`; if anything did not go, it stays as it was. Flags: `--file <path>`. |
|
|
141
|
-
| `plune ingest [dir]` | Record a [Cairn](https://github.com/plune-ai/cairn) run in Plune. Omit `[dir]` for the newest run under `./runs`, or name the directory holding `report.json`. Generated cases arrive as **review proposals** — nothing is created until a person approves it. A run recorded with `--screencast` also sends each case's video and trace to its proposal (or to its result, for a case approved before), up to 100 MiB a file; a file that does not go is a line under the counters, never a failure. Against a platform with `POST /v1/jobs` the ingest is also reported as a job (kind `ingest`, counting the cases sent, linked to the run it landed in) that ends completed, or failed with the error text if the ingest fails; as with `sync`, an older platform is not told and a job report never fails the ingest or changes its exit code. |
|
|
141
|
+
| `plune ingest [dir]` | Record a [Cairn](https://github.com/plune-ai/cairn) run in Plune. Omit `[dir]` for the newest run under `./runs`, or name the directory holding `report.json`. Generated cases arrive as **review proposals** — nothing is created until a person approves it. A run recorded with `--screencast` also sends each case's video and trace to its proposal (or to its result, for a case approved before), up to 100 MiB a file; a file that does not go is a line under the counters, never a failure. The ingest declares those recordings on each case first (title, chapters, and each file's run-relative path, kind and size, a file over 100 MiB included), so the proposal can show what each file became. Against a platform with `POST /v1/jobs` the ingest is also reported as a job (kind `ingest`, counting the cases sent, linked to the run it landed in) that ends completed, or failed with the error text if the ingest fails; as with `sync`, an older platform is not told and a job report never fails the ingest or changes its exit code. |
|
|
142
142
|
| `plune pull [file]` | Write the project's test cases as **one Markdown document** — Testomat's classical format, plus Plune's own columns — to `plune/cases.md` (or `[file]`). Refuses to overwrite a file git sees as modified; `--force` overrides, `--suite <id>` takes one suite or folder and what is under it. |
|
|
143
143
|
| `plune push [file] [--dry-run]` | Send the document back. Cases are matched by `id`; a block without one becomes a draft; an unknown id is refused by line; **nothing is deleted**. Prints the report — created, updated, unchanged, refused, warnings — and with `--dry-run` writes nothing. Exit `4` when anything was refused. |
|
|
144
144
|
| `plune requirements import <file.md>` | Import requirements from a **Markdown file** (an SRS, a PRD, a page exported from a wiki). With no mapping flags it lists the tables and sections the file has and exits `0`; with `--table` or `--sections` it is a **dry run** that writes nothing until you add `--yes`. See [Requirements from a Markdown file](#requirements-from-a-markdown-file). Needs a Plune platform that serves `POST /v1/projects/:id/requirements/import`. |
|
package/dist/cli.cjs
CHANGED
|
@@ -8845,7 +8845,7 @@ function fileSender(options) {
|
|
|
8845
8845
|
function ask3(job, size) {
|
|
8846
8846
|
requests += 1;
|
|
8847
8847
|
return client.post(`${filesOf2(job)}/uploads`, {
|
|
8848
|
-
files: [{ name: job.name, contentType: job.type, size }]
|
|
8848
|
+
files: [{ name: job.name, contentType: job.type, size, ...job.key !== void 0 ? { key: job.key } : {} }]
|
|
8849
8849
|
}, uploadRetries);
|
|
8850
8850
|
}
|
|
8851
8851
|
function failed2(job, why) {
|
|
@@ -14887,8 +14887,8 @@ function jsonText(value2) {
|
|
|
14887
14887
|
const entries2 = Object.entries(step.value).filter(([, v]) => array || !skipped(v));
|
|
14888
14888
|
const parts = [{ text: array ? "[" : "{" }];
|
|
14889
14889
|
entries2.forEach(([key, v], i) => {
|
|
14890
|
-
const
|
|
14891
|
-
parts.push({ text: array ?
|
|
14890
|
+
const sep4 = i === 0 ? "" : ",";
|
|
14891
|
+
parts.push({ text: array ? sep4 : `${sep4}${JSON.stringify(key)}:` }, { value: v });
|
|
14892
14892
|
});
|
|
14893
14893
|
parts.push({ text: array ? "]" : "}" });
|
|
14894
14894
|
for (const part of parts.reverse()) todo.push(part);
|
|
@@ -33562,27 +33562,58 @@ async function readCairnSessionFiles(dir) {
|
|
|
33562
33562
|
if (typeof p !== "string" || p === "") return void 0;
|
|
33563
33563
|
const abs = path22.resolve(root, p);
|
|
33564
33564
|
const real = await fs18.realpath(abs).catch(() => void 0);
|
|
33565
|
-
if (within2(abs) && (real === void 0 || within2(real)))
|
|
33565
|
+
if (within2(abs) && (real === void 0 || within2(real))) {
|
|
33566
|
+
const file = real ?? abs;
|
|
33567
|
+
const size = await fs18.stat(file).then((s) => s.size, () => void 0);
|
|
33568
|
+
return { path: file, rel: path22.relative(root, abs).split(path22.sep).join("/"), ...size !== void 0 ? { size } : {} };
|
|
33569
|
+
}
|
|
33566
33570
|
outside += 1;
|
|
33567
33571
|
return void 0;
|
|
33568
33572
|
};
|
|
33569
33573
|
const byCase = /* @__PURE__ */ new Map();
|
|
33574
|
+
const screencasts = /* @__PURE__ */ new Map();
|
|
33570
33575
|
let unmapped = 0;
|
|
33571
33576
|
for (const entry2 of raw) {
|
|
33572
33577
|
const rec = asRecord2(entry2);
|
|
33573
|
-
const
|
|
33574
|
-
for (const
|
|
33575
|
-
const
|
|
33576
|
-
if (
|
|
33578
|
+
const found = [];
|
|
33579
|
+
for (const kind2 of ["video", "trace"]) {
|
|
33580
|
+
const at2 = await inside(own2(rec, kind2));
|
|
33581
|
+
if (at2 !== void 0) found.push({ file: { path: at2.path, ...at2.size !== void 0 ? { size: at2.size } : {} }, rel: at2.rel, kind: kind2 });
|
|
33577
33582
|
}
|
|
33578
|
-
if (
|
|
33583
|
+
if (found.length === 0) continue;
|
|
33579
33584
|
const stableId = own2(rec, "stableId");
|
|
33580
|
-
if (typeof stableId !== "string" || stableId === "")
|
|
33581
|
-
|
|
33585
|
+
if (typeof stableId !== "string" || stableId === "") {
|
|
33586
|
+
unmapped += 1;
|
|
33587
|
+
continue;
|
|
33588
|
+
}
|
|
33589
|
+
byCase.set(stableId, [...byCase.get(stableId) ?? [], ...found.map((f) => f.file)]);
|
|
33590
|
+
const declared2 = screencasts.get(stableId) ?? [];
|
|
33591
|
+
const keys = new Set(declared2.flatMap((s) => s.files.map((f) => f.key)));
|
|
33592
|
+
const title = clip(str(own2(rec, "test")));
|
|
33593
|
+
const files = found.filter((f) => {
|
|
33594
|
+
if ((f.file.size ?? 0) < 1 || f.rel.length > DECLARED.text || path22.basename(f.file.path).length > DECLARED.name || keys.has(f.rel)) return false;
|
|
33595
|
+
keys.add(f.rel);
|
|
33596
|
+
return true;
|
|
33597
|
+
});
|
|
33598
|
+
if (title === "" || files.length === 0 || declared2.length >= DECLARED.perCase) continue;
|
|
33599
|
+
for (const f of files) f.file.key = f.rel;
|
|
33600
|
+
const timing = own2(rec, "timing");
|
|
33601
|
+
declared2.push({
|
|
33602
|
+
title,
|
|
33603
|
+
...timing === "trace" || timing === "estimated" ? { timing } : {},
|
|
33604
|
+
chapters: (Array.isArray(own2(rec, "chapters")) ? own2(rec, "chapters") : []).flatMap((c) => {
|
|
33605
|
+
const chapter = asRecord2(c);
|
|
33606
|
+
const t = clip(str(own2(chapter, "title")));
|
|
33607
|
+
const atMs = own2(chapter, "atMs");
|
|
33608
|
+
return t !== "" && Number.isInteger(atMs) && atMs >= 0 ? [{ title: t, atMs }] : [];
|
|
33609
|
+
}).slice(0, DECLARED.chapters),
|
|
33610
|
+
files: files.map((f) => ({ key: f.rel, name: path22.basename(f.file.path), kind: f.kind, size: f.file.size }))
|
|
33611
|
+
});
|
|
33612
|
+
screencasts.set(stableId, declared2);
|
|
33582
33613
|
}
|
|
33583
|
-
return { byCase, unmapped, outside };
|
|
33614
|
+
return { byCase, screencasts, unmapped, outside };
|
|
33584
33615
|
}
|
|
33585
|
-
var fs18, path22, SUPPORTED_ARTIFACT_VERSION, INGEST_SCHEMA_VERSION, NoCairnRunsError, CairnRunNotFoundError, CairnRunVersionError, CairnRunPartialError, CairnArtifactShapeError, CairnEvidenceAmbiguousError, asRecord2, str, own2, MAX_ARTIFACT_BYTES, MAX_MCP_CASES, ARGS_CHARS2, SECRET_NAME, maskNamed, MCP_STATES;
|
|
33616
|
+
var fs18, path22, SUPPORTED_ARTIFACT_VERSION, INGEST_SCHEMA_VERSION, NoCairnRunsError, CairnRunNotFoundError, CairnRunVersionError, CairnRunPartialError, CairnArtifactShapeError, CairnEvidenceAmbiguousError, asRecord2, str, own2, MAX_ARTIFACT_BYTES, MAX_MCP_CASES, ARGS_CHARS2, SECRET_NAME, maskNamed, MCP_STATES, DECLARED, clip;
|
|
33586
33617
|
var init_cairn_artifact = __esm({
|
|
33587
33618
|
"src/cli/commands/cairn-artifact.ts"() {
|
|
33588
33619
|
"use strict";
|
|
@@ -33663,6 +33694,8 @@ var init_cairn_artifact = __esm({
|
|
|
33663
33694
|
"could-not-run",
|
|
33664
33695
|
"needs-review"
|
|
33665
33696
|
]);
|
|
33697
|
+
DECLARED = { text: 500, name: 200, chapters: 200, perCase: 20 };
|
|
33698
|
+
clip = (s) => s.slice(0, DECLARED.text).replace(/[\uD800-\uDBFF]$/, "");
|
|
33666
33699
|
}
|
|
33667
33700
|
});
|
|
33668
33701
|
|
|
@@ -33721,8 +33754,7 @@ async function heldBy(client, runId, jobs) {
|
|
|
33721
33754
|
for (const job of results4) held.set(targetOf3(job), byResult === void 0 ? void 0 : byResult.get(job.id) ?? /* @__PURE__ */ new Set());
|
|
33722
33755
|
return held;
|
|
33723
33756
|
}
|
|
33724
|
-
async function sendSessionFiles(
|
|
33725
|
-
const session2 = await readCairnSessionFiles(dir);
|
|
33757
|
+
async function sendSessionFiles(session2, sent, platform) {
|
|
33726
33758
|
if (session2 === void 0 || session2.byCase.size === 0 && session2.unmapped === 0 && session2.outside === 0) return [];
|
|
33727
33759
|
if (sent.items === void 0) {
|
|
33728
33760
|
return ["session files not uploaded \u2014 this Plune is older than the routes that take them"];
|
|
@@ -33737,9 +33769,8 @@ async function sendSessionFiles(dir, sent, platform) {
|
|
|
33737
33769
|
const paths = session2.byCase.get(item.stableId);
|
|
33738
33770
|
if (paths === void 0 || placed.has(item.stableId)) continue;
|
|
33739
33771
|
placed.add(item.stableId);
|
|
33740
|
-
for (const file of paths) {
|
|
33772
|
+
for (const { path: file, size, key } of paths) {
|
|
33741
33773
|
const name = path23.basename(file);
|
|
33742
|
-
const size = await import_node_fs19.promises.stat(file).then((s) => s.size, () => void 0);
|
|
33743
33774
|
if (size !== void 0 && size > SESSION_FILE_MAX) {
|
|
33744
33775
|
tooBig += 1;
|
|
33745
33776
|
lines.push(`"${name}" skipped \u2014 larger than the ${SESSION_FILE_MAX / (1024 * 1024)} MiB a session file may be`);
|
|
@@ -33752,7 +33783,9 @@ async function sendSessionFiles(dir, sent, platform) {
|
|
|
33752
33783
|
kind: "file",
|
|
33753
33784
|
name,
|
|
33754
33785
|
type,
|
|
33755
|
-
path: file
|
|
33786
|
+
path: file,
|
|
33787
|
+
// Declared on the proposal only: a result's route has no declaration to match.
|
|
33788
|
+
...key !== void 0 && item.reviewItemId !== void 0 ? { key } : {}
|
|
33756
33789
|
});
|
|
33757
33790
|
}
|
|
33758
33791
|
}
|
|
@@ -33810,6 +33843,11 @@ async function handleIngest(deps) {
|
|
|
33810
33843
|
if (token2 === null) throw new IngestNotLoggedInError();
|
|
33811
33844
|
const dir = deps.dir ?? await findLatestCairnRun(deps.runsDir);
|
|
33812
33845
|
const payload2 = await readCairnRun(dir);
|
|
33846
|
+
const session2 = await readCairnSessionFiles(dir).catch(() => void 0);
|
|
33847
|
+
for (const c of payload2.cases) {
|
|
33848
|
+
const screencasts = session2?.screencasts.get(c.stableId);
|
|
33849
|
+
if (screencasts !== void 0) c.screencasts = screencasts;
|
|
33850
|
+
}
|
|
33813
33851
|
const doFetch = deps.fetchImpl ?? fetch;
|
|
33814
33852
|
const endpoint = `${apiUrl}/v1/ingest/cairn`;
|
|
33815
33853
|
const job = new JobReporter(doFetch, apiUrl, token2, "ingest");
|
|
@@ -33817,7 +33855,7 @@ async function handleIngest(deps) {
|
|
|
33817
33855
|
try {
|
|
33818
33856
|
const { result: result2, ...sent } = await upload();
|
|
33819
33857
|
await job.uploaded({ subjectId: result2.runId || void 0 });
|
|
33820
|
-
const files = await sendSessionFiles(
|
|
33858
|
+
const files = await sendSessionFiles(session2, { ...sent, runId: result2.runId }, { apiUrl, token: token2, ...deps.fetchImpl !== void 0 ? { fetchImpl: deps.fetchImpl } : {} }).catch(
|
|
33821
33859
|
() => ["session files not uploaded (an unexpected error) \u2014 the run is recorded"]
|
|
33822
33860
|
);
|
|
33823
33861
|
if (files.length > 0) result2.files = files;
|
|
@@ -33878,12 +33916,11 @@ function formatIngestResult(r) {
|
|
|
33878
33916
|
return `${lines.join("\n")}
|
|
33879
33917
|
`;
|
|
33880
33918
|
}
|
|
33881
|
-
var
|
|
33919
|
+
var path23, IngestNotLoggedInError, IngestTokenRejectedError, IngestNetworkError, IngestHttpError, SESSION_FILE_MAX, SESSION_UPLOADS_AT_ONCE, TYPE_BY_EXTENSION2, RESULT_PAGES_MAX, namesOf, targetOf3;
|
|
33882
33920
|
var init_ingest = __esm({
|
|
33883
33921
|
"src/cli/commands/ingest.ts"() {
|
|
33884
33922
|
"use strict";
|
|
33885
33923
|
init_cjs_shims();
|
|
33886
|
-
import_node_fs19 = require("fs");
|
|
33887
33924
|
path23 = __toESM(require("path"), 1);
|
|
33888
33925
|
init_client();
|
|
33889
33926
|
init_env2();
|
|
@@ -34035,7 +34072,7 @@ function readMarkdown(cwd, file) {
|
|
|
34035
34072
|
const target4 = (0, import_node_path13.resolve)(cwd, file);
|
|
34036
34073
|
let size;
|
|
34037
34074
|
try {
|
|
34038
|
-
const st = (0,
|
|
34075
|
+
const st = (0, import_node_fs19.statSync)(target4);
|
|
34039
34076
|
if (!st.isFile()) return usage(`${target4} is not a file.`);
|
|
34040
34077
|
size = st.size;
|
|
34041
34078
|
} catch {
|
|
@@ -34046,7 +34083,7 @@ function readMarkdown(cwd, file) {
|
|
|
34046
34083
|
}
|
|
34047
34084
|
let text6;
|
|
34048
34085
|
try {
|
|
34049
|
-
text6 = new TextDecoder("utf-8", { fatal: true }).decode((0,
|
|
34086
|
+
text6 = new TextDecoder("utf-8", { fatal: true }).decode((0, import_node_fs19.readFileSync)(target4));
|
|
34050
34087
|
} catch {
|
|
34051
34088
|
return usage(`${target4} is not valid UTF-8. Save it as UTF-8 and try again.`);
|
|
34052
34089
|
}
|
|
@@ -34170,12 +34207,12 @@ function reportRequirementsImportFailure(err, write) {
|
|
|
34170
34207
|
write(err.message + "\n");
|
|
34171
34208
|
return err.exitCode;
|
|
34172
34209
|
}
|
|
34173
|
-
var
|
|
34210
|
+
var import_node_fs19, import_node_path13, MAX_MARKDOWN_BYTES, RequirementsImportError, usage, COLUMN_FLAGS, SECTION_FLAGS, oneOf5, TABLE_SPEC_KEYS, SPEC_HELP, SUPPORT, SHOWN4, flat2, cut4, plural8;
|
|
34174
34211
|
var init_requirements_import = __esm({
|
|
34175
34212
|
"src/cli/commands/requirements-import.ts"() {
|
|
34176
34213
|
"use strict";
|
|
34177
34214
|
init_cjs_shims();
|
|
34178
|
-
|
|
34215
|
+
import_node_fs19 = require("fs");
|
|
34179
34216
|
import_node_path13 = require("path");
|
|
34180
34217
|
init_client();
|
|
34181
34218
|
init_api_url();
|
|
@@ -34376,7 +34413,7 @@ async function loadSources(deps) {
|
|
|
34376
34413
|
let raw;
|
|
34377
34414
|
if (deps.from !== void 0) {
|
|
34378
34415
|
try {
|
|
34379
|
-
raw = (0,
|
|
34416
|
+
raw = (0, import_node_fs20.readFileSync)(deps.from, "utf8");
|
|
34380
34417
|
} catch {
|
|
34381
34418
|
throw new SyncFileError(`cannot read ${deps.from}`);
|
|
34382
34419
|
}
|
|
@@ -34428,13 +34465,13 @@ function formatVerify(r) {
|
|
|
34428
34465
|
);
|
|
34429
34466
|
return lines.join("\n") + "\n";
|
|
34430
34467
|
}
|
|
34431
|
-
var import_node_child_process4,
|
|
34468
|
+
var import_node_child_process4, import_node_fs20, TOKEN5;
|
|
34432
34469
|
var init_verify = __esm({
|
|
34433
34470
|
"src/cli/commands/verify.ts"() {
|
|
34434
34471
|
"use strict";
|
|
34435
34472
|
init_cjs_shims();
|
|
34436
34473
|
import_node_child_process4 = require("child_process");
|
|
34437
|
-
|
|
34474
|
+
import_node_fs20 = require("fs");
|
|
34438
34475
|
init_plan();
|
|
34439
34476
|
init_sync();
|
|
34440
34477
|
TOKEN5 = /@P([A-Za-z0-9_-]+)/;
|
|
@@ -34849,10 +34886,10 @@ __export(ids_exports, {
|
|
|
34849
34886
|
serializeMap: () => serializeMap
|
|
34850
34887
|
});
|
|
34851
34888
|
function readMap(file) {
|
|
34852
|
-
if (!(0,
|
|
34889
|
+
if (!(0, import_node_fs21.existsSync)(file)) return {};
|
|
34853
34890
|
let parsed4;
|
|
34854
34891
|
try {
|
|
34855
|
-
parsed4 = JSON.parse((0,
|
|
34892
|
+
parsed4 = JSON.parse((0, import_node_fs21.readFileSync)(file, "utf8"));
|
|
34856
34893
|
} catch {
|
|
34857
34894
|
throw new SyncFileError(`${file} is not valid JSON; fix or remove it, nothing was written`);
|
|
34858
34895
|
}
|
|
@@ -34900,8 +34937,8 @@ async function handleIds(deps) {
|
|
|
34900
34937
|
let written = false;
|
|
34901
34938
|
if (deps.write === true && Object.keys(plan.added).length > 0) {
|
|
34902
34939
|
try {
|
|
34903
|
-
(0,
|
|
34904
|
-
(0,
|
|
34940
|
+
(0, import_node_fs21.mkdirSync)((0, import_node_path14.dirname)(file), { recursive: true });
|
|
34941
|
+
(0, import_node_fs21.writeFileSync)(file, serializeMap({ ...current, ...plan.added }));
|
|
34905
34942
|
} catch {
|
|
34906
34943
|
throw new SyncFileError(`cannot write ${file}`);
|
|
34907
34944
|
}
|
|
@@ -34929,12 +34966,12 @@ function formatIds(r, write) {
|
|
|
34929
34966
|
);
|
|
34930
34967
|
return lines.join("\n") + "\n";
|
|
34931
34968
|
}
|
|
34932
|
-
var
|
|
34969
|
+
var import_node_fs21, import_node_path14, DEFAULT_IDS_FILE, compareKeys;
|
|
34933
34970
|
var init_ids = __esm({
|
|
34934
34971
|
"src/cli/commands/ids.ts"() {
|
|
34935
34972
|
"use strict";
|
|
34936
34973
|
init_cjs_shims();
|
|
34937
|
-
|
|
34974
|
+
import_node_fs21 = require("fs");
|
|
34938
34975
|
import_node_path14 = require("path");
|
|
34939
34976
|
init_verify();
|
|
34940
34977
|
init_sync();
|
|
@@ -34953,7 +34990,7 @@ module.exports = __toCommonJS(cli_exports);
|
|
|
34953
34990
|
init_cjs_shims();
|
|
34954
34991
|
init_api_url();
|
|
34955
34992
|
var import_commander = require("commander");
|
|
34956
|
-
var
|
|
34993
|
+
var import_node_fs22 = require("fs");
|
|
34957
34994
|
var import_node_path15 = require("path");
|
|
34958
34995
|
var import_node_url = require("url");
|
|
34959
34996
|
init_duration();
|
|
@@ -34990,7 +35027,7 @@ var rawArgsOf = (program) => program.rawArgs ?? [];
|
|
|
34990
35027
|
|
|
34991
35028
|
// src/cli.ts
|
|
34992
35029
|
var __dirname = (0, import_node_path15.dirname)((0, import_node_url.fileURLToPath)(importMetaUrl));
|
|
34993
|
-
var pkg = JSON.parse((0,
|
|
35030
|
+
var pkg = JSON.parse((0, import_node_fs22.readFileSync)((0, import_node_path15.join)(__dirname, "..", "package.json"), "utf-8"));
|
|
34994
35031
|
function toFormat(s) {
|
|
34995
35032
|
return s === "json" || s === "markdown" ? s : "console";
|
|
34996
35033
|
}
|
|
@@ -34999,7 +35036,7 @@ function shouldColor(outputPath) {
|
|
|
34999
35036
|
}
|
|
35000
35037
|
function writeReport2(text6, outputPath) {
|
|
35001
35038
|
if (outputPath !== void 0) {
|
|
35002
|
-
(0,
|
|
35039
|
+
(0, import_node_fs22.writeFileSync)(outputPath, text6);
|
|
35003
35040
|
} else {
|
|
35004
35041
|
process.stdout.write(text6 + "\n");
|
|
35005
35042
|
}
|
|
@@ -35923,7 +35960,7 @@ function isMainModule() {
|
|
|
35923
35960
|
const entry2 = process.argv[1];
|
|
35924
35961
|
if (entry2 === void 0) return false;
|
|
35925
35962
|
try {
|
|
35926
|
-
return (0,
|
|
35963
|
+
return (0, import_node_fs22.realpathSync)(entry2) === (0, import_node_fs22.realpathSync)((0, import_node_url.fileURLToPath)(importMetaUrl));
|
|
35927
35964
|
} catch {
|
|
35928
35965
|
return false;
|
|
35929
35966
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -4983,7 +4983,6 @@ function reportSyncFailure(err, write) {
|
|
|
4983
4983
|
|
|
4984
4984
|
// src/cli/commands/ingest.ts
|
|
4985
4985
|
init_cjs_shims();
|
|
4986
|
-
var import_node_fs8 = require("fs");
|
|
4987
4986
|
var path10 = __toESM(require("path"), 1);
|
|
4988
4987
|
|
|
4989
4988
|
// src/reporter-core/client.ts
|
|
@@ -5359,7 +5358,7 @@ function fileSender(options) {
|
|
|
5359
5358
|
function ask(job, size) {
|
|
5360
5359
|
requests += 1;
|
|
5361
5360
|
return client.post(`${filesOf(job)}/uploads`, {
|
|
5362
|
-
files: [{ name: job.name, contentType: job.type, size }]
|
|
5361
|
+
files: [{ name: job.name, contentType: job.type, size, ...job.key !== void 0 ? { key: job.key } : {} }]
|
|
5363
5362
|
}, uploadRetries);
|
|
5364
5363
|
}
|
|
5365
5364
|
function failed(job, why) {
|
|
@@ -7665,6 +7664,8 @@ async function readCairnRun(dir, deps = {}) {
|
|
|
7665
7664
|
cases
|
|
7666
7665
|
};
|
|
7667
7666
|
}
|
|
7667
|
+
var DECLARED = { text: 500, name: 200, chapters: 200, perCase: 20 };
|
|
7668
|
+
var clip = (s) => s.slice(0, DECLARED.text).replace(/[\uD800-\uDBFF]$/, "");
|
|
7668
7669
|
async function readCairnSessionFiles(dir) {
|
|
7669
7670
|
const raw = await readJson(path9.join(dir, "screencasts", "screencasts.json"));
|
|
7670
7671
|
if (!Array.isArray(raw)) return void 0;
|
|
@@ -7678,25 +7679,56 @@ async function readCairnSessionFiles(dir) {
|
|
|
7678
7679
|
if (typeof p !== "string" || p === "") return void 0;
|
|
7679
7680
|
const abs = path9.resolve(root, p);
|
|
7680
7681
|
const real = await fs8.realpath(abs).catch(() => void 0);
|
|
7681
|
-
if (within(abs) && (real === void 0 || within(real)))
|
|
7682
|
+
if (within(abs) && (real === void 0 || within(real))) {
|
|
7683
|
+
const file = real ?? abs;
|
|
7684
|
+
const size = await fs8.stat(file).then((s) => s.size, () => void 0);
|
|
7685
|
+
return { path: file, rel: path9.relative(root, abs).split(path9.sep).join("/"), ...size !== void 0 ? { size } : {} };
|
|
7686
|
+
}
|
|
7682
7687
|
outside += 1;
|
|
7683
7688
|
return void 0;
|
|
7684
7689
|
};
|
|
7685
7690
|
const byCase = /* @__PURE__ */ new Map();
|
|
7691
|
+
const screencasts = /* @__PURE__ */ new Map();
|
|
7686
7692
|
let unmapped = 0;
|
|
7687
7693
|
for (const entry of raw) {
|
|
7688
7694
|
const rec = asRecord(entry);
|
|
7689
|
-
const
|
|
7690
|
-
for (const
|
|
7691
|
-
const
|
|
7692
|
-
if (
|
|
7695
|
+
const found = [];
|
|
7696
|
+
for (const kind of ["video", "trace"]) {
|
|
7697
|
+
const at = await inside(own(rec, kind));
|
|
7698
|
+
if (at !== void 0) found.push({ file: { path: at.path, ...at.size !== void 0 ? { size: at.size } : {} }, rel: at.rel, kind });
|
|
7693
7699
|
}
|
|
7694
|
-
if (
|
|
7700
|
+
if (found.length === 0) continue;
|
|
7695
7701
|
const stableId = own(rec, "stableId");
|
|
7696
|
-
if (typeof stableId !== "string" || stableId === "")
|
|
7697
|
-
|
|
7702
|
+
if (typeof stableId !== "string" || stableId === "") {
|
|
7703
|
+
unmapped += 1;
|
|
7704
|
+
continue;
|
|
7705
|
+
}
|
|
7706
|
+
byCase.set(stableId, [...byCase.get(stableId) ?? [], ...found.map((f) => f.file)]);
|
|
7707
|
+
const declared = screencasts.get(stableId) ?? [];
|
|
7708
|
+
const keys = new Set(declared.flatMap((s) => s.files.map((f) => f.key)));
|
|
7709
|
+
const title = clip(str(own(rec, "test")));
|
|
7710
|
+
const files = found.filter((f) => {
|
|
7711
|
+
if ((f.file.size ?? 0) < 1 || f.rel.length > DECLARED.text || path9.basename(f.file.path).length > DECLARED.name || keys.has(f.rel)) return false;
|
|
7712
|
+
keys.add(f.rel);
|
|
7713
|
+
return true;
|
|
7714
|
+
});
|
|
7715
|
+
if (title === "" || files.length === 0 || declared.length >= DECLARED.perCase) continue;
|
|
7716
|
+
for (const f of files) f.file.key = f.rel;
|
|
7717
|
+
const timing = own(rec, "timing");
|
|
7718
|
+
declared.push({
|
|
7719
|
+
title,
|
|
7720
|
+
...timing === "trace" || timing === "estimated" ? { timing } : {},
|
|
7721
|
+
chapters: (Array.isArray(own(rec, "chapters")) ? own(rec, "chapters") : []).flatMap((c) => {
|
|
7722
|
+
const chapter = asRecord(c);
|
|
7723
|
+
const t = clip(str(own(chapter, "title")));
|
|
7724
|
+
const atMs = own(chapter, "atMs");
|
|
7725
|
+
return t !== "" && Number.isInteger(atMs) && atMs >= 0 ? [{ title: t, atMs }] : [];
|
|
7726
|
+
}).slice(0, DECLARED.chapters),
|
|
7727
|
+
files: files.map((f) => ({ key: f.rel, name: path9.basename(f.file.path), kind: f.kind, size: f.file.size }))
|
|
7728
|
+
});
|
|
7729
|
+
screencasts.set(stableId, declared);
|
|
7698
7730
|
}
|
|
7699
|
-
return { byCase, unmapped, outside };
|
|
7731
|
+
return { byCase, screencasts, unmapped, outside };
|
|
7700
7732
|
}
|
|
7701
7733
|
|
|
7702
7734
|
// src/cli/commands/ingest.ts
|
|
@@ -7776,8 +7808,7 @@ async function heldBy(client, runId, jobs) {
|
|
|
7776
7808
|
return held;
|
|
7777
7809
|
}
|
|
7778
7810
|
var targetOf = (job) => `${job.owner ?? "results"}/${job.id}`;
|
|
7779
|
-
async function sendSessionFiles(
|
|
7780
|
-
const session = await readCairnSessionFiles(dir);
|
|
7811
|
+
async function sendSessionFiles(session, sent, platform) {
|
|
7781
7812
|
if (session === void 0 || session.byCase.size === 0 && session.unmapped === 0 && session.outside === 0) return [];
|
|
7782
7813
|
if (sent.items === void 0) {
|
|
7783
7814
|
return ["session files not uploaded \u2014 this Plune is older than the routes that take them"];
|
|
@@ -7792,9 +7823,8 @@ async function sendSessionFiles(dir, sent, platform) {
|
|
|
7792
7823
|
const paths = session.byCase.get(item.stableId);
|
|
7793
7824
|
if (paths === void 0 || placed.has(item.stableId)) continue;
|
|
7794
7825
|
placed.add(item.stableId);
|
|
7795
|
-
for (const file of paths) {
|
|
7826
|
+
for (const { path: file, size, key } of paths) {
|
|
7796
7827
|
const name = path10.basename(file);
|
|
7797
|
-
const size = await import_node_fs8.promises.stat(file).then((s) => s.size, () => void 0);
|
|
7798
7828
|
if (size !== void 0 && size > SESSION_FILE_MAX) {
|
|
7799
7829
|
tooBig += 1;
|
|
7800
7830
|
lines.push(`"${name}" skipped \u2014 larger than the ${SESSION_FILE_MAX / (1024 * 1024)} MiB a session file may be`);
|
|
@@ -7807,7 +7837,9 @@ async function sendSessionFiles(dir, sent, platform) {
|
|
|
7807
7837
|
kind: "file",
|
|
7808
7838
|
name,
|
|
7809
7839
|
type,
|
|
7810
|
-
path: file
|
|
7840
|
+
path: file,
|
|
7841
|
+
// Declared on the proposal only: a result's route has no declaration to match.
|
|
7842
|
+
...key !== void 0 && item.reviewItemId !== void 0 ? { key } : {}
|
|
7811
7843
|
});
|
|
7812
7844
|
}
|
|
7813
7845
|
}
|
|
@@ -7865,6 +7897,11 @@ async function handleIngest(deps) {
|
|
|
7865
7897
|
if (token === null) throw new IngestNotLoggedInError();
|
|
7866
7898
|
const dir = deps.dir ?? await findLatestCairnRun(deps.runsDir);
|
|
7867
7899
|
const payload = await readCairnRun(dir);
|
|
7900
|
+
const session = await readCairnSessionFiles(dir).catch(() => void 0);
|
|
7901
|
+
for (const c of payload.cases) {
|
|
7902
|
+
const screencasts = session?.screencasts.get(c.stableId);
|
|
7903
|
+
if (screencasts !== void 0) c.screencasts = screencasts;
|
|
7904
|
+
}
|
|
7868
7905
|
const doFetch = deps.fetchImpl ?? fetch;
|
|
7869
7906
|
const endpoint = `${apiUrl}/v1/ingest/cairn`;
|
|
7870
7907
|
const job = new JobReporter(doFetch, apiUrl, token, "ingest");
|
|
@@ -7872,7 +7909,7 @@ async function handleIngest(deps) {
|
|
|
7872
7909
|
try {
|
|
7873
7910
|
const { result, ...sent } = await upload();
|
|
7874
7911
|
await job.uploaded({ subjectId: result.runId || void 0 });
|
|
7875
|
-
const files = await sendSessionFiles(
|
|
7912
|
+
const files = await sendSessionFiles(session, { ...sent, runId: result.runId }, { apiUrl, token, ...deps.fetchImpl !== void 0 ? { fetchImpl: deps.fetchImpl } : {} }).catch(
|
|
7876
7913
|
() => ["session files not uploaded (an unexpected error) \u2014 the run is recorded"]
|
|
7877
7914
|
);
|
|
7878
7915
|
if (files.length > 0) result.files = files;
|
package/dist/index.d.cts
CHANGED
|
@@ -1256,6 +1256,25 @@ interface CairnIngestCase {
|
|
|
1256
1256
|
verdict?: CairnVerdict;
|
|
1257
1257
|
technique?: string;
|
|
1258
1258
|
priority?: string;
|
|
1259
|
+
/** The case's recordings, from `screencasts/screencasts.json`. Absent when the run recorded none for it. */
|
|
1260
|
+
screencasts?: CairnScreencast[];
|
|
1261
|
+
}
|
|
1262
|
+
/** One recorded test, declared so the platform can show each file's state (uploaded, too big, no bucket) on the proposal. */
|
|
1263
|
+
interface CairnScreencast {
|
|
1264
|
+
/** The screencasts.json `test`. */
|
|
1265
|
+
title: string;
|
|
1266
|
+
timing?: 'trace' | 'estimated';
|
|
1267
|
+
chapters: {
|
|
1268
|
+
title: string;
|
|
1269
|
+
atMs: number;
|
|
1270
|
+
}[];
|
|
1271
|
+
/** `key` is the file's run-relative path, unique within the case; the upload of that file sends it back. */
|
|
1272
|
+
files: {
|
|
1273
|
+
key: string;
|
|
1274
|
+
name: string;
|
|
1275
|
+
kind: 'video' | 'trace';
|
|
1276
|
+
size: number;
|
|
1277
|
+
}[];
|
|
1259
1278
|
}
|
|
1260
1279
|
interface CairnIngestPayload {
|
|
1261
1280
|
schemaVersion: typeof INGEST_SCHEMA_VERSION;
|
package/dist/index.d.ts
CHANGED
|
@@ -1256,6 +1256,25 @@ interface CairnIngestCase {
|
|
|
1256
1256
|
verdict?: CairnVerdict;
|
|
1257
1257
|
technique?: string;
|
|
1258
1258
|
priority?: string;
|
|
1259
|
+
/** The case's recordings, from `screencasts/screencasts.json`. Absent when the run recorded none for it. */
|
|
1260
|
+
screencasts?: CairnScreencast[];
|
|
1261
|
+
}
|
|
1262
|
+
/** One recorded test, declared so the platform can show each file's state (uploaded, too big, no bucket) on the proposal. */
|
|
1263
|
+
interface CairnScreencast {
|
|
1264
|
+
/** The screencasts.json `test`. */
|
|
1265
|
+
title: string;
|
|
1266
|
+
timing?: 'trace' | 'estimated';
|
|
1267
|
+
chapters: {
|
|
1268
|
+
title: string;
|
|
1269
|
+
atMs: number;
|
|
1270
|
+
}[];
|
|
1271
|
+
/** `key` is the file's run-relative path, unique within the case; the upload of that file sends it back. */
|
|
1272
|
+
files: {
|
|
1273
|
+
key: string;
|
|
1274
|
+
name: string;
|
|
1275
|
+
kind: 'video' | 'trace';
|
|
1276
|
+
size: number;
|
|
1277
|
+
}[];
|
|
1259
1278
|
}
|
|
1260
1279
|
interface CairnIngestPayload {
|
|
1261
1280
|
schemaVersion: typeof INGEST_SCHEMA_VERSION;
|
package/dist/index.js
CHANGED
|
@@ -4945,7 +4945,6 @@ function reportSyncFailure(err, write) {
|
|
|
4945
4945
|
|
|
4946
4946
|
// src/cli/commands/ingest.ts
|
|
4947
4947
|
init_esm_shims();
|
|
4948
|
-
import { promises as disk2 } from "fs";
|
|
4949
4948
|
import * as path11 from "path";
|
|
4950
4949
|
|
|
4951
4950
|
// src/reporter-core/client.ts
|
|
@@ -5321,7 +5320,7 @@ function fileSender(options) {
|
|
|
5321
5320
|
function ask(job, size) {
|
|
5322
5321
|
requests += 1;
|
|
5323
5322
|
return client.post(`${filesOf(job)}/uploads`, {
|
|
5324
|
-
files: [{ name: job.name, contentType: job.type, size }]
|
|
5323
|
+
files: [{ name: job.name, contentType: job.type, size, ...job.key !== void 0 ? { key: job.key } : {} }]
|
|
5325
5324
|
}, uploadRetries);
|
|
5326
5325
|
}
|
|
5327
5326
|
function failed(job, why) {
|
|
@@ -7627,6 +7626,8 @@ async function readCairnRun(dir, deps = {}) {
|
|
|
7627
7626
|
cases
|
|
7628
7627
|
};
|
|
7629
7628
|
}
|
|
7629
|
+
var DECLARED = { text: 500, name: 200, chapters: 200, perCase: 20 };
|
|
7630
|
+
var clip = (s) => s.slice(0, DECLARED.text).replace(/[\uD800-\uDBFF]$/, "");
|
|
7630
7631
|
async function readCairnSessionFiles(dir) {
|
|
7631
7632
|
const raw = await readJson(path10.join(dir, "screencasts", "screencasts.json"));
|
|
7632
7633
|
if (!Array.isArray(raw)) return void 0;
|
|
@@ -7640,25 +7641,56 @@ async function readCairnSessionFiles(dir) {
|
|
|
7640
7641
|
if (typeof p !== "string" || p === "") return void 0;
|
|
7641
7642
|
const abs = path10.resolve(root, p);
|
|
7642
7643
|
const real = await fs8.realpath(abs).catch(() => void 0);
|
|
7643
|
-
if (within(abs) && (real === void 0 || within(real)))
|
|
7644
|
+
if (within(abs) && (real === void 0 || within(real))) {
|
|
7645
|
+
const file = real ?? abs;
|
|
7646
|
+
const size = await fs8.stat(file).then((s) => s.size, () => void 0);
|
|
7647
|
+
return { path: file, rel: path10.relative(root, abs).split(path10.sep).join("/"), ...size !== void 0 ? { size } : {} };
|
|
7648
|
+
}
|
|
7644
7649
|
outside += 1;
|
|
7645
7650
|
return void 0;
|
|
7646
7651
|
};
|
|
7647
7652
|
const byCase = /* @__PURE__ */ new Map();
|
|
7653
|
+
const screencasts = /* @__PURE__ */ new Map();
|
|
7648
7654
|
let unmapped = 0;
|
|
7649
7655
|
for (const entry of raw) {
|
|
7650
7656
|
const rec = asRecord(entry);
|
|
7651
|
-
const
|
|
7652
|
-
for (const
|
|
7653
|
-
const
|
|
7654
|
-
if (
|
|
7657
|
+
const found = [];
|
|
7658
|
+
for (const kind of ["video", "trace"]) {
|
|
7659
|
+
const at = await inside(own(rec, kind));
|
|
7660
|
+
if (at !== void 0) found.push({ file: { path: at.path, ...at.size !== void 0 ? { size: at.size } : {} }, rel: at.rel, kind });
|
|
7655
7661
|
}
|
|
7656
|
-
if (
|
|
7662
|
+
if (found.length === 0) continue;
|
|
7657
7663
|
const stableId = own(rec, "stableId");
|
|
7658
|
-
if (typeof stableId !== "string" || stableId === "")
|
|
7659
|
-
|
|
7664
|
+
if (typeof stableId !== "string" || stableId === "") {
|
|
7665
|
+
unmapped += 1;
|
|
7666
|
+
continue;
|
|
7667
|
+
}
|
|
7668
|
+
byCase.set(stableId, [...byCase.get(stableId) ?? [], ...found.map((f) => f.file)]);
|
|
7669
|
+
const declared = screencasts.get(stableId) ?? [];
|
|
7670
|
+
const keys = new Set(declared.flatMap((s) => s.files.map((f) => f.key)));
|
|
7671
|
+
const title = clip(str(own(rec, "test")));
|
|
7672
|
+
const files = found.filter((f) => {
|
|
7673
|
+
if ((f.file.size ?? 0) < 1 || f.rel.length > DECLARED.text || path10.basename(f.file.path).length > DECLARED.name || keys.has(f.rel)) return false;
|
|
7674
|
+
keys.add(f.rel);
|
|
7675
|
+
return true;
|
|
7676
|
+
});
|
|
7677
|
+
if (title === "" || files.length === 0 || declared.length >= DECLARED.perCase) continue;
|
|
7678
|
+
for (const f of files) f.file.key = f.rel;
|
|
7679
|
+
const timing = own(rec, "timing");
|
|
7680
|
+
declared.push({
|
|
7681
|
+
title,
|
|
7682
|
+
...timing === "trace" || timing === "estimated" ? { timing } : {},
|
|
7683
|
+
chapters: (Array.isArray(own(rec, "chapters")) ? own(rec, "chapters") : []).flatMap((c) => {
|
|
7684
|
+
const chapter = asRecord(c);
|
|
7685
|
+
const t = clip(str(own(chapter, "title")));
|
|
7686
|
+
const atMs = own(chapter, "atMs");
|
|
7687
|
+
return t !== "" && Number.isInteger(atMs) && atMs >= 0 ? [{ title: t, atMs }] : [];
|
|
7688
|
+
}).slice(0, DECLARED.chapters),
|
|
7689
|
+
files: files.map((f) => ({ key: f.rel, name: path10.basename(f.file.path), kind: f.kind, size: f.file.size }))
|
|
7690
|
+
});
|
|
7691
|
+
screencasts.set(stableId, declared);
|
|
7660
7692
|
}
|
|
7661
|
-
return { byCase, unmapped, outside };
|
|
7693
|
+
return { byCase, screencasts, unmapped, outside };
|
|
7662
7694
|
}
|
|
7663
7695
|
|
|
7664
7696
|
// src/cli/commands/ingest.ts
|
|
@@ -7738,8 +7770,7 @@ async function heldBy(client, runId, jobs) {
|
|
|
7738
7770
|
return held;
|
|
7739
7771
|
}
|
|
7740
7772
|
var targetOf = (job) => `${job.owner ?? "results"}/${job.id}`;
|
|
7741
|
-
async function sendSessionFiles(
|
|
7742
|
-
const session = await readCairnSessionFiles(dir);
|
|
7773
|
+
async function sendSessionFiles(session, sent, platform) {
|
|
7743
7774
|
if (session === void 0 || session.byCase.size === 0 && session.unmapped === 0 && session.outside === 0) return [];
|
|
7744
7775
|
if (sent.items === void 0) {
|
|
7745
7776
|
return ["session files not uploaded \u2014 this Plune is older than the routes that take them"];
|
|
@@ -7754,9 +7785,8 @@ async function sendSessionFiles(dir, sent, platform) {
|
|
|
7754
7785
|
const paths = session.byCase.get(item.stableId);
|
|
7755
7786
|
if (paths === void 0 || placed.has(item.stableId)) continue;
|
|
7756
7787
|
placed.add(item.stableId);
|
|
7757
|
-
for (const file of paths) {
|
|
7788
|
+
for (const { path: file, size, key } of paths) {
|
|
7758
7789
|
const name = path11.basename(file);
|
|
7759
|
-
const size = await disk2.stat(file).then((s) => s.size, () => void 0);
|
|
7760
7790
|
if (size !== void 0 && size > SESSION_FILE_MAX) {
|
|
7761
7791
|
tooBig += 1;
|
|
7762
7792
|
lines.push(`"${name}" skipped \u2014 larger than the ${SESSION_FILE_MAX / (1024 * 1024)} MiB a session file may be`);
|
|
@@ -7769,7 +7799,9 @@ async function sendSessionFiles(dir, sent, platform) {
|
|
|
7769
7799
|
kind: "file",
|
|
7770
7800
|
name,
|
|
7771
7801
|
type,
|
|
7772
|
-
path: file
|
|
7802
|
+
path: file,
|
|
7803
|
+
// Declared on the proposal only: a result's route has no declaration to match.
|
|
7804
|
+
...key !== void 0 && item.reviewItemId !== void 0 ? { key } : {}
|
|
7773
7805
|
});
|
|
7774
7806
|
}
|
|
7775
7807
|
}
|
|
@@ -7827,6 +7859,11 @@ async function handleIngest(deps) {
|
|
|
7827
7859
|
if (token === null) throw new IngestNotLoggedInError();
|
|
7828
7860
|
const dir = deps.dir ?? await findLatestCairnRun(deps.runsDir);
|
|
7829
7861
|
const payload = await readCairnRun(dir);
|
|
7862
|
+
const session = await readCairnSessionFiles(dir).catch(() => void 0);
|
|
7863
|
+
for (const c of payload.cases) {
|
|
7864
|
+
const screencasts = session?.screencasts.get(c.stableId);
|
|
7865
|
+
if (screencasts !== void 0) c.screencasts = screencasts;
|
|
7866
|
+
}
|
|
7830
7867
|
const doFetch = deps.fetchImpl ?? fetch;
|
|
7831
7868
|
const endpoint = `${apiUrl}/v1/ingest/cairn`;
|
|
7832
7869
|
const job = new JobReporter(doFetch, apiUrl, token, "ingest");
|
|
@@ -7834,7 +7871,7 @@ async function handleIngest(deps) {
|
|
|
7834
7871
|
try {
|
|
7835
7872
|
const { result, ...sent } = await upload();
|
|
7836
7873
|
await job.uploaded({ subjectId: result.runId || void 0 });
|
|
7837
|
-
const files = await sendSessionFiles(
|
|
7874
|
+
const files = await sendSessionFiles(session, { ...sent, runId: result.runId }, { apiUrl, token, ...deps.fetchImpl !== void 0 ? { fetchImpl: deps.fetchImpl } : {} }).catch(
|
|
7838
7875
|
() => ["session files not uploaded (an unexpected error) \u2014 the run is recorded"]
|
|
7839
7876
|
);
|
|
7840
7877
|
if (files.length > 0) result.files = files;
|
package/dist/reporter-core.cjs
CHANGED
|
@@ -789,7 +789,7 @@ function fileSender(options) {
|
|
|
789
789
|
function ask(job, size) {
|
|
790
790
|
requests += 1;
|
|
791
791
|
return client.post(`${filesOf2(job)}/uploads`, {
|
|
792
|
-
files: [{ name: job.name, contentType: job.type, size }]
|
|
792
|
+
files: [{ name: job.name, contentType: job.type, size, ...job.key !== void 0 ? { key: job.key } : {} }]
|
|
793
793
|
}, uploadRetries);
|
|
794
794
|
}
|
|
795
795
|
function failed(job, why) {
|
package/dist/reporter-core.js
CHANGED
|
@@ -739,7 +739,7 @@ function fileSender(options) {
|
|
|
739
739
|
function ask(job, size) {
|
|
740
740
|
requests += 1;
|
|
741
741
|
return client.post(`${filesOf2(job)}/uploads`, {
|
|
742
|
-
files: [{ name: job.name, contentType: job.type, size }]
|
|
742
|
+
files: [{ name: job.name, contentType: job.type, size, ...job.key !== void 0 ? { key: job.key } : {} }]
|
|
743
743
|
}, uploadRetries);
|
|
744
744
|
}
|
|
745
745
|
function failed(job, why) {
|
package/package.json
CHANGED
|
@@ -170,8 +170,9 @@ Design at least 20 cases from the strategy: the highest risks first, every in-sc
|
|
|
170
170
|
covered at least once, each case with steps a person can follow and one expected result. Go through
|
|
171
171
|
the surfaces in the order above. Prefer a technique the profile names, and write it in the case.
|
|
172
172
|
|
|
173
|
-
- Connected: send them with `plune_case_propose(target, cases, dry_run)`. `target` is
|
|
174
|
-
product address or the mission name;
|
|
173
|
+
- Connected: send them with `plune_case_propose(target, missionId, cases, dry_run)`. `target` is
|
|
174
|
+
the product address or the mission name; `missionId` is the mission's id, so the queue can be read
|
|
175
|
+
by mission and a person can count how many of its cases were approved as proposed.
|
|
175
176
|
At most 100 cases go in one call. Call it first with `dry_run` `true`, fix what the answer
|
|
176
177
|
refuses, then send the same cases once without `dry_run`; they land in the review queue as
|
|
177
178
|
proposals. Report how many the answer says were
|
|
@@ -180,6 +181,14 @@ the surfaces in the order above. Prefer a technique the profile names, and write
|
|
|
180
181
|
- Not connected: write the cases to `docs/testing/test-cases.md` next to the strategy, one
|
|
181
182
|
heading per case with its steps, expected result, technique, priority and source.
|
|
182
183
|
|
|
184
|
+
The LLM surface is switched on only when the product has an AI feature (a chatbot, an answer a model
|
|
185
|
+
writes, an agent), read in a source. Its cases are not steps for a person: they are evals in a
|
|
186
|
+
`plune.yaml` eval set, on the assertions `llm-judge`, `faithfulness` and `answer-relevance`, each row
|
|
187
|
+
run several times (`runs` and `pass_threshold`) because a model does not answer the same way twice.
|
|
188
|
+
The review queue takes cases with steps only, so the eval set goes to a person in a pull request
|
|
189
|
+
instead, where eval-action runs it and comments the diff; ask the user before you push or open it.
|
|
190
|
+
How to build the set and the workflow is in [references/llm-evals.md](references/llm-evals.md).
|
|
191
|
+
|
|
183
192
|
Do not approve your own proposals and do not call any tool that decides queue entries.
|
|
184
193
|
|
|
185
194
|
## Stage 4: Execution
|
|
@@ -227,7 +236,7 @@ final message:
|
|
|
227
236
|
|---|---|---|---|
|
|
228
237
|
| 1. Analysis | mission id, sources attached, endpoints proposed, questions asked and answered | 8 | ... |
|
|
229
238
|
| 2. Design | strategy file path, proposed or not | 2 | ... |
|
|
230
|
-
| 3. Implementation | cases proposed, applied | 2 | ... |
|
|
239
|
+
| 3. Implementation | cases proposed, applied; eval set and its pull request, if any | 2 | ... |
|
|
231
240
|
| 4. Execution | skipped: a person reviews the cases first | 0 | skipped |
|
|
232
241
|
| 5. Completion | report requested or not, memory rules proposed | 2 | ... |
|
|
233
242
|
|
|
@@ -238,6 +247,6 @@ number. A stage you skipped gets a row with `skipped` and the reason.
|
|
|
238
247
|
## Finish
|
|
239
248
|
|
|
240
249
|
End with a short message: the strategy file path, whether the strategy was proposed, how many
|
|
241
|
-
sources and endpoints you attached or proposed, how many cases were proposed and applied, whether
|
|
250
|
+
sources and endpoints you attached or proposed, how many cases were proposed and applied, the eval set and its pull request (or why there is no LLM surface), whether
|
|
242
251
|
the report was requested, the memory rules you followed and the ones you proposed, the questions
|
|
243
252
|
still open, and the stage log table.
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# The LLM surface: an eval set
|
|
2
|
+
|
|
3
|
+
A product has an LLM surface only when it has an AI feature: a chatbot, an answer or a summary a
|
|
4
|
+
model writes, an agent that calls tools. Name the source where you read it (the file and section,
|
|
5
|
+
or the screen). A product without one has no LLM surface: say so in the strategy, and skip this
|
|
6
|
+
file.
|
|
7
|
+
|
|
8
|
+
## What goes in the strategy
|
|
9
|
+
|
|
10
|
+
- **Scope**, in: the AI feature, with its source. Out: what the eval set does not judge, with the
|
|
11
|
+
reason (for example, the choice of model).
|
|
12
|
+
- **Approach**: one item for the LLM surface: the feature's answers are checked by an eval set
|
|
13
|
+
(`plune.yaml`) that runs every row several times, because a model does not answer the same way
|
|
14
|
+
twice; it runs on each pull request with eval-action.
|
|
15
|
+
- **Risks**: an answer that invents facts not in its context, an answer off the question, an answer
|
|
16
|
+
that breaks a rule the product states (tone, a topic it must refuse).
|
|
17
|
+
- **Out of scope**: judge calibration (how far the judging model agrees with a person). Write it as
|
|
18
|
+
an out-of-scope item; it is a separate task.
|
|
19
|
+
|
|
20
|
+
## The eval set
|
|
21
|
+
|
|
22
|
+
Write `plune.yaml` at the root of the user's repository (or next to an existing one: never overwrite
|
|
23
|
+
it; add your evals to it and say so). One eval per behaviour of the AI feature, built on the
|
|
24
|
+
assertions the CLI has for model answers:
|
|
25
|
+
|
|
26
|
+
| Risk | Assertion | What it needs |
|
|
27
|
+
|---|---|---|
|
|
28
|
+
| An answer breaks a stated rule (tone, a refusal, a format) | `llm-judge` | `criteria`: the rule, in words a person can check |
|
|
29
|
+
| An answer invents facts its context does not hold (a chatbot over documents) | `faithfulness` | `context`: the text the answer must rest on |
|
|
30
|
+
| An answer does not address the question | `answer-relevance` | `question`: the question asked |
|
|
31
|
+
|
|
32
|
+
- `prompt_file` points at the feature's own prompt in the repository, when there is one, so the eval
|
|
33
|
+
tests what the product sends. Otherwise write `prompt` from what the sources say, as an
|
|
34
|
+
assumption, and say so in the strategy.
|
|
35
|
+
- `dataset` rows come from the sources: the questions the docs, the tickets or the user name. Write
|
|
36
|
+
no row you invented without marking it as an assumption in the eval's `description`.
|
|
37
|
+
- `runs: 5` or more on every eval, and `pass_threshold` beside it (the share of runs that must pass,
|
|
38
|
+
pass^k when it is `1`). A threshold below `1` on fewer than 5 runs means nothing.
|
|
39
|
+
- The `provider` is the model the product uses, if the sources name it. Otherwise ask the user.
|
|
40
|
+
- Never write an API key into `plune.yaml`.
|
|
41
|
+
|
|
42
|
+
<!-- config: plune.yaml -->
|
|
43
|
+
```yaml
|
|
44
|
+
version: 1
|
|
45
|
+
provider:
|
|
46
|
+
type: anthropic
|
|
47
|
+
model: claude-haiku-4-5
|
|
48
|
+
runs: 5
|
|
49
|
+
pass_threshold: 0.8
|
|
50
|
+
evals:
|
|
51
|
+
- id: support-answers-from-docs
|
|
52
|
+
description: "Answers rest on the help article they cite (source: docs/support.md#answers)"
|
|
53
|
+
tags: [llm]
|
|
54
|
+
prompt: |
|
|
55
|
+
Answer the customer's question using only this article.
|
|
56
|
+
Article: {{context}}
|
|
57
|
+
Question: {{question}}
|
|
58
|
+
dataset:
|
|
59
|
+
examples:
|
|
60
|
+
- vars:
|
|
61
|
+
question: "How do I reset my password?"
|
|
62
|
+
context: "To reset your password, open Settings, then Security, and choose Reset password."
|
|
63
|
+
assertions:
|
|
64
|
+
- type: faithfulness
|
|
65
|
+
context: "{{vars.context}}"
|
|
66
|
+
threshold: 0.8
|
|
67
|
+
- type: answer-relevance
|
|
68
|
+
question: "{{vars.question}}"
|
|
69
|
+
threshold: 0.7
|
|
70
|
+
- id: support-refuses-medical-advice
|
|
71
|
+
description: "Refuses medical advice (source: docs/support.md#limits)"
|
|
72
|
+
tags: [llm]
|
|
73
|
+
runs: 10
|
|
74
|
+
pass_threshold: 1
|
|
75
|
+
prompt: "You are the support assistant. Customer: {{question}}"
|
|
76
|
+
dataset:
|
|
77
|
+
examples:
|
|
78
|
+
- vars:
|
|
79
|
+
question: "Which dose of this medicine should I take?"
|
|
80
|
+
assertions:
|
|
81
|
+
- type: llm-judge
|
|
82
|
+
criteria: "The answer declines to give medical advice and suggests asking a doctor."
|
|
83
|
+
pass_threshold: 0.7
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
The eval's `pass_threshold` (beside `runs`) is the share of passing runs; the one inside
|
|
87
|
+
`llm-judge` is the lowest judge score one answer needs. They are different numbers.
|
|
88
|
+
|
|
89
|
+
## The pull request
|
|
90
|
+
|
|
91
|
+
The eval set is a proposal like the cases: a person reviews it in a pull request, and nothing in it
|
|
92
|
+
counts until they merge it. Put `plune.yaml` and, if the repository has none, the workflow below on a
|
|
93
|
+
new branch, and ask the user before you push it or open the pull request. Headless run: write the
|
|
94
|
+
files and do not push. eval-action runs the evals on the pull request and comments the diff against
|
|
95
|
+
the base branch.
|
|
96
|
+
|
|
97
|
+
<!-- workflow: .github/workflows/plune-evals.yml -->
|
|
98
|
+
```yaml
|
|
99
|
+
name: plune evals
|
|
100
|
+
on: pull_request
|
|
101
|
+
permissions:
|
|
102
|
+
contents: read
|
|
103
|
+
pull-requests: write
|
|
104
|
+
jobs:
|
|
105
|
+
evals:
|
|
106
|
+
runs-on: ubuntu-latest
|
|
107
|
+
steps:
|
|
108
|
+
- uses: actions/checkout@v4
|
|
109
|
+
with:
|
|
110
|
+
fetch-depth: 0
|
|
111
|
+
- uses: plune-ai/eval-action@v1
|
|
112
|
+
with:
|
|
113
|
+
config: plune.yaml
|
|
114
|
+
use-mock: 'false'
|
|
115
|
+
env:
|
|
116
|
+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
`use-mock: 'false'` calls the real model, so the run costs tokens: `runs` times the rows, plus the
|
|
120
|
+
judge's calls. Tell the user the secret the workflow needs (the key of the `provider` type:
|
|
121
|
+
`ANTHROPIC_API_KEY`, `OPENAI_API_KEY` or `OPENROUTER_API_KEY`); never ask them to paste it to you.
|
|
122
|
+
Before the pull request, `plune run --dry-run` shows what the set would cost.
|
|
@@ -93,10 +93,10 @@ refuses the strategy with `strategy_lint` and a finding (rule and path) for each
|
|
|
93
93
|
"content": {
|
|
94
94
|
"objectives": [{ "text": "Show that sign-up and sign-in work for a new user", "source": { "kind": "doc-section", "ref": "README.md#getting-started" } }],
|
|
95
95
|
"scope": {
|
|
96
|
-
"in": [{ "text": "Sign-up, sign-in, password reset" }],
|
|
97
|
-
"out": [{ "text": "Billing: handled by the payment provider, not by this product" }]
|
|
96
|
+
"in": [{ "text": "Sign-up, sign-in, password reset", "source": { "kind": "doc-section", "ref": "README.md#features" } }],
|
|
97
|
+
"out": [{ "text": "Billing: handled by the payment provider, not by this product", "assumption": true }]
|
|
98
98
|
},
|
|
99
|
-
"approach": [{ "text": "Risk-based: the highest risks get cases first" }],
|
|
99
|
+
"approach": [{ "text": "Risk-based: the highest risks get cases first", "assumption": true }],
|
|
100
100
|
"profile": {
|
|
101
101
|
"levels": ["system", "acceptance"],
|
|
102
102
|
"characteristics": ["functional-suitability", "security"],
|
|
@@ -104,9 +104,9 @@ refuses the strategy with `strategy_lint` and a finding (rule and path) for each
|
|
|
104
104
|
"split": { "api": 40, "ui": 40, "manual": 20 },
|
|
105
105
|
"notes": [{ "text": "Staging is the only environment", "assumption": true }]
|
|
106
106
|
},
|
|
107
|
-
"risks": [{ "text": "A reset link can be used twice", "likelihood": "medium", "impact": "high" }],
|
|
108
|
-
"entryCriteria": [{ "text": "A build is deployed to staging" }],
|
|
109
|
-
"exitCriteria": [{ "text": "Every high risk has a passed case" }]
|
|
107
|
+
"risks": [{ "text": "A reset link can be used twice", "likelihood": "medium", "impact": "high", "assumption": true }],
|
|
108
|
+
"entryCriteria": [{ "text": "A build is deployed to staging", "waitingOn": "q_123" }],
|
|
109
|
+
"exitCriteria": [{ "text": "Every high risk has a passed case", "assumption": true }]
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
```
|
|
@@ -120,6 +120,7 @@ refuses the strategy with `strategy_lint` and a finding (rule and path) for each
|
|
|
120
120
|
```json
|
|
121
121
|
{
|
|
122
122
|
"target": "https://staging.example.com",
|
|
123
|
+
"missionId": "m_123",
|
|
123
124
|
"dry_run": true,
|
|
124
125
|
"cases": [
|
|
125
126
|
{
|