Skip to content

fix(spring-config): init postgres or mysql datastore conditionally - #94

Merged
rawo merged 2 commits into
mainfrom
bugfix/issue-90
Jul 30, 2026
Merged

fix(spring-config): init postgres or mysql datastore conditionally#94
rawo merged 2 commits into
mainfrom
bugfix/issue-90

Conversation

@rawo

@rawo rawo commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

#90
Postgres wins when both are on the classpath.

Copilot AI review requested due to automatic review settings July 30, 2026 09:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Not ready to approve

The updated tests/docs have a couple of concrete issues (including an incomplete “DB untouched” assertion and remaining inconsistent documentation elsewhere) that should be corrected before merging.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.

Pull request overview

This PR addresses issue #90 by removing the non-deterministic “winner” behavior when both okapi-postgres and okapi-mysql are on the classpath, and instead making startup fail fast unless the user explicitly provides an @Bean OutboxStore.

Changes:

  • Update OutboxAutoConfiguration to conditionally activate Postgres/MySQL store configs only when the other store module is absent, and add an explicit “ambiguous classpath” configuration that fails startup.
  • Update the dual-module tests to assert the new fail-fast behavior and verify the explicit @Bean OutboxStore escape hatch.
  • Adjust the real-DB E2E test scenario to reflect the new startup-failure invariant when both modules are present.
File summaries
File Description
okapi-spring-boot/src/main/kotlin/com/softwaremill/okapi/springboot/OutboxAutoConfiguration.kt Add conditional exclusion between Postgres/MySQL store configs and introduce fail-fast AmbiguousStoreConfiguration.
okapi-spring-boot/src/test/kotlin/com/softwaremill/okapi/springboot/LiquibaseE2ETest.kt Update E2E test to expect startup failure in dual-module classpath and assert DB remains untouched.
okapi-spring-boot/src/test/kotlin/com/softwaremill/okapi/springboot/LiquibaseAutoConfigurationTest.kt Replace “exactly one wins” dual-module assertion with fail-fast expectation; add escape-hatch test for explicit OutboxStore.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 2
  • Review effort level: Low

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

Copilot AI review requested due to automatic review settings July 30, 2026 10:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Not ready to approve

The PR description says the app should “fail fast when both are on the classpath,” but the implementation instead enforces “Postgres wins,” so the intended contract needs to be clarified and aligned.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.

Review details

Comments suppressed due to low confidence (1)

okapi-spring-boot/src/main/kotlin/com/softwaremill/okapi/springboot/OutboxAutoConfiguration.kt:58

  • PR metadata/description says "Fail fast when both are on the class path", but this implementation instead makes Postgres deterministically win when both okapi-postgres and okapi-mysql are present. That’s a materially different contract (and still allows a silent misconfiguration for MySQL-backed apps that accidentally have both modules). Please clarify the intended behavior and align either the code (add a fail-fast guard when both modules are present and no explicit OutboxStore is provided) or the PR description/documentation accordingly.
 * - [OutboxStore] — auto-configured to [PostgresOutboxStore] or [MysqlOutboxStore]
 *   depending on which module (`okapi-postgres` / `okapi-mysql`) is on the classpath. If *both*
 *   are present, Postgres takes priority — enforced deterministically via `@Order` on
 *   [PostgresStoreConfiguration] / [MysqlStoreConfiguration] (issue #90: this was previously only
 *   documented, not enforced, and MySQL could silently win instead depending on undocumented
 *   nested-`@Configuration` processing order). Override by defining your own `@Bean OutboxStore`.
  • Files reviewed: 3/3 changed files
  • Comments generated: 0 new
  • Review effort level: Low

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

@rawo
rawo merged commit 5a4add9 into main Jul 30, 2026
9 checks passed
@rawo
rawo deleted the bugfix/issue-90 branch July 30, 2026 10:57
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.

2 participants