Repository navigation
Auto-apply catalog updates that only add optional query parameters; WooCommerce sync filters - #1631
Merged
Merged
Conversation
…ooCommerce sync filters and setup hints
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
#1619 gave WooCommerce
list_orders/search_productsan optional_fieldsparameter, but it reached only 3 of 109 installed connectors. Adding a key toendpointMapping.queryParamsmade the tool "structural", and the boot-time reconciler skips structural tools entirely, so the 106 older connectors got neither_fieldsnor the per_page advice. One paying shop still pulls ~650 MB of full orders a day, and its bursts are the main app-side cause of event-loop stalls.This PR adds a narrow third case to the safe class and ships the WooCommerce quick wins from the 11-11 analysis.
Changes
catalog-resync.service.ts: new exportedadditiveQueryParams(catalogTool, installedTool). An endpoint change counts as safe only when:queryParamsis identical (method, path, body, headers, timeouts);$arg, never a constant or a template;argis an optional parameter with nodefault;The REST engine drops a
$argquery key when the argument is absent (resolveValue), so a call that does not pass the new argument sends exactly the same request as before. An operator's own edit of the mapping keeps the tool structural and untouched.computeDiffreports such a tool askind: 'safe'withaddedQueryParams, so the UI types do not change.resyncin safe mode writes the catalog mapping only for those tools; the check is re-run on the row read inside the transaction. Responses mappings, role access, enable/disable and useProxy are preserved as before.woocommerce.json:list_ordersgainsmodified_after,modified_beforeanddates_are_gmt, so a recurring sync can ask only for changed orders (one page instead of 40).per_pageon the list tools is bounded to 1-100.unreachableandupstream_error._fieldsandmodified_after.timeoutMson product create, update and batch writes (44 write timeouts in 30 days, p95 22.8 s).New
woocommerce.live.spec.ts(static assertions; live smoke test behindRUN_WOOCOMMERCE_LIVE=1) andcatalog-resync.additive.spec.ts.No response changes: every new parameter is optional and has no default.
Fleet impact (read-only simulation on Cloud data, 11-11)
With this rule, the next boot applies endpoint changes to 109 connectors in 103 workspaces. Each connector gets only its own tools updated, in its own transaction, from the catalog:
_fields(plus the newmodified_*keys from this PR).payment_at,reference,page,limit.show_plan.filter[expenseId].Every other structural diff (4,5xx connectors) stays pending exactly as today.
Type
Testing
In
packages/backend(Prisma client generated in the worktree):npx jest src/adapters/intl/woocommerce src/connectors/catalog-resync: 3 suites, 49 passed, 1 live test skipped.npx eslinton the changed files: clean.From the root:
node scripts/validate-adapters.mjs --warn: no new warning (the WooCommerce parameter-description warnings are older).node scripts/regenerate-catalog.mjs: no diff.node scripts/adapter-count.mjs --check: OK.Full suite and typecheck run in CI.
Checklist
npm test) (targeted locally, full suite in CI)Cloud and self-hosted behave the same. Self-hosters with
CATALOG_AUTOSYNC=falsekeep the old behaviour (nothing auto-applied).Related Issues
Follow-up to #1619. Analysis: daily check 11-11.