From 3563360066a321522712572bbaa5c47b2873cb8d Mon Sep 17 00:00:00 2001 From: aemous Date: Mon, 6 Apr 2026 10:41:04 -0400 Subject: [PATCH 1/2] Progress on checksums warning emission. --- awscli/customizations/s3/subcommands.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/awscli/customizations/s3/subcommands.py b/awscli/customizations/s3/subcommands.py index 473293c6a3c0..0b41424ee60f 100644 --- a/awscli/customizations/s3/subcommands.py +++ b/awscli/customizations/s3/subcommands.py @@ -1144,6 +1144,20 @@ def run(self): '#cliv2-migration-s3-copy-metadata.\n\n', out_file=sys.stderr ) + elif ( + operation_name == 'upload' + and self.parameters.get('checksum_algorithm') is None + ): + uni_print( + '\nAWS CLI v2 UPGRADE WARNING: In AWS CLI v2, TODO. ' + 'This is different from v1 behavior, where TODO. For guidance ' + 'on retaining v1 behavior in AWS CLI v2, or for more ' + 'details, see ' + 'https://docs.aws.amazon.com/cli/latest/userguide/' + 'cliv2-migration-changes.html' + '#cliv2-migration-checksums.\n\n', + out_file=sys.stderr + ) fgen_kwargs = { 'client': self._source_client, 'operation_name': operation_name, From 92300ee48f64a842d7ab589218748a96cd3e5415 Mon Sep 17 00:00:00 2001 From: aemous Date: Mon, 13 Apr 2026 13:55:47 -0400 Subject: [PATCH 2/2] Update wording in the upgrade debug warning output, implement functional tests to verify behavior of this new feature, and add a changelog entry. --- .../enhancement-Migration-87248.json | 5 ++++ awscli/customizations/s3/subcommands.py | 12 ++++++--- tests/functional/s3/test_cp_command.py | 27 +++++++++++++++++++ tests/functional/s3/test_mv_command.py | 27 +++++++++++++++++++ 4 files changed, 67 insertions(+), 4 deletions(-) create mode 100644 .changes/next-release/enhancement-Migration-87248.json diff --git a/.changes/next-release/enhancement-Migration-87248.json b/.changes/next-release/enhancement-Migration-87248.json new file mode 100644 index 000000000000..88099af194ab --- /dev/null +++ b/.changes/next-release/enhancement-Migration-87248.json @@ -0,0 +1,5 @@ +{ + "type": "enhancement", + "category": "Migration", + "description": "Added support to upgrade debug mode for detecting breaking change introduced in AWS CLI v2: in v2, Cyclic Redundancy Check 64 (CRC64NVME) is used by default for ``aws s3`` commands that upload a file to S3, but Cyclic Redundancy Check 32 (CRC32) is used instead in v1. To use upgrade debug mode, specify the ``--v2-debug`` global parameter on a command." +} diff --git a/awscli/customizations/s3/subcommands.py b/awscli/customizations/s3/subcommands.py index 0b41424ee60f..494625a26c12 100644 --- a/awscli/customizations/s3/subcommands.py +++ b/awscli/customizations/s3/subcommands.py @@ -1149,10 +1149,14 @@ def run(self): and self.parameters.get('checksum_algorithm') is None ): uni_print( - '\nAWS CLI v2 UPGRADE WARNING: In AWS CLI v2, TODO. ' - 'This is different from v1 behavior, where TODO. For guidance ' - 'on retaining v1 behavior in AWS CLI v2, or for more ' - 'details, see ' + '\nAWS CLI v2 UPGRADE WARNING: In AWS CLI v2, for ' + '`aws s3` commands that upload a file to an S3 bucket, ' + 'Cyclic Redundancy Check 64 (CRC64NVME) will be used to ' + 'compute object checksums by default and include it in ' + 'the request. This is different from v1 behavior, where ' + 'Cyclic Redundancy Check 32 (CRC32) checksums will ' + 'instead be used. For guidance on retaining v1 behavior ' + 'in AWS CLI v2, or for more details, see ' 'https://docs.aws.amazon.com/cli/latest/userguide/' 'cliv2-migration-changes.html' '#cliv2-migration-checksums.\n\n', diff --git a/tests/functional/s3/test_cp_command.py b/tests/functional/s3/test_cp_command.py index d0243d657bd6..eb7b0c5603cc 100644 --- a/tests/functional/s3/test_cp_command.py +++ b/tests/functional/s3/test_cp_command.py @@ -817,6 +817,33 @@ def test_download_with_checksum_mode_crc32c(self): self.assertEqual(self.operations_called[1][0].name, 'GetObject') self.assertEqual(self.operations_called[1][1]['ChecksumMode'], 'ENABLED') + def test_upload_with_no_checksum_param_v2_debug(self): + full_path = self.files.create_file('foo.txt', 'contents') + cmdline = f'{self.prefix} {full_path} s3://bucket/key.txt --v2-debug' + _, stderr, _ = self.run_cmd(cmdline, expected_rc=0) + self.assertIn( + 'AWS CLI v2 UPGRADE WARNING: In AWS CLI v2, for `aws s3` ' + 'commands that upload a file to an S3 bucket, Cyclic Redundancy ' + 'Check 64 (CRC64NVME) will be used to compute object checksums by ' + 'default and include it in the request.', + stderr + ) + + def test_upload_with_crc32_checksum_v2_debug(self): + full_path = self.files.create_file('foo.txt', 'contents') + cmdline = ( + f'{self.prefix} {full_path} s3://bucket/key.txt ' + f'--checksum-algorithm CRC32 --v2-debug' + ) + _, stderr, _ = self.run_cmd(cmdline, expected_rc=0) + self.assertNotIn( + 'AWS CLI v2 UPGRADE WARNING: In AWS CLI v2, for `aws s3` ' + 'commands that upload a file to an S3 bucket, Cyclic Redundancy ' + 'Check 64 (CRC64NVME) will be used to compute object checksums by ' + 'default and include it in the request.', + stderr + ) + class TestStreamingCPCommand(BaseAWSCommandParamsTest): def test_streaming_upload(self): diff --git a/tests/functional/s3/test_mv_command.py b/tests/functional/s3/test_mv_command.py index b7e6ca71ed63..4e7b6dc5f839 100644 --- a/tests/functional/s3/test_mv_command.py +++ b/tests/functional/s3/test_mv_command.py @@ -165,6 +165,33 @@ def test_download_with_checksum_mode_crc32(self): self.assertEqual(self.operations_called[1][0].name, 'GetObject') self.assertEqual(self.operations_called[1][1]['ChecksumMode'], 'ENABLED') + def test_upload_with_no_checksum_param_v2_debug(self): + full_path = self.files.create_file('foo.txt', 'contents') + cmdline = f'{self.prefix} {full_path} s3://bucket/key.txt --v2-debug' + _, stderr, _ = self.run_cmd(cmdline, expected_rc=0) + self.assertIn( + 'AWS CLI v2 UPGRADE WARNING: In AWS CLI v2, for `aws s3` ' + 'commands that upload a file to an S3 bucket, Cyclic Redundancy ' + 'Check 64 (CRC64NVME) will be used to compute object checksums by ' + 'default and include it in the request.', + stderr + ) + + def test_upload_with_crc32_checksum_v2_debug(self): + full_path = self.files.create_file('foo.txt', 'contents') + cmdline = ( + f'{self.prefix} {full_path} s3://bucket/key.txt ' + f'--checksum-algorithm CRC32 --v2-debug' + ) + _, stderr, _ = self.run_cmd(cmdline, expected_rc=0) + self.assertNotIn( + 'AWS CLI v2 UPGRADE WARNING: In AWS CLI v2, for `aws s3` ' + 'commands that upload a file to an S3 bucket, Cyclic Redundancy ' + 'Check 64 (CRC64NVME) will be used to compute object checksums by ' + 'default and include it in the request.', + stderr + ) + class TestMvCommandWithValidateSameS3Paths(BaseS3TransferCommandTest):