Skip to content

Fix AutoGeneratedTimestampRecordExtension failing on @DynamoDbConvertedBy list attributes - #6854

Merged
alextwoods merged 2 commits into
masterfrom
alexwoo/fix_ddbe_ts_list
Apr 13, 2026
Merged

Fix AutoGeneratedTimestampRecordExtension failing on @DynamoDbConvertedBy list attributes#6854
alextwoods merged 2 commits into
masterfrom
alexwoo/fix_ddbe_ts_list

Conversation

@alextwoods

@alextwoods alextwoods commented Apr 11, 2026

Copy link
Copy Markdown
Contributor

Motivation and Context

Fixes #6852

PR #6546 added nested record support to AutoGeneratedTimestampRecordExtension, which recursively introspects all attributes to find @DynamoDbAutoGeneratedTimestampAttribute fields in nested types. This introspection does not respect @DynamoDbConvertedBy on list attributes — it attempts to resolve a TableSchema for the list element type even when a custom converter already handles serialization.

If the list element class is not annotated with @DynamoDbBean or @DynamoDbImmutable, TableSchema.fromClass() throws IllegalArgumentException. This is a regression for any @DynamoDbBean that has both a @DynamoDbAutoGeneratedTimestampAttribute field and a List<T> field with @DynamoDbConvertedBy where T is not a DynamoDB-annotated class.

Modifications

In NestedRecordUtils.getTableSchemaForListElement(), before calling TableSchema.fromClass() on the list element type, check whether the class has @DynamoDbBean or @DynamoDbImmutable annotations. If neither is present, return null instead of throwing. The callers in AutoGeneratedTimestampRecordExtension already handle null by skipping introspection for that attribute.

Testing

  • Added unit tests in NestedRecordUtilsTest verifying getTableSchemaForListElement returns null for non-annotated element types and that getListElementSchemaCached caches the null result.
  • Added functional tests in AutoGeneratedTimestampExtensionTest verifying beforeWrite succeeds and correctly sets the auto-generated timestamp while leaving @DynamoDbConvertedBy list and map attributes unchanged.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed
  • I have added a changelog entry. Adding a new entry must be accomplished by running the scripts/new-change script and following the instructions. Commit the new file created by the script in .changes/next-release with your changes.
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

@alextwoods alextwoods changed the title Fix AutoGeneratedTimestampRecordExtension failing on @DynamoDbConvert… Fix AutoGeneratedTimestampRecordExtension failing on @DynamoDbConvertedBy list attributes Apr 11, 2026
@alextwoods

alextwoods commented Apr 11, 2026

Copy link
Copy Markdown
Contributor Author

@anasatirbasa - tagging you for review as well as author of #6546 (couldn't add you directly as a reviewer, so just tagging here)

@alextwoods
alextwoods marked this pull request as ready for review April 11, 2026 20:27
@alextwoods
alextwoods requested a review from a team as a code owner April 11, 2026 20:27
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
D Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@alextwoods
alextwoods added this pull request to the merge queue Apr 13, 2026
Merged via the queue into master with commit bce35a4 Apr 13, 2026
40 of 42 checks passed
@github-actions

Copy link
Copy Markdown

This pull request has been closed and the conversation has been locked. Comments on closed PRs are hard for our team to see. If you need more assistance, please open a new issue that references this one.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Apr 13, 2026
@alextwoods
alextwoods deleted the alexwoo/fix_ddbe_ts_list branch July 20, 2026 19:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AutoGeneratedTimestampRecordExtension fails on List fields with @DynamoDbConvertedBy when element type is not a DynamoDB-annotated class

2 participants