Skip to content

feat(dx-sap-spartacus-import): SAP product picker for B2B powertools sites, picker preflight - #39

Open
vaishnavi-kedar-cstk wants to merge 3 commits into
nextfrom
feat/sap-import-powertools-picker
Open

vaishnavi-kedar-cstk wants to merge 3 commits into
nextfrom
feat/sap-import-powertools-picker

Conversation

@vaishnavi-kedar-cstk

@vaishnavi-kedar-cstk vaishnavi-kedar-cstk commented Nov 19, 2026 •

Copy link
Copy Markdown

Base

One commit on next. Follows #38 (dx-sap-spartacus-import).

What

The SAP Commerce Cloud app's product picker already turned on from the SAP_APP_* configuration for any site. This makes the powertools (B2B) case explicit and safe, from a run that set the picker up end to end on a fresh powertools-spa stack.

Picker preflight (scripts/marketplace-app/sap_preflight.py, new). With carousels going into sap_products, gate 2 checks the server the picker will search, with TLS verified:

Check Fails when
tls the certificate isn't publicly trusted (SAP's default dev cert, CN=hybris)
site SAP_APP_BASE_SITE isn't a base site there
search product search returns 0 products (index not built) or needs a login (B2B)
codes none of the carousel codes exist there (some missing is a warning)

The dry run prints the result. A write stops with exit code 4 before the app is installed or anything is written, and each failure names its fix. All four failures were real steps on the way to the powertools picker: the old demo server's certificate, a missing powertools-spa, then an empty index.

Localize. A failed entry update is retried once. A transient 422 on global_slots (site_links) happened once and passed on retry. If something still fails, localize.py exits 3, and the orchestrator records that locale as warn and names it in the final banner. Before this, the locale was marked ok even with a failed entry.

Smaller fixes:

  • The --carousel-field help said auto means electronics-spa; it's the SAP_APP_* configuration.
  • references/sap-commerce-app.md gains a base-site table (electronics → electronics, powertools → powertools-spa), the same-catalog rule and the preflight table.
  • SKILL.md, pipeline.md and the docs page cover the powertools picker inputs, exit code 4 and an example.
  • evals/routing-dx-sap-spartacus-import-3: a powertools picker prompt loads the skill.

Testing

  • node scripts/validate.mjs: 34 skills, 7 manifests valid. All scripts compile.
  • Preflight against a real SAP Commerce Cloud environment:
    • powertools-spa passes (252 products, 14/14 codes).
    • electronics passes (221 products, 17/17 codes).
    • An unknown base site fails on site, exit 4.
    • The old demo server with SAP's dev certificate fails on tls, exit 4.
  • Orchestrator: a dry run with the picker on shows the preflight at gate 2. A write with a failing preflight exits 4, with picker-preflight: fail and gate2: blocked, and no app, seed or publish stage.
  • End to end on the powertools trial stack, before this change:
    • The app installed and configured once; 14/14 codes resolved; round-trip and delivery checks pass; en/de/ja/zh done.
    • In the CMS, the picker shows each carousel's 7 products and searches all 252 Powertools products.
  • localize.py after this change: Japanese and German re-runs on that stack, 0 errors.
  • Agent-prompt flow, end to end on a fresh, empty stack. An agent was given only SKILL.md, the guide's prompt ("Import the powertools-spa SAP storefront … with German, Japanese and Chinese", picker on) and the settings in the shell. Exit 0 in 44 minutes:
    • picker-preflight: pass, sap-app: ok, seed: ok, publish: ok, verify-roundtrip: pass (23/23 components, 2/2 nav trees), and de/ja/zh ok.
    • verify-cda: check, as expected: there's no delivery token on a fresh stack.
    • The picker, checked in the browser, shows 7 products on first open.
    • The agent also listed 13 places where SKILL.md was unclear or didn't match the scripts. The second commit fixes them (next section).

Second commit: fixes from the agent-prompt run

  • Gate 2 report:
    • names the target stack and says whether it's empty (new cs-seed/stack_info.py, read-only);
    • counts the full starter pack it imports (17 content types, not the 13 the entries use) and says existing types with those uids are replaced;
    • splits components, navigation entries and pages (30 / 53 / 6, not "83 components");
    • shows the app's base site on its own.
  • Connector warning: if the picker is forced onto a connector that reads only products (0.1.0), gate 2 warns that its carousels render empty.
  • Partial failures are no longer ok:
    • seed and publish exit 3 on per-item errors; they're recorded as warn and named in the final summary;
    • content-type import errors are always printed;
    • publish ends with a totals line and publishes in CS_MASTER_LOCALE.
  • Delivery check on a fresh stack: with no CS_DELIVERY_TOKEN (always the case on a fresh stack), cda_read.py exits 5 and says what to do. The manifest note and the summary repeat it.
  • Secrets: sap_app.py passes the stack API key to node through the environment, not argv, where it would be visible in ps. The preflight's manifest note keeps only the check results.
  • SKILL.md:
    • required vs optional env vars;
    • curl -k only with OCC_INSECURE_TLS=1;
    • --locales / --run-dir in the dry run too;
    • run the ~45-minute write in the background and never start a second one;
    • the delivery check on a fresh stack;
    • warn statuses;
    • ask the user to check the picker when there's no browser.

Re-test of the second commit (on the agent-flow stack, picker on):

  • Gate 2 shows the stack name, 17 types, 30/53/6, and the connector warning.
  • Stages:
    • preflight pass;
    • the existing app install was only checked (key via env);
    • seed 0 errors;
    • "161 assets and 90 entries published … 0 errors";
    • round-trip pass;
    • the delivery check reports the no-token note.
  • Plan: a dry run after the change confirms the carousels plan only sap_products.
  • Checks: validate.mjs passes and all scripts compile.

Third commit: the picker follows the installed connector

--carousel-field auto now chooses the picker only when the SAP_APP_* settings are exported and the installed connector reads sap_products. Otherwise the carousels keep the plain products list, and gate 2 says why.

  • npm 0.1.0 reads only products, so the import seeds products.
  • A connector from the repo's main branch (a build, a file: tarball, an npm link, or a checkout via CONNECTOR_STARTER_PACK) reads sap_products, so the import seeds the picker.

The version can't tell them apart (both say 0.1.0), so the orchestrator checks the connector's code.

Dry-run results:

Connector Picker settings Result
npm 0.1.0 exported products, "SAP product picker not set up: the installed connector (0.1.0) reads only products"
built from main exported sap_products, preflight 17/17
checkout via CONNECTOR_STARTER_PACK exported sap_products, 14/14
npm 0.1.0, forced --carousel-field sap_products exported sap_products, with the empty-carousel warning
any none products

Not covered: the seed's speed. A picker re-run on an existing stack took about 95 minutes, at about one Management API call per second. Worth its own change.

🤖 Generated with Claude Code

…sites, picker preflight

The SAP Commerce Cloud app picker already turned on from the SAP_APP_* configuration for
any site; this makes the powertools (B2B) case explicit and safe, from a run that set it
up end to end on a fresh powertools-spa stack.

- New marketplace-app/sap_preflight.py, run at gate 2 when carousels go into sap_products:
  checks the picker's SAP server with TLS verified (trusted certificate, base site present,
  product search returns products without a login, carousel codes found). The dry run
  prints it; a write stops with exit code 4 before the app is installed or anything is
  written. Each failure names its fix (e.g. a full powertoolsIndex for an empty search).
- references/sap-commerce-app.md: which base site per demo (electronics, powertools-spa),
  same-catalog rule, the preflight table.
- localize.py: retry a failed entry update once (transient 422 seen on global_slots) and
  exit 3 when something still failed; the orchestrator records that locale as warn and
  names it in the final banner instead of marking it ok.
- orchestrate.py: --carousel-field help no longer says auto means electronics-spa.
- SKILL.md, pipeline.md, docs page: powertools picker inputs, exit code 4, an example.
- evals/routing-dx-sap-spartacus-import-3: a powertools picker prompt loads the skill.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vaishnavi-kedar-cstk
vaishnavi-kedar-cstk requested review from a team as code owners November 19, 2026 10:59
@snyk-io

snyk-io Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@github-actions

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 0 25 ✅ Passed
🟡 Medium Severity 0 0 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

✅ BUILD PASSED - All security checks passed

…tial errors, key handling

An agent following SKILL.md imported powertools with the picker into a fresh stack (exit 0,
44 min, all stages ok) and listed where the skill was unclear or didn't match the scripts.

- Gate 2 names the target stack and says whether it's empty (new cs-seed/stack_info.py,
  read-only), counts the full starter pack it imports (17 types, not the 13 the entries use),
  and splits components / navigation / pages. The app line shows the base site on its own.
- Gate 2 warns when the installed connector reads only `products` (connector 0.1.0): picker
  carousels render empty until the connector release that reads sap_products.
- Seed and publish exit 3 on per-item errors (recorded as warn, named in the final summary)
  instead of reporting ok; content-type import errors are always printed. Publish ends with a
  totals line and publishes in CS_MASTER_LOCALE instead of a hard-coded en-us.
- cda_read: with no CS_DELIVERY_TOKEN (always on a fresh stack) it exits 5 with what to do;
  the manifest note and the final summary say so.
- sap_app.py passes the stack API key to node through the environment, not argv (ps).
- The picker-preflight manifest note keeps only the check results, not the server URL.
- SKILL.md: required vs optional env vars, `curl -k` only with OCC_INSECURE_TLS=1, --locales
  and --run-dir in the dry run too, run the ~45-minute write in the background, the delivery
  check on a fresh stack, warn statuses, and asking the user to check the picker when there's
  no browser. References: use_products --starter-pack, warn and exit-5 notes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 0 25 ✅ Passed
🟡 Medium Severity 0 0 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

✅ BUILD PASSED - All security checks passed

…led connector renders it

--carousel-field auto now picks sap_products only when the SAP_APP_* settings are exported
AND the installed connector reads sap_products; otherwise carousels keep the plain
`products` list and gate 2 says why ("SAP product picker not set up: the installed
connector (0.1.0) reads only `products`").

The version can't decide it: a build of the connector repo's main branch also says 0.1.0.
So the orchestrator checks the connector's code: the installed bundle (node_modules, a
`file:` tarball or an npm link), else a connector checkout's dist/ build or src/ (specs
excluded) when CONNECTOR_STARTER_PACK points into it.

Tested with dry runs: npm 0.1.0 + picker settings -> products with the explanation; a
connector built from main -> sap_products (preflight 17/17); CONNECTOR_STARTER_PACK at a
connector checkout -> sap_products (14/14); npm 0.1.0 + --carousel-field sap_products ->
sap_products with the empty-carousel warning; no picker settings -> products.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 0 25 ✅ Passed
🟡 Medium Severity 0 0 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

✅ BUILD PASSED - All security checks passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant