Skip to content

🐛 fix: don't bump freshness timestamps on position-only reorder#652

Merged
jbourdin merged 1 commit into
developfrom
fix/reorder-no-timestamp-bump
May 30, 2026
Merged

🐛 fix: don't bump freshness timestamps on position-only reorder#652
jbourdin merged 1 commit into
developfrom
fix/reorder-no-timestamp-bump

Conversation

@jbourdin
Copy link
Copy Markdown
Owner

@jbourdin jbourdin commented May 30, 2026

Summary

Reordering archetypes (drag-and-drop) or deck variants only changes the position field, but it re-stamped the entities' update timestamps as if the content had changed. That polluted several "content was updated" signals:

  • the sitemap <lastmod> (via Archetype.updatedAt / Deck.updatedAt),
  • the JSON-LD dateModified,
  • the user-facing "Updated on …" caption in the archetype catalog,
  • the catalog's "sort by updated" order (driven by lastPublishedAt).

Investigation surfaced three stamping paths off the same reorder, not one:

  1. Archetype::onPreUpdate — bumped updatedAt and lastPublishedAt (via PublishableTimestampsTrait).
  2. Deck::onPreUpdate — bumped the deck's own updatedAt.
  3. ArchetypeFreshnessListener — listened on Doctrine postUpdate for Deck and re-stamped the parent archetype's lastPublishedAt on any variant save, reorder included.

Changes

  • New StructuralChangeTrait — single source of truth for display-ordering fields (['position']) plus an isStructuralOnlyChange(PreUpdateEventArgs) helper.
  • Archetype / Deck — their #[ORM\PreUpdate] hooks early-return when position is the only changed field, leaving every timestamp untouched. A change that also touches a real field still bumps as before.
  • ArchetypeFreshnessListener — moved update collection from postUpdate to preUpdate (where the change-set is reliably exposed) and applied the same guard. postPersist (new variant = real activity) and postFlush (bulk writer) are unchanged.
  • Docs — updated features.md (F2.27) and models/deck.md to describe the reorder rule.

Test plan

  • make test — full suite green (new StructuralChangeTest + extended ArchetypeFreshnessListenerTest)
  • In dev: drag-reorder archetypes, confirm updated_at / last_published_at stay put while position moves
  • In dev: drag-reorder variants within an archetype, confirm neither the deck's updated_at nor the archetype's last_published_at change
  • In dev: edit an archetype's (or variant's) content, confirm the timestamps do advance
  • Confirm the catalog "Updated on …" caption and "sort by updated" order are unaffected by a reorder

Reordering archetypes or deck variants only moves `position`, yet it
re-stamped the update timestamps as if the content had changed —
polluting the sitemap <lastmod>, the JSON-LD dateModified, the catalog
"Updated on" caption and the "sort by updated" order.

Add `StructuralChangeTrait` so the `#[ORM\PreUpdate]` hooks on Archetype
and Deck leave `updatedAt` / `lastPublishedAt` untouched when `position`
is the only changed field. Move `ArchetypeFreshnessListener` collection
from postUpdate to preUpdate (where the change-set is reliably exposed)
and apply the same guard, so a variant reorder no longer bumps the
parent archetype's freshness either.
@sentry
Copy link
Copy Markdown

sentry Bot commented May 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@jbourdin jbourdin merged commit a9df8e3 into develop May 30, 2026
6 checks passed
@jbourdin jbourdin deleted the fix/reorder-no-timestamp-bump branch May 30, 2026 20:42
@jbourdin jbourdin mentioned this pull request May 30, 2026
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.

1 participant