Skip to content

fix: correct the transaction write for put correctly.#175

Merged
snehithv merged 2 commits into
masterfrom
fix/transaction-write-error
Nov 17, 2025
Merged

fix: correct the transaction write for put correctly.#175
snehithv merged 2 commits into
masterfrom
fix/transaction-write-error

Conversation

@snehithv

@snehithv snehithv commented Nov 17, 2025

Copy link
Copy Markdown
Contributor

Description

This PR fixes a bug in the transactWriteItems function where ExpressionAttributeValues was being unconditionally assigned even when empty for Put operations. The fix ensures that DynamoDB EXISTS operations (which don't require attribute values) correctly omit the ExpressionAttributeValues field when it's empty.

Key changes:

Added conditional check to only set ExpressionAttributeValues for Put operations when values exist
Moved buildConditionExpressions to shared expressionBuilder.ts module to eliminate code duplication
Added support for EXISTS operator in buildConditionExpressions to properly handle attribute existence checks
Updated tests to reflect correct behavior (empty ExpressionAttributeValues object or omitted entirely)

Related Issues

Issue: #XXX

How Has This Been Tested

Unit tests

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Screenshots (if appropriate)

N/A

@snehithv

Copy link
Copy Markdown
Contributor Author

@copilot update the PR description

Copilot AI commented Nov 17, 2025

Copy link
Copy Markdown
Contributor

@snehithv I've opened a new pull request, #176, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a bug in the transactWriteItems function where ExpressionAttributeValues was being unconditionally assigned even when empty for Put operations. The fix ensures that DynamoDB EXISTS operations (which don't require attribute values) correctly omit the ExpressionAttributeValues field when it's empty.

Key changes:

  • Added conditional check to only set ExpressionAttributeValues for Put operations when values exist
  • Moved buildConditionExpressions to shared expressionBuilder.ts module to eliminate code duplication
  • Added support for EXISTS operator in buildConditionExpressions to properly handle attribute existence checks
  • Updated tests to reflect correct behavior (empty ExpressionAttributeValues object or omitted entirely)

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/mutation/transactWriteItems.ts Added conditional check to only assign ExpressionAttributeValues when non-empty for Put operations
src/mutation/transactWriteItems.spec.ts Updated test expectations to reflect proper handling of EXISTS conditions (no attribute values needed)
src/mutation/putItem.ts Refactored to use shared buildConditionExpressions from expressionBuilder module
src/mutation/expressionBuilder.ts Added EXISTS operator support to handle attribute_exists and attribute_not_exists without values
package.json Version bump from 0.6.2 to 0.6.3

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@snehithv snehithv merged commit c5d7a80 into master Nov 17, 2025
8 checks passed
@snehithv snehithv deleted the fix/transaction-write-error branch November 17, 2025 02:53
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.

3 participants