feat: add path-level prerender deploy support to tokowaka-client#1598
Open
ssilare-adobe wants to merge 4 commits into
Open
feat: add path-level prerender deploy support to tokowaka-client#1598ssilare-adobe wants to merge 4 commits into
ssilare-adobe wants to merge 4 commits into
Conversation
|
This PR will trigger a minor release when merged. |
…stions in rollbackSuggestions
…isDomainWide checks
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.
Context
This is PR 1 of 4 in the end-to-end path-level prerender suggestions feature. It must ship and be consumed by `spacecat-api-service` before path deploy requests can be made.
Feature overview: The prerender audit today generates per-URL and domain-wide suggestions. This feature adds a third tier — path-level suggestions (e.g., `/products/*`) — that group URLs by their first path segment. When a path is deployed, the CDN allow-list is updated with that path pattern (append semantics), and per-URL suggestions under that prefix are marked as covered. See the full design plan for details.
Deployment sequence
What this PR does
Extends
packages/spacecat-shared-tokowaka-clientto handlepathType: truesuggestions in thedeployToEdgeandrollbackSuggestionsmethods.Key changes
deployToEdge— path suggestions use append semantics:data.pathType === trueaspathSuggestions(separate fromdomainWideSuggestionsand per-URLvalidSuggestions)metaconfig.prerender.allowList→ append the new path pattern (deduped viaSet) → write backedgeDeployedtimestamp on the suggestion after successful deploycoveredSuggestionsfor per-URL suggestions whose URL starts with the deployed path prefixrollbackSuggestions— path and domain-wide suggestions use remove-one semantics:pathType: true) and domain-wide (isDomainWide: true) suggestions are classified beforefilterEligibleSuggestions(the prerender mapper'scanDeployrejects them since they have nourlfield)allowedRegexPatterns[0]fromallowList, and writing backallowListis empty after removal, deletes theprerenderkey entirely/*intact when rolling back/products/*)failedSuggestions; other suggestions in the same batch are unaffectedDomain-wide deploy updated (no longer full-replace):
/*into the existingallowListinstead of full-replacing/*from the list via the same remove-one pathConcurrent path deploys (race condition mitigation):
allowListallowListbehaviour summary/*)/products/*)/*into existing list/*, delete key if emptyTest additions (
packages/spacecat-shared-tokowaka-client/test/index.test.js)/products/*whenallowListis empty →['/products/*']/products/*whenallowList: ['/*']→['/*', '/products/*'](domain-wide preserved)allowList/products/*removes only that pattern, leaves/*intactprerenderkey entirely/*into existing list (not full replace)/*coveredSuggestionsreturns matching per-URL suggestions for path deploysprerenderkeyallowListallowedRegexPatternsis missingstatusCode: 500when upload throwsTest plan
npm test -w packages/spacecat-shared-tokowaka-client— all 718 tests pass, 100% line/branch/statement coverage🤖 Generated with Claude Code