Keep front-desk owner records fresh with visible change history - #2
Keep front-desk owner records fresh with visible change history#2ivanmilevtues wants to merge 1 commit into
Conversation
CodeBoarding reviewStatus: 8 changed components See the full change in CodeBoarding. graph LR
n_Owner_and_Pet_Management["Owner and Pet Management"]
n_Veterinarian_Management["Veterinarian Management"]
n_Web_Presentation_and_Localization["Web Presentation and Localization"]
n_Cache_Configuration_and_Diagnostics["Cache Configuration and Diagnostics"]
n_Application_Bootstrap["Application Bootstrap"]
n_Owner_and_Pet_Management -- "invalidates search caches on domain mutations" --> n_Cache_Configuration_and_Diagnostics
n_Veterinarian_Management -- "extends shared base domain entity models" --> n_Owner_and_Pet_Management
n_Application_Bootstrap -- "registers GraalVM native serialization hints an…" --> n_Owner_and_Pet_Management
n_Application_Bootstrap -- "registers native runtime reflection hints and i…" --> n_Veterinarian_Management
n_Application_Bootstrap -- "Registers web configuration and landing page en…" --> n_Web_Presentation_and_Localization
n_Application_Bootstrap -- "configures caching infrastructure and diagnosti…" --> n_Cache_Configuration_and_Diagnostics
n_Veterinarian_Management -- "Binds repository query caching to configured ca…" --> n_Cache_Configuration_and_Diagnostics
n_Web_Presentation_and_Localization -- "Intercepts incoming web requests to apply local…" --> n_Owner_and_Pet_Management
n_Web_Presentation_and_Localization -- "Intercepts incoming web requests to apply local…" --> n_Veterinarian_Management
classDef added fill:#1f883d,stroke:#0b5d23,color:#ffffff;
classDef modified fill:#bf8700,stroke:#7d4e00,color:#ffffff;
classDef deleted fill:#cf222e,stroke:#82071e,color:#ffffff,stroke-dasharray:5 3;
class n_Owner_and_Pet_Management,n_Veterinarian_Management,n_Cache_Configuration_and_Diagnostics modified;
linkStyle 0,1 stroke:#0b5d23,stroke-width:2px;
linkStyle 2,3,5 stroke:#7d4e00,stroke-width:2px;
linkStyle 6,7,8 stroke:#82071e,stroke-width:2px,stroke-dasharray:5 3;
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 865b63873f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
|
|
||
| public void visitBooked(Owner owner, Visit visit) { | ||
| recordChange(owner.getId(), "VISIT_BOOKED", "Visit booked: " + visit.getDescription()); |
There was a problem hiding this comment.
Keep visit summaries within the database column
When a visit description is between 242 and 255 characters, saving the visit succeeds in H2/MySQL because visits.description is VARCHAR(255), but adding the Visit booked: prefix makes this audit value exceed owner_changes.summary VARCHAR(255). The subsequent insert then fails, returning a 500 after the visit has already been committed and leaving no history entry; widen the summary column or truncate/validate the generated summary.
Useful? React with 👍 / 👎.
| * @return a Collection of matching {@link Owner}s (or an empty Collection if none | ||
| * found) | ||
| */ | ||
| @Cacheable("ownerSearch") |
There was a problem hiding this comment.
Prevent stale searches from repopulating after invalidation
When a cache-miss search overlaps an owner mutation, the search can read the pre-mutation data, the mutation can commit and clear ownerSearch, and then the still-running @Cacheable invocation can publish its stale page after that clear. Because this cache has no expiry, subsequent searches can remain stale until another mutation happens; coordinate population with invalidation or configure an expiration strategy.
Useful? React with 👍 / 👎.
| * @return a Collection of matching {@link Owner}s (or an empty Collection if none | ||
| * found) | ||
| */ | ||
| @Cacheable("ownerSearch") |
There was a problem hiding this comment.
Every distinct user-controlled last-name and page combination passed to /owners now creates a permanent cache entry, including empty result pages, while neither the Caffeine configuration nor this JCache configuration sets a maximum size or expiration. Repeated requests with unique search strings can therefore grow ownerSearch without bound until the process exhausts memory or an owner mutation happens to clear the entire cache; configure a capacity/TTL or avoid caching unrestricted search keys.
Useful? React with 👍 / 👎.
|
|
||
| owner.setId(ownerId); | ||
| this.owners.save(owner); | ||
| this.changeTracker.ownerUpdated(owner); |
There was a problem hiding this comment.
Avoid recording no-op edits as owner changes
When staff submit the owner edit form without changing any values, this unconditional call still appends an OWNER_UPDATED entry claiming that contact details changed. The pet edit path behaves the same way, so routine no-op submissions make the newly introduced history inaccurate; compare the persisted values with the submitted values and record an event only when a tracked field actually changes.
Useful? React with 👍 / 👎.
Summary
Motivation
Front-desk staff need confidence that owner searches reflect the latest contact, pet, and appointment changes. This update makes recent changes visible on the owner page while ensuring search and veterinarian data remain current.
Verification