Skip to content

Re-land SCAPI backend for mrt env access-control (W-24145908) and redirect (W-24145907) - #736

Merged
vvemireddy-sf merged 2 commits into
feature/scapi-mrt-envfrom
reland-scapi-ach-redirects
Oct 2, 2026
Merged

vvemireddy-sf merged 2 commits into
feature/scapi-mrt-envfrom
reland-scapi-ach-redirects

Conversation

@vvemireddy-sf

@vvemireddy-sf vvemireddy-sf commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Re-lands the two SCAPI MRT env features onto the feature/scapi-mrt-env integration branch (they are being reverted from main in the companion revert PR #735). This PR's diff is exactly the ACH + redirect changes.

  • Access control (W-24145908) — SCAPI backend + full CRUD for mrt env access-control (list / create / get / delete), scopes sfcc.storefront.environments[.rw].
  • Redirects (W-24145907) — SCAPI backend + get/update for mrt env redirect, including the --source/--destination aliases on redirect create.

Incorporates #734. The feature branch is based on main after #734 ("Default --mrt-backend to legacy instead of auto"), with both features reverted — so the re-landed features sit on top of the legacy-default behavior and docs. The resulting tree is byte-identical to the current main tip (features + #734); the conflicts in SKILL.md/docs/cli/mrt.md from the default-wording change were resolved to keep #734's legacy default while re-adding the ACH/redirect scope mentions.

Changes

  • mrt env access-control SCAPI backend + CRUD (SDK operations + client, CLI commands, docs, skill reference, tests).
  • mrt env redirect SCAPI backend + get/update, --source/--destination aliases on create (SDK operations, CLI commands, docs, skill reference, tests).

Testing

  • Re-landed tree verified byte-identical to current main (git diff origin/main empty).
  • SDK + CLI build clean; CLI test typecheck clean.
  • mrt env redirect + mrt env access-control CLI suites — 54 passing.
  • SDK mrt-command + test/operations/mrt — 287 passing (incl. Default --mrt-backend to legacy instead of auto #734's legacy-default expectations).

…722)

Expand the `mrt env access-control` command family from list-only to full
CRUD (list/create/get/delete), making each command backend-aware between the
legacy MRT Cloud API and the SCAPI Storefront Environments API.

- SDK: add the 4 access-control-header paths/schemas to the storefront
  environments spec, regenerate the client types, add the 4 *Scapi ops and
  their normalizers, and add backend-aware *WithBackend wrappers (auto
  fallback, fail-loud on explicit scapi).
- CLI: rewrite list backend-aware; add create/get/delete commands.
- Tests: SDK (MSW) + CLI (sinon) covering legacy, SCAPI, and the backend
  routing matrix.
- Docs, tooling-index, and changeset updated.
* Add SCAPI backend + get/update to mrt env redirect (W-24145907)

Make the `mrt env redirect` command family backend-aware between the legacy
MRT Cloud API and the SCAPI Storefront Environments API, and add two new
subcommands (`get`, `update`) so all six redirect operations are reachable
over SCAPI.

- SDK: add the redirect paths/schemas to the storefront environments spec,
  regenerate the client types, export the new types, and add the 6 *Scapi
  operations + normalizers and the 6 backend-aware *WithBackend wrappers
  (auto fallback, fail-loud on explicit scapi). Update mrt-command.ts for the
  new supported family.
- CLI: rewrite list/create/delete/clone backend-aware; add get/update. The
  neutral `identifier` positional maps to the source path on legacy and the
  redirect ID (UUID) on SCAPI. update is a partial update; clone rejects a
  same-source clone.
- Tests: SDK (MSW) + CLI (sinon) covering legacy, SCAPI, and the backend
  routing matrix.
- Docs, tooling-index, and changeset updated.

* docs: add redirect and access-control families to the SCAPI-supported commands list

* Add --source/--destination aliases for redirect create --from/--to (W-24145907)
@vvemireddy-sf
vvemireddy-sf force-pushed the reland-scapi-ach-redirects branch from 7c76658 to 369d161 Compare October 2, 2026 20:03
@vvemireddy-sf
vvemireddy-sf merged commit cb2b210 into feature/scapi-mrt-env Oct 2, 2026
2 checks passed
@vvemireddy-sf
vvemireddy-sf deleted the reland-scapi-ach-redirects branch October 2, 2026 20:12
vvemireddy-sf added a commit that referenced this pull request Oct 8, 2026
…onflicts (W-24461621)

main reverted the SCAPI redirect + access-control work (#735) that this branch
independently re-landed (#736). Resolution keeps the feature branch's re-landed
versions for every file the revert touched (commands, SDK operations, specs,
generated client, tests, docs, skills) — main contributed no other change to
those files. The two re-land changesets (mrt-access-control-scapi,
mrt-redirect-scapi) are restored; changesets consumed by main's release (#728)
stay deleted. data/tooling/index.json was regenerated from the merged tree to
retain main's entries alongside the re-landed MRT content.

Verified: both packages typecheck clean; 388 SDK + 140 CLI MRT tests pass; lint
clean (0 errors).
vvemireddy-sf added a commit that referenced this pull request Oct 13, 2026
* Revert "Add SCAPI backend + get/update to mrt env redirect (W-24145907) (#729)"

This reverts commit 515c206.

* Revert "Add SCAPI backend + full CRUD to mrt env access-control (W-24145908) (#722)"

This reverts commit aa1c66f.

* Re-land SCAPI backend for mrt env access-control (W-24145908) and redirect (W-24145907) (#736)

* Add SCAPI backend + full CRUD to mrt env access-control (W-24145908) (#722)

Expand the `mrt env access-control` command family from list-only to full
CRUD (list/create/get/delete), making each command backend-aware between the
legacy MRT Cloud API and the SCAPI Storefront Environments API.

- SDK: add the 4 access-control-header paths/schemas to the storefront
  environments spec, regenerate the client types, add the 4 *Scapi ops and
  their normalizers, and add backend-aware *WithBackend wrappers (auto
  fallback, fail-loud on explicit scapi).
- CLI: rewrite list backend-aware; add create/get/delete commands.
- Tests: SDK (MSW) + CLI (sinon) covering legacy, SCAPI, and the backend
  routing matrix.
- Docs, tooling-index, and changeset updated.

* Add SCAPI backend + get/update to mrt env redirect (W-24145907) (#729)

* Add SCAPI backend + get/update to mrt env redirect (W-24145907)

Make the `mrt env redirect` command family backend-aware between the legacy
MRT Cloud API and the SCAPI Storefront Environments API, and add two new
subcommands (`get`, `update`) so all six redirect operations are reachable
over SCAPI.

- SDK: add the redirect paths/schemas to the storefront environments spec,
  regenerate the client types, export the new types, and add the 6 *Scapi
  operations + normalizers and the 6 backend-aware *WithBackend wrappers
  (auto fallback, fail-loud on explicit scapi). Update mrt-command.ts for the
  new supported family.
- CLI: rewrite list/create/delete/clone backend-aware; add get/update. The
  neutral `identifier` positional maps to the source path on legacy and the
  redirect ID (UUID) on SCAPI. update is a partial update; clone rejects a
  same-source clone.
- Tests: SDK (MSW) + CLI (sinon) covering legacy, SCAPI, and the backend
  routing matrix.
- Docs, tooling-index, and changeset updated.

* docs: add redirect and access-control families to the SCAPI-supported commands list

* Add --source/--destination aliases for redirect create --from/--to (W-24145907)

* Add SCAPI backend to mrt project (storefronts) commands (W-24145902) (#732)

* Add SCAPI backend to mrt project (storefronts) commands (W-24145902)

Make the `mrt project` family (list/create/get/update/delete) backend-aware
over `--mrt-backend`. A project maps to a SCAPI storefront: the storefront ID
is the project slug and the organization is fixed by --tenant-id.

- New SDK client for the Storefront Storefronts API
  (/storefront/storefronts/v1, scopes sfcc.storefront.storefronts[.rw]).
- Backend-aware project operations in operations/mrt/project.ts: 5 SCAPI
  primitives + 5 *WithBackend wrappers routing legacy <-> SCAPI with safe auto
  fallback and a normalized MrtProjectView.
- 5 CLI commands rewritten backend-aware; backend-specific flag validation
  (legacy create needs --organization; SCAPI create needs >=1 --site, --type
  defaults to storefront_next; SCAPI update cannot rename and --site fully
  replaces the assigned-sites set). SCAPI create/delete return 202 (async).
- mrt project member / notification stay legacy-only and reject
  --mrt-backend scapi.
- Unit + MSW tests for the legacy/SCAPI/routing matrix; docs and changeset.

* Address review feedback on MRT SCAPI backend commands (W-24145902)

- access-control delete: add confirmation prompt + --force/-f flag
- redirect list: keep fromPath/toUrl column aliases; warn when --search
  is combined with the SCAPI backend (gateway does not accept it yet)
- redirect delete --json: emit identifier + backward-compatible fromPath
- redirect clone --json: synthesize {from,to,count} on SCAPI's empty 201

* review changes

* Fix legacy redirect clone crash on empty response body (W-24145902)

* Add SCAPI backend to mrt env lifecycle commands (W-24145903) (#743)

* Add SCAPI backend to mrt env lifecycle commands (W-24145903)

* Address PR #743 review: drop redundant jsonEnabled guard, rename clone flags type

- invalidate.ts: remove the redundant if (!this.jsonEnabled()) guard around
  the success/note log calls; MrtCommand.log() already no-ops under --json.
- env.ts / index.ts: rename interface ScapiCloneEnvironmentFlags ->
  CloneEnvironmentFlagsScapi to match the Scapi-suffix convention for
  functions/types in operations/mrt.

* Address PR #743 review: SCAPI clone --wait, serialized error cause, SCAPI invalidate ack, preserve-proxy-user-agent

- clone: implement --wait on the SCAPI backend via waitForEnvironmentScapi
  (polls building -> ready/build_failed with injectable sleep/now); drop the
  "not supported yet" warning and the legacy-only note on the flag.
- base-command: serializeErrorCause() preserves object/Error causes in the
  --json error envelope instead of stringifying to "[object Object]".
- invalidate: SCAPI returns an empty 202 (raw === null), so emit a stable
  structured ack under --json; legacy response is returned verbatim (unchanged).
- env update: add --preserve-proxy-user-agent (legacy-only), wire SDK updateEnv
  + updateEnvironmentWithBackend, add preserve_proxy_user_agent to the legacy
  MRT spec and regenerate the client.
- Tests updated/added across SDK and CLI.

* Address PR #753 review feedback for SCAPI MRT env (W-24145903)

- redirect list: remap fromPath/toUrl aliases to source/destination before
  selectColumns() instead of duplicate column defs
- env create/clone/update, project create: remove premature command-level
  SCAPI gates; each SDK backend branch validates its own inputs; add shared
  mrtBackendOnlyFlags() mechanism
- mrt-command: declare backend-specific flags per command; one consistent
  check after backend resolution (error on explicit, warn on auto)
- env get: printEnvView carries and prints legacy-only fields
- docs/cli/mrt.md: add mrt env lifecycle commands to SCAPI-supported list,
  add set-primary section, regenerate tooling index; add skill entries
- changesets: trim each to a one-line user benefit; fold redirect ACH
  review-fixes changeset into the redirect/access-control changesets

* Fix legacy project_type test literal to valid ProjectTypeEnum value

The merge of main regenerated the MRT OpenAPI client, tightening
project_type from a loose string to ProjectTypeEnum. The pre-existing
normalizeLegacyProject test used 'sfra', which no longer typechecks
under 'tsc --noEmit -p test' (CI pretest). Use 'SSR' instead.
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.

2 participants