OSIS-155: do not log the expected headTenant pre-create 404 as an error#166
OSIS-155: do not log the expected headTenant pre-create 404 as an error#166anurag4DSB wants to merge 1 commit into
Conversation
Review by Claude Code |
f234bdb to
0f149e6
Compare
|
Addressed in 0f149e6. The catch now distinguishes the expected pre-create not-found (a NotFoundException, or a VaultServiceException with a 404 status) from genuinely unexpected failures: the expected case logs at DEBUG with no stack trace, while anything else (NPE, network, a Vault 5xx, etc.) still logs at ERROR with its stack trace so it stays diagnosable. The headTenant "404 for any error" contract OSE relies on is unchanged. Added a regression test (testHeadTenantUnexpectedErrorIsLoggedAtError) pinning that an unexpected fault is logged at ERROR with a trace while the caller still receives a 404. |
|
LGTM — the logging change is clean and well-tested. The expectedNotFound discriminator correctly separates the pre-create 404 (NotFoundException and VaultServiceException with 404 status) from genuinely unexpected errors. Both branches are pinned by regression tests. No issues found. |
Intent: why does this change exist?
During tenant activation OSE probes headTenant before the account exists, so the platform answers 404 and OSIS rethrows NotFoundException. The service logged that expected pre-create case at ERROR with a full stack trace, which reads as a fault during normal activation.
System impact: what's affected, including downstream?
Service-layer logging only, inside headTenant. No change to the HTTP response, the 404 contract, or any OSE/Vault interaction.
Preserved behavior: what explicitly stays the same?
headTenant still returns a 404 (NotFoundException) in every error scenario, as OSE requires. Only the spurious ERROR log line is removed.
Intended change: what's different after this PR?
The expected pre-create 404 is no longer logged as an error with a stack trace. A regression test pins that the service emits no ERROR or WARN and no stack trace for that path while still throwing NotFoundException.
Verification: how do we know this worked, or how would we know if it didn't?
Ran the full osis-core test module including the 75% JaCoCo gate: green. The new test fails if anything reintroduces an ERROR or stack-trace log for the expected pre-create 404.