Anonymization app#2368
Conversation
🦋 Changeset detectedLatest commit: cb08651 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub. 9 Skipped Deployments
|
Differences FoundExpandLicense Package <<missing>> saleor-app-anonymizer MIT @types/uuid SummaryExpand
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2368 +/- ##
=======================================
Coverage 38.00% 38.00%
=======================================
Files 1048 1048
Lines 67133 67133
Branches 3578 3578
=======================================
Hits 25515 25515
Misses 41228 41228
Partials 390 390
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR introduces a new Saleor Anonymizer app into the monorepo. The app provides a Dashboard UI to find a customer by email, anonymize all associated orders by scrambling identifying address/email fields, and then delete the customer profile, following the repo’s shared tooling and observability patterns.
Changes:
- Added a new Next.js Pages Router app (
apps/anonymizer) with manifest/register endpoints and a single-page UI flow to anonymize orders by email. - Added GraphQL operations + generated typings to support fetching orders, updating orders, and deleting customers.
- Wired in shared monorepo tooling (TypeScript/ESLint/Vitest), env validation, and observability (Sentry + OTel + structured logging).
Reviewed changes
Copilot reviewed 34 out of 40 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Adds the new app workspace importer and updates lockfile snapshots for new dependencies. |
| apps/anonymizer/vitest.config.ts | Vitest configuration for the anonymizer app (jsdom, setup file, aliases, shuffle). |
| apps/anonymizer/turbo.json | Turbo task env passthrough configuration for deploy. |
| apps/anonymizer/tsconfig.json | TypeScript config extending shared base, with app-specific path aliases. |
| apps/anonymizer/src/setup-tests.ts | Vitest setup entrypoint (currently empty module). |
| apps/anonymizer/src/pages/index.tsx | App entry page rendering the anonymization UI component. |
| apps/anonymizer/src/pages/api/register.ts | Saleor app registration endpoint (APL + allowed URL gating + logging/otel wrappers). |
| apps/anonymizer/src/pages/api/manifest.ts | Saleor app manifest endpoint describing permissions/URLs/version. |
| apps/anonymizer/src/pages/_error.tsx | Custom Next.js error page integrated with Sentry. |
| apps/anonymizer/src/pages/_document.tsx | Custom Next.js document wrapper. |
| apps/anonymizer/src/pages/_app.tsx | App shell: Macaw styling, iframe protection, AppBridge, theme sync, GraphQL provider. |
| apps/anonymizer/src/modules/graphql/graphql-provider.tsx | Provides an urql client once AppBridge state is available. |
| apps/anonymizer/src/modules/anonymize/scramble.ts | Scrambling/anonymization helpers for address and user details. |
| apps/anonymizer/src/modules/anonymize/scramble.test.ts | Unit tests for scrambling helpers. |
| apps/anonymizer/src/modules/anonymize/scramble-orders-by-email.tsx | Main UI and orchestration to fetch orders, update them, and delete the user. |
| apps/anonymizer/src/logger.ts | App logger setup with transports and masking configuration. |
| apps/anonymizer/src/logger-context.ts | Logger context for server-side runtime transport binding. |
| apps/anonymizer/src/instrumentations/sentry-node.ts | Custom Sentry NodeClient wiring (without Sentry’s OTel setup). |
| apps/anonymizer/src/instrumentations/otel-node.ts | OTel registration for Node runtime with Saleor helpers + Vercel OTel. |
| apps/anonymizer/src/instrumentation.ts | Next.js instrumentation entry (conditionally loads OTel/Sentry). |
| apps/anonymizer/src/env.ts | Env validation and runtime env binding for the anonymizer app. |
| apps/anonymizer/sentry.client.config.ts | Client-side Sentry init configuration. |
| apps/anonymizer/saleor-app.ts | SaleorApp instance + APL wiring (currently FileAPL only). |
| apps/anonymizer/README.md | App documentation and local development instructions. |
| apps/anonymizer/package.json | New app package manifest (scripts + deps/devDeps). |
| apps/anonymizer/next.config.ts | Next.js config + Sentry wrapper. |
| apps/anonymizer/next-env.d.ts | Next.js TypeScript env references. |
| apps/anonymizer/lint-staged.config.js | App-level lint-staged configuration extending repo base. |
| apps/anonymizer/graphql/queries/user-by-email.graphql | Query to fetch user + orders by email. |
| apps/anonymizer/graphql/mutations/order-update.graphql | Mutation to update order userEmail + addresses. |
| apps/anonymizer/graphql/mutations/customer-delete.graphql | Mutation to delete a customer. |
| apps/anonymizer/graphql.config.ts | GraphQL Codegen configuration for generating typed documents/types. |
| apps/anonymizer/generated/graphql.ts | Generated GraphQL documents and types for the app. |
| apps/anonymizer/eslint.config.js | ESLint config extending shared rules with app overrides. |
| apps/anonymizer/.prettierignore | Ignores generated outputs and schema from formatting. |
| apps/anonymizer/.env.example | Example env file for local development/deployment. |
| .changeset/anonymizer-app-onboarded.md | Changeset entry announcing addition of the anonymizer app. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
| "@testing-library/dom": "10.4.0", | ||
| "@testing-library/react": "16.2.0", | ||
| "@total-typescript/ts-reset": "0.6.1", | ||
| "@types/node": "catalog:", |
There was a problem hiding this comment.
was causing build issues, fixed once for all apps
| * To read more about storing auth data, read the | ||
| * [APL documentation](https://docs.saleor.io/developer/extending/apps/developing-apps/app-sdk/apl) | ||
| */ | ||
| const apl = new NoopAPL(); |
There was a problem hiding this comment.
for 3.23+ we don't even need to provide register url / token exchange url, but its kept for compatiblity
| } catch (e) { | ||
| const combinedError = e as CombinedError; | ||
|
|
||
| /* | ||
| * Surface GraphQL errors (e.g. missing MANAGE_ORDERS / MANAGE_USERS | ||
| * permission), which Saleor returns alongside `data` rather than as a | ||
| * network error. | ||
| */ | ||
| logger.error("Failed to fetch user and orders", { | ||
| graphQLErrors: combinedError.graphQLErrors?.map((graphQLError) => graphQLError.message), | ||
| networkError: combinedError.networkError?.message, | ||
| }); | ||
| setError(combinedError); | ||
| } finally { |
| return { | ||
| firstName: scrambledFirstName, | ||
| lastName: scrambledLastName, | ||
| phone: scrambledPhone, | ||
| city: address.city, | ||
| postalCode: address.postalCode, | ||
| streetAddress1: scrambledStreetAddress1, | ||
| country: address.country.code as CountryCode, | ||
| countryArea: address.countryArea, | ||
| }; |
| }), | ||
| ).then(() => { | ||
| setOrdersRun((previous) => ({ ...previous, done: previous.done + batch.length })); | ||
| }); |
| }), | ||
| ).then(() => { | ||
| setCustomersRun((previous) => ({ ...previous, done: previous.done + batch.length })); | ||
| }); |
Adds new app - adjusted https://github.com/saleor/anonymization-app
Two features: