Skip to content
This repository was archived by the owner on Mar 23, 2026. It is now read-only.

S3: fix tagging with cross region calls#13834

Merged
bentsku merged 2 commits into
mainfrom
fix-s3-post-tagging-cross-account
Feb 24, 2026
Merged

S3: fix tagging with cross region calls#13834
bentsku merged 2 commits into
mainfrom
fix-s3-post-tagging-cross-account

Conversation

@bentsku

@bentsku bentsku commented Feb 24, 2026

Copy link
Copy Markdown
Contributor

Motivation

Following #13821, we switch S3 tags to be a local attribute instead of a cross account one, which is the right behavior, tagging should be scoped per region, as testing with RGTA showed.

However, our S3 code was not fully ready for this change: when fetching the bucket and the store associated with it, we did not take the region into account, and would we return only a store that had the same account as the bucket. This wasn't an issue before because all attributes were cross-region. Now that tagging is local, this started to become an issue, as if you sent a request from us-east-1, you wouldn't be able to see the tags if the bucket came from eu-west-1 for example.

The fix is in the _get_cross_account_bucket change.

The rest is just refactoring following the RGTA architectural change, to use the new clean Tags API directly 👍

All the _bucket tagging utility functions that were there already had the right behavior and were re-fetching the right store, but we should have the right store from the beginning available in the provider operation 👍

Changes

  • fix _get_cross_account_bucket to return the right regional store with the bucket
  • refactor to remove one line functions

Tests

Related

@bentsku bentsku added this to the 4.14 milestone Feb 24, 2026
@bentsku bentsku self-assigned this Feb 24, 2026
@bentsku bentsku added aws:s3 Amazon Simple Storage Service semver: patch Non-breaking changes which can be included in patch releases docs: skip Pull request does not require documentation changes notes: skip Pull request does not have to be mentioned in the release notes labels Feb 24, 2026
@github-actions

github-actions Bot commented Feb 24, 2026

Copy link
Copy Markdown

S3 Image Test Results (AMD64 / ARM64)

    2 files      2 suites   8m 9s ⏱️
  573 tests   517 ✅  56 💤 0 ❌
1 146 runs  1 034 ✅ 112 💤 0 ❌

Results for commit e38de90.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Feb 24, 2026

Copy link
Copy Markdown

Test Results - Preflight, Unit

23 070 tests  ±0   21 179 ✅ ±0   6m 2s ⏱️ -25s
     1 suites ±0    1 891 💤 ±0 
     1 files   ±0        0 ❌ ±0 

Results for commit e38de90. ± Comparison against base commit aa8af99.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Feb 24, 2026

Copy link
Copy Markdown

Test Results (amd64) - Acceptance

7 tests  ±0   5 ✅ ±0   3m 3s ⏱️ -1s
1 suites ±0   2 💤 ±0 
1 files   ±0   0 ❌ ±0 

Results for commit e38de90. ± Comparison against base commit aa8af99.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Feb 24, 2026

Copy link
Copy Markdown

Test Results (amd64) - Integration, Bootstrap

    5 files      5 suites   1h 37m 23s ⏱️
2 081 tests 1 918 ✅ 163 💤 0 ❌
2 087 runs  1 918 ✅ 169 💤 0 ❌

Results for commit e38de90.

♻️ This comment has been updated with latest results.

@bentsku bentsku marked this pull request as ready for review February 24, 2026 11:36
@github-actions

github-actions Bot commented Feb 24, 2026

Copy link
Copy Markdown

LocalStack Community integration with Pro

    2 files      2 suites   1h 15m 39s ⏱️
2 057 tests 1 890 ✅ 167 💤 0 ❌
2 059 runs  1 890 ✅ 169 💤 0 ❌

Results for commit e38de90.

♻️ This comment has been updated with latest results.

key_id = get_unique_key_id(bucket, object_key, version_id)
self._remove_all_object_tags(store, key_id)
store.tags.delete_all_tags(key_id)
print(f"{tagging=}")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

leftover print here! 👀

@aidehn aidehn Feb 24, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

(also on line 4613, 4615, 3373, 3374)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

oof, good catch 💯

@aidehn aidehn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you for picking this up! (and sorry for introducing the regression in the last PR 😅) - the logic looks a lot cleaner now too without all the tagging methods 👍🏼

Just some comments to remove the remaining print statements! Also, out of curiosity do we know why the integration tests didn't pick this up on the PR merged?

@bentsku

bentsku commented Feb 24, 2026

Copy link
Copy Markdown
Contributor Author

Also, out of curiosity do we know why the integration tests didn't pick this up on the PR merged?

Yes, this wasn't an issue because our regular integration tests do not run tests in non default account/region, so this case only happened when we don't use us-east-1 😅 because pre-signed POST do fallback to us-east-1 I believe.

@bentsku bentsku merged commit bcc9e9d into main Feb 24, 2026
42 checks passed
@bentsku bentsku deleted the fix-s3-post-tagging-cross-account branch February 24, 2026 18:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

aws:s3 Amazon Simple Storage Service docs: skip Pull request does not require documentation changes notes: skip Pull request does not have to be mentioned in the release notes semver: patch Non-breaking changes which can be included in patch releases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants