Skip to content

Add per-instance Net::HTTP Semian policy - #1052

Draft
serioushaircut wants to merge 1 commit into
Shopify:mainfrom
serioushaircut:ae-task-1128-add-explicit-per-instance-net-http-semia
Draft

serioushaircut wants to merge 1 commit into
Shopify:mainfrom
serioushaircut:ae-task-1128-add-explicit-per-instance-net-http-semia

Conversation

@serioushaircut

@serioushaircut serioushaircut commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add an explicit per-instance policy to the Net::HTTP adapter so callers can inherit the process-wide configuration, disable Semian, or replace the whole resource with caller-owned options. This lets HTTP client frameworks configure an already-created Net::HTTP object before its first Semian lookup.

Approach

  • Preserve omitted semian: and semian: true as inheritance from Semian::NetHTTP.semian_configuration
  • Treat semian: false as a complete opt-out and a hash as a complete replacement, without merging platform circuit-breaker or bulkhead settings
  • Expose semian_policy= for pre-use framework integration, defensively copy and freeze caller options, allow idempotent repeats, and reject policy changes after assignment or use
  • Synchronize policy assignment with first use so concurrent callers cannot change protection after lookup begins
  • Give disabled instances a stable unprotected resource identity and cache the explicit opt-out path
  • Validate caller-owned names and reject dynamic: true for immutable instance policies
  • Document whole-resource replacement, bulkhead implications, and the constructor limitation for subclasses that perform Semian work during initialization

Validation

  • bundle exec rubocop (134 files, no offenses)
  • Focused policy tests (14 runs, 61 assertions, 1 Linux-only bulkhead test skipped locally)
  • Net::HTTP adapter tests excluding the existing macOS-incompatible SysV bulkhead assertion (41 runs, 150 assertions, 1 Linux-only positive bulkhead test skipped locally)

Co-authored-by: GPT-5.6-sol noreply@openai.com
Orchestrated-by: ae noreply@shopify.com

Allow callers and HTTP client frameworks to opt out of the process-wide
policy or replace it before the first Semian lookup.

Co-authored-by: GPT-5.6-sol <noreply@openai.com>
Orchestrated-by: ae <noreply@shopify.com>
Assisted-By: devx/3865f48a-5615-4606-8a95-0f0ef753aa15
@serioushaircut
serioushaircut force-pushed the ae-task-1128-add-explicit-per-instance-net-http-semia branch from 7a0c0a1 to 6608ae5 Compare September 21, 2026 13:45

This branch has not been deployed

No deployments
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