@tokenoftrust/storefront-runner 2.2.10 → 2.2.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.
@@ -1028,8 +1028,7 @@ export interface DeveloperAppBinding {
1028
1028
  /** Best-effort outcome of the app-binding write (never fails the invite). */
1029
1029
  export type AppBindingResult =
1030
1030
  | { recorded: true }
1031
- // Skipped fail-closed: the write was not attempted/counted because the seam is
1032
- // unconfigured OR the MCP route isn't mounted yet (401). Not an error.
1031
+ // Skipped: the write was not attempted because the seam is unconfigured. Not an error.
1033
1032
  | { recorded: false; skipped: true; reason: string }
1034
1033
  // Attempted but failed for a real reason (bad body / store fault / transport).
1035
1034
  | { recorded: false; skipped: false; reason: string };
@@ -1047,9 +1046,8 @@ export type AppBindingResult =
1047
1046
  * (capability/app are optional MCP defaults but sent explicitly). Idempotent.
1048
1047
  * → 200 { status:'recorded', ... } | 401 bad/missing secret | 400 bad body | 502 store.
1049
1048
  *
1050
- * FAIL-CLOSED: the MCP route is only mounted once the shared secret is set on the
1051
- * MCP deploy, so an unconfigured seam (no URL/secret) OR a 401 is treated as
1052
- * `{ skipped: true }`, not a hard failure. A 400/502/transport fault is a real
1049
+ * An unconfigured seam (no URL/secret) is `{ skipped: true }`. A 401 (wrong secret, or a
1050
+ * URL under the MCP's session-guarded /api surface), 400, 502 or transport fault is a real
1053
1051
  * (non-skipped) failure the caller surfaces as partial success.
1054
1052
  *
1055
1053
  * BEST-EFFORT by contract: this NEVER throws and NEVER blocks the invite. The
@@ -1081,11 +1079,12 @@ export async function recordDeveloperAppBinding(
1081
1079
  );
1082
1080
  if (res.status >= 200 && res.status < 300) return { recorded: true };
1083
1081
  if (res.status === 401) {
1084
- // Bad/missing secret or the MCP route isn't mounted yet — fail-closed as skipped.
1082
+ // A route answered and refused: the secret does not match, or the URL sits under the
1083
+ // MCP's session-guarded /api surface. Both are misconfiguration, so it is a failure.
1085
1084
  return {
1086
1085
  recorded: false,
1087
- skipped: true,
1088
- reason: "unauthorized (mcp service secret rejected or route unmounted)",
1086
+ skipped: false,
1087
+ reason: "unauthorized: the mcp service secret was rejected, or MCP_APP_BINDING_URL is not the /internal path",
1089
1088
  };
1090
1089
  }
1091
1090
  return {
@@ -1,5 +1,9 @@
1
- import { defineConfig } from "vitest/config";
2
- import { fileURLToPath } from "node:url";
1
+ // .cts so Vite compiles this in memory. An ESM config writes a sibling file, which the read-only
2
+ // verification workspace rejects. The results cache is off: that workspace cannot create
3
+ // node_modules/.vite/vitest.
4
+ process.env.VITE_CJS_IGNORE_WARNING = "1";
5
+ const { defineConfig } = require("vitest/config");
6
+ const path = require("node:path");
3
7
 
4
8
  // Storefront unit tests — pure TS logic (tenant routing, search, query engine,
5
9
  // image-attr resolution, edge cache, etc.). We deliberately do NOT render .astro
@@ -7,12 +11,12 @@ import { fileURLToPath } from "node:url";
7
11
  // vite-plugin-head crashes under vitest@2 + astro@7 (configureServer reads an
8
12
  // undefined `ssr`). Render *logic* is extracted into testable modules instead
9
13
  // (e.g. lib/imageAttrs.ts), and rendered output is verified on a live preview.
10
- export default defineConfig({
14
+ module.exports = defineConfig({
11
15
  // Mirror the `@` -> src alias from tsconfig so tests can import aliased modules
12
16
  // (e.g. src/config/tenants.ts, which pulls the theme registry).
13
17
  resolve: {
14
18
  alias: {
15
- "@": fileURLToPath(new URL("./src", import.meta.url)),
19
+ "@": path.join(__dirname, "src"),
16
20
  // `astro:middleware` is a virtual id Astro's own Vite plugin maps onto this
17
21
  // real module. Mapping it the same way lets src/middleware/index.ts — the
18
22
  // branch-to-handler dispatch — be invoked in a unit test instead of only
@@ -26,5 +30,6 @@ export default defineConfig({
26
30
  // *.spec.ts matrix runs separately via playwright.a11y.config.ts).
27
31
  include: ["src/**/*.test.ts", "e2e/a11y/**/*.test.ts"],
28
32
  environment: "node",
33
+ cache: false,
29
34
  },
30
35
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokenoftrust/storefront-runner",
3
- "version": "2.2.10",
3
+ "version": "2.2.12",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "description": "World-shareable storefront runner: multi-tenant renderer on Astro/Cloudflare. No control plane.",
6
6
  "packageManager": "pnpm@11.9.0",
@@ -0,0 +1,13 @@
1
+ // .cts so Vite compiles this in memory. An ESM config writes a sibling file, which the read-only
2
+ // verification workspace rejects. The results cache is off: that workspace cannot create
3
+ // node_modules/.vite/vitest.
4
+ process.env.VITE_CJS_IGNORE_WARNING = "1";
5
+ const { defineConfig } = require("vitest/config");
6
+
7
+ module.exports = defineConfig({
8
+ test: {
9
+ include: ["tests/**/*.test.ts"],
10
+ environment: "node",
11
+ cache: false,
12
+ },
13
+ });
@@ -1,8 +0,0 @@
1
- import { defineConfig } from "vitest/config";
2
-
3
- export default defineConfig({
4
- test: {
5
- include: ["tests/**/*.test.ts"],
6
- environment: "node",
7
- },
8
- });