← back to Sku Check Skill
feat: dryRun flag on /api/check/sku (read-only preview, no tag/slack/db write)
6ebeddbbbafc7536734388d90dc63e0726afc004 · 2026-07-09 22:24:00 -0700 · Steve
Files touched
Diff
commit 6ebeddbbbafc7536734388d90dc63e0726afc004
Author: Steve <steve@designerwallcoverings.com>
Date: Thu Jul 9 22:24:00 2026 -0700
feat: dryRun flag on /api/check/sku (read-only preview, no tag/slack/db write)
---
server.js | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/server.js b/server.js
index 861cd23..e79b016 100644
--- a/server.js
+++ b/server.js
@@ -417,6 +417,11 @@ app.post('/api/check/sku', async (req, res) => {
const { dw_sku } = req.body;
if (!dw_sku) return res.status(400).json({ error: 'dw_sku required' });
+ // Read-only preview: run the full lookup + vendor check but write nothing —
+ // no sku_check_results row, no "Review" tag on Shopify, no Slack. Lets you
+ // see what a check WOULD do before committing the side effects.
+ const dryRun = req.body.dryRun === true || req.query.dryRun === '1';
+
try {
const crossref = await lookupSku(dw_sku);
if (!crossref) {
@@ -426,6 +431,19 @@ app.post('/api/check/sku', async (req, res) => {
const shopify = await findShopifyProduct(crossref.dw_sku_dash);
const vendorResult = await checkVendorWebsite(crossref.mfr_sku, crossref.vendor_code);
+ if (dryRun) {
+ // Report exactly what a live check WOULD do, without doing it.
+ const wouldTag = vendorResult.status === 'not_found' && !!shopify?.id;
+ return res.json({
+ dryRun: true,
+ wouldTagReview: wouldTag,
+ wouldSlack: wouldTag,
+ crossref,
+ shopify: shopify ? { id: shopify.id, handle: shopify.handle, tags: shopify.tags } : null,
+ vendorCheck: vendorResult
+ });
+ }
+
// Store result
const insertResult = await pool.query(
`INSERT INTO sku_check_results
← 6456c3e chore: v1.0.1 (session close) — 127.0.0.1 bind fix + .deploy
·
back to Sku Check Skill
·
chore: v1.1.0 (dryRun feature, session close) 082a8fb →