Skip to content

Conversation

@ArmaanMcleod
Copy link
Contributor

@ArmaanMcleod ArmaanMcleod commented Nov 15, 2025

Pull Request

Description

Added New-CosmosDbTransactionalBatch function for executing atomic transactional batch operations against a collection.

Supports Create, Upsert, Read, Replace, and Delete operations on multiple documents within the same partition key

Related Issues

Fixes #516

Improvements / Enhancements

Testing

  • Added unit and integration tests.

Contributor Mention

cc @PlagueHO


This change is Reviewable

@ArmaanMcleod ArmaanMcleod marked this pull request as ready for review November 15, 2025 11:48
@PlagueHO PlagueHO requested a review from Copilot November 15, 2025 18:57
@PlagueHO PlagueHO self-assigned this Nov 15, 2025
Copilot finished reviewing on behalf of PlagueHO November 15, 2025 19:02
Copy link

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

This pull request adds support for transactional batch operations in Cosmos DB by introducing the New-CosmosDbTransactionalBatch command. This allows multiple operations (Create, Upsert, Read, Replace, Delete) to be executed atomically or non-atomically against documents within the same partition key.

Key Changes:

  • New public function New-CosmosDbTransactionalBatch for executing batch operations
  • New private helper function for setting custom type names on batch operation results
  • Comprehensive unit and integration test coverage using Pester v5 syntax (first Pester v5 tests in the codebase)
  • Custom format file for displaying transactional batch operation results
  • Complete documentation in markdown format

Reviewed Changes

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

Show a summary per file
File Description
source/Public/transactionalbatch/New-CosmosDbTransactionalBatch.ps1 New public function implementing transactional batch operations with support for various operation types and atomic/non-atomic modes
source/Private/transactionalbatch/Set-CosmosDbTransactionalBatchOperationType.ps1 Helper function to set custom type names on batch operation result objects
tests/Unit/CosmosDB.transactionalbatch.Tests.ps1 Comprehensive unit tests covering all function scenarios including error handling
tests/Integration/CosmosDB.integration.Tests.ps1 Integration tests verifying batch operations against actual Cosmos DB service
source/formats/transactionalbatch.formats.ps1xml Custom format definitions for displaying batch operation results in table, wide, and list views
source/en-US/CosmosDB.strings.psd1 Localization string for ShouldProcess message
source/CosmosDB.psd1 Module manifest updates to export new function and include format file
docs/New-CosmosDbTransactionalBatch.md Complete documentation with examples and parameter descriptions
CHANGELOG.md Change log entry documenting the new feature

Copy link

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

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


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

Comment on lines 1 to 5
function New-CosmosDbTransactionalBatch
{
[CmdletBinding(SupportsShouldProcess = $true)]
[OutputType([System.Object[]])]
param (
Copy link

Copilot AI Nov 16, 2025

Choose a reason for hiding this comment

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

Missing comment-based help. Public functions should include comment-based help with at least .SYNOPSIS, .DESCRIPTION, .PARAMETER, .EXAMPLE, .OUTPUTS, and .NOTES sections as per PowerShell guidelines (CodingGuidelineID: 1000003). The private helper function Set-CosmosDbTransactionalBatchOperationType correctly includes comment-based help, but this public-facing cmdlet does not.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably not necessary since this command is in the docs folder

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.

Support Transactional Batch Operations

2 participants