Skip to content

Auto-apply catalog updates that only add optional query parameters; WooCommerce sync filters - #1631

Merged
helpcodeai merged 1 commit into
mainfrom
feat/woo-quickwins-additive
Nov 11, 2026
Merged

helpcodeai merged 1 commit into
mainfrom
feat/woo-quickwins-additive

Conversation

@helpcodeai

Copy link
Copy Markdown
Contributor

Summary

#1619 gave WooCommerce list_orders / search_products an optional _fields parameter, but it reached only 3 of 109 installed connectors. Adding a key to endpointMapping.queryParams made the tool "structural", and the boot-time reconciler skips structural tools entirely, so the 106 older connectors got neither _fields nor 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 exported additiveQueryParams(catalogTool, installedTool). An endpoint change counts as safe only when:

    • everything in the mapping except queryParams is identical (method, path, body, headers, timeouts);
    • every existing query key keeps its exact value, and the catalog only adds keys;
    • each added key maps a plain $arg, never a constant or a template;
    • arg is an optional parameter with no default;
    • the adapter is REST.

    The REST engine drops a $arg query 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. computeDiff reports such a tool as kind: 'safe' with addedQueryParams, so the UI types do not change. resync in 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_orders gains modified_after, modified_before and dates_are_gmt, so a recurring sync can ask only for changed orders (one page instead of 40).
    • per_page on the list tools is bounded to 1-100.
    • Verify hints for 403 (firewall, security plugin, Cloudflare, with the Cloud egress IP), unreachable and upstream_error.
    • Key help: an administrator or shop manager, Read is enough to look.
    • Instructions point to _fields and modified_after.
    • The probe reads one order id (proves order access with a tiny answer).
    • 90 s timeoutMs on 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 behind RUN_WOOCOMMERCE_LIVE=1) and catalog-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:

  • 106 WooCommerce connectors, 212 tools: _fields (plus the new modified_* keys from this PR).
  • easybill: 1 tool gains optional payment_at, reference, page, limit.
  • twelve-data: 1 tool gains optional show_plan.
  • fudo: 1 tool gains optional filter[expenseId].

Every other structural diff (4,5xx connectors) stays pending exactly as today.

Type

  • Bug fix
  • New feature
  • Documentation
  • Refactoring
  • Performance improvement
  • Other (describe below)

Testing

  • Added/updated unit tests
  • Tested manually (describe steps below)
  • No tests needed (explain why)

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 eslint on 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

  • My code follows the existing code style
  • I have tested my changes locally
  • I have updated documentation (if applicable)
  • All existing tests pass (npm test) (targeted locally, full suite in CI)
  • This PR has a descriptive title

Cloud and self-hosted behave the same. Self-hosters with CATALOG_AUTOSYNC=false keep the old behaviour (nothing auto-applied).

Related Issues

Follow-up to #1619. Analysis: daily check 11-11.

@helpcodeai
helpcodeai requested a review from D3nisty as a code owner November 11, 2026 10:18
@helpcodeai
helpcodeai merged commit b0076ab into main Nov 11, 2026
17 checks passed
@helpcodeai
helpcodeai deleted the feat/woo-quickwins-additive branch November 11, 2026 10:33
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant