GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |
GeezerVison is showing github.com — fix(mail-v2): address the three blocking Major findings from the #1124 review by shazia-k · Pull Request #1132 · OpenResilienceInitiative/ORISO-UserService Conversation
Collaborator
Targets Addresses the three findings from the CodeRabbit review on #1124 that block a What changed
Now logs the exception type chain plus the configured SMTP host — operator
Source This is not a restoration of the 24-hour cache that was removed. It is a memo
Two defects in the last-known-good path:
Deserialisation now yields an Why this one is not cosmetic: when the policy read fails, VerificationFull unit suite on this branch, JDK 21: Spotless passes (bound to Reviewer test plan
Not in scopeThe remaining ten Majors are untriaged here by agreement: findings 1, 2, 5, 10, Separately, and not changed here: Also still open and a product decision, not a code fix: 🤖 Generated with Claude Code
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsOrisoEmailDispatcher.send logged the whole SmtpSendException. Its cause chain
is the Jakarta Mail failure, and provider rejection replies routinely embed the
address they rejected ("550 5.1.1 <[email protected]> user unknown"), so every failed
send wrote an advice-seeker address to disk.
NotificationEmailService already refuses to retain these details for exactly
this reason; this call site contradicted that decision, and WelcomeEmailService
still routes through it.
Log the exception type chain and the configured SMTP host instead - operator
configuration, not personal data. Auth failures, TLS failures and timeouts stay
distinguishable. The chain is bounded at five links and tolerates a cyclic
cause, so a deeply wrapped failure cannot flood the log.
Refs CodeRabbit review on #1124 (Major, Security & Privacy).
Co-Authored-By: Claude Opus 5 <[email protected]>
Source 2606d84 replaced the cached tenant read with getRestrictedTenantDataFresh so a logo change reaches mail immediately. That fixed the staleness, but resolve() runs once per recipient: NotificationEmailService.render calls valuesForTenant for every entry in a batch, so a daily digest of N consultants now issues N remote calls to TenantService, plus the platform fallbacks, nearly all for the same tenant. Add a short-lived memo keyed by tenant id, default 10 seconds and configurable via email.branding.cache-ttl-seconds. This is deliberately not the 24-hour cache that was removed: a branding save is still visible in the next mail within seconds, while one batch costs one lookup. Setting the TTL to 0 disables it, and the existing five-argument constructor keeps that behaviour so tests stay deterministic. Null results are memoised too - a tenant-admin invite resolves to "no tenant yet", and repeating that 404 once per recipient helps nobody. Entries are keyed per tenant with a platform sentinel, so no tenant can be served another's brand. Refs CodeRabbit review on #1124 (Major, Performance & Scalability). Co-Authored-By: Claude Opus 5 <[email protected]> Two defects in the last-known-good path, both of which end with a tenant enforcing a policy nobody chose. refreshKnownTenants ran refresh inside a plain forEach. One tenant whose snapshot could not be read aborted the sweep, so every tenant after it was never refreshed and silently kept an aging snapshot. Inside refresh, the upstream-failure branch called deserialize on the persisted snapshot. deserialize throws IllegalStateException on invalid JSON, so that exception escaped the very catch block meant to provide the fallback - and it surfaced as "Cached Case Handover policy is invalid", hiding the real outage. getEffective had the same defect on the read path, where an unreadable snapshot threw instead of falling through to a refresh. Deserialisation now yields an Optional. getEffective refreshes when the stored snapshot is unreadable; refresh rethrows the ORIGINAL upstream failure so the real cause stays visible to callers, and the scheduled sweep isolates and logs each tenant. This matters beyond robustness: when the policy read fails, CaseHandoverService falls back to the legacy reason rows, and on Dev all five of those carry client_consent_required = 0. A silently skipped refresh is therefore a silently weakened consent gate. Adds the two cases the production code actually failed on, per the review. Refs CodeRabbit review on #1124 (Major, Stability & Availability). Co-Authored-By: Claude Opus 5 <[email protected]>
|
There was an error while loading. Please reload this page.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…tate The replica-safety contract fails the build for any main source holding process-local state that the catalogue does not declare, and the ConcurrentHashMap added in d0885ba is exactly that. The gate is right to stop it: an undeclared per-replica cache is how scale-out surprises happen. Declared as bounded/performance, next to the sibling email-template-cache. The decision text records what makes this one different from that cache: it holds mutable tenant branding, so replicas CAN disagree - but only inside the TTL, and a miss re-reads through getRestrictedTenantDataFresh, so no replica serves branding older than email.branding.cache-ttl-seconds. It also records why the TTL is short, so nobody later "optimises" it back towards the 24h cache that 2606d84 removed. Verified: tests/ci/test_replica_safety_contract.py and ReplicaSafetyInventoryContractTest both pass; full unit suite 4440/0/0/0. Co-Authored-By: Claude Opus 5 <[email protected]>
There was an error while loading. Please reload this page.
#1124) * fix(email): wire notification SMTP and effective tenant branding Reuse the installed SMTP transport and existing email layouts for legacy notification producers. Preserve SMTP acceptance semantics, carry tenant branding across async senders, resolve platform assets by actual owner, and retain actively viewed messages as read timeline entries. Implemented and tested by Codex from Frank Gerhardt's requirements. Local validation: 372 selected regression tests, Spotless, and package passed. No deployment or real-mail acceptance claimed. * fix(email): retain tenant branding in scheduled notification batches Carry the owning tenant through existing template metadata for digest and inactivity mail. Render every recipient independently without changing ambient thread context, including mixed-tenant batches. Implemented and tested by Codex from Frank Gerhardt's requirements. Three regression cases failed before the change; 28 targeted tests, Spotless and package now pass locally. Runtime acceptance remains separate. * fix(email): honor dedicated enquiry digest preference Implemented and tested by Codex from Frank Gerhardt’s requirements. NEW_EMAIL_NOTIFICATIONS now combines the master switch with notifyEnquiriesRepeating rather than the initial-enquiry preference. Regression matrix covers both release-toggle modes and independent preference settings. Schedule unchanged. * fix(auth): preserve reset request tenant across async dispatch * fix(email): honor assignment notification preferences Implemented and locally tested by Codex from Frank Gerhardt’s requirements. Modern assignment mail respects the recipient master switch and explicit assignment opt-out; missing or null row retains default-on semantics. Legacy mode remains unchanged. Focused regression matrix covers both gates and defaults; no runtime mail claim. * fix(email): use transactional layout for operational messages Implemented and tested by Codex from Frank Gerhardt’s requirements after actual acceptance-mail receipt exposed an invitation CTA. Routes authored operational content through the existing mitteilung design, retains exact subject and sanitized rich/plain body, and uses the platform CTA. Actual invitation rendering is unchanged. Focused tests reproduced the wrong CTA and verify sanitization and MIME content. * fix(auth): resolve shared password recovery by exact identity tenant * fix(email): isolate recipient failures and inject shared SMTP resolver * fix(email): validate branding URLs and normalize default ports * fix(email): keep SMTP diagnostic links on configured app origin Default the notification base to app.base.url while retaining its explicit override. Send only the diagnostic primary CTA to /admin while keeping footer links at the application base. Four focused tests and Spotless passed; both origin and CTA regressions failed before the fix. Implemented and verified by OpenAI Codex. * test(email): verify reassignment through current SMTP delivery boundary * test: clear registration tenant context between integration tests The testing profile disables HttpTenantFilter, leaving registration fixture tenant state on the JUnit thread. Clear it before setup and before teardown fixture restoration can fail. Verified exact CI predecessor sequence: 7 failures before, 136 passing after; full required integration suite: 908 passing, no skips. Spotless passed. Implemented and verified by OpenAI Codex. * fix: resolve current tenant branding for outgoing mail Use the existing uncached tenant lookup for concrete-tenant mail branding so saved logo additions and removals are reflected without the 24-hour tenant cache delay. Verified regression red before fix; 43 resolver and tenant service/cache tests pass with Spotless. Implemented and tested by OpenAI Codex. * fix: refresh platform mail branding without tenant cache The platform branding getter is used only by the mail resolver. Remove its cache annotation while preserving explicit technical tenant scope zero and the main-subdomain lookup; unrelated tenant caches remain unchanged. Real Spring cache regression fails before and passes after for logo addition/removal, preserving ambient tenant context. 50 resolver, tenant/cache and template supplier tests pass with Spotless. Implemented and verified by OpenAI Codex. * fix: align invitation delivery and preview with modern mail layout * fix: exclude removed agencies from consultant profiles Use the supported ORM collection restriction so profile reloads exclude soft-deleted relations while retaining their audit history. Refs #1125. Regression reproduced before the fix; 38 related database/profile tests pass. * fix: send tenant system notifications through the secret owner Refs #1006 and OpenResilienceInitiative/ORISO-TenantService#240. Authenticate explicitly on the asynchronous path and delegate the three existing system-mail purposes without reading SMTP credentials. Preserve recipient privacy and rendering, reject invalid tenants, sanitize failures and close the technical session. Fifty focused tests pass. * fix: select standard headers in tenant email client * test: pin current contact email JSON binding contract * fix(mail): render readable contact login and wrap long values * fix(handover): preserve department-scoped candidate lookup (#1105) Integrates existing 9da1c03 candidate-scope slice onto mail-v2 without replacing the current email work. Adapted and verified by OpenAI Codex. Focused regression: 59 tests pass; prior behavior produced 11 failures and 1 error. * feat(handover): preserve effective policy and temporary co-access semantics * feat(handover): dispatch takeover outcome mail after commit * feat(handover): adapt named offers and committed takeover mail outcomes * test(handover): publish and guard the complete offer and access contract * fix(handover): retain current owner membership when old co-access expires * fix(handover): preserve policy and history during schema convergence * ci: pin handover contracts to coordinated TenantService provider * ci: assign handover schema preservation to required MariaDB suite * fix(handover): account for bounded scheduler leases and release tenant context * test(handover): cover legacy null grants and strict scheduler inventory * fix(handover): authenticate policy reads and preserve event access type * fix(mail-v2): address the three blocking Major findings from the #1124 review (#1132) * fix(email): keep SMTP rejection replies out of the application log OrisoEmailDispatcher.send logged the whole SmtpSendException. Its cause chain is the Jakarta Mail failure, and provider rejection replies routinely embed the address they rejected ("550 5.1.1 <[email protected]> user unknown"), so every failed send wrote an advice-seeker address to disk. NotificationEmailService already refuses to retain these details for exactly this reason; this call site contradicted that decision, and WelcomeEmailService still routes through it. Log the exception type chain and the configured SMTP host instead - operator configuration, not personal data. Auth failures, TLS failures and timeouts stay distinguishable. The chain is bounded at five links and tolerates a cyclic cause, so a deeply wrapped failure cannot flood the log. Refs CodeRabbit review on #1124 (Major, Security & Privacy). Co-Authored-By: Claude Opus 5 <[email protected]> * perf(email): collapse per-recipient tenant branding lookups Source 2606d84 replaced the cached tenant read with getRestrictedTenantDataFresh so a logo change reaches mail immediately. That fixed the staleness, but resolve() runs once per recipient: NotificationEmailService.render calls valuesForTenant for every entry in a batch, so a daily digest of N consultants now issues N remote calls to TenantService, plus the platform fallbacks, nearly all for the same tenant. Add a short-lived memo keyed by tenant id, default 10 seconds and configurable via email.branding.cache-ttl-seconds. This is deliberately not the 24-hour cache that was removed: a branding save is still visible in the next mail within seconds, while one batch costs one lookup. Setting the TTL to 0 disables it, and the existing five-argument constructor keeps that behaviour so tests stay deterministic. Null results are memoised too - a tenant-admin invite resolves to "no tenant yet", and repeating that 404 once per recipient helps nobody. Entries are keyed per tenant with a platform sentinel, so no tenant can be served another's brand. Refs CodeRabbit review on #1124 (Major, Performance & Scalability). Co-Authored-By: Claude Opus 5 <[email protected]> * fix(handover): isolate Case Handover policy cache failures per tenant Two defects in the last-known-good path, both of which end with a tenant enforcing a policy nobody chose. refreshKnownTenants ran refresh inside a plain forEach. One tenant whose snapshot could not be read aborted the sweep, so every tenant after it was never refreshed and silently kept an aging snapshot. Inside refresh, the upstream-failure branch called deserialize on the persisted snapshot. deserialize throws IllegalStateException on invalid JSON, so that exception escaped the very catch block meant to provide the fallback - and it surfaced as "Cached Case Handover policy is invalid", hiding the real outage. getEffective had the same defect on the read path, where an unreadable snapshot threw instead of falling through to a refresh. Deserialisation now yields an Optional. getEffective refreshes when the stored snapshot is unreadable; refresh rethrows the ORIGINAL upstream failure so the real cause stays visible to callers, and the scheduled sweep isolates and logs each tenant. This matters beyond robustness: when the policy read fails, CaseHandoverService falls back to the legacy reason rows, and on Dev all five of those carry client_consent_required = 0. A silently skipped refresh is therefore a silently weakened consent gate. Adds the two cases the production code actually failed on, per the review. Refs CodeRabbit review on #1124 (Major, Stability & Availability). Co-Authored-By: Claude Opus 5 <[email protected]> * chore(observability): inventory the branding cache as process-local state The replica-safety contract fails the build for any main source holding process-local state that the catalogue does not declare, and the ConcurrentHashMap added in d0885ba is exactly that. The gate is right to stop it: an undeclared per-replica cache is how scale-out surprises happen. Declared as bounded/performance, next to the sibling email-template-cache. The decision text records what makes this one different from that cache: it holds mutable tenant branding, so replicas CAN disagree - but only inside the TTL, and a miss re-reads through getRestrictedTenantDataFresh, so no replica serves branding older than email.branding.cache-ttl-seconds. It also records why the TTL is short, so nobody later "optimises" it back towards the 24h cache that 2606d84 removed. Verified: tests/ci/test_replica_safety_contract.py and ReplicaSafetyInventoryContractTest both pass; full unit suite 4440/0/0/0. Co-Authored-By: Claude Opus 5 <[email protected]> --------- Co-authored-by: Shazia Kausar <[email protected]> Co-authored-by: Claude Opus 5 <[email protected]> --------- Co-authored-by: Frank Gerhardt <[email protected]> Co-authored-by: Shazia Kausar <[email protected]> Co-authored-by: Shazia Kausar <[email protected]> Co-authored-by: Claude Opus 5 <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.