Add ^:synchronized opt-out for parallel namespaces - #52
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds ^:synchronized metadata as a concise opt-out from parallel execution, complementing existing ^:parallel behavior while preserving the precedence rule that test-level metadata overrides namespace-level metadata.
Changes:
- Extend
mb.hawk.parallel/parallel?to treat^:synchronizedas shorthand for^{:parallel false}at both var and namespace scope. - Add test coverage for
:parallel/:synchronizedprecedence combinations. - Document opting out (
^:synchronized) and opting in (^:parallel) behavior in the README.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/mb/hawk/parallel.clj |
Adds :synchronized handling via a helper and updates parallel? docstring. |
test/mb/hawk/parallel_test.clj |
Updates/extends tests to cover synchronized behavior and precedence. |
README.md |
Documents ^:synchronized and clarifies override directions and precedence. |
Suppressed comments (1)
README.md:94
- README grammar: “shouldn't be ran” should be “shouldn't be run”.
Hawk includes `mb.hawk.parallel/assert-test-is-not-parallel`, which you can use to make sure things that shouldn't be ran
in parallel tests are not:
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
|
||
| (defn parallel? | ||
| "Whether `test-var` can be ran in parallel with other parallel tests." | ||
| "Whether `test-var` can be ran in parallel with other parallel tests. |
Comment on lines
80
to
+81
| Metabase test runner. All tests are ran synchronously unless they are given `^:parallel` metadata (either the test | ||
| itself, or the namespace). | ||
| itself, or the namespace). A test in a parallel namespace can explicitly opt out with `^:synchronized`: |
Contributor
Author
|
@coderabbitai review |
camsaul
reviewed
Aug 18, 2026
| (defn- parallel-setting [metadata] | ||
| (if-some [parallel (:parallel metadata)] | ||
| parallel | ||
| (when (:synchronized metadata) |
Member
There was a problem hiding this comment.
Uh what if someone puts ^{:synchronized false}? 😆
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Marking a namespace
^:parallelis a convenient way to opt many tests into concurrency at once. Occasionally one test in that namespace mutates global state or uses another shared resource and must run serially.Hawk already supports that override through
^{:parallel false}on the test, but the map metadata is cumbersome for a common and important escape hatch.^:synchronizedmakes the two execution choices concise and symmetric:^:parallel^:synchronizedWhat changed
^:synchronizedas shorthand for^{:parallel false}on tests and namespaces.This is additive and backward-compatible; existing
:parallelmetadata keeps the same behavior.Verification
clojure -X:dev:test— 35 tests, 180 assertions, 0 failures/errorsclojure -M:kondo --lint src test— 0 errors, 0 warningsFollow-up consumer: metabase/metabase#80064