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

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);
@@ -16191,6 +16201,7 @@ function buildApp() {
16191
16201
  if (capabilities)
16192
16202
  return proxyControlPlane(req, reply, `${hostedSammyPath}/generations/${encodeURIComponent(req.params.id)}/approve`, { ...selectedBody(req.body, ["gateId", "name", "policyVersion", "expectedRevisionNumber"]), capabilities });
16193
16203
  }), app.post("/api/intelligence/generations/:id/compile-suite", async (req, reply) => proxyControlPlane(req, reply, `${hostedSammyPath}/generations/${encodeURIComponent(req.params.id)}/compile-suite`, {})), app.get("/api/intelligence/usage", async (req, reply) => proxyControlPlane(req, reply, `${hostedSammyPath}/usage`, void 0, "GET")), app.get("/api/intelligence/datasets", async (req, reply) => proxyControlPlane(req, reply, `${hostedSammyPath}/datasets`, void 0, "GET")), app.post("/api/intelligence/datasets", async (req, reply) => proxyControlPlane(req, reply, `${hostedSammyPath}/datasets`, selectedBody(req.body, ["name", "format", "content"]))), app.get("/api/intelligence/native-artifacts", async (req, reply) => {
16204
+ reply.header("cache-control", "no-store");
16194
16205
  let capabilities = hostedCapabilities(reply);
16195
16206
  if (!capabilities)
16196
16207
  return;
@@ -17672,8 +17683,21 @@ ${answer}`
17672
17683
  });
17673
17684
  let tagsFile = () => join8(process.cwd(), DEFAULT_TAGS_FILE), readTagsConfig = (file) => parseTagsConfig(existsSync7(file) ? readFileSync7(file, "utf8") : ""), writeTagsConfig = (file, config) => {
17674
17685
  mkdirSync7(dirname5(file), { recursive: !0 }), writeFileSync6(file, serializeTagsConfig(config));
17686
+ }, tagState = (config) => {
17687
+ 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));
17688
+ return {
17689
+ revision: fingerprint3(config.tests),
17690
+ refreshedAt: (/* @__PURE__ */ new Date()).toISOString(),
17691
+ tagSnapshots: Object.fromEntries(names.map((name) => {
17692
+ let tests = config.tests.filter((test) => test.tags.some((tag2) => tag2.toLowerCase() === name.toLowerCase()));
17693
+ return [name, { fingerprint: fingerprint3(tests), testIds: tests.map((test) => test.id).sort(), testCount: tests.length }];
17694
+ }))
17695
+ };
17675
17696
  };
17676
- app.get("/api/tags", async () => ({ ok: !0, path: DEFAULT_TAGS_FILE, config: readTagsConfig(tagsFile()) })), app.post("/api/tags", async (req, reply) => {
17697
+ app.get("/api/tags", async () => {
17698
+ let config = readTagsConfig(tagsFile());
17699
+ return { ok: !0, path: DEFAULT_TAGS_FILE, config, ...tagState(config) };
17700
+ }), app.post("/api/tags", async (req, reply) => {
17677
17701
  let plan = await resolvePlan(req);
17678
17702
  if (!plan.gates)
17679
17703
  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 +17705,13 @@ ${answer}`
17681
17705
  if (!isTaggedTest(test))
17682
17706
  return reply.code(400).send({ ok: !1, error: "A valid tagged test (id, pillar, tags[]) is required." });
17683
17707
  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 };
17708
+ return writeTagsConfig(file, next), { ok: !0, path: DEFAULT_TAGS_FILE, config: next, ...tagState(next) };
17685
17709
  }), app.delete("/api/tags/:id", async (req, reply) => {
17686
17710
  let plan = await resolvePlan(req);
17687
17711
  if (!plan.gates)
17688
17712
  return reply.code(402).send({ ok: !1, upgrade: !0, feature: "gates", tier: plan.tier, error: "CI gates are part of the Scale plan." });
17689
17713
  let file = tagsFile(), next = removeTest(readTagsConfig(file), req.params.id);
17690
- return writeTagsConfig(file, next), { ok: !0, path: DEFAULT_TAGS_FILE, config: next };
17714
+ return writeTagsConfig(file, next), { ok: !0, path: DEFAULT_TAGS_FILE, config: next, ...tagState(next) };
17691
17715
  });
17692
17716
  let gatesPath = () => join8(process.cwd(), ".prooflane/gates.json"), validLegacyRegressionGroup = (value) => {
17693
17717
  if (!value || typeof value != "object" || Array.isArray(value))