@blamejs/blamejs-shop 0.3.19 → 0.3.21

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/CHANGELOG.md CHANGED
@@ -8,6 +8,10 @@ upgrading across more than a few patches at a time.
8
8
 
9
9
  ## v0.3.x
10
10
 
11
+ - v0.3.21 (2026-05-30) — **Customers can cancel an order from their account before it ships.** A signed-in customer can now cancel one of their own orders from the order page, as long as it has not started fulfillment. The Cancel control appears only while the order is still cancellable — a paid or pending order — and is absent once the order is fulfilling, shipped, delivered, already cancelled, or refunded. The action is tied to the signed-in customer, so a customer can only cancel their own order. Note: cancelling a paid order changes its status to cancelled but does not by itself refund the charge — issue the refund from the admin console as usual; a customer-initiated cancellation of a paid order is your signal to do so. **Added:** *Cancel an unfulfilled order from the account* — The order page now shows a Cancel button while an order is still in a pre-fulfillment state (paid or pending). Cancelling moves the order to cancelled and shows a confirmation; the control does not appear once an order is fulfilling, shipped, delivered, cancelled, or refunded, and a customer can only cancel their own order. A paid-order cancellation updates the status but does not automatically refund the captured payment — refund it from the console; treat a customer cancellation of a paid order as the prompt to do so.
12
+
13
+ - v0.3.20 (2026-05-30) — **Served media carries hardened headers, primary-image changes are product-scoped, and image-by-URL imports are size-capped.** Three defense-in-depth fixes on product media. Media assets served from storage now carry X-Content-Type-Options: nosniff and Cross-Origin-Resource-Policy: same-origin, and SVG files additionally carry a content policy that prevents script from running when the file is opened directly while still rendering normally inside a product image. Setting a product's primary image now verifies the image actually belongs to the product named in the request rather than acting on the image alone. And importing a product image by URL now refuses a response larger than the same 10 MiB limit the file-upload path enforces, instead of buffering an unbounded download. **Changed:** *Setting the primary image is product-scoped* — The endpoint that makes an image a product's primary (hero) now verifies the image belongs to the product in the request path and returns not-found otherwise, instead of acting on the image regardless of the product named. A request whose product and image don't match is now rejected. · *Vendored runtime updated to v0.14.9* — The vendored blamejs runtime is updated to v0.14.9, a documentation-path and source-comment fix with no API, wire-format, or behavior changes. No operator action is required. **Security:** *Hardened response headers on served media* — Media served from storage now sets X-Content-Type-Options: nosniff and Cross-Origin-Resource-Policy: same-origin, so a mistyped or hostile upload can't be content-sniffed into something executable or embedded cross-origin. An SVG additionally carries a default-src 'none' sandbox content-security policy, so opening an SVG URL directly cannot run script (it still renders inside an img tag). This sits behind the existing SVG-upload sanitizer as a second layer. · *Importing an image by URL is size-capped* — Importing a product image from a URL now refuses a response larger than 10 MiB — the same limit a direct file upload uses — returning a clear error instead of buffering an unbounded download.
14
+
11
15
  - v0.3.19 (2026-05-30) — **Edit announcement bars, automatic-discount terms, and subscription plans from the console.** Three admin entities could be created but only partly edited from the console — the rest of their fields were reachable only through the API, so changing them meant archive-and-recreate or a manual API call. Each now has a detail screen with the full edit form. An announcement bar can have its message, links, schedule, audience, and dismissibility changed in place. An automatic discount can have its actual terms changed — the amount, percentage, threshold, or buy-x-get-y values — not just its title, priority, and on/off state. A subscription plan can have its price, billing interval, trial length, active state, and variant edited. Create and archive behavior is unchanged. **Fixed:** *Announcement bars are editable in place* — A detail screen now lets you change an announcement's message, link, theme, audience, start/end schedule, and whether it can be dismissed — instead of archiving it and creating a new one (which lost the slug and any recorded dismissal state). · *Automatic-discount terms are editable from the console* — The discount detail screen now edits the rule's trigger and value — the amount off, percent off, cart threshold, or buy-x-get-y terms — which previously could only be changed through the API. The inline priority and on/off controls are unchanged. · *Subscription plans have an edit screen* — A subscription plan's price, billing interval count, trial length, active state, and variant can now be edited from a detail screen. The Stripe-bound fields (the price id, interval unit, and currency) remain read-only, as they were always immutable.
12
16
 
13
17
  - v0.3.18 (2026-05-30) — **Write and publish blog posts from the admin console.** The storefront already served a blog — the index at /blog, individual posts at /blog/:slug, an RSS feed, and sitemap entries — but there was no way to write a post, so it rendered empty. The admin console now has a Blog screen with the full lifecycle: create a draft, edit its title, body (Markdown), tags, hero image, and meta fields, publish it, unpublish it, and archive or restore it. A post is created as a draft and stays off the storefront until it is explicitly published, so work in progress is never visible to shoppers. **Added:** *Blog authoring in the admin console* — A new Blog screen lists posts by status and lets an operator create, edit, publish, unpublish, archive, and restore them. New posts start as drafts and do not appear on the storefront /blog, its RSS feed, or the sitemap until published; archiving removes a published post from the storefront and is reversible. This wires the admin over the blog backend that was already serving the customer-facing pages.
package/lib/admin.js CHANGED
@@ -1086,6 +1086,18 @@ function mount(router, deps) {
1086
1086
 
1087
1087
  // ---- media ----------------------------------------------------------
1088
1088
 
1089
+ // True when media `mid` exists AND its product_id equals `productId` — the
1090
+ // self-consistency check the per-product media routes assert before acting,
1091
+ // so a `/admin/products/:id/media/:mid/...` request can't name product A in
1092
+ // the path while operating on product B's media. A malformed `mid` makes
1093
+ // catalog.media.get throw TypeError (the caller maps it to a clean 400);
1094
+ // an unknown id, a foreign-product id, or a variant-only row (no
1095
+ // product_id) returns false so the caller renders the same not-found.
1096
+ async function _mediaBelongsToProduct(mid, productId) {
1097
+ var row = await catalog.media.get(mid);
1098
+ return !!(row && row.product_id && row.product_id === productId);
1099
+ }
1100
+
1089
1101
  router.post("/admin/media", W("media.attach", async function (req, res) {
1090
1102
  var m = await catalog.media.attach(req.body || {});
1091
1103
  _json(res, 201, m);
@@ -1156,16 +1168,28 @@ function mount(router, deps) {
1156
1168
  // Fetch the source bytes. The framework's httpClient runs every
1157
1169
  // outbound through the SSRF gate, so a `source_url` pointing at
1158
1170
  // a cloud-metadata IP (169.254.169.254) / RFC 1918 host can't
1159
- // smuggle internal data into the bucket.
1171
+ // smuggle internal data into the bucket. `maxResponseBytes` caps the
1172
+ // buffered body at the same media budget the direct-file path enforces
1173
+ // (`_UPLOAD_MAX_BYTES`): without it the client buffers up to its
1174
+ // ~1 GiB GET default, so a `source_url` pointing at a multi-gigabyte
1175
+ // resource would balloon memory before the magic-byte sniff ever runs.
1176
+ // The client rejects with `RESPONSE_TOO_LARGE` the moment the body
1177
+ // crosses the cap; that surfaces below as a clean 413, never an OOM or
1178
+ // a 500.
1160
1179
  var fetched;
1161
1180
  try {
1162
1181
  fetched = await b.httpClient.request({
1163
- method: "GET",
1164
- url: body.source_url,
1165
- timeoutMs: 20000,
1166
- headers: { "accept": body.content_type + ",*/*;q=0.5" },
1182
+ method: "GET",
1183
+ url: body.source_url,
1184
+ timeoutMs: 20000,
1185
+ maxResponseBytes: _UPLOAD_MAX_BYTES,
1186
+ headers: { "accept": body.content_type + ",*/*;q=0.5" },
1167
1187
  });
1168
1188
  } catch (e) {
1189
+ if (e && e.code === "RESPONSE_TOO_LARGE") {
1190
+ return { status: 413, code: "source-too-large",
1191
+ detail: "source_url body exceeds the " + _UPLOAD_MAX_BYTES + "-byte media upload cap" };
1192
+ }
1169
1193
  return { status: 502, code: "source-fetch-failed", detail: (e && e.message) || String(e) };
1170
1194
  }
1171
1195
  if (fetched.statusCode < 200 || fetched.statusCode >= 300) {
@@ -1515,10 +1539,23 @@ function mount(router, deps) {
1515
1539
  // id is in the path, the product id only used to PRG back to the detail.
1516
1540
  // A malformed id throws TypeError (→ 400 / ?err=1); an unknown or
1517
1541
  // variant-only row returns false (→ 404 / ?err=1). DB-only.
1542
+ //
1543
+ // The :id (product) path segment is asserted against the media row's own
1544
+ // product_id before the promote: the primitive scopes its reorder by the
1545
+ // row's product, so naming product A in the path while pointing :mid at
1546
+ // product B's media would silently act on B. Refuse that mismatch (and a
1547
+ // variant-only row, which has no product to lead) with the same clean
1548
+ // not-found status, so the path is self-consistent and the contract
1549
+ // doesn't lie about which product it touched.
1518
1550
  router.post("/admin/products/:id/media/:mid/primary", _pageOrApi(false,
1519
1551
  W("media.set_primary", async function (req, res) {
1520
1552
  var ok;
1521
- try { ok = await catalog.media.setPrimary(req.params.mid); }
1553
+ try {
1554
+ if (!(await _mediaBelongsToProduct(req.params.mid, req.params.id))) {
1555
+ return _problem(res, 404, "media-not-found");
1556
+ }
1557
+ ok = await catalog.media.setPrimary(req.params.mid);
1558
+ }
1522
1559
  catch (e) { if (e instanceof TypeError) return _problem(res, 400, "bad-request", e.message); throw e; }
1523
1560
  if (!ok) return _problem(res, 404, "media-not-found");
1524
1561
  _json(res, 200, { ok: true });
@@ -1528,7 +1565,12 @@ function mount(router, deps) {
1528
1565
  var id = req.params.id;
1529
1566
  var enc = encodeURIComponent(id);
1530
1567
  var ok = false;
1531
- try { ok = await catalog.media.setPrimary(req.params.mid); }
1568
+ try {
1569
+ if (!(await _mediaBelongsToProduct(req.params.mid, id))) {
1570
+ return _redirect(res, "/admin/products/" + enc + "?err=1");
1571
+ }
1572
+ ok = await catalog.media.setPrimary(req.params.mid);
1573
+ }
1532
1574
  catch (e) {
1533
1575
  _safeNotice(e, "media.set_primary");
1534
1576
  return _redirect(res, "/admin/products/" + enc + "?err=1");
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.3.19",
2
+ "version": "0.3.21",
3
3
  "assets": {
4
4
  "css/admin.css": {
5
5
  "integrity": "sha384-1SIn6oAf1DjECbRfKENZasdKHJiywGdXR58wn0hsFGcdVHzUmvfgMkEz5ANIAZJ3",
package/lib/storefront.js CHANGED
@@ -4569,6 +4569,20 @@ function _orderEligibleForReorder(status) {
4569
4569
  return status !== "pending";
4570
4570
  }
4571
4571
 
4572
+ // Cancel is offered only while the order is still pre-fulfillment: the
4573
+ // order FSM (lib/order.js) accepts the `cancel` event from `pending`
4574
+ // (awaiting capture) and `paid` (captured, not yet picked) only. Once
4575
+ // the warehouse starts fulfilling — and through shipped / delivered —
4576
+ // the order is no longer the customer's to cancel; the terminal off-ramps
4577
+ // (cancelled / refunded) have no cancel edge either. Keeping this in lock-
4578
+ // step with the FSM's cancel edges means the button never offers a
4579
+ // transition the primitive would refuse. A cancel on a `paid` order does
4580
+ // NOT void the captured charge — the FSM only moves the status — so a paid
4581
+ // cancel leaves the operator to issue the refund from the console.
4582
+ function _orderEligibleForCancel(status) {
4583
+ return status === "pending" || status === "paid";
4584
+ }
4585
+
4572
4586
  // Render the lifecycle timeline. Every step up to and including the
4573
4587
  // current status is marked done; the current step is also marked
4574
4588
  // current. A terminal off-ramp (refunded / cancelled) collapses the rail
@@ -4669,6 +4683,12 @@ function _orderActionsBlock(o) {
4669
4683
  btns.push(
4670
4684
  "<a class=\"btn-secondary order-action\" href=\"/account/orders/" + esc(String(o.id)) + "/return\">Request a return</a>");
4671
4685
  }
4686
+ if (_orderEligibleForCancel(o.status)) {
4687
+ btns.push(
4688
+ "<form class=\"order-action\" method=\"post\" action=\"/orders/" + esc(String(o.id)) + "/cancel\">" +
4689
+ "<button type=\"submit\" class=\"btn-ghost\">Cancel order</button>" +
4690
+ "</form>");
4691
+ }
4672
4692
  if (!btns.length) return "";
4673
4693
  return "<div class=\"order-page__actions\">" + btns.join("") + "</div>";
4674
4694
  }
@@ -4733,6 +4753,7 @@ function renderOrder(opts) {
4733
4753
  actions_html: actionsHtml,
4734
4754
  can_return: _orderEligibleForReturn(o.status),
4735
4755
  can_reorder: _orderEligibleForReorder(o.status),
4756
+ can_cancel: _orderEligibleForCancel(o.status),
4736
4757
  recommendations: recs,
4737
4758
  has_recommendations: recs.length > 0,
4738
4759
  asset_css_main: opts.theme.assetUrl("css/main.css"),
@@ -4759,6 +4780,14 @@ function renderOrder(opts) {
4759
4780
  var reorderNotice = opts.reordered
4760
4781
  ? "<p class=\"form-notice form-notice--ok\" role=\"status\">Items from this order were added to your cart. <a href=\"/cart\">View cart →</a></p>"
4761
4782
  : "";
4783
+ // Confirmation banner after a successful cancel (the POST redirects to
4784
+ // ?cancelled=1). A paid order's captured charge is not auto-voided by the
4785
+ // cancel — the refund is the operator's call from the console — so the
4786
+ // copy stays neutral ("cancelled") rather than promising a refund the
4787
+ // status transition didn't perform.
4788
+ var cancelNotice = opts.cancelled
4789
+ ? "<p class=\"form-notice form-notice--ok\" role=\"status\">This order has been cancelled.</p>"
4790
+ : "";
4762
4791
  var body = _render(ORDER_PAGE, {
4763
4792
  order_id: o.id,
4764
4793
  status: o.status,
@@ -4768,7 +4797,7 @@ function renderOrder(opts) {
4768
4797
  shipping: shipping,
4769
4798
  total: total,
4770
4799
  }).replace("RAW_LINES", rows)
4771
- .replace("RAW_REORDER_NOTICE", reorderNotice)
4800
+ .replace("RAW_REORDER_NOTICE", reorderNotice + cancelNotice)
4772
4801
  .replace("RAW_ORDER_TIMELINE", timelineHtml)
4773
4802
  .replace("RAW_ORDER_TRACKING", trackingHtml)
4774
4803
  .replace("RAW_ORDER_ACTIONS", actionsHtml)
@@ -8557,6 +8586,7 @@ function mount(router, deps) {
8557
8586
  recommendations: recommendations,
8558
8587
  shipments: shipments,
8559
8588
  reordered: ordUrl ? ordUrl.searchParams.get("reordered") === "1" : false,
8589
+ cancelled: ordUrl ? ordUrl.searchParams.get("cancelled") === "1" : false,
8560
8590
  shop_name: shopName,
8561
8591
  theme: theme,
8562
8592
  }));
@@ -10895,6 +10925,68 @@ function mount(router, deps) {
10895
10925
  res.setHeader && res.setHeader("location", "/orders/" + encodeURIComponent(o.id) + "?reordered=1");
10896
10926
  return res.end ? res.end() : res.send("");
10897
10927
  });
10928
+
10929
+ // POST /orders/:id/cancel — customer-initiated cancellation of an
10930
+ // order that hasn't been fulfilled yet. The order FSM (lib/order.js)
10931
+ // accepts the `cancel` event from `pending` and `paid` only; this
10932
+ // route gates on the same eligibility (_orderEligibleForCancel) so a
10933
+ // shipped / delivered / already-cancelled / refunded order can't be
10934
+ // cancelled here. Two refusals guard against IDOR: the order must
10935
+ // belong to the signed-in customer (a foreign or guest-owned order is
10936
+ // a clean 404, never acted on and never leaked), and only then is the
10937
+ // transition attempted. A cancel the FSM still refuses (a status that
10938
+ // raced past `paid` between the page render and the POST) maps to a
10939
+ // clean redirect back to the order rather than a 500. Cancelling a
10940
+ // `paid` order moves the status only — the captured charge is NOT
10941
+ // auto-voided by the transition, so the refund remains the operator's
10942
+ // action from the console.
10943
+ router.post("/orders/:order_id/cancel", async function (req, res) {
10944
+ var orderId = req.params && req.params.order_id;
10945
+ // Cancel is a logged-in-customer action — resolve the session first
10946
+ // so an unauthenticated POST goes to login, never near the order.
10947
+ var cancelAuth = _currentCustomerEnv(req);
10948
+ if (!cancelAuth) {
10949
+ res.status(303); res.setHeader && res.setHeader("location", "/account/login");
10950
+ return res.end ? res.end() : res.send("");
10951
+ }
10952
+ var o;
10953
+ try { o = orderId ? await deps.order.get(orderId) : null; }
10954
+ catch (e) { if (e instanceof TypeError) { o = null; } else throw e; }
10955
+ // Ownership gate against IDOR: a missing order, a malformed id, an
10956
+ // order owned by another customer, OR a guest order with no owner
10957
+ // all 404 — the cancel never touches an order the caller doesn't own.
10958
+ if (!o || !o.customer_id || o.customer_id !== cancelAuth.customer_id) {
10959
+ return _send(res, 404, renderNotFound({ shop_name: shopName, theme: theme }));
10960
+ }
10961
+ // Eligibility gate mirrors the FSM's cancel edges (pending | paid).
10962
+ // A non-cancellable status (fulfilling / shipped / delivered /
10963
+ // cancelled / refunded) bounces back to the order page unchanged —
10964
+ // a clean 303, no transition attempted, no 500.
10965
+ if (!_orderEligibleForCancel(o.status)) {
10966
+ res.status(303);
10967
+ res.setHeader && res.setHeader("location", "/orders/" + encodeURIComponent(o.id));
10968
+ return res.end ? res.end() : res.send("");
10969
+ }
10970
+ try {
10971
+ await deps.order.transition(o.id, "cancel", { reason: "customer-requested" });
10972
+ } catch (e) {
10973
+ // The FSM refuses the event (a status that advanced out of the
10974
+ // cancellable window between render and POST). order.transition
10975
+ // tags the refusal with .code = ORDER_TRANSITION_REFUSED; surface
10976
+ // it as a clean redirect to the order page rather than a 500.
10977
+ if (e && e.code === "ORDER_TRANSITION_REFUSED") {
10978
+ res.status(303);
10979
+ res.setHeader && res.setHeader("location", "/orders/" + encodeURIComponent(o.id));
10980
+ return res.end ? res.end() : res.send("");
10981
+ }
10982
+ throw e;
10983
+ }
10984
+ // PRG back to the order page with a confirmation banner (a refresh
10985
+ // doesn't re-fire the cancel).
10986
+ res.status(303);
10987
+ res.setHeader && res.setHeader("location", "/orders/" + encodeURIComponent(o.id) + "?cancelled=1");
10988
+ return res.end ? res.end() : res.send("");
10989
+ });
10898
10990
  }
10899
10991
 
10900
10992
  // POST /cart/lines — add a line. Reads variant_id + qty from the
@@ -3,8 +3,8 @@
3
3
  "_about": "blamejs.shop vendors a single framework — blamejs — which itself bundles every server-side crypto/identity dependency. The transitive packages blamejs ships are surfaced in its own MANIFEST.json at lib/vendor/blamejs/lib/vendor/MANIFEST.json — Trivy / Grype rely on that nested data for CVE attribution.",
4
4
  "packages": {
5
5
  "blamejs": {
6
- "version": "0.14.8",
7
- "tag": "v0.14.8",
6
+ "version": "0.14.9",
7
+ "tag": "v0.14.9",
8
8
  "license": "Apache-2.0",
9
9
  "author": "blamejs contributors",
10
10
  "source": "https://github.com/blamejs/blamejs",
@@ -8,6 +8,8 @@ upgrading across more than a few patches at a time.
8
8
 
9
9
  ## v0.14.x
10
10
 
11
+ - v0.14.9 (2026-05-30) — **Corrects EU AI Act doc paths that named an uncallable namespace, plus source-comment hygiene and two new codebase checks.** A documentation fix and internal hygiene. The `@primitive` / `@signature` / `@example` blocks for the EU AI Act fundamental-rights-impact-assessment and GPAI training-data-summary helpers advertised `b.complianceAiAct.*`, which is undefined — the callable path is `b.compliance.aiAct.*` — so an operator copying the documented call got `undefined is not a function`. The documented paths now match the real surface. Alongside that: a duplicate parser entry in a doc block is removed, version stamps embedded in section-divider comments are stripped, and two codebase checks are added — one that fails the build when a `@primitive` block documents a wholly-unresolvable namespace (the gap that hid the AI Act paths), and one that flags a version stamp left inside a section divider. No exported API, error code, wire format, or runtime behaviour changes. **Changed:** *Source-comment hygiene* — Removed a duplicate `env` entry from the parsers `@module` doc block, and stripped internal version stamps (`vX.Y.Z`) from `// ---- ... ----` section-divider comments across several files, keeping the descriptive label. Comment-only; no behaviour change. **Fixed:** *EU AI Act helper documentation named an uncallable path* — `b.compliance.aiAct.fundamentalRightsImpactAssessment` and `b.compliance.aiAct.gpai.trainingDataSummary` were documented as `b.complianceAiAct.*` in their `@primitive` / `@signature` / `@example` blocks (and one returned reference string). `b.complianceAiAct` is undefined, so the documented call failed; the documented paths now match the callable surface. **Detectors:** *`@primitive` reachability covers wrong-namespace paths* — The reachability check previously only flagged a missing leaf on a resolved namespace; a `@primitive` whose entire dotted prefix is unresolvable (the shape that hid the AI Act doc paths) was silently skipped. It now walks each prefix segment and fails the build on any unresolvable one, while preserving the factory-instance-shorthand exemption. · *Version-stamp-in-divider check* — A new check flags a version stamp (`vX.Y.Z`) left immediately after a section divider's dashes (`// ---- vX.Y.Z ...`) — internal release vocabulary that does not belong in shipped source comments — without matching legitimate `@since` tags or prose version references.
12
+
11
13
  - v0.14.8 (2026-05-30) — **Source-comment and codebase-check hygiene, plus a new require-block alignment check; no API or behaviour changes.** Internal lint and comment cleanup with no operator-facing surface change. Several codebase-check comments and one stub helper name that described behaviour the check no longer has are corrected; an unused lint-suppression class and a set of stale duplicate-cluster qualifiers (functions that were since renamed or extracted) are pruned or re-pointed. Fifty-nine `// allow:` markers that named the byte-size or time-literal check on values those checks no longer flag are removed, and twenty self-negating rationales on markers the time check genuinely fires on are rewritten to say why the value coincidentally matches. A new codebase check holds top-of-file require blocks to consistent `=` column alignment, with the files that currently carry drift listed as a migration allowlist. No exported API, error code, wire format, or runtime behaviour changes. **Changed:** *Lint-suppression and codebase-check comment cleanup* — Corrected codebase-check comments that overstated their check's scope (a duplicate-code threshold described as three files when the advisory threshold is two, a narrowed byte-literal check carrying its pre-narrowing description, and a deferred-scan helper named as though it enforced a guarantee it does not yet provide). Removed an unused lint-suppression class and its one dead in-code marker, and pruned or re-pointed stale duplicate-cluster qualifiers that named functions since renamed or extracted into shared helpers. Removed fifty-nine `// allow:` markers that suppressed nothing, and rewrote twenty self-negating marker rationales (which read "not seconds" while sitting on a value the time check fires on) to explain the coincidental match. Source-comment and test hygiene only. **Detectors:** *Require-block `=` alignment check* — A new codebase check flags a top-of-file require block that mixes its `=` column alignment — a fittable line whose `=` drifts off the column the rest of the block shares. Compact single-space blocks are exempt (only blocks that declare alignment intent are checked), as are destructures and long names physically too wide to reach the column, and blank- or comment-separated tiers align independently. The files that currently carry such drift are an explicit migration allowlist, reflowed over time; new code is held to the rule.
12
14
 
13
15
  - v0.14.7 (2026-05-30) — **Storage and audit-trail hardening: queries are gated to declared columns, raw SQL refuses embedded literals, the database key is bound to its location, sealed-column lookup hashes gain a keyed mode, audit-chain purges can require dual control, and breach deadlines ship a running clock.** This release tightens the data and audit layers against a set of failure modes that were previously reachable. Database queries are now checked against the columns a table declared in its schema: a reference to an undeclared column fails closed by default instead of silently matching nothing, and the `whereRaw` escape hatch refuses an embedded string literal so values bind through placeholders. The database encryption key is sealed with its purpose, data directory, and key path as additional authenticated data, so a key file cannot be relocated to another deployment and unsealed there; an older key without that binding upgrades itself on first load. Sealed-column equality-lookup hashes can now be computed as a keyed MAC (HMAC-SHAKE256) off a per-deployment key, making the lookup hash unforgeable without that key, while the salted-SHA3 default is unchanged. Purging the tamper-evident audit chain can be placed under a two-authorizer dual-control grant so one operator cannot erase it alone, and database credential-rejection audits now record which relation the rejected credential tried to reach. Finally, breach-notification deadlines get a running clock that raises approaching and passed alerts as each regime's window elapses. One behavior change to note: the column gate defaults to reject — if a service issues queries against columns it did not declare in its schema, set `db.init({ columnGate: "warn" })` (audited, allowed) or `"off"` while the schema is reconciled. **Added:** *Column-membership gate on every query* — `b.db.from(table)` now checks each referenced column against the table's declared schema. The mode is set with `db.init({ columnGate: "reject" | "warn" | "off" })` (default `reject`), and `query.allowedColumns([...])` narrows a single query to an explicit allowlist that is always enforced. `b.db.getDeclaredColumns(table)` returns a table's declared column names (or `null` for an unknown table). This is defense in depth against typo'd or caller-influenced column names reaching the SQL layer (CWE-89). · *Keyed mode for sealed-column lookup hashes* — Equality-lookup ("derived") hashes for sealed columns can be computed as `hmac-shake256` — a keyed MAC over a per-deployment key — instead of the default `salted-sha3`. Set it per table with `cryptoField.registerTable(name, { derivedHashMode: "hmac-shake256" })` or per column with `{ from, mode: "hmac-shake256" }`. The keyed hash is unforgeable and un-correlatable without the deployment's MAC key, which raises the bar against offline lookup-table attacks on low-entropy sealed values (CWE-916). `b.vault.getDerivedHashMacKey()` exposes the 32-byte per-deployment key; it is created on first use and re-sealed across key rotation automatically. · *Dual-control gate on audit-chain purge* — `b.auditTools.purge` accepts `dualControlGrant`. When `audit_log` is placed under dual control, a verified archive and `confirm: true` are no longer sufficient: the purge additionally requires a consumed m-of-n grant whose action is bound to the purge, so a grant minted for another operation cannot be replayed and one operator cannot erase the tamper-evident chain alone (NIST SP 800-53 AU-9, separation of duties). · *Running clock for breach-notification deadlines* — `b.incident.report.createDeadlineClock({ notify, approachThresholds })` tracks open incidents and raises `deadline_approaching` and `deadline_passed` alerts as each regime's window elapses (GDPR 72h, DORA, NIS2, and the rest of the registry). Alerts are deduplicated per incident and stage, suppressed once a submission stage is acknowledged, and the clock can run on an interval or be ticked manually. **Changed:** *Queries against undeclared columns now fail closed by default* — The column gate defaults to `reject`: a query that references a column the table did not declare throws rather than silently matching nothing. A service that intentionally queries undeclared columns can set `db.init({ columnGate: "warn" })` to audit and allow, or `"off"` to disable the gate, while its schema is reconciled. Framework-declared columns (including `_id` and derived-hash columns) are always members. **Security:** *Database encryption key bound to its location* — `db.key.enc` is sealed with additional authenticated data over its purpose, resolved data directory, and resolved key path. A sealed key copied to a different deployment or path no longer unseals there — the AEAD authentication fails — which prevents silent key relocation. A legacy key sealed without this binding is detected and re-sealed in the bound format on first load, with no operator action required. · *`whereRaw` refuses embedded string literals* — `whereRaw(sql, params)` and `WhereBuilder.raw(sql, params)` reject a raw fragment containing a string literal (`'...'`); values must bind through the `params` array. A static, operator-controlled literal can opt in with `{ allowLiterals: true }`. This closes a path where a value concatenated into a raw fragment would reintroduce SQL injection (CWE-89). · *Credential-rejection audits record the attempted relation* — A `db.auth.failed` audit row (SQLSTATE 28000 / 28P01 / 42501) now carries `attemptedTable`, the relation the rejected credential tried to reach, extracted defensively from the statement. Triage can scope the blast radius of a credential-abuse event without correlating back to the raw SQL log (CWE-778). **Detectors:** *Audit-purge dual-control gate* — A new check fails the build if a call to `purgeAuditChain` appears in a file that does not also route through the dual-control gate, so a future caller cannot physically delete chain rows without two-authorizer enforcement. · *Raw-SQL literal/interpolation guard* — A new check fails the build on a `whereRaw` / `.raw` call whose SQL argument is built by template interpolation or string concatenation, keeping the bound-params discipline enforceable in framework code. · *Hand-rolled lookup-hash guard* — A new check fails the build if a sealed-column lookup hash is derived from the per-deployment salt outside the canonical helper, so call sites cannot bypass the keyed-mode and per-column mode policy. · *Auth-audit attempted-relation guard* — A new check fails the build if a `db.auth.failed` audit is emitted in a file that does not name `attemptedTable`, so the forensic field cannot be dropped from a future emitter.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 1,
3
- "frameworkVersion": "0.14.8",
4
- "createdAt": "2026-05-30T23:08:17.846Z",
3
+ "frameworkVersion": "0.14.9",
4
+ "createdAt": "2026-05-31T03:42:29.026Z",
5
5
  "exports": {
6
6
  "a2a": {
7
7
  "type": "object",
@@ -842,7 +842,7 @@ function create(opts) {
842
842
  "</md:EntityDescriptor>";
843
843
  }
844
844
 
845
- // ---- v0.10.16 — Single Logout (RFC SAML Bindings §3.4 HTTP-Redirect) ----
845
+ // ---- Single Logout (RFC SAML Bindings §3.4 HTTP-Redirect) ----
846
846
 
847
847
  /**
848
848
  * @primitive b.auth.saml.sp.buildLogoutRequest
@@ -1250,7 +1250,7 @@ function create(opts) {
1250
1250
  };
1251
1251
  }
1252
1252
 
1253
- // ---- v0.10.16 — SLO HTTP-POST binding (SAML Bindings §3.5) ----
1253
+ // ---- SLO HTTP-POST binding (SAML Bindings §3.5) ----
1254
1254
 
1255
1255
  /**
1256
1256
  * @primitive b.auth.saml.sp.buildLogoutRequestPost
@@ -1524,7 +1524,7 @@ function create(opts) {
1524
1524
  };
1525
1525
  }
1526
1526
 
1527
- // ---- v0.10.16 — SAML EncryptedAssertion decrypt (XMLEnc) ----
1527
+ // ---- SAML EncryptedAssertion decrypt (XMLEnc) ----
1528
1528
 
1529
1529
  // XMLEnc Algorithm URIs we support.
1530
1530
  //
@@ -1722,7 +1722,7 @@ function _decryptEncryptedAssertion(encAssertion, spPrivateKeyPem) {
1722
1722
  return clearBytes.toString("utf8");
1723
1723
  }
1724
1724
 
1725
- // ---- v0.10.16 — SAML SLO XMLDSig-Enveloped (HTTP-POST/SOAP) ----
1725
+ // ---- SAML SLO XMLDSig-Enveloped (HTTP-POST/SOAP) ----
1726
1726
 
1727
1727
  // PQC SignatureMethod URIs used by the embedded XMLDSig signatures.
1728
1728
  // Standard XMLDSig vocabulary classical signing URIs (W3C XMLDSig
@@ -1936,7 +1936,7 @@ function _verifyEmbeddedXmlDsig(xml, idpVerifyKey, idpVerifyAlg, expectedRootLoc
1936
1936
  }
1937
1937
  }
1938
1938
 
1939
- // ---- v0.10.16 SAML SLO signature-alg dispatch ----
1939
+ // ---- SAML SLO signature-alg dispatch ----
1940
1940
 
1941
1941
  function _sigAlgUrn(alg) {
1942
1942
  // PQC signers — framework-private experimental URIs. The `urn:`
@@ -1015,7 +1015,7 @@ module.exports = {
1015
1015
  BUNDLE_ID_RE: BUNDLE_ID_RE,
1016
1016
  };
1017
1017
 
1018
- // ---- v0.12.7: bundleAdapterStorage ---------------------------------------
1018
+ // ---- bundleAdapterStorage ---------------------------------------
1019
1019
 
1020
1020
  /**
1021
1021
  * @primitive b.backup.bundleAdapterStorage
@@ -2257,7 +2257,7 @@ bundleAdapterStorage.fsAdapter = function (fsOpts) {
2257
2257
  };
2258
2258
  };
2259
2259
 
2260
- // ---- v0.12.13: objectStoreAdapter ----------------------------------------
2260
+ // ---- objectStoreAdapter ----------------------------------------
2261
2261
 
2262
2262
  /**
2263
2263
  * @primitive b.backup.bundleAdapterStorage.objectStoreAdapter
@@ -2475,7 +2475,7 @@ bundleAdapterStorage.objectStoreAdapter = function (client, osOpts) {
2475
2475
  };
2476
2476
  };
2477
2477
 
2478
- // ---- v0.12.8: migrate ----------------------------------------------------
2478
+ // ---- migrate ----------------------------------------------------
2479
2479
 
2480
2480
  /**
2481
2481
  * @primitive b.backup.migrate
@@ -538,8 +538,8 @@ function deployerChecklist(assessment) {
538
538
  }
539
539
 
540
540
  /**
541
- * @primitive b.complianceAiAct.fundamentalRightsImpactAssessment
542
- * @signature b.complianceAiAct.fundamentalRightsImpactAssessment(opts)
541
+ * @primitive b.compliance.aiAct.fundamentalRightsImpactAssessment
542
+ * @signature b.compliance.aiAct.fundamentalRightsImpactAssessment(opts)
543
543
  * @since 0.8.77
544
544
  *
545
545
  * EU AI Act Article 27 — Fundamental Rights Impact Assessment (FRIA).
@@ -569,7 +569,7 @@ function deployerChecklist(assessment) {
569
569
  * }
570
570
  *
571
571
  * @example
572
- * var fria = b.complianceAiAct.fundamentalRightsImpactAssessment({
572
+ * var fria = b.compliance.aiAct.fundamentalRightsImpactAssessment({
573
573
  * systemId: "credit-scoring-v3",
574
574
  * deploymentContext: { purpose: "loan approval", sector: "financial",
575
575
  * geography: "EU", scale: "1M decisions/year" },
@@ -603,13 +603,13 @@ function fundamentalRightsImpactAssessment(opts) {
603
603
  notificationStatus: "operator-must-notify",
604
604
  note: "Notify national market-surveillance authority before first use (Art 27(3))",
605
605
  auditHook: "b.audit emission action='aiact.fria.completed' recommended",
606
- annexIVReference: "see b.complianceAiAct.annexIVScaffold for technical documentation",
606
+ annexIVReference: "see b.compliance.aiAct.annexIVScaffold for technical documentation",
607
607
  };
608
608
  }
609
609
 
610
610
  /**
611
- * @primitive b.complianceAiAct.gpai.trainingDataSummary
612
- * @signature b.complianceAiAct.gpai.trainingDataSummary(opts)
611
+ * @primitive b.compliance.aiAct.gpai.trainingDataSummary
612
+ * @signature b.compliance.aiAct.gpai.trainingDataSummary(opts)
613
613
  * @since 0.8.77
614
614
  *
615
615
  * EU AI Act Article 53(1)(d) — GPAI training-data summary template
@@ -634,7 +634,7 @@ function fundamentalRightsImpactAssessment(opts) {
634
634
  * contentProvenance: object, // { synthIdEmbed, c2paManifestEmbed, watermarkProvider }
635
635
  *
636
636
  * @example
637
- * var summary = b.complianceAiAct.gpai.trainingDataSummary({
637
+ * var summary = b.compliance.aiAct.gpai.trainingDataSummary({
638
638
  * modelId: "acme-llm-7b",
639
639
  * modelVersion: "1.0",
640
640
  * provider: { name: "Acme AI", address: "1 St", contact: "ai@acme.example" },
@@ -107,12 +107,12 @@ var KNOWN_POSTURES = Object.freeze([
107
107
  "bsi-c5", // Germany BSI C5
108
108
  "ens-es", // Spain Esquema Nacional de Seguridad
109
109
  "uk-g-cloud", // UK G-Cloud
110
- // ---- v0.8.70 expansion — 2026 effective deadlines ----
110
+ // ---- 2026 effective deadlines ----
111
111
  "modpa", // Maryland Online Data Privacy Act (effective 2025-10-01) — strict data-min
112
112
  "nydfs-500", // NYDFS 23 NYCRR 500 Amendment 2 — financial cybersecurity (multi-factor + asset inventory + governance)
113
113
  "hipaa-2026", // HHS HIPAA Security Rule 2026-Q4 final — extends hipaa with mandatory MFA + asset inventory + 72h restoration testing
114
114
  "quebec-25", // Quebec Law 25 final phase (effective 2026-09-22) — DPIA + automated-decision opt-out
115
- // ---- v0.8.77 expansion — US state consumer-privacy postures ----
115
+ // ---- US state consumer-privacy postures ----
116
116
  // Each posture carries per-state cure-period, profiling opt-out
117
117
  // and minor-consent metadata via b.dsr.stateRules(state). The
118
118
  // generic DSR primitive (b.dsr.submit) covers ~80% of the surface;
@@ -139,7 +139,7 @@ var KNOWN_POSTURES = Object.freeze([
139
139
  "ct-sb3", // Connecticut SB 3 Consumer Health Data
140
140
  "tx-cubi", // Texas Capture or Use of Biometric Identifier
141
141
  "fl-fdbr", // Florida Digital Bill of Rights (SB 262, effective 2024-07-01) — narrow scope ($1B+ revenue threshold)
142
- // ---- v0.8.81 expansion — AI-governance postures ----
142
+ // ---- AI-governance postures ----
143
143
  // State + sectoral AI regulations crystallizing through 2026. Each
144
144
  // posture is a flag that operators pin alongside their base
145
145
  // privacy/sectoral posture; the floors enforce audit-chain signing
@@ -153,20 +153,20 @@ var KNOWN_POSTURES = Object.freeze([
153
153
  "ca-tfaia", // California SB 53 — Transparency in Frontier AI Act (effective 2026-01-01)
154
154
  "kr-ai-basic", // South Korea AI Basic Act (effective 2026-01-22)
155
155
  "cn-ai-label", // China Measures for Labelling of AI-Generated Content (effective 2025-09-01)
156
- // ---- v0.8.81 expansion — AI management cross-walks ----
156
+ // ---- AI management cross-walks ----
157
157
  "iso-42001", // ISO/IEC 42001:2023 — AI Management System
158
158
  "iso-23894", // ISO/IEC 23894:2023 — AI Risk Management Guidance
159
- // ---- v0.8.81 expansion — content-credentials posture flags ----
159
+ // ---- content-credentials posture flags ----
160
160
  "ca-sb942", // California SB-942 (Cal. Bus. & Prof. Code §22757) gen-AI disclosure (effective 2026-08-02) // regulatory identifier + date, not bytes
161
161
  "ca-ab853", // California AB-853 platform-side gen-AI detection (effective 2026-08-02) // regulatory identifier + date, not bytes
162
- // ---- v0.8.81 expansion — substrate-to-posture cleanup ----
162
+ // ---- substrate-to-posture cleanup ----
163
163
  "eaa", // EU Accessibility Act / Directive (EU) 2019/882 (effective 2025-06-28)
164
164
  "wcag-2-2", // W3C Web Content Accessibility Guidelines 2.2 (Oct 2023 Recommendation)
165
165
  "eu-data-act", // EU Data Act / Regulation (EU) 2023/2854 (effective 2025-09-12)
166
166
  "hitech", // Health Information Technology for Economic and Clinical Health Act (2009)
167
167
  "ferpa", // Family Educational Rights and Privacy Act (20 U.S.C. §1232g)
168
168
  "dpdp", // India Digital Personal Data Protection Act 2023 (rules-pending; cascade tier exists)
169
- // ---- v0.8.82 expansion — privacy 2026 sweep ----
169
+ // ---- privacy 2026 sweep ----
170
170
  // US federal child / financial privacy
171
171
  "coppa", // Children's Online Privacy Protection Act (15 U.S.C. §6501)
172
172
  "coppa-2025", // COPPA 2025 Amendment (FTC final 2025-04-22; effective 2026-06-23 — biometric expansion + knowing-collection disclosure)
@@ -203,7 +203,7 @@ var KNOWN_POSTURES = Object.freeze([
203
203
  "eu-cer", // EU Critical Entities Resilience Directive (2022/2557; transposition 2024-10-17)
204
204
  "eu-cyber-sol", // EU Cyber Solidarity Act (Regulation 2025/38; effective 2025-02-04)
205
205
  "eidas-2", // eIDAS 2 / EUDI Wallet (Regulation 2024/1183; rollout 2026-2027)
206
- // ---- v0.8.86 expansion — sectoral + cybersecurity directives ----
206
+ // ---- sectoral + cybersecurity directives ----
207
207
  "cmmc-2.0", // US DoD Cybersecurity Maturity Model Certification 2.0 (effective 2025-Q1)
208
208
  "cjis-v6", // FBI Criminal Justice Information Services Security Policy v6.0 (Dec 2024)
209
209
  "iso-27001-2022", // ISO/IEC 27001:2022 — Information Security Management System
@@ -214,7 +214,7 @@ var KNOWN_POSTURES = Object.freeze([
214
214
  "nist-800-66-r2", // NIST SP 800-66 Rev 2 — HIPAA Security Rule implementation guidance // NIST publication number, not bytes
215
215
  "ehds", // EU European Health Data Space (Regulation 2025/327; phased 2027-2029)
216
216
  "circia", // US Cyber Incident Reporting for Critical Infrastructure Act (final rule pending)
217
- // ---- v0.9.6 expansion — exceptd framework-control-gap closure ----
217
+ // ---- exceptd framework-control-gap closure ----
218
218
  // Postures added to recognise every framework cited in the
219
219
  // exceptd 2026-05-11 framework-control-gaps catalog. Each posture
220
220
  // either (a) maps to a framework the operator must audit against,
@@ -248,7 +248,7 @@ var KNOWN_POSTURES = Object.freeze([
248
248
  "cwe-top-25-2024", // CWE Top 25 Most Dangerous Software Weaknesses (2024)
249
249
  "cis-controls-v8", // CIS Controls v8
250
250
  "cmmc-2.0-level-2", // CMMC 2.0 Level 2 (Advanced) — 110 NIST 800-171 Rev 2 controls // NIST pub number / level, not bytes
251
- // ---- v0.9.57 — granular CMMC level distinction ----
251
+ // ---- granular CMMC level distinction ----
252
252
  // CMMC 2.0 maturity levels carry distinct control-mapping
253
253
  // expectations: Level 1 = 15 controls (FAR 52.204-21), Level 2 =
254
254
  // 110 controls (NIST 800-171 Rev 2), Level 3 = additional NIST
@@ -257,7 +257,7 @@ var KNOWN_POSTURES = Object.freeze([
257
257
  // L1/L2/L3 postures are the recommended pin for new deployments.
258
258
  "cmmc-2.0-level-1", // CMMC 2.0 Level 1 (Foundational) — 15 FAR controls; FCI-only data // regulatory identifier, not bytes
259
259
  "cmmc-2.0-level-3", // CMMC 2.0 Level 3 (Expert) — NIST 800-172 enhanced controls atop L2 // regulatory identifier, not bytes
260
- // ---- v0.12.1 — promote POSTURE_DEFAULTS-only entries into the
260
+ // ---- promote POSTURE_DEFAULTS-only entries into the
261
261
  // canonical KNOWN_POSTURES surface so operators can actually
262
262
  // `b.compliance.set(...)` them. Each entry had cascade
263
263
  // configuration wired but couldn't be pinned because set()'s
@@ -757,7 +757,7 @@ var REGIME_MAP = Object.freeze({
757
757
  "ct-sb3": { name: "Connecticut SB 3 Consumer Health Data", citation: "Conn. P.A. 23-56 (effective 2023-07-01)", jurisdiction: "US-CT", domain: "health" },
758
758
  "tx-cubi": { name: "Texas Capture or Use of Biometric Identifier", citation: "Tex. Bus. & Com. Code §503.001 (effective 2009-09-01)", jurisdiction: "US-TX", domain: "biometric" },
759
759
  "fl-fdbr": { name: "Florida Digital Bill of Rights", citation: "Fla. Stat. §501.701 et seq. SB 262 (effective 2024-07-01)", jurisdiction: "US-FL", domain: "privacy" },
760
- // ---- v0.8.81 — AI governance ----
760
+ // ---- AI governance ----
761
761
  "co-ai": { name: "Colorado AI Act", citation: "C.R.S. §6-1-1701 et seq. SB24-205 (postponed to 2026-06-30; enforcement stayed)", jurisdiction: "US-CO", domain: "ai-governance" },
762
762
  "il-hb3773": { name: "Illinois HB 3773 — AI in Employment", citation: "775 ILCS 5 IHRA AI amendment (effective 2026-01-01)", jurisdiction: "US-IL", domain: "ai-governance" },
763
763
  "tx-traiga": { name: "Texas Responsible AI Governance Act", citation: "Tex. Bus. & Com. Code Ch. 552 HB 149 (effective 2026-01-01)", jurisdiction: "US-TX", domain: "ai-governance" },
@@ -766,20 +766,20 @@ var REGIME_MAP = Object.freeze({
766
766
  "ca-tfaia": { name: "California Transparency in Frontier AI Act", citation: "Cal. Bus. & Prof. Code §22757.10 et seq. SB 53 (effective 2026-01-01)", jurisdiction: "US-CA", domain: "ai-governance" },
767
767
  "kr-ai-basic": { name: "South Korea AI Basic Act", citation: "Framework Act on Development of AI (effective 2026-01-22)", jurisdiction: "KR", domain: "ai-governance" },
768
768
  "cn-ai-label": { name: "China — Measures for Labelling AI-Generated Content", citation: "CAC + MIIT + Ministry of Public Security + NRTA Order (effective 2025-09-01)", jurisdiction: "CN", domain: "ai-governance" },
769
- // ---- v0.8.81 — AI management cross-walks ----
769
+ // ---- AI management cross-walks ----
770
770
  "iso-42001": { name: "ISO/IEC 42001 — AI Management System", citation: "ISO/IEC 42001:2023", jurisdiction: "international", domain: "ai-governance" },
771
771
  "iso-23894": { name: "ISO/IEC 23894 — AI Risk Management", citation: "ISO/IEC 23894:2023", jurisdiction: "international", domain: "ai-governance" },
772
- // ---- v0.8.81 — content-credentials posture flags ----
772
+ // ---- content-credentials posture flags ----
773
773
  "ca-sb942": { name: "California Gen-AI Provenance Disclosure", citation: "Cal. Bus. & Prof. Code §22757 SB-942 (effective 2026-08-02)", jurisdiction: "US-CA", domain: "content-credentials" },
774
774
  "ca-ab853": { name: "California Platform Gen-AI Detection", citation: "Cal. Bus. & Prof. Code §22757 AB-853 (effective 2026-08-02)", jurisdiction: "US-CA", domain: "content-credentials" },
775
- // ---- v0.8.81 — substrate-to-posture cleanup ----
775
+ // ---- substrate-to-posture cleanup ----
776
776
  "eaa": { name: "EU Accessibility Act", citation: "Directive (EU) 2019/882 (effective 2025-06-28)", jurisdiction: "EU", domain: "accessibility" },
777
777
  "wcag-2-2": { name: "W3C Web Content Accessibility Guidelines 2.2", citation: "W3C Recommendation (Oct 2023)", jurisdiction: "international", domain: "accessibility" },
778
778
  "eu-data-act": { name: "EU Data Act", citation: "Regulation (EU) 2023/2854 (effective 2025-09-12)", jurisdiction: "EU", domain: "data-sharing" },
779
779
  "hitech": { name: "Health Information Technology for Economic and Clinical Health Act", citation: "Pub. L. 111-5, Title XIII, Subtitle D (2009)", jurisdiction: "US", domain: "health" },
780
780
  "ferpa": { name: "Family Educational Rights and Privacy Act", citation: "20 U.S.C. §1232g; 34 CFR Part 99", jurisdiction: "US", domain: "student-records" },
781
781
  "dpdp": { name: "Digital Personal Data Protection Act 2023", citation: "Act 22 of 2023 (India; rules pending)", jurisdiction: "IN", domain: "privacy" },
782
- // ---- v0.8.82 — privacy 2026 sweep ----
782
+ // ---- privacy 2026 sweep ----
783
783
  // US federal
784
784
  "coppa": { name: "Children's Online Privacy Protection Act", citation: "15 U.S.C. §§6501-6506; 16 CFR Part 312 (effective 2000-04-21)", jurisdiction: "US", domain: "child-privacy" },
785
785
  "coppa-2025": { name: "COPPA 2025 Amendment", citation: "FTC final rule (2025-04-22; effective 2026-06-23) — biometric expansion + knowing-collection-13-and-under disclosure", jurisdiction: "US", domain: "child-privacy" },
@@ -815,7 +815,7 @@ var REGIME_MAP = Object.freeze({
815
815
  "eu-cer": { name: "EU Critical Entities Resilience Directive", citation: "Directive (EU) 2022/2557 (transposition 2024-10-17)", jurisdiction: "EU", domain: "cybersecurity" },
816
816
  "eu-cyber-sol": { name: "EU Cyber Solidarity Act", citation: "Regulation (EU) 2025/38 (effective 2025-02-04)", jurisdiction: "EU", domain: "cybersecurity" },
817
817
  "eidas-2": { name: "eIDAS 2 / EUDI Wallet", citation: "Regulation (EU) 2024/1183 (rollout 2026-2027)", jurisdiction: "EU", domain: "identity" },
818
- // ---- v0.8.86 — sectoral + cybersecurity directives ----
818
+ // ---- sectoral + cybersecurity directives ----
819
819
  "cmmc-2.0": { name: "Cybersecurity Maturity Model Certification 2.0", citation: "32 CFR Part 170 (DFARS rule effective 2025-Q1)", jurisdiction: "US", domain: "cybersecurity" },
820
820
  "cjis-v6": { name: "FBI CJIS Security Policy v6.0", citation: "CJIS Security Policy v6.0 (effective 2024-12)", jurisdiction: "US", domain: "law-enforcement" },
821
821
  "iso-27001-2022": { name: "ISO/IEC 27001:2022 Information Security Management System", citation: "ISO/IEC 27001:2022", jurisdiction: "international", domain: "cybersecurity" },
@@ -826,7 +826,7 @@ var REGIME_MAP = Object.freeze({
826
826
  "nist-800-66-r2": { name: "NIST SP 800-66 Rev 2 — HIPAA Security Rule Guidance", citation: "NIST SP 800-66 Rev 2 (Feb 2024)", jurisdiction: "US", domain: "health" },
827
827
  "ehds": { name: "European Health Data Space", citation: "Regulation (EU) 2025/327 (phased 2027-2029)", jurisdiction: "EU", domain: "health" },
828
828
  "circia": { name: "Cyber Incident Reporting for Critical Infrastructure Act", citation: "6 U.S.C. §681 et seq. (final rule pending)", jurisdiction: "US", domain: "cybersecurity" },
829
- // ---- v0.12.1 — REGIME_MAP backfill for KNOWN_POSTURES without
829
+ // ---- REGIME_MAP backfill for KNOWN_POSTURES without
830
830
  // describe() coverage. Each entry resolves `b.compliance.describe
831
831
  // (posture)` → { name, citation, jurisdiction, domain } so admin
832
832
  // UI / generated audit reports rendering "running under <name>
@@ -870,7 +870,7 @@ var REGIME_MAP = Object.freeze({
870
870
  "bsi-c5": { name: "Germany BSI C5 — Cloud Computing Compliance Catalogue", citation: "BSI Cloud Computing Compliance Criteria Catalogue (C5:2020)", jurisdiction: "DE", domain: "cybersecurity" },
871
871
  "ens-es": { name: "Spain Esquema Nacional de Seguridad", citation: "Real Decreto 311/2022", jurisdiction: "ES", domain: "cybersecurity" },
872
872
  "uk-g-cloud": { name: "UK G-Cloud Framework", citation: "UK Crown Commercial Service G-Cloud 14", jurisdiction: "UK", domain: "cybersecurity" },
873
- // ---- v0.9.6 expansion REGIME_MAP backfill (cybersecurity / AI / supply-chain frameworks) ----
873
+ // ---- REGIME_MAP backfill (cybersecurity / AI / supply-chain frameworks) ----
874
874
  "nist-800-53": { name: "NIST SP 800-53 Rev 5 — Security & Privacy Controls", citation: "NIST SP 800-53 Rev 5", jurisdiction: "US", domain: "cybersecurity" },
875
875
  "nist-ai-rmf-1.0": { name: "NIST AI Risk Management Framework 1.0", citation: "NIST AI 100-1 (Jan 2023)", jurisdiction: "US", domain: "ai" },
876
876
  "iso-42001-2023": { name: "ISO/IEC 42001:2023 — AI Management System", citation: "ISO/IEC 42001:2023", jurisdiction: "international", domain: "ai" },
@@ -1176,7 +1176,7 @@ var POSTURE_DEFAULTS = Object.freeze({
1176
1176
  "nist-800-66-r2": Object.freeze({ backupEncryptionRequired: true, auditChainSignedRequired: true, tlsMinVersion: "TLSv1.3", requireVacuumAfterErase: true }),
1177
1177
  "ehds": Object.freeze({ backupEncryptionRequired: true, auditChainSignedRequired: true, tlsMinVersion: "TLSv1.3", requireVacuumAfterErase: true }),
1178
1178
  "circia": Object.freeze({ backupEncryptionRequired: false, auditChainSignedRequired: true, tlsMinVersion: "TLSv1.3", requireVacuumAfterErase: false }),
1179
- // ---- v0.9.6 — exceptd framework-control-gap closure cascade ----
1179
+ // ---- exceptd framework-control-gap closure cascade ----
1180
1180
  "nist-800-53": Object.freeze({ backupEncryptionRequired: true, auditChainSignedRequired: true, tlsMinVersion: "TLSv1.3", requireVacuumAfterErase: true }),
1181
1181
  // NIST AI-RMF MANAGE.4.3 / ISO 23894 §6.5 / ISO 42001
1182
1182
  // §A.6 require encrypted backups for AI system state (model
@@ -1242,7 +1242,7 @@ var POSTURE_DEFAULTS = Object.freeze({
1242
1242
  "cmmc-2.0-level-1": Object.freeze({ backupEncryptionRequired: false, auditChainSignedRequired: true, tlsMinVersion: "TLSv1.3", requireVacuumAfterErase: false }),
1243
1243
  "cmmc-2.0-level-2": Object.freeze({ backupEncryptionRequired: true, auditChainSignedRequired: true, tlsMinVersion: "TLSv1.3", requireVacuumAfterErase: true }),
1244
1244
  "cmmc-2.0-level-3": Object.freeze({ backupEncryptionRequired: true, auditChainSignedRequired: true, tlsMinVersion: "TLSv1.3", requireVacuumAfterErase: true, fipsMode: false }),
1245
- // ---- v0.10.16 — sectoral catch-up ----
1245
+ // ---- sectoral catch-up ----
1246
1246
  // 42 CFR Part 2 — Substance Use Disorder records confidentiality
1247
1247
  // (HHS final rule 2024-04-16 aligns Part 2 with HIPAA but retains
1248
1248
  // a stricter consent floor; encrypted backups + signed audit chain
@@ -1078,7 +1078,7 @@ function dbTicketStore(opts) {
1078
1078
  };
1079
1079
  }
1080
1080
 
1081
- // ---- v0.8.77 — US state-law DSR drift registry -------------------
1081
+ // ---- US state-law DSR drift registry -------------------
1082
1082
  //
1083
1083
  // Each US state consumer-privacy law expresses the same DSR core
1084
1084
  // (access / deletion / correction / portability) but with per-state
@@ -905,7 +905,7 @@ module.exports = {
905
905
  tarEntryPolicy: tarEntryPolicy,
906
906
  };
907
907
 
908
- // ---- v0.12.7 extensions ---------------------------------------------------
908
+ // ---- extensions ---------------------------------------------------
909
909
 
910
910
  /**
911
911
  * @primitive b.guardArchive.inspect
@@ -928,7 +928,7 @@ function _audit(auditHandle, action, outcome, metadata) {
928
928
  } catch (_e) { /* drop-silent — audit failures must not crash callers */ }
929
929
  }
930
930
 
931
- // ---- v0.10.16 experimental encrypt/decrypt + WKD ----
931
+ // ---- experimental encrypt/decrypt + WKD ----
932
932
  //
933
933
  // PQC PGP encrypt/decrypt for ML-KEM-1024 recipients shipped under
934
934
  // `experimental` namespace (RFC 9580bis PKESK ML-KEM codepoints
@@ -36,12 +36,6 @@
36
36
  * parsed as `country: false`). Block + flow style;
37
37
  * literal `|` and folded `>` block scalars with chomp
38
38
  * indicators.
39
- * env — .env file loader with size cap + schema validation;
40
- * refuses to expand $VAR references; refuses to silently
41
- * overwrite existing process.env values unless explicitly
42
- * opted in. Dev-tooling — production secrets should still
43
- * come through the operator's secrets-management; this is
44
- * the local-development convenience.
45
39
  * ini — INI / .gitconfig / systemd-unit / php.ini / tox.ini parser.
46
40
  * Sections (incl. [parent.child] / [parent "child"] nesting),
47
41
  * ; or # comments (inline + leading), single + double quoting
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blamejs/core",
3
- "version": "0.14.8",
3
+ "version": "0.14.9",
4
4
  "description": "The Node framework that owns its stack.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "blamejs contributors",
@@ -0,0 +1,40 @@
1
+ {
2
+ "$schema": "../scripts/release-notes-schema.json",
3
+ "version": "0.14.9",
4
+ "date": "2026-05-30",
5
+ "headline": "Corrects EU AI Act doc paths that named an uncallable namespace, plus source-comment hygiene and two new codebase checks",
6
+ "summary": "A documentation fix and internal hygiene. The `@primitive` / `@signature` / `@example` blocks for the EU AI Act fundamental-rights-impact-assessment and GPAI training-data-summary helpers advertised `b.complianceAiAct.*`, which is undefined — the callable path is `b.compliance.aiAct.*` — so an operator copying the documented call got `undefined is not a function`. The documented paths now match the real surface. Alongside that: a duplicate parser entry in a doc block is removed, version stamps embedded in section-divider comments are stripped, and two codebase checks are added — one that fails the build when a `@primitive` block documents a wholly-unresolvable namespace (the gap that hid the AI Act paths), and one that flags a version stamp left inside a section divider. No exported API, error code, wire format, or runtime behaviour changes.",
7
+ "sections": [
8
+ {
9
+ "heading": "Fixed",
10
+ "items": [
11
+ {
12
+ "title": "EU AI Act helper documentation named an uncallable path",
13
+ "body": "`b.compliance.aiAct.fundamentalRightsImpactAssessment` and `b.compliance.aiAct.gpai.trainingDataSummary` were documented as `b.complianceAiAct.*` in their `@primitive` / `@signature` / `@example` blocks (and one returned reference string). `b.complianceAiAct` is undefined, so the documented call failed; the documented paths now match the callable surface."
14
+ }
15
+ ]
16
+ },
17
+ {
18
+ "heading": "Changed",
19
+ "items": [
20
+ {
21
+ "title": "Source-comment hygiene",
22
+ "body": "Removed a duplicate `env` entry from the parsers `@module` doc block, and stripped internal version stamps (`vX.Y.Z`) from `// ---- ... ----` section-divider comments across several files, keeping the descriptive label. Comment-only; no behaviour change."
23
+ }
24
+ ]
25
+ },
26
+ {
27
+ "heading": "Detectors",
28
+ "items": [
29
+ {
30
+ "title": "`@primitive` reachability covers wrong-namespace paths",
31
+ "body": "The reachability check previously only flagged a missing leaf on a resolved namespace; a `@primitive` whose entire dotted prefix is unresolvable (the shape that hid the AI Act doc paths) was silently skipped. It now walks each prefix segment and fails the build on any unresolvable one, while preserving the factory-instance-shorthand exemption."
32
+ },
33
+ {
34
+ "title": "Version-stamp-in-divider check",
35
+ "body": "A new check flags a version stamp (`vX.Y.Z`) left immediately after a section divider's dashes (`// ---- vX.Y.Z ...`) — internal release vocabulary that does not belong in shipped source comments — without matching legitimate `@since` tags or prose version references."
36
+ }
37
+ ]
38
+ }
39
+ ]
40
+ }
@@ -10801,12 +10801,46 @@ function testPrimitiveReachability() {
10801
10801
  return cur;
10802
10802
  }
10803
10803
 
10804
+ // Walk the dotted prefix (every segment except the leaf) so a break at
10805
+ // ANY segment — including a wholesale-wrong namespace whose parent
10806
+ // resolves to undefined — is surfaced rather than silently skipped. A
10807
+ // function OR a `.create`-bearing object anywhere in the chain is a
10808
+ // factory-instance shorthand and stays exempt.
10809
+ function walkPrefix(name, surface) {
10810
+ var parts = name.split(".");
10811
+ var cur = surface;
10812
+ for (var i = 1; i < parts.length - 1; i += 1) {
10813
+ // A missing prefix segment is a wrong-namespace doc path even when
10814
+ // `cur` is itself a factory (has `.create`): a namespace that ALSO
10815
+ // has real static children (e.g. b.mail.create + b.mail.bimi /
10816
+ // b.mail.rbl) is used statically, so an undefined child is a typo,
10817
+ // not a factory-instance method. The factory-shorthand exemption is
10818
+ // therefore applied ONLY at the leaf parent (the trailing function
10819
+ // check below + the caller's `.create` check) — never at an
10820
+ // intermediate segment, which would mask the typo.
10821
+ if (cur == null || typeof cur[parts[i]] === "undefined") {
10822
+ return { brokenName: parts.slice(0, i + 1).join(".") };
10823
+ }
10824
+ cur = cur[parts[i]];
10825
+ }
10826
+ if (typeof cur === "function") return { factory: true };
10827
+ return { parent: cur, parentName: parts.slice(0, -1).join(".") };
10828
+ }
10829
+
10804
10830
  // @primitive paths that legitimately don't resolve as a flat member
10805
10831
  // (documented elsewhere / intentional). Keyed by dotted name.
10806
10832
  var REACHABILITY_ALLOWLIST = {
10807
10833
  // (none — every surfaced gap is fixed in-tree)
10808
10834
  };
10809
10835
 
10836
+ // Self-test (locks the fix): a missing intermediate segment under a
10837
+ // mixed factory+static namespace must be flagged, never masked by the
10838
+ // factory-shorthand exemption.
10839
+ var _rMock = { mail: { create: function () {}, bimi: {} } };
10840
+ var _rProbe = walkPrefix("b.mail.bmi.recordShape", _rMock);
10841
+ check("primitive-reachability: typo under a mixed factory namespace is flagged",
10842
+ _rProbe.brokenName === "b.mail.bmi");
10843
+
10810
10844
  var libFiles = _libFiles();
10811
10845
  var unreachable = [];
10812
10846
  for (var i = 0; i < libFiles.length; i += 1) {
@@ -10818,9 +10852,24 @@ function testPrimitiveReachability() {
10818
10852
  var name = m[1];
10819
10853
  if (REACHABILITY_ALLOWLIST[name]) continue;
10820
10854
  if (typeof resolve(name) !== "undefined") continue;
10821
- var parts = name.split(".");
10822
- var parentName = parts.slice(0, -1).join(".");
10823
- var parent = resolve(parentName);
10855
+ var w = walkPrefix(name, bSurface);
10856
+ // Factory-instance shorthands (b.X.create() → instance method) skip.
10857
+ if (w.factory) continue;
10858
+ if (w.brokenName) {
10859
+ // The whole dotted namespace prefix is unresolvable — the parent
10860
+ // resolved to undefined, so the flat-namespace check below never
10861
+ // fired and the doc-lie was silently skipped. Flag it.
10862
+ unreachable.push({
10863
+ file: rel,
10864
+ line: 1,
10865
+ content: "@primitive " + name + " documents a b.* path that does not resolve (the namespace `" +
10866
+ w.brokenName + "` is undefined — no prefix segment resolves on the public surface). " +
10867
+ "Correct the @primitive/@signature namespace, or wire the namespace into the surface.",
10868
+ });
10869
+ continue;
10870
+ }
10871
+ var parent = w.parent;
10872
+ var parentName = w.parentName;
10824
10873
  // Flag only flat namespaces (object parent without a `create`
10825
10874
  // factory). Factory-instance shorthands are skipped.
10826
10875
  if (parent && typeof parent === "object" && typeof parent.create !== "function") {
@@ -10913,6 +10962,7 @@ function testNoInternalNarrativeComments() {
10913
10962
  { re: /\b[Aa]udit\s+\d{4}-\d{2}-\d{2}/, what: "dated audit/decision residue" },
10914
10963
  { re: /\bReported\s+\d{4}-\d{2}-\d{2}/, what: "dated report residue" },
10915
10964
  { re: /\bCore Rule\s+§\d/, what: "internal CLAUDE.md rule-number citation" },
10965
+ { re: /----\s*v\d+\.\d+\.\d+/, what: "version stamp in a section-divider comment" },
10916
10966
  ];
10917
10967
  var files = _libFiles();
10918
10968
  var bad = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blamejs/blamejs-shop",
3
- "version": "0.3.19",
3
+ "version": "0.3.21",
4
4
  "description": "Open-source framework built on blamejs. Vendored stack, zero npm runtime deps, PQC-first crypto, security-on by default.",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {