Skip to content

Fix/inventory service#618

Merged
jeastham1993 merged 9 commits intomainfrom
fix/inventory-service
Mar 5, 2026
Merged

Fix/inventory service#618
jeastham1993 merged 9 commits intomainfrom
fix/inventory-service

Conversation

@jeastham1993
Copy link
Copy Markdown
Collaborator

What does this PR do?

Motivation

Testing Guidelines

Additional Notes

Types of Changes

  • Bug fix
  • New feature
  • Breaking change
  • Misc (docs, refactoring, dependency upgrade, etc.)

Check all that apply

  • This PR's description is comprehensive
  • This PR contains breaking changes that are documented in the description
  • This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future
  • This PR impacts documentation, and it has been updated (or a ticket has been logged)
  • This PR's changes are covered by the automated tests
  • This PR collects user input/sensitive content into Datadog

@jeastham1993
Copy link
Copy Markdown
Collaborator Author

@codex can you review this please?

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7b8c70499c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

_, _ = tracer.SetDataStreamsCheckpointWithParams(datastreams.ExtractFromBase64Carrier(ctx, &evt), options.CheckpointParams{
ServiceOverride: "productservice-publiceventpublisher",
}, "direction:in", "type:sqs", "topic:"+evt.Type, "manual_checkpoint:true")
}, "direction:in", productcore.InternalPubSubName, "topic:"+evt.Type, "manual_checkpoint:true")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep SQS checkpoint type on SQS-triggered ingress

This handler is invoked from events.SQSEvent and tags spans as messaging.system=aws_sqs, but the new checkpoint now records ingress as type:sns; that misclassifies the transport leg and degrades Data Streams topology/latency attribution for the SNS→SQS path (and makes this consumer inconsistent with other SQS consumers in this repo that still checkpoint type:sqs).

Useful? React with 👍 / 👎.

jeastham1993 and others added 2 commits March 5, 2026 07:47
The mock was storing and returning item references, so mutations from the
parallel stock-check phase (processProductReservation) were immediately
visible in stored state without a successful update() call. This caused the
rollback assertion in reserve_stock_rolls_back_on_partial_write_failure to
fail because productId3's reserved level was non-zero despite update()
always throwing. Returning copies from withProductId() now matches real
database read behaviour.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 29fba2e55f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

SetHeader,
scope.Span.Context,
"sns",
"eventbridge",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep DSM transport type consistent for order event consumers

Changing InjectIncludingDsm to use "eventbridge" here updates only the producer side for orders.* events, but inventory ACL consumers still call setConsumeCheckpoint("sns", ...) in src/inventory-service/inventory-acl/src/main/java/com/inventory/acl/lambda/handleOrderCreatedLambda.java and handleOrderCompletedLambda.java (line 68 in both). For the order→inventory flow this creates mixed transport tags for the same pipeline, which splits/misattributes Data Streams topology and latency attribution; this should be migrated end-to-end in one change.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d097c66b10

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

try {
for (InventoryItem inventoryItem : result.stockAddedFor()) {
reserveStockWithRetry(inventoryItem.getProductId(), orderNumber);
successfullyReserved.add(inventoryItem.getProductId());
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Track only newly reserved items before rollback

The rollback list is populated unconditionally after reserveStockWithRetry, but that method can return after an idempotent no-op when the same orderNumber was already reserved (for example, on an SQS retry of orderCreated). If a later product update fails, the rollback loop calls releaseStockWithRetry for these entries and can remove a reservation that existed before this attempt, leaving inventory under-reserved for an order that was previously successful.

Useful? React with 👍 / 👎.

@jeastham1993 jeastham1993 merged commit 666c9c7 into main Mar 5, 2026
25 of 28 checks passed
@jeastham1993 jeastham1993 deleted the fix/inventory-service branch March 5, 2026 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant