Skip to content

POC skipping calculate_taxes#2225

Draft
lkostrowski wants to merge 4 commits intomainfrom
skip-calculate-taxes
Draft

POC skipping calculate_taxes#2225
lkostrowski wants to merge 4 commits intomainfrom
skip-calculate-taxes

Conversation

@lkostrowski
Copy link
Copy Markdown
Member

draft impl for saleor/saleor#18784 on app side

Copilot AI review requested due to automatic review settings February 10, 2026 09:47
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Feb 10, 2026

⚠️ No Changeset found

Latest commit: ef00568

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link
Copy Markdown

vercel bot commented Feb 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
saleor-app-avatax Ready Ready Preview, Comment Feb 10, 2026 9:51am
saleor-app-cms Ready Ready Preview, Comment Feb 10, 2026 9:51am
saleor-app-payment-np-atobarai Ready Ready Preview, Comment Feb 10, 2026 9:51am
saleor-app-payment-stripe Ready Ready Preview, Comment Feb 10, 2026 9:51am
saleor-app-products-feed Ready Ready Preview, Comment Feb 10, 2026 9:51am
saleor-app-search Ready Ready Preview, Comment Feb 10, 2026 9:51am
saleor-app-segment Ready Ready Preview, Comment Feb 10, 2026 9:51am
saleor-app-smtp Ready Ready Preview, Comment Feb 10, 2026 9:51am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
saleor-app-klaviyo Ignored Ignored Preview Feb 10, 2026 9:51am

Request Review

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 10, 2026

Codecov Report

❌ Patch coverage is 0% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 37.08%. Comparing base (f4374b6) to head (ef00568).

Files with missing lines Patch % Lines
...app/api/webhooks/checkout-calculate-taxes/route.ts 0.00% 4 Missing ⚠️
...rc/app/api/webhooks/order-calculate-taxes/route.ts 0.00% 4 Missing ⚠️
...s/webhooks/definitions/checkout-calculate-taxes.ts 0.00% 2 Missing ⚠️
...ules/webhooks/definitions/order-calculate-taxes.ts 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2225      +/-   ##
==========================================
+ Coverage   36.89%   37.08%   +0.18%     
==========================================
  Files         959      905      -54     
  Lines       62209    60332    -1877     
  Branches     3076     2958     -118     
==========================================
- Hits        22953    22372     -581     
+ Misses      38887    37620    -1267     
+ Partials      369      340      -29     
Flag Coverage Δ
avatax 56.49% <0.00%> (-0.02%) ⬇️
cms 16.87% <ø> (ø)
domain 100.00% <ø> (ø)
dynamo-config-repository 79.29% <ø> (ø)
errors 91.66% <ø> (ø)
logger 28.81% <ø> (ø)
np-atobarai 72.68% <ø> (ø)
products-feed 5.65% <ø> (ø)
search 29.78% <ø> (ø)
segment ?
shared 37.35% <ø> (ø)
smtp 36.46% <ø> (ø)
stripe 70.62% <ø> (ø)
webhook-utils 11.02% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Draft app-side updates to support Saleor’s POC for skipping/deferring calculateTaxes delivery, and to adjust SMTP app fallback sender email derivation to be tenant-based rather than fully configured.

Changes:

  • SMTP app: replace fallback sender email env var with a sender domain and derive the sender email from saleorApiUrl.
  • AvaTax app: update CalculateTaxes subscription and webhook handlers to the new calculateTaxes(deferIf: ...) shape.
  • Add tests + changeset entry reflecting the SMTP fallback behavior change.

Reviewed changes

Copilot reviewed 7 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
apps/smtp/turbo.json Updates Turbo env var list to use FALLBACK_SMTP_SENDER_DOMAIN.
apps/smtp/src/modules/smtp/configuration/smtp-config-schema.ts Changes fallback schema from senderEmail to senderDomain.
apps/smtp/src/modules/saleor-fallback-behavior/fallback-sender-email.ts Introduces derived fallback sender email generator from saleorApiUrl.
apps/smtp/src/modules/saleor-fallback-behavior/fallback-sender-email.test.ts Adds unit tests for fallback sender email derivation and error cases.
apps/smtp/src/modules/event-handlers/use-case/send-event-messages.use-case.ts Uses derived fallback sender email when sending via fallback config.
apps/smtp/src/modules/event-handlers/use-case/send-event-messages.use-case.test.ts Updates fallback tests for senderDomain and derived senderEmail; adds invalid-URL test.
apps/smtp/src/env.ts Renames env var to FALLBACK_SMTP_SENDER_DOMAIN.
apps/smtp/.env.example Updates example env var name and layout.
apps/avatax/src/modules/webhooks/definitions/order-calculate-taxes.ts Adjusts webhook payload typing for new calculateTaxes subscription structure.
apps/avatax/src/modules/webhooks/definitions/checkout-calculate-taxes.ts Adjusts webhook payload typing for new calculateTaxes subscription structure.
apps/avatax/src/app/api/webhooks/order-calculate-taxes/route.ts Reads calculateTaxes payload from the updated webhook payload structure.
apps/avatax/src/app/api/webhooks/checkout-calculate-taxes/route.ts Reads calculateTaxes payload from the updated webhook payload structure.
apps/avatax/graphql/subscriptions/CalculateTaxes.graphql Switches from event { ... } to calculateTaxes(deferIf: ADDRESS_MISSING) { ... }.
apps/avatax/graphql/fragments/CalculateTaxesEvent.graphql Updates fragment type condition to CalculateTaxes and includes additional metadata fields.
apps/avatax/graphql.config.ts Adds scalar mappings for Hour and PositiveInt.
.changeset/calm-spoons-judge.md Adds changeset for SMTP fallback sender email behavior change.
Comments suppressed due to low confidence (1)

apps/avatax/src/app/api/webhooks/order-calculate-taxes/route.ts:131

  • SubscriptionPayloadErrorChecker treats GraphQL errors on path event.taxBase.sourceObject.user as handled. With the new subscription root field (calculateTaxes(...)), GraphQL error paths will likely start with calculateTaxes instead of event, so these previously-handled errors may be misclassified and captured as unhandled. Update the checker (or its handled path logic) to account for the new root field name.
        subscriptionErrorChecker.checkPayload(payload);

        loggerContext.set("channelSlug", channelSlug);
        loggerContext.set("orderId", orderId);

Comment on lines 64 to +66
subscriptionErrorChecker.checkPayload(payload);

loggerContext.set(ObservabilityAttributes.CHANNEL_SLUG, ctx.payload.taxBase.channel.slug);
loggerContext.set(ObservabilityAttributes.CHECKOUT_ID, ctx.payload.taxBase.sourceObject.id);
loggerContext.set(ObservabilityAttributes.CHANNEL_SLUG, payload.taxBase.channel.slug);
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SubscriptionPayloadErrorChecker treats GraphQL errors on path event.taxBase.sourceObject.user as handled. With the new subscription root field (calculateTaxes(...)), GraphQL error paths will likely start with calculateTaxes instead of event, so these previously-handled errors may be misclassified and captured as unhandled. Update the checker (or its handled path logic) to account for the new root field name.

Copilot uses AI. Check for mistakes.
Comment on lines 1 to 12
subscription CalculateTaxes {
event {
...CalculateTaxesEvent
calculateTaxes(deferIf: ADDRESS_MISSING) {
taxBase {
...TaxBase
}
recipient {
privateMetadata {
key
value
}
}
}
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The subscription no longer selects __typename/version/issuedAt, but the webhook handlers and SubscriptionPayloadErrorChecker rely on these fields for observability and error reporting. Either add these fields back to the selection set or reuse ...CalculateTaxesEvent so the runtime payload matches the expected CalculateTaxesPayload shape.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants