.vbw-planning/milestones/aia-ssl-fix/01-aia-certificate-resolution/PLAN-03.md
Wire AIA resolution into FeedFetcher's error handling so SSL failures automatically attempt intermediate certificate recovery before giving up.
Modify perform_fetch (lines 77-90):
Split rescue clause: Separate Faraday::SSLError from Faraday::ConnectionFailed into its own rescue:
rescue Faraday::ConnectionFailed => error
raise ConnectionError.new(error.message, original_error: error)
rescue Faraday::SSLError => error
attempt_aia_recovery(error) || raise(ConnectionError.new(error.message, original_error: error))
Add attempt_aia_recovery private method:
@aia_attempted is true (prevents recursion)@aia_attempted = trueURI.parse(source.feed_url).hostSourceMonitor::HTTP::AIAResolver.resolve(hostname)AIAResolver.enhanced_cert_store([intermediate])@connection = SourceMonitor::HTTP.client(cert_store: store, headers: request_headers)perform_request (the retry)Tag instrumentation: In the handle_response path after successful AIA retry, the instrumentation_payload[:aia_resolved] = true will naturally flow through since perform_fetch calls handle_response on the retried response.
Add 3 tests under a new section # -- AIA Certificate Resolution --:
SSL error + AIA resolve succeeds -> fetch succeeds:
Faraday::SSLErrorAIAResolver.resolve to return a mock certificateAIAResolver.enhanced_cert_store to return a storeSSL error + AIA resolve returns nil -> ConnectionError:
Faraday::SSLErrorAIAResolver.resolve to return nilNon-SSL ConnectionError -> AIA not attempted:
Faraday::ConnectionFailedAIAResolver.resolve was NOT calledPARALLEL_WORKERS=1 bin/rails test test/lib/source_monitor/fetching/feed_fetcher_test.rbbin/rails test (full suite)bin/rubocopbin/brakeman --no-pager| Action | Path |
|---|---|
| MODIFY | lib/source_monitor/fetching/feed_fetcher.rb |
| MODIFY | test/lib/source_monitor/fetching/feed_fetcher_test.rb |
PARALLEL_WORKERS=1 bin/rails test test/lib/source_monitor/fetching/feed_fetcher_test.rb
bin/rails test
bin/rubocop
bin/brakeman --no-pager