Document that an adapter instance represents one resource - #1046
Open
serioushaircut wants to merge 1 commit into
Open
Document that an adapter instance represents one resource#1046serioushaircut wants to merge 1 commit into
serioushaircut wants to merge 1 commit into
Conversation
Author
|
Status nudge rather than a bump: this one is docs-only (README, no behaviour change) and backs the hazard reported in #1045, so it should be cheap to review. Two things that may help whoever picks it up:
🤖 AE · ✅ approved by @serioushaircut |
serioushaircut
force-pushed
the
docs-adapter-shared-object-thread-safety
branch
from
August 31, 2026 08:38
4b3c0ee to
0642d6f
Compare
serioushaircut
force-pushed
the
docs-adapter-shared-object-thread-safety
branch
from
August 31, 2026 08:43
0642d6f to
144e8ed
Compare
Semian::Adapter's contract is that the object it is included in stands for a single resource, and that once that resource is acquired, further access through the same instance is part of the same session: nested calls neither re-enter the circuit breaker nor take a second bulkhead ticket, so a circuit that opens elsewhere cannot interrupt a session that is already in flight and succeeding. Every adapter that ships with the gem has that shape - the mixin goes into a connection object. Nothing said so, and the failure is silent when the requirement is not met: with the instance shared process-wide, calls from other threads are treated as part of whatever session is in flight, so they are not fast-failed when the circuit is open and their failures are not counted. State the contract in Creating Adapters and in Thread Safety, and suggest a per-unit-of-work session object as the adapterized wrapper around a singleton, noting that circuit and bulkhead state is keyed by semian_identifier in a process-wide registry, so short-lived adapter instances still share one circuit. Refs Shopify#1045 Co-authored-by: Claude Opus 5 <noreply@anthropic.com> Orchestrated-by: ae <noreply@shopify.com> Assisted-By: devx/39c7b308-c333-4ffe-8cd7-f642a14a4b7c
serioushaircut
force-pushed
the
docs-adapter-shared-object-thread-safety
branch
from
August 31, 2026 09:12
144e8ed to
aa60a3d
Compare
Edouard-chin
approved these changes
Sep 2, 2026
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.
Documents the contract behind #1045: an adapter instance represents one resource, and
access through the same instance is assumed good until that session ends.
Motivation:
Trust Battery is essentially doing it "wrong" - semian adapter is in a process wide singleton for entirety of core, instead of a "session-y" object, and we run into some weirdness. That spawned this clarification (and I follow up with Trust Battery to fix their use).
Wording follows @matthewd's review. The one genuine race in the same area — the
re-entrancy guard being stranded permanently — is #1047.
Co-authored-by: Claude Opus 5 noreply@anthropic.com
Orchestrated-by: ae noreply@shopify.com