Repository navigation
Documents the handler use's literal options - #134
Merged
Merged
Conversation
StatifierOban.Invoke.Handler's __using__/1 reads its options only when the use argument is a literal keyword list, and reads only :max_attempts from it. A module attribute, a variable or a function call holding the keyword list is ignored whole, and an unknown or misspelled key is ignored, both without an error. The moduledoc's "Capping a handler's attempts" now says so, and two tests pin it: a misspelled key, and a keyword list reached through an attribute or a variable, each compile and store the invoke worker's default max_attempts. No behaviour change; no changelog fragment (documentation and tests, per changelog.d/README.md). Full mix quality green on this tree. Refs: sob-qmb
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.
What
StatifierOban.Invoke.Handler's__using__/1reads its options only when theuseargument is a literal keyword list, and reads only:max_attemptsfrom it. Until now the moduledoc did not say so: a keyword list reached through a module attribute, a variable or a function call is ignored whole, and an unknown or misspelled key is ignored, with no error in either case.This takes the documentation arm of the bead's acceptance ("the moduledoc says literal keyword options only; a test pins the chosen behaviour"):
use; an argument that only holds a keyword list, or is not one, declares no cap;max_attempts: nildeclares no cap; any key other than:max_attemptsis ignored; none of these is an error.test/statifier_oban/invoke/handler_test.exsgains two tests, each compiling a handler withCode.compile_string/1: a misspelled key, and a keyword list reached through a module attribute and through a variable. Each asserts__statifier_oban_max_attempts__/0returnsniland the stored job carries the invoke worker's defaultmax_attempts.No behaviour change and no changelog fragment (documentation and tests are excluded by
changelog.d/README.md).Provenance
The compile-time-error arm of the acceptance was not taken: it would change what an existing host's code compiles to, which this change keeps as it is (ruled by the operator, 2026-09-27: defaults stay the packages'). The paragraph is consistent with ADR-0005's 2026-09-27 Note ("What an explicit
nildoes"), which already records that a non-keyworduseargument andmax_attempts: nilcompile clean and declare no cap.Review (own, in-turn)
I re-read the diff against the bead and checked each claim in the new paragraph against
__using__/1and__max_attempts__!/2inlib/statifier_oban/invoke/handler.ex. The option is read byKeyword.keyword?(opts)on the unexpanded argument, so an attribute, a variable or a call is not a keyword list at that point and yieldsnil.Keyword.get(opts, :max_attempts)reads the one key and nothing else.__max_attempts__!(nil, _)returnsnil, andput_max_attempts/2adds nothing fornil. Two sabotage checks each turned a new test red on an assertion: reading the first value of any keyword list instead of:max_attempts, and evaluating a non-keyword argument in the module body. Both were reverted from a copy, confirmed byte-equal, and recorded in one comment line above each test. Tier: gate. The PR is a moduledoc paragraph and two tests, with no contract surface touched and fewer than 300 lines changed.Gate
Full
mix qualitygreen on the committed tree: format, compile (warnings as errors), doc links, dependencies, credo, docs, tests (305 of 305, 97.1% coverage), dialyzer. Doctor, gettext and sobelow are skipped as not installed.Refs: sob-qmb