Conversation
Add PDP pre-render support for Commerce Optimizer --------- Co-authored-by: Stephen <sirugh@users.noreply.github.com>
Add support for PLP pre-rendering
* Render PLPs from category base template and replace only product-list-page block * Revert "Render PLPs from category base template and replace only product-list-page block" This reverts commit 55394bf. * Update product-list-page class name and wrap content in a div
… of the category (#270)
sirugh
commented
Apr 30, 2026
…ssing template gracefully - getCategoryUrl: split slug into segments and run sanitizeName on each (instead of sanitizePath on the whole path) so double-hyphens in any segment are normalized - renderUtils: warn and return empty string instead of throwing when template fetch fails - Updated helix-shared-string mock and tests to cover both changes Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* adds local_fs capability, to debug without aio. bumps timeouts and memory Signed-off-by: Stephen Rugh <rugh@adobe.com> * increasing timeout to 3 hours and commenting out triggers for now Signed-off-by: Stephen Rugh <rugh@adobe.com> * add claude tool to summarize and check errors in activations * batch getUrlKey GraphQL queries in mark-up-clean-up to stay within catalog 100-product limit Passing all published SKUs in a single query fails when the catalog exceeds 100 products (observed at 23,398 SKUs: "Product count exceeds the maximum allowed (100)"). With no query result, every published product appears redundant and risks mass unpublishing. Fix: split SKUs into batches of 50 (reusing createBatches/BATCH_SIZE) and fan out requests in parallel, then merge results before the redundancy check. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * add script to get the state file. add note to runbook about log availability. add watchdog exit script to exit early incase of recurring failures at commerce api (504, etc). * Updates comments on watchdog and ensures we dont exit while publishing batches. * Apply suggestion from @sirugh * Apply suggestions from code review Co-authored-by: Natxo Cabré <natxo.cabre@gmail.com> * missed loglevel env read. * extend get-state-csv to download both check-product-changes and render-all-categories; output to local-data/ - adds render-all-categories prefix alongside check-product-changes - saves files to local-data/{prefix}/ (project-root-anchored via __dirname) - uses path.basename instead of replace to derive local filenames - anchors dotenv to project root so script works from any cwd Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: use CATALOG_BATCH_SIZE=100 for GetUrlKeyQuery batching in mark-up-clean-up Catalog Service GraphQL rejects queries with >100 SKUs ("Product count exceeds the maximum allowed (100)"). The batching added in 4625e42 originally used BATCH_SIZE=50, which was safe, but 22f211d raised BATCH_SIZE to 600 for the AEM Admin rate limit, inadvertently breaking the catalog query batching. Fix: add CATALOG_BATCH_SIZE=100 constant, make createBatches accept an optional size param (defaulting to BATCH_SIZE), and pass CATALOG_BATCH_SIZE explicitly at the GetUrlKeyQuery call site. The AEM unpublish batches keep BATCH_SIZE=600. Limit confirmed against live API: 100 SKUs succeed, 101 fails. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * add comment explaining pLimit reduction from 50 to 20 in enrichProductWithRenderedHash Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Move check-errors and add readme for it * fix tests --------- Signed-off-by: Stephen Rugh <rugh@adobe.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Natxo Cabré <natxo.cabre@gmail.com>
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.
Do not merge. This is a WIP/reference branch.
This PR demonstrates end-to-end PDP and PLP pre-rendering support for both ACO and ACCS sites. It can be used as a reference or basis for adopting pre-rendering in your own project. See commit history and linked PRs for further context.
What's included
PDP pre-rendering — ACO support (#265, USF-3785/3786/3770)
config['adobe-commerce-optimizer']orAC--prefixed CS headers (getSiteType)ACO_CATEGORY_FAMILIESenv varactions/queries.jsPLP pre-rendering (#266, USF-3819/3834)
render-all-categoriesaction + poller to pre-render all PLPs per categoryplp-rendererdirectory: Handlebars templates, rendering, preview, and publish logicplp-renderer/ldJson.js: generatesCollectionPageJSON-LD withBreadcrumbListandItemListPLP_PRODUCTS_PER_PAGEinput (default: 9)PLP block decoration fix (#268, USF-3898)
product-list-pageas root block, content wrapped in adivPLP category product rendering fix (#270, USF-4023)
urlPathfield in the product-listing block so PLPs render the correct category's productsURL sanitization & template error handling
getCategoryUrl(utils.js): sanitizes each URL path segment individually viasanitizeNameso double-hyphens in any segment are normalized correctlyrenderUtils.prepareBaseTemplate: warns and returns empty string instead of throwing when the products template fetch failsrenderUtils.js— shared rendering infrastructureConsolidates logic previously duplicated between PDP and PLP:
loadState/saveState/deleteState: parameterized bydataKeyandfilePrefixso both pollers share the same state I/OprocessPublishedBatch: handles state updates and counters for both PDP and PLP publish flowsvalidateRequiredParams,getHtmlFilePathsanitize: HTML tag allowlist withall,inline, andnomodesgetProductPrice,generatePriceString), image helpers (getPrimaryImage,getImageList),getGTIN,getBrand,findDescriptioncategories.js— category tree modulegetCategorySlugsFromFamilies,getCategoryMapFromFamilies,getCategoryMap,getCategories,buildBreadcrumbsfetch-all-products(ACO PDP) andrender-all-categories(PLP)fetch-all-productsrefactorCONCURRENCY=5,p-limit), capped atMAX_PRODUCTS_PER_CATEGORY=10,000with a warningStability & observability improvements (#271)
Watchdog timer (
check-product-changes/poller.js,render-all-categories/poller.js)Uses
Promise.racebetween locale processing and a watchdog promise (polled every 30s). If no render or AEM batch completes within 5 minutes, the action aborts by callingadminApi.abortProcessing()(skips draining queues) rather than burning the full timeout.Extended timeout & memory (
app.config.yaml,check-product-changes/index.js)check-product-changestimeout extended from 1h → 3h, memory from 512 MB → 4 GB. Mutex TTL is now derived fromACTION_TIMEOUT_MSso the lock auto-expires if the runtime kills the process unexpectedly.AEM Admin API tuning (
aem.js)BATCH_SIZEraised to 600 paths/minute to match the overlay API limit.MAX_PENDING_JOBSreduced 20 → 4 and poll interval increased 5s → 15s to reduce memory backlog at the higher batch size.abortProcessing()added for the watchdog path.mark-up-clean-upbatchingGetUrlKeyGraphQL queries are batched atCATALOG_BATCH_SIZE=100(catalog hard limit). Unpublish batches keepBATCH_SIZE=600.createBatchesnow accepts an optional size parameter.Concurrent render limit (
check-product-changes/poller.js)p-limitconcurrency reduced 50 → 20: at 50 concurrent renders the Commerce API returned 504s, stalling the action and triggering the watchdog.LOCAL_FSmode (localFilesLib.js, all four actions, runners)Set
LOCAL_FS=trueto redirect allaio FilesI/O to./local-data/for running the full pipeline locally without App Builder credentials. Preview/publish still targets the site's configured overlay.Tooling
tools/check-errors.sh: paginatesaio rt activation list, surfaces error activations and prints full logs; wired up as/check-aio-errorsClaude slash commandtools/get-state-csv.js: fetches and saves state CSVs for bothcheck-product-changesandrender-all-categoriestolocal-data/RUNBOOK.md: notes on long-running activations not appearing inaio rt activation listuntil completion;LOCAL_FSusage docs