Build: #2927 was successful Changes by copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Code commits
Openfire (master)
-
copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> ddfc5252b879c76e93c0ed5684e64221cdf47587
fix(pubsub): always update lastPublished when same item is overwritten (XEP-0060 §7.1.2)
Root cause of PubSubExtIntegrationTest failure:
setLastPublishedItem() only updated the in-memory lastPublished cache
when the new item's creation date was *strictly after* the existing one.
When a publisher re-publishes an item with the same ItemID in rapid
succession (within the same millisecond, common in integration tests),
both items share the same CacheFactory.getClusterTime() value.
The after() check returns false, so lastPublished is NOT updated.
The persistence layer correctly performs an SQL UPDATE, but
getPublishedItem() short-circuits by returning the stale in-memory
lastPublished instead of going to the database, causing the test
assertion ("item equals first, not second") to fail.
Fix: add a third update condition — always update when the incoming
item has the same unique identifier (same node + same ItemID) as the
current lastPublished. Overwrites are always reflected in the cache
regardless of timestamp resolution.
Adds 3 regression tests in LeafNodeTest covering same-ID/same-time
overwrite, same-time different-ID non-overwrite, and newer-time
different-ID update.
Co-authored-by: akrherz <210858+akrherz@users.noreply.github.com>- xmppserver/src/main/java/org/jivesoftware/openfire/pubsub/LeafNode.java (version ddfc5252b879c76e93c0ed5684e64221cdf47587)
- xmppserver/src/test/java/org/jivesoftware/openfire/pubsub/LeafNodeTest.java (version ddfc5252b879c76e93c0ed5684e64221cdf47587)