4d288589fab2ea8c72f0907bbd413f1fb84e04d6
Synchronous @EventListener consumer of PersonDisplayNameChangedEvent. Finds every block whose sidecar references the renamed person via the derived query, replaces "@OldName" with "@NewName" inside block.text, and updates the matching PersonMention.displayName in the sidecar list. saveAll in one batch; SLF4J info log records the audit line. Synchronous on purpose: the rename and the propagation must commit as one transaction so a half-applied rewrite never reaches the archive. If the archive grows past tens of thousands of blocks, switch to @TransactionalEventListener(AFTER_COMMIT) + @Async. Adds PersonService.existsById to give the listener a layered way to verify the personId still corresponds to a real Person — defensive guard for any future async refactor where an event could outlive the entity. The check goes through PersonService rather than PersonRepository to honour the "services never reach into another domain's repository" rule. Happy-path @DataJpaTest + Testcontainers asserts a single-block, single- mention rewrite mutates both the text and the sidecar entry. blockRepository .flush() is called explicitly so saveAll is committed before em.clear() — in production the surrounding @Transactional flushes on commit; in test we substitute by flushing manually. Implements PR-A tasks 13 and 15 as one red→green cycle. Refs #362 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Description
No description provided
Languages
Python
73.3%
TypeScript
11.4%
Java
10.8%
Svelte
4.2%
Shell
0.1%