Skip to content

fix(directory): surface BTP error bodies via specifyAPIError#731

Open
maximilianbraun wants to merge 3 commits into
mainfrom
fix/directory-surface-btp-error-bodies
Open

fix(directory): surface BTP error bodies via specifyAPIError#731
maximilianbraun wants to merge 3 commits into
mainfrom
fix/directory-surface-btp-error-bodies

Conversation

@maximilianbraun

Copy link
Copy Markdown
Member

Summary

Test plan

  • go build ./... && go vet ./...
  • go test -race -count=1 ./internal/clients/directory/... ./internal/controller/account/directory/...
  • New DeleteAPI409SurfacesError unit test exercising a GenericOpenAPIError with ApiExceptionResponseObject model.
  • Existing 404 short-circuit and other delete/update tests still pass.

@maximilianbraun maximilianbraun added the release-notes/bugfix Marks PR as bugfix for release note generation label Jun 20, 2026

@maximilianbraun maximilianbraun left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

internal/clients/directory/directory_test.go:880 — Drop the local create409Error; it is a verbatim copy of subaccount_test.go's helper (same unsafe-pointer reflection over GenericOpenAPIError's unexported fields). Move one copy to internal/testutils (or wherever the BTP test helpers live) and import it from both packages — duplicating a reflect/unsafe trick guarantees one of them rots silently when the SDK regenerates.

@maximilianbraun maximilianbraun marked this pull request as draft June 20, 2026 08:19

@maximilianbraun maximilianbraun left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Helper is appropriately minimal: every parameter has a caller using it, the empty-message branch lets the original code-only call site stay one-liner, and the regeneration-rot warning is the right ceiling note for unsafe-reflection. Subaccount_test.go edit is the deduplication itself, not scope creep. Lean.

maximilianbraun added a commit that referenced this pull request Jun 20, 2026
Reviewer flagged 4 inline reflect+unsafe copies that all set the unexported
`body` field on a *xsuaa.GenericOpenAPIError. Extract to
internal/testutils/openapi_errors_xsuaa.go::NewXsuaaAPIError so each test
site collapses to one line.

Filed under a separate filename from PR #731's openapi_errors.go to avoid
a rebase collision; the two helpers can be unified once both branches land.
@maximilianbraun maximilianbraun marked this pull request as ready for review June 20, 2026 08:46
@maximilianbraun maximilianbraun force-pushed the fix/directory-surface-btp-error-bodies branch from 939efc9 to 51e8cde Compare June 20, 2026 08:51
@jn-av jn-av temporarily deployed to pr-e2e-approval June 23, 2026 15:49 — with GitHub Actions Inactive
@jn-av jn-av temporarily deployed to pr-e2e-no-approval June 23, 2026 15:52 — with GitHub Actions Inactive
@jn-av jn-av temporarily deployed to pr-e2e-no-approval June 23, 2026 15:52 — with GitHub Actions Inactive
@jn-av jn-av temporarily deployed to pr-e2e-no-approval June 23, 2026 15:52 — with GitHub Actions Inactive
@jn-av jn-av temporarily deployed to pr-e2e-no-approval June 23, 2026 15:52 — with GitHub Actions Inactive
@jn-av jn-av had a problem deploying to pr-e2e-no-approval June 23, 2026 15:52 — with GitHub Actions Failure
@jn-av jn-av temporarily deployed to pr-e2e-no-approval June 23, 2026 15:52 — with GitHub Actions Inactive
@jn-av jn-av temporarily deployed to pr-e2e-no-approval June 23, 2026 15:52 — with GitHub Actions Inactive
@jn-av jn-av temporarily deployed to pr-e2e-no-approval June 23, 2026 15:52 — with GitHub Actions Inactive
@jn-av jn-av temporarily deployed to pr-e2e-no-approval June 23, 2026 15:52 — with GitHub Actions Inactive
@jn-av jn-av temporarily deployed to pr-e2e-no-approval June 23, 2026 15:52 — with GitHub Actions Inactive
@jn-av jn-av temporarily deployed to pr-e2e-no-approval June 23, 2026 15:52 — with GitHub Actions Inactive
@jn-av jn-av temporarily deployed to pr-e2e-no-approval June 23, 2026 15:52 — with GitHub Actions Inactive
@jn-av jn-av temporarily deployed to pr-e2e-no-approval June 23, 2026 15:52 — with GitHub Actions Inactive
@jn-av jn-av temporarily deployed to pr-e2e-no-approval June 23, 2026 15:52 — with GitHub Actions Inactive
@jn-av jn-av temporarily deployed to pr-e2e-no-approval June 23, 2026 15:52 — with GitHub Actions Inactive
@jn-av jn-av temporarily deployed to pr-e2e-no-approval June 23, 2026 15:52 — with GitHub Actions Inactive
@jn-av jn-av temporarily deployed to pr-e2e-no-approval June 23, 2026 15:52 — with GitHub Actions Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-notes/bugfix Marks PR as bugfix for release note generation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants