Skip to content

(PW-3151) Changes in Status trail API#300

Merged
zubri merged 4 commits intomainfrom
PW-3151-Audit-trail-for-a-message-does-not-contain-all-comments-that-were-added-by-rules
Apr 1, 2026
Merged

(PW-3151) Changes in Status trail API#300
zubri merged 4 commits intomainfrom
PW-3151-Audit-trail-for-a-message-does-not-contain-all-comments-that-were-added-by-rules

Conversation

@fernando-prowide
Copy link
Copy Markdown
Contributor

No description provided.

Made `SwiftMessageUtils.md5()` public for checksum computation in custom implementations
@fernando-prowide fernando-prowide requested a review from zubri March 18, 2026 21:46
zubri and others added 2 commits April 1, 2026 12:39
…ent access

The sort_key column managed by @OrderColumn gets corrupted under race conditions
(duplicate/missing values), causing JPA to load incomplete or duplicated status
trail entries. Replacing with @orderby("creationDate ASC") delegates ordering to
SQL and ensures all records are always loaded regardless of sort_key state.

Applied to statusTrail, notes, and revisions fields. Also guards against null
creationDate in SwiftMessageStatusInfo 5-arg constructor.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add secondary sort by id to @orderby on statusTrail, notes, and revisions for deterministic ordering when timestamps collide
- Initialize SwiftMessageNote.creationDate at field declaration to prevent null ordering
- Add null guard to SwiftMessageStatusInfo.setCreationDate() consistent with constructor
- Add SwiftMessageStatusInfoTest covering creationDate null-guard behavior

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@zubri
Copy link
Copy Markdown
Member

zubri commented Apr 1, 2026

Code review

Found 1 issue:

  1. SwiftMessageNote.setCreationDate() accepts null without guard, inconsistent with SwiftMessageStatusInfo

The PR adds null guards to SwiftMessageStatusInfo.setCreationDate() (line 197-200) to prevent null creationDate, since @OrderBy("creationDate ASC, id ASC") relies on it being non-null. However, SwiftMessageNote also uses @OrderBy("creationDate ASC, id ASC") and its setCreationDate() still accepts null without guard — calling setCreationDate(null) would override the field-level default and break ordering.

*/
public void setCreationDate(Calendar creationDate) {
this.creationDate = creationDate;
}

For reference, the guarded version in SwiftMessageStatusInfo:

public SwiftMessageStatusInfo setCreationDate(Calendar creationDate) {
if (creationDate != null) {
this.creationDate = creationDate;
}
return this;
}

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

@zubri zubri merged commit 46acdc8 into main Apr 1, 2026
2 checks passed
@zubri zubri deleted the PW-3151-Audit-trail-for-a-message-does-not-contain-all-comments-that-were-added-by-rules branch April 1, 2026 16:42
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.

2 participants