Skip to content

chore(test): stop the test environment from hiding compiler warnings - #18

Merged
yordis merged 2 commits into
mainfrom
yordis/chore-clear-test-env-warnings
Sep 15, 2026
Merged

yordis merged 2 commits into
mainfrom
yordis/chore-clear-test-env-warnings

Conversation

@yordis

@yordis yordis commented Sep 15, 2026

Copy link
Copy Markdown
Member
  • mix compile --warnings-as-errors only covers the current project in dev, so warnings raised while compiling test files never fail CI. Nine of them had accumulated, and that noise is exactly what hides the next real one.
  • One of those warnings was correct: pagination_metadata/1 had a catch-all clause that nothing could ever reach, since the only call site always passes a keyword list.
  • The rest came from the set-theoretic type checker, which infers dynamic() for bindings that come out of Enum.map or list destructuring, so the struct updates that follow cannot be checked. Matching the struct at the binding restores that.
  • .dialyzer_ignore.exs had been dead since the postgrex bump and was reported as Unnecessary Skips: 2 on every run.
  • test/manual/ held two .exs scripts, so nothing ever compiled them. long_running_subscription.exs had rotted into calling functions that only exist inside EventStore.__using__ and would have raised on its first subscribe. As compiled modules under test/support/ they are covered by the build.

`--warnings-as-errors` never reaches test files, so warnings there
accumulate unchecked and drown out new ones. One of them was pointing at
genuinely unreachable code, and the two manual scripts were `.exs`, so
nothing ever compiled them.

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
@cursor

cursor Bot commented Sep 15, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Mostly test/support refactors and removal of dead Dialyzer ignores; the only lib change deletes an unreachable function clause with no behavior change.

Overview
This PR clears accumulated compiler/type-checker noise so test compilation can surface real warnings again, and tightens a few spots that were contributing to it.

Production code: Drops the unreachable pagination_metadata/1 catch-all in the generated EventStore macro (callers always pass a keyword list). Removes stale Dialyzer skip file and ignore_warnings from mix.exs.

Tests & support: Adds explicit %RecordedEvent{} pattern matches in storage tests and EventFactory.deserialize_events/1 so struct updates type-check cleanly. Moves former test/manual/ scripts into compiled test/support/ modules—EventStore.LongRunningSubscription (fixed to use TestEventStore) and EventStore.MigrationSeed—with shared Event/Snapshot fixtures in migration_fixtures.ex; migration test no longer defines those modules inline.

Reviewed by Cursor Bugbot for commit 6212b8c. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

Warning

Review limit reached

Next included review available in 51 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: f853240b-6a22-49ba-a6e1-a9b38ce0aa08

📥 Commits

Reviewing files that changed from the base of the PR and between 3ba87b8 and 6212b8c.

📒 Files selected for processing (1)
  • test/support/long_running_subscription.ex

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 4304d4db-5c10-484f-b890-10caf297361a

📥 Commits

Reviewing files that changed from the base of the PR and between 95f1c5d and 3ba87b8.

📒 Files selected for processing (11)
  • .dialyzer_ignore.exs
  • lib/event_store.ex
  • mix.exs
  • test/manual/long_running_subscription.exs
  • test/migrated_event_store_test.exs
  • test/storage/append_events_test.exs
  • test/storage/read_events_test.exs
  • test/support/event_factory.ex
  • test/support/long_running_subscription.ex
  • test/support/migration_fixtures.ex
  • test/support/migration_seed.ex
💤 Files with no reviewable changes (5)
  • .dialyzer_ignore.exs
  • test/manual/long_running_subscription.exs
  • lib/event_store.ex
  • test/migrated_event_store_test.exs
  • mix.exs

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


Walkthrough

The changes remove Dialyzer configuration, tighten pagination and test patterns, move migration fixtures into shared support, replace a manual subscription script, and add reusable long-running subscription support.

Changes

EventStore maintenance and test support

Layer / File(s) Summary
Runtime and Dialyzer cleanup
.dialyzer_ignore.exs, mix.exs, lib/event_store.ex
Removes Dialyzer suppressions and configuration. Removes the non-list fallback from pagination_metadata/1.
Migration fixture and seed support
test/support/migration_fixtures.ex, test/support/migration_seed.ex, test/migrated_event_store_test.exs
Moves Event and Snapshot fixtures into shared support. Converts migration seeding into EventStore.MigrationSeed.seed/1, which starts the test store.
Long-running subscription support
test/manual/long_running_subscription.exs, test/support/long_running_subscription.ex
Deletes the standalone manual script and adds reusable subscriber and interval appender support modules.
Stricter storage test shapes
test/support/event_factory.ex, test/storage/read_events_test.exs, test/storage/append_events_test.exs
Restricts event deserialization and test setup to %RecordedEvent{} values. Updates duplicate-event tests to use explicit iteration and pattern matching.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Other

Merge Risk: ⚪ Minimal · up to 3ba87

The changes are mergeable based on the available evidence; no actionable regression remains identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 6 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly explains the compiler-warning changes, the unreachable clause removal, Dialyzer cleanup, and migration of manual scripts into compiled test-support modules.
Title check ✅ Passed The title clearly summarizes the primary change: test compilation now surfaces compiler warnings instead of hiding them.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch yordis/chore-clear-test-env-warnings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit checks each event in line
Dialyzer leaves its notes behind
Fixtures gather, scripts depart
Subscribers tick with steady heart
Recorded shapes now match just right

Comment @coderabbitai help to get the list of available commands.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 3ba87b8. Configure here.

Comment thread test/support/long_running_subscription.ex
The test event store serializes with `Jason`, so the event struct has to
derive the encoder or the first append raises.

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
@yordis
yordis merged commit 549dbe0 into main Sep 15, 2026
6 checks passed
@yordis
yordis deleted the yordis/chore-clear-test-env-warnings branch September 15, 2026 22:31
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