Skip to content

fix(schema): retry transient network errors when downloading schemas - #4633

Merged
kddejong merged 1 commit into
aws-cloudformation:mainfrom
kddejong:fix/issue/4631
Aug 13, 2026
Merged

fix(schema): retry transient network errors when downloading schemas#4633
kddejong merged 1 commit into
aws-cloudformation:mainfrom
kddejong:fix/issue/4631

Conversation

@kddejong

@kddejong kddejong commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Description

Schema specs are downloaded from a GitHub release asset (resource-provider-enhanced-schemasschemas-cfn-lint.zip) served through a CDN that intermittently resets connections under load (Remote end closed connection without response). The download had no retry, so a single reset failed the whole cfn-lint --update-specs run. In CI the unitlint matrix fires ~18 concurrent downloads with fail-fast: true, so one reset cancels every job in the run.

This wraps the network calls in the URL helpers with a small shared retry/backoff helper:

  • 3 attempts, 0.5s base delay with exponential backoff
  • Retries connection-level errors (URLError, ConnectionResetError / RemoteDisconnected, timeouts — all OSError) and HTTP 429/5xx
  • Deterministic HTTP 4xx responses are not retried (fail fast)
  • Applied to get_url_retrieve (schema zip), get_url_content (version.json), and url_has_newer_version (HEAD check)

This reduces transient CI flakiness; it does not make the download bulletproof against a sustained outage.

Additional change: FindInMap guardrail test

Follow-up to #4628 (which made Fn::FindInMap maxItems unconditionally 4 so DefaultValue works without AWS::LanguageExtensions). Adds a regression test asserting that a 4th element which is not a {DefaultValue: ...} object is still rejected via prefixItems[3] (is not of type 'object') even without the transform — locking in that relaxing the arity did not weaken the 4th-element shape check.

Validation

  • pytest test/unit/module/helpers -q and pytest test/unit/rules/functions/test_find_in_map.py -q
  • ruff check / ruff format --check on the changed files
  • mypy src/cfnlint/helpers.py
  • cfn-lint --update-specs --force succeeds locally

Schema specs are downloaded from a GitHub release asset served through a
CDN that intermittently resets connections under load ("Remote end closed
connection without response"). The download had no retry, so a single
reset failed the entire `cfn-lint --update-specs` run. In CI the unitlint
matrix fires many concurrent downloads with fail-fast, so one reset
cancels every job in the run.

Wrap the urlopen/urlretrieve calls in the URL helpers with a bounded
exponential backoff (3 attempts, 0.5s base). Connection-level errors and
HTTP 429/5xx are retried; deterministic 4xx responses still fail fast.
@codecov

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.58%. Comparing base (732ea3c) to head (56e981b).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4633   +/-   ##
=======================================
  Coverage   94.57%   94.58%           
=======================================
  Files         432      432           
  Lines       15395    15417   +22     
  Branches     2984     2986    +2     
=======================================
+ Hits        14560    14582   +22     
  Misses        456      456           
  Partials      379      379           
Flag Coverage Δ
unittests 94.58% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kddejong
kddejong merged commit fc5cfa3 into aws-cloudformation:main Aug 13, 2026
21 checks passed
@kddejong
kddejong deleted the fix/issue/4631 branch August 13, 2026 15:26
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