Repository navigation
Add SCAPI backend + get/update to mrt env redirect (W-24145907) - #729
Merged
Merged
Conversation
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.
kieran-sf
reviewed
Oct 1, 2026
Comment on lines
31
to
38
| from: Flags.string({ | ||
| description: 'Source path to redirect from', | ||
| required: true, | ||
| }), | ||
| to: Flags.string({ | ||
| description: 'Destination URL to redirect to', | ||
| required: true, | ||
| }), |
Contributor
There was a problem hiding this comment.
Since the SCAPI api accept source and destination instead of fromPath and toUrl, can we add source and destination as aliases here?
kieran-sf
approved these changes
Oct 2, 2026
Contributor
📘 Docs preview🧹 The preview for this PR has been removed (PR closed). |
This was referenced Oct 2, 2026
vvemireddy-sf
added a commit
that referenced
this pull request
Oct 2, 2026
* 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
added a commit
that referenced
this pull request
Oct 2, 2026
…irect (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)
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Makes the
mrt env redirectcommand family backend-aware between the legacy MRT Cloud API and the SCAPI Storefront Environments API, and adds two new subcommands (get,update) so all six redirect operations — list / create / get / update / delete / clone — are reachable over SCAPI. Each command honors--mrt-backendand, over SCAPI, uses scopessfcc.storefront.environmentsfor reads andsfcc.storefront.environments.rwfor writes. Underauto, SCAPI is used when configured with a safe fallback to legacy; explicit--mrt-backend scapifails loud rather than silently downgrading. This follows the same pattern as the merged access-control SCAPI migration (#722).The two backends identify a redirect differently — legacy keys on the source path (
from_path), SCAPI keys on a redirect ID (UUID) — soget/update/deletetake a neutralidentifierpositional.updateis a partial update (only supplied fields change; the source path cannot be changed) andclonerejects a same-source clone.Work item: W-24145907.
Changes
b2c-tooling-sdk): added the redirect paths/ops and schemas tospecs/storefront-environments-v1.yaml, regeneratedstorefront-environments.generated.ts, exported the new types, and added the 6*Scapioperations + normalizers and the 6 backend-aware*WithBackendwrappers (routing viarunMrtWithFallback). Updatedmrt-command.tsfor the new supported family.b2c-cli): rewrotelist/create/delete/clonebackend-aware; addedget/update(delete gated byassertDestructiveOperationAllowed; clone rejects same-source before touching the backend).--jsonreturns the serving backend's native response verbatim.docs/cli/mrt.md, the b2c-mrt skill (SKILL.md,ENVIRONMENT-COMMANDS.md), regenerated the tooling-index, and added aminor/minorchangeset.Testing
pnpm --filter @salesforce/b2c-tooling-sdk exec mochaontest/operations/mrt/redirect.test.ts— 34 passing (MSW: legacy ops, 6 SCAPI ops incl. the empty-201 clone + errors, and the scapi/legacy/auto-fallback/explicit-fail-loud routing matrix).pnpm --filter @salesforce/b2c-cli exec mochaontest/commands/mrt/env/redirect/*.test.ts— 30 passing (sinon: arg/flag validation, backend-context forwarding,--jsonraw passthrough, non-JSON detail render, partial-update guard, same-source clone rejection, destructive-mode guard).pnpm run lint:agent— clean.typecheck:agent) and CLI test typecheck (tsc --noEmit -p test) — clean; both packagesbuildcleanly.Did not run the full test suite; validation was targeted to the changed SDK operations and CLI commands plus lint/typecheck.
Here are the commands for testing(Below project and target are in zymb_006):
`
1. LIST — baseline
./bin/dev.js mrt env redirect list -p teststorefron-715281 -e teststoref-8094fde3 --mrt-backend legacy --cloud-origin https://cloud-soak.mrt-soak.com
2. CREATE — permanent 301 (default)
./bin/dev.js mrt env redirect create -p teststorefron-715281 -e teststoref-8094fde3 --from "/old-page" --to "/new-page" --mrt-backend legacy --cloud-origin https://cloud-soak.mrt-soak.com
2b. CREATE — temporary 302 with query-string + wildcard forwarding
./bin/dev.js mrt env redirect create -p teststorefron-715281 -e teststoref-8094fde3 --from "/legacy/*" --to "/modern/$1" --status 302 --forward-querystring --forward-wildcard --mrt-backend legacy --cloud-origin https://cloud-soak.mrt-soak.com
3. GET — identify by SOURCE PATH on legacy
./bin/dev.js mrt env redirect get "/old-page" -p teststorefron-715281 -e teststoref-8094fde3 --mrt-backend legacy --cloud-origin https://cloud-soak.mrt-soak.com
4. UPDATE — partial: change only the destination (identify by source path)
./bin/dev.js mrt env redirect update "/old-page" -p teststorefron-715281 -e teststoref-8094fde3 --to "/newest-page" --mrt-backend legacy --cloud-origin https://cloud-soak.mrt-soak.com
4b. UPDATE — change status and disable query-string forwarding (verifies --no- flags)
./bin/dev.js mrt env redirect update "/legacy/*" -p teststorefron-715281 -e teststoref-8094fde3 --status 301 --no-forward-querystring --mrt-backend legacy --cloud-origin https://cloud-soak.mrt-soak.com
5. DELETE — by source path (--force skips the confirm prompt)
./bin/dev.js mrt env redirect delete "/old-page" -p teststorefron-715281 -e teststoref-8094fde3 --force --mrt-backend legacy --cloud-origin https://cloud-soak.mrt-soak.com
Clone needs a second, distinct environment in the same project:
6. CLONE — copies all redirects from --from into --to (must differ)
./bin/dev.js mrt env redirect clone -p teststorefron-715281 --from teststoref-8094fde3 --to teststoref-c3c38423 --force --mrt-backend legacy --cloud-origin https://cloud-soak.mrt-soak.com
6b. CLONE same-source rejection — should error "must differ" before touching the backend
./bin/dev.js mrt env redirect clone -p teststorefron-715281 --from teststoref-8094fde3 --to teststoref-8094fde3 --force --mrt-backend legacy --cloud-origin https://cloud-soak.mrt-soak.com
--mrt-backend legacy --cloud-origin https://cloud-soak.mrt-soak.com
3. GET — identify by SOURCE PATH on legacy
./bin/dev.js mrt env redirect get "/old-page" -p teststorefron-715281 -e teststoref-8094fde3 --mrt-backend legacy --cloud-origin https://cloud-soak.mrt-soak.com
4. UPDATE — partial: change only the destination (identify by source path)
./bin/dev.js mrt env redirect update "/old-page" -p teststorefron-715281 -e teststoref-8094fde3 --to "/newest-page" --mrt-backend legacy --cloud-origin https://cloud-soak.mrt-soak.com
4b. UPDATE — change status and disable query-string forwarding (verifies --no- flags)
./bin/dev.js mrt env redirect update "/legacy/*" -p teststorefron-715281 -e teststoref-8094fde3 --status 301 --no-forward-querystring --mrt-backend legacy --cloud-origin https://cloud-soak.mrt-soak.com
5. DELETE — by source path (--force skips the confirm prompt)
./bin/dev.js mrt env redirect delete "/old-page" -p teststorefron-715281 -e teststoref-8094fde3 --force --mrt-backend legacy --cloud-origin https://cloud-soak.mrt-soak.com
Clone needs a second, distinct environment in the same project:
6. CLONE — copies all redirects from --from into --to (must differ)
./bin/dev.js mrt env redirect clone -p teststorefron-715281 --from teststoref-8094fde3 --to teststoref-c3c38423 --force --mrt-backend legacy --cloud-origin https://cloud-soak.mrt-soak.com
6b. CLONE same-source rejection — should error "must differ" before touching the backend
./bin/dev.js mrt env redirect clone -p teststorefron-715281 --from teststoref-8094fde3 --to teststoref-8094fde3 --force --mrt-backend legacy --cloud-origin https://cloud-soak.mrt-soak.com`