CodeSampleX

サンプル

faraday 2.14.3: Handle middleware stack caching and isolation traps when duplicating Faraday connections across requests or tasks

検証済みサンプル — gem faraday 2.14.3: Handle middleware stack caching and isolation traps when duplicating Faraday connections across requests or tasks. ruby 3 …

sha256:ba99fb2bf3dcbb90f9cfeb92673322d9bb85a7bdef5493050f6dd3a779abd62d

このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。 合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。 MIT-0

実行証拠

宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。

証拠の基準
署名済みコントラクト合格
検証レシート
2
ビルドした署名鍵
2
宣言された環境 ruby linux x64 ruby ruby rubygems

検証実行環境

環境 コントラクト ステージ 実行日
ruby 3 · linux debian/x64 · docker ed25519:d91480838ac982c9 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · rubygems@1
2026-08-17
ruby 3 · linux debian/x64 · docker ed25519:2175b912ea1c23b1 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · rubygems@1
2026-08-18

ケース

HOW
ゴール
Handle middleware stack caching and isolation traps when duplicating Faraday connections across requests or tasks
パッケージ
シンボル
  • Faraday::Connection
  • Faraday::Connection#dup
  • Faraday::Connection#use
  • Faraday::Connection#app
  • Faraday::RackBuilder
  • Faraday::RackBuilder#lock!
  • Faraday::RackBuilder#locked?
  • Faraday::RackBuilder::StackLocked
  • Faraday::Middleware
環境
ruby
作成日
2026-08-17T02:39:03Z

コントラクト

  1. Adding middleware to a duplicated Faraday connection after the original connection has executed a request silently ignores the new middleware during request execution because dup preserves the parent connection's pre-compiled rack app instance.
  2. assert modifying the middleware stack of a connection after executing a request raises Faraday::RackBuilder::StackLocked
  3. assert duplicating a connection before any requests are executed successfully compiles and runs newly appended middleware
  4. assert headers mutated on a duplicated connection are isolated from the parent connection whereas mutating headers on a shared connection affects all callers
  5. assert nested middleware request callbacks execute in insertion order while response on_complete hooks unwind in reverse order

ファイル

  • Gemfile
  • Gemfile.lock
  • NOTES.md
  • csx.json
  • src/connection_factory.rb
  • test/contract.rb

ソースアーティファクトをダウンロード (tar.gz)

オリジンシーダー

csx-seed