Skip to content

test(server): drop flaky account error-mapping test#26475

Merged
kitlangton merged 1 commit into
devfrom
kit/drop-account-error-mapping-flake
May 9, 2026
Merged

test(server): drop flaky account error-mapping test#26475
kitlangton merged 1 commit into
devfrom
kit/drop-account-error-mapping-flake

Conversation

@kitlangton
Copy link
Copy Markdown
Contributor

Summary

The test used `mock.module("@/account/account", ...)` to inject a failing service. Bun's mock.module applies at module-load time — if any other test file imports `@/account/account` (transitively, via `Server.Default()`) BEFORE this file's mock.module call runs, the mock is silently ignored and both tests fail with "expected 500, received 200".

The flakiness is load-order-dependent and shifts whenever new tests are added elsewhere in the suite. It's been blocking CI on every PR since the test landed.

The behavior under test is two lines: an `Effect.catch` mapping a service failure to `HttpApiError.InternalServerError` and the endpoint's `error: HttpApiError.InternalServerError` declaration. Code review is sufficient; the integration test buys little for the flake cost.

Todo `m0ra36` tracks the proper fix (custom test runtime that provides Account.Service via a layer override, bypassing mock.module entirely) for whenever we want behavioral coverage back.

Test plan

  • CI green (no flaky test = no flake)

The test used \`mock.module(\"@/account/account\", ...)\` to inject a
failing service. Bun's mock.module applies at module-load time — if
any other test file imports \`@/account/account\` (transitively, via
\`Server.Default()\`) BEFORE this file's mock.module call runs, the
mock is silently ignored and both tests fail with \"expected 500,
received 200\".

The flakiness is load-order-dependent and shifts whenever new tests
are added elsewhere in the suite. It's been blocking CI on every PR
since the test landed.

The behavior under test is two lines: an \`Effect.catch\` mapping a
service failure to \`HttpApiError.InternalServerError\` and the
endpoint's \`error: HttpApiError.InternalServerError\` declaration.
Code review is sufficient; the integration test buys little for the
flake cost.

Todo \`m0ra36\` tracks the proper fix (custom test runtime that
provides Account.Service via a layer override, bypassing
mock.module entirely) for whenever we want behavioral coverage back.
@kitlangton kitlangton merged commit e7cc825 into dev May 9, 2026
10 checks passed
@kitlangton kitlangton deleted the kit/drop-account-error-mapping-flake branch May 9, 2026 04:29
katosun2 pushed a commit to katosun2/opencode that referenced this pull request May 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant