@prooflane/inspector-beta 0.1.0-beta.11 → 0.1.0-beta.12

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/cli.mjs CHANGED
@@ -6348,6 +6348,9 @@ function filterTestsByTags(cfg, tags) {
6348
6348
  return [];
6349
6349
  return cfg.tests.filter((t) => t.tags.some((tag) => want.has(tag.toLowerCase())));
6350
6350
  }
6351
+ function serializeTagsConfig(cfg) {
6352
+ return JSON.stringify({ version: TAGS_FORMAT, tests: cfg.tests }, null, 2) + "\n";
6353
+ }
6351
6354
 
6352
6355
  // ../core/dist/localSuiteMigration.js
6353
6356
  import { createHash as createHash9 } from "node:crypto";
@@ -7294,6 +7297,20 @@ function resolveRunnableTests(input, cwd) {
7294
7297
  } catch (cause) {
7295
7298
  throw new Error(`Could not read local tagged tests: ${compactError(cause)}`);
7296
7299
  }
7300
+ for (const control of input.suiteVersion.manifest.controls) {
7301
+ if (control.executionType !== "LOCAL_DETERMINISTIC" || control.executor !== "TAG_REFERENCE" || control.operation !== "tag.execute" || control.localRef?.kind !== "TAG")
7302
+ continue;
7303
+ const snapshot = control.parameters?.tagSnapshot;
7304
+ if (!snapshot || typeof snapshot !== "object" || Array.isArray(snapshot))
7305
+ continue;
7306
+ const expected = snapshot;
7307
+ const selected = filterTestsByTags(config, [control.localRef.name]).sort((left, right) => left.id.localeCompare(right.id));
7308
+ const actualFingerprint = `sha256:${createHash11("sha256").update(serializeTagsConfig({ version: "prooflane-tags-v1", tests: selected }), "utf8").digest("hex")}`;
7309
+ const actualIds = selected.map((test) => test.id);
7310
+ if (expected.fingerprint !== actualFingerprint || !Array.isArray(expected.testIds) || JSON.stringify(expected.testIds) !== JSON.stringify(actualIds)) {
7311
+ throw new Error(`LOCAL_TAG_SNAPSHOT_CHANGED: #${control.localRef.name} no longer matches the reviewed Suite DRAFT. Refresh Gates and import the current tests into a new Suite version.`);
7312
+ }
7313
+ }
7297
7314
  const byId = /* @__PURE__ */ new Map();
7298
7315
  for (const test of filterTestsByTags(config, tags))
7299
7316
  byId.set(test.id, test);
package/dist/server.mjs CHANGED
@@ -4633,6 +4633,16 @@ function resolveRunnableTests(input, cwd) {
4633
4633
  } catch (cause) {
4634
4634
  throw new Error(`Could not read local tagged tests: ${compactError(cause)}`);
4635
4635
  }
4636
+ for (let control of input.suiteVersion.manifest.controls) {
4637
+ if (control.executionType !== "LOCAL_DETERMINISTIC" || control.executor !== "TAG_REFERENCE" || control.operation !== "tag.execute" || control.localRef?.kind !== "TAG")
4638
+ continue;
4639
+ let snapshot = control.parameters?.tagSnapshot;
4640
+ if (!snapshot || typeof snapshot != "object" || Array.isArray(snapshot))
4641
+ continue;
4642
+ let expected = snapshot, selected = filterTestsByTags(config, [control.localRef.name]).sort((left, right) => left.id.localeCompare(right.id)), actualFingerprint = `sha256:${createHash11("sha256").update(serializeTagsConfig({ version: "prooflane-tags-v1", tests: selected }), "utf8").digest("hex")}`, actualIds = selected.map((test) => test.id);
4643
+ if (expected.fingerprint !== actualFingerprint || !Array.isArray(expected.testIds) || JSON.stringify(expected.testIds) !== JSON.stringify(actualIds))
4644
+ throw new Error(`LOCAL_TAG_SNAPSHOT_CHANGED: #${control.localRef.name} no longer matches the reviewed Suite DRAFT. Refresh Gates and import the current tests into a new Suite version.`);
4645
+ }
4636
4646
  let byId = /* @__PURE__ */ new Map();
4637
4647
  for (let test of filterTestsByTags(config, tags))
4638
4648
  byId.set(test.id, test);
@@ -17672,8 +17682,21 @@ ${answer}`
17672
17682
  });
17673
17683
  let tagsFile = () => join8(process.cwd(), DEFAULT_TAGS_FILE), readTagsConfig = (file) => parseTagsConfig(existsSync7(file) ? readFileSync7(file, "utf8") : ""), writeTagsConfig = (file, config) => {
17674
17684
  mkdirSync7(dirname5(file), { recursive: !0 }), writeFileSync6(file, serializeTagsConfig(config));
17685
+ }, tagState = (config) => {
17686
+ let fingerprint3 = (tests) => `sha256:${createHash22("sha256").update(serializeTagsConfig({ version: "prooflane-tags-v1", tests: [...tests].sort((left, right) => left.id.localeCompare(right.id)) }), "utf8").digest("hex")}`, names = [...new Set(config.tests.flatMap((test) => test.tags))].sort((left, right) => left.localeCompare(right));
17687
+ return {
17688
+ revision: fingerprint3(config.tests),
17689
+ refreshedAt: (/* @__PURE__ */ new Date()).toISOString(),
17690
+ tagSnapshots: Object.fromEntries(names.map((name) => {
17691
+ let tests = config.tests.filter((test) => test.tags.some((tag2) => tag2.toLowerCase() === name.toLowerCase()));
17692
+ return [name, { fingerprint: fingerprint3(tests), testIds: tests.map((test) => test.id).sort(), testCount: tests.length }];
17693
+ }))
17694
+ };
17675
17695
  };
17676
- app.get("/api/tags", async () => ({ ok: !0, path: DEFAULT_TAGS_FILE, config: readTagsConfig(tagsFile()) })), app.post("/api/tags", async (req, reply) => {
17696
+ app.get("/api/tags", async () => {
17697
+ let config = readTagsConfig(tagsFile());
17698
+ return { ok: !0, path: DEFAULT_TAGS_FILE, config, ...tagState(config) };
17699
+ }), app.post("/api/tags", async (req, reply) => {
17677
17700
  let plan = await resolvePlan(req);
17678
17701
  if (!plan.gates)
17679
17702
  return reply.code(402).send({ ok: !1, upgrade: !0, feature: "gates", tier: plan.tier, error: "CI gates are part of the Scale plan. Upgrade to capture tagged tests for CI." });
@@ -17681,13 +17704,13 @@ ${answer}`
17681
17704
  if (!isTaggedTest(test))
17682
17705
  return reply.code(400).send({ ok: !1, error: "A valid tagged test (id, pillar, tags[]) is required." });
17683
17706
  let file = tagsFile(), next = upsertTest(readTagsConfig(file), { ...test, createdAt: test.createdAt || (/* @__PURE__ */ new Date()).toISOString() });
17684
- return writeTagsConfig(file, next), { ok: !0, path: DEFAULT_TAGS_FILE, config: next };
17707
+ return writeTagsConfig(file, next), { ok: !0, path: DEFAULT_TAGS_FILE, config: next, ...tagState(next) };
17685
17708
  }), app.delete("/api/tags/:id", async (req, reply) => {
17686
17709
  let plan = await resolvePlan(req);
17687
17710
  if (!plan.gates)
17688
17711
  return reply.code(402).send({ ok: !1, upgrade: !0, feature: "gates", tier: plan.tier, error: "CI gates are part of the Scale plan." });
17689
17712
  let file = tagsFile(), next = removeTest(readTagsConfig(file), req.params.id);
17690
- return writeTagsConfig(file, next), { ok: !0, path: DEFAULT_TAGS_FILE, config: next };
17713
+ return writeTagsConfig(file, next), { ok: !0, path: DEFAULT_TAGS_FILE, config: next, ...tagState(next) };
17691
17714
  });
17692
17715
  let gatesPath = () => join8(process.cwd(), ".prooflane/gates.json"), validLegacyRegressionGroup = (value) => {
17693
17716
  if (!value || typeof value != "object" || Array.isArray(value))