Skip to content

Pins the held-scope, precedence and empty-string arms of processor_scope - #136

Merged
johnnyt merged 1 commit into
mainfrom
sr-pby-processor-scope-arms-tests
Sep 30, 2026
Merged

johnnyt merged 1 commit into
mainfrom
sr-pby-processor-scope-arms-tests

Conversation

@johnnyt

@johnnyt johnnyt commented Sep 30, 2026

Copy link
Copy Markdown
Member

What

Three arms of processor_scope/1 (the scope a send resolves in on the send-processor shape) had no test that went red when they broke. Three tests in test/statifier_router/send_handler_test.exs, describe "the scope a live session names", now pin them:

  • With no :processor_scope configured, the scope the calling process holds (SendHandler.put_delivery_scope/1) is the one the send resolves in.
  • A configured :processor_scope wins over a held scope, both as a static value and as a fun's answer.
  • A fun answering "" is a miss: a send and a delayed send each answer {:error, {:invalid_value, :processor_scope, ""}}, nothing is routed and nothing is queued, even with a held scope in reach.

Tests only: lib/statifier_router/send_handler.ex is unchanged, so no answer changes. No changelog fragment: changelog.d/README.md excludes test changes with no public surface.

Sabotage

Each mutation was applied to processor_scope/1 from a copy of the file, the handler test file was run, and the file was restored byte-equal before the next check:

  • the nil-config clause answered {:ok, nil}: "with no scope configured, the scope the calling process holds applies" failed on its assertion;
  • the static-scope clause answered the held scope ahead of the configured one: "a configured scope wins over the scope the calling process holds" failed on its assertion;
  • the fun clause answered the held scope ahead of the fun's answer: the same test failed on its assertion;
  • the fun clause dropped its empty-string guard: "a fun that answers an empty string is a miss, and nothing is routed or queued" failed on its assertion.

Gate

Full mix quality ran green on this exact tree: format, compile with warnings as errors, isolated tests, doc links, dependencies, Credo, docs, tests (399 of 399, 98.4% coverage) and Dialyzer.

Review

In-turn review: I re-read the diff against the bead's acceptance ("a held delivery scope with no :processor_scope configured is used; a configured :processor_scope wins over a held one; a fun answering "" is a miss; each sabotage-proven") and checked each test against processor_scope/1 and override_scope/0 in send_handler.ex. The nil-config clause and the fun's nil answer read the held scope; a binary answer is used as given; any other answer, "" included, is {:invalid_value, :processor_scope, value}. The existing test for an atom answer already calls that tuple "a miss", so the new test uses the same word. Each test cleans up the held scope with on_exit(&SendHandler.delete_delivery_scope/0), as the existing seam test does. The bead's description said the changelog does not name the invalid-value error. That is stale: the 0.5.0 section's lead paragraph names it, so this PR adds nothing there.

Refs: sr-pby

Three arms of the send-processor shape's scope choice had no test that
went red when they broke: with no :processor_scope configured, the
scope the calling process holds (put_delivery_scope/1) is the one a
send resolves in; a configured :processor_scope, static or a fun's
answer, wins over a held one; and a fun answering "" is a miss,
answered as {:error, {:invalid_value, :processor_scope, ""}} for a send
and a delayed send alike, with nothing routed or queued.

Three tests in "the scope a live session names" pin them, each
sabotage-proven against processor_scope/1 in send_handler.ex (the
mutation is named above each test). Tests only; send_handler.ex is
unchanged. No changelog fragment: changelog.d/README.md excludes test
changes with no public surface. The full gate (mix quality) ran green
on this exact tree.

Refs: sr-pby
@johnnyt
johnnyt merged commit bb292c8 into main Sep 30, 2026
1 check passed
@johnnyt
johnnyt deleted the sr-pby-processor-scope-arms-tests branch September 30, 2026 06:25
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