Skip to content

Solution: fix update_job_state/3 in the Quantum.Storage.Test macro - #720

Closed
dajiaohuang wants to merge 1 commit into
quantum-elixir:mainfrom
dajiaohuang:fix/test-storage-update-job-state
Closed

dajiaohuang wants to merge 1 commit into
quantum-elixir:mainfrom
dajiaohuang:fix/test-storage-update-job-state

Conversation

@dajiaohuang

Copy link
Copy Markdown

A storage defined with use Quantum.Storage.Test notified only the job name in update_job_state/3 and returned the new state to the caller. The Quantum.Storage callback returns :ok, and Quantum.JobBroadcaster matches it as such, so activate_job/2 and deactivate_job/2 crashed the job broadcaster with a MatchError for every storage built with the macro.

The module-level implementation in the same file already sends {:update_job_state, {job_name, state}} and returns :ok; the macro now does the same, and the regression test deactivates a job on a storage built with the macro.

Verified on the branch with mix test, mix format --check-formatted, mix credo --strict and mix dialyzer.

A storage defined with `use Quantum.Storage.Test` sent only the job name in
its `update_job_state/3` notification and returned the new state to the
caller. The `Quantum.Storage` callback returns `:ok` and `Quantum.JobBroadcaster`
matches it as such, so activating or deactivating a job crashed the job
broadcaster with a `MatchError` for every storage built with the macro.

Send `{job_name, state}`, as the module-level implementation in the same file
already does, and let the helper return its default `:ok`.

Adds a regression test that deactivates a job on a storage built with the macro.
@maennchen

Copy link
Copy Markdown
Member

Based on the fact that I got 5 notifications of PRs in as many projects in less than 30 minutes, this looks like AI spam. If I want an AI to fix stuff, I'll ask my own. Closing.

@maennchen maennchen closed this Sep 17, 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.

2 participants