[object Object]

← back to Sister Parish Onboarding

Fix: replace relative-path shim with portable resolution (TK-11786)

4dbf7faeaeff90e7ec63918a0857dc46f47492de · 2026-09-22 17:52:52 -0700 · Steve Abrams

The inventory-stamp-guard.mjs shim now resolves via DW_SHARED_GUARDS env or
home-dir fallback instead of relative path. This enables the guard to work
on Kamatera (/root), Mac1, and any other machine regardless of repo location.

ESM consumers (import) work correctly. CJS consumers (require) fail safely
with ERR_REQUIRE_ASYNC_MODULE, preventing silent bad defaults on inventory
stamps.

Original vendored copy preserved as inventory-stamp-guard.mjs.pre-shared-lift.
The $0-orderable guard (TK-11357) now has ONE source of truth at
~/Projects/_shared/dw-guards/.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WoD95uATtwJXUZvQ7PNPsB

Files touched

Diff

commit 4dbf7faeaeff90e7ec63918a0857dc46f47492de
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Tue Sep 22 17:52:52 2026 -0700

    Fix: replace relative-path shim with portable resolution (TK-11786)
    
    The inventory-stamp-guard.mjs shim now resolves via DW_SHARED_GUARDS env or
    home-dir fallback instead of relative path. This enables the guard to work
    on Kamatera (/root), Mac1, and any other machine regardless of repo location.
    
    ESM consumers (import) work correctly. CJS consumers (require) fail safely
    with ERR_REQUIRE_ASYNC_MODULE, preventing silent bad defaults on inventory
    stamps.
    
    Original vendored copy preserved as inventory-stamp-guard.mjs.pre-shared-lift.
    The $0-orderable guard (TK-11357) now has ONE source of truth at
    ~/Projects/_shared/dw-guards/.
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_01WoD95uATtwJXUZvQ7PNPsB
---
 scripts/lib/inventory-stamp-guard.mjs | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/scripts/lib/inventory-stamp-guard.mjs b/scripts/lib/inventory-stamp-guard.mjs
index e60470e..5000592 100644
--- a/scripts/lib/inventory-stamp-guard.mjs
+++ b/scripts/lib/inventory-stamp-guard.mjs
@@ -1,5 +1,23 @@
 // inventory-stamp-guard.mjs — RE-EXPORT SHIM -> canonical master (2026-09-22 Option-B decouple).
-// Executable code verified IDENTICAL to the master (comment-only diff) + predicate-proof GREEN
-// after this shim. The $0-orderable guard (TK-11357) now has ONE source of truth.
+// The $0-orderable guard (TK-11357) has ONE source of truth: ~/Projects/_shared/dw-guards/.
 // Original preserved as inventory-stamp-guard.mjs.pre-shared-lift.
-export * from '../../../_shared/dw-guards/inventory-stamp-guard.mjs';
+//
+// PORTABLE resolution (TK-11786 review fix): resolve the master via DW_SHARED_GUARDS or the
+// per-user home dir, NOT a hardcoded /Users/macstudio3 path — mirrors validate-before-activate.js
+// and internal-guard.js so this works on Kamatera (/root), Mac1, and any other home.
+// ESM .mjs — CJS require() is NOT supported (would need to resolve async or switch to .js wrapper).
+// For CJS consumers: change to `const m = await import('./...')` or convert to ESM.
+// Fail-safe: if require() is attempted, Node throws ERR_REQUIRE_ASYNC_MODULE, preventing silent bad defaults.
+
+import os from 'node:os';
+import path from 'node:path';
+import { pathToFileURL } from 'node:url';
+
+const base = process.env.DW_SHARED_GUARDS || path.join(os.homedir(), 'Projects', '_shared', 'dw-guards');
+const _m = await import(pathToFileURL(path.join(base, 'inventory-stamp-guard.mjs')).href);
+
+export const PRICE_SUPPRESSED_TAGS = _m.PRICE_SUPPRESSED_TAGS;
+export const isPriceSuppressed = _m.isPriceSuppressed;
+export const isSellableVariant = _m.isSellableVariant;
+export const isZeroPriceOrderableRisk = _m.isZeroPriceOrderableRisk;
+export const safeStampQuantity = _m.safeStampQuantity;

← b126d74 Make SP guard shim path portable and skip $0-orderable varia  ·  back to Sister Parish Onboarding  ·  (newest)