Skip to content

OSIS-155: pin headTenant pre-create 404 to INFO, no stack trace#163

Closed
anurag4DSB wants to merge 3 commits into
improvement/OSIS-163-error-boundary-log-oncefrom
improvement/OSIS-155-headtenant-precreate-404-log
Closed

OSIS-155: pin headTenant pre-create 404 to INFO, no stack trace#163
anurag4DSB wants to merge 3 commits into
improvement/OSIS-163-error-boundary-log-oncefrom
improvement/OSIS-155-headtenant-precreate-404-log

Conversation

@anurag4DSB

@anurag4DSB anurag4DSB commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Intent: why does this change exist?

During tenant activation OSE calls headTenant before the account exists, so the platform answers 404 and OSIS used to log a misleading "invalid account ID" error with a full stack trace even though the create that follows succeeds. The error-boundary work already fixed the behavior; this pins it so it cannot regress.

System impact: what's affected, including downstream?

Test-only change: osis-core adds a regression test; osis-app drops a redundant near-duplicate test. No production code is touched, so no runtime behavior and no downstream OSE or Vault interaction changes.

Preserved behavior: what explicitly stays the same?

headTenant still returns a 404 (NotFoundException) for the pre-create case, and the error boundary still translates and logs every 4xx exactly once at INFO. The activation flow is unchanged.

Intended change: what's different after this PR?

A service-layer regression test (Logback ListAppender) asserting the pre-create 404 is never logged at ERROR or WARN and carries no stack trace. A near-duplicate boundary test was dropped per review, since it exercised the same respond() path as the existing testNotFoundMapsTo404LoggedOnceAtInfoWithoutTrace.

Verification: how do we know this worked, or how would we know if it didn't?

Ran ./gradlew :osis-core:test :osis-app:test jacocoTestCoverageVerification: all tests pass and coverage stays above the 75% gate. The new test would fail if anything reintroduced an ERROR-level or stack-trace log for the expected pre-create 404. The underlying behavior was already fixed by the error-boundary change, so no further production change is needed beyond this regression test.

OSIS-163 already removed the service-layer logger.error that dumped a
full stack on the expected pre-create 404 during tenant activation, and
routed that NotFoundException through the error boundary, which logs 4xx
once at INFO with no trace. This adds regression tests so the misleading
'invalid account ID' stack trace cannot come back.

No production change: a service-layer test asserts the pre-create 404
still returns NotFoundException and is never logged at ERROR/WARN with a
stack trace, and a boundary test pins that the exact headTenant 404 is
logged once at INFO without a trace.
Comment thread osis-app/src/test/java/com/scality/osis/resource/OsisErrorBoundaryTest.java Outdated
@claude

claude Bot commented Jun 25, 2026

Copy link
Copy Markdown
  • osis-app/.../OsisErrorBoundaryTest.java:100-112 — The new boundary test is a near-duplicate of testNotFoundMapsTo404LoggedOnceAtInfoWithoutTrace (line 80): both call the same handleResponseStatus(NotFoundException) path, differing only in the message string. The service-layer test in ScalityOsisServiceTenantTests is the meaningful regression pin; the boundary test adds no additional code-path coverage. Consider removing it or documenting what scenario-specific guard it provides beyond the generic 404 test.
    - osis-core/.../ScalityOsisServiceTenantTests.java:416-444 — Clean, correct test. The ListAppender + try/finally pattern is well-structured and the assertions (no ERROR, no WARN, no stack trace) accurately pin the regression.

    Review by Claude Code

@claude

claude Bot commented Jun 25, 2026

Copy link
Copy Markdown
  • PR body says "Test-only change in osis-core and osis-app" and promises "Two regression tests ... a service-layer test ... and a boundary test", but only one test in one file (osis-core) is included. The boundary test in osis-app that would assert the 404 is logged once at INFO by OsisErrorBoundary is missing from this PR. Consider either adding the boundary test or updating the description to match the actual deliverable.
    - Code in the single test is correct: mock setup, log capture, assertions, and finally-block cleanup all look good.

    Review by Claude Code

@anurag4DSB

Copy link
Copy Markdown
Contributor Author

Addressed in e783151: removed the redundant boundary test. It exercised the same respond() path as testNotFoundMapsTo404LoggedOnceAtInfoWithoutTrace (only the message string differed, and respond() does not branch on it), so it added no code-path coverage. The service-layer test in ScalityOsisServiceTenantTests remains the regression pin.

@claude

claude Bot commented Jun 25, 2026

Copy link
Copy Markdown

LGTM — clean, well-structured regression test.

One nit on the PR description: it says "Two regression tests" but the final diff only adds one (the service-layer test). The boundary test was added in commit 1 then dropped as redundant in commit 2 — the description still references both. Worth a quick edit for posterity since the PR body becomes the merge record.

Review by Claude Code

@anurag4DSB

Copy link
Copy Markdown
Contributor Author

Superseded by #166, which re-creates this change minimally on top of main instead of stacked on the closed refactor chain. Closing this one.

@anurag4DSB anurag4DSB closed this Jun 26, 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