Skip to content

feat: Add version.json schema precedence and bundled fallback - #4573

Merged
kddejong merged 5 commits into
aws-cloudformation:mainfrom
kddejong:fix/configurable-schema-cache-dir
Jul 8, 2026
Merged

feat: Add version.json schema precedence and bundled fallback#4573
kddejong merged 5 commits into
aws-cloudformation:mainfrom
kddejong:fix/configurable-schema-cache-dir

Conversation

@kddejong

@kddejong kddejong commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Schema manager uses bundled schemas (PyPI install) by default, with user cache as fallback
  • Compares schema_date from version.json between bundled and cache to determine precedence
  • cfn-lint -u downloads to cache and fetches version.json — cache wins if newer
  • A pip upgrade with newer bundled schemas takes precedence until user runs -u again
  • CD workflow copies schemas + version.json into package dir for bundling

Depends on

Test plan

  • Fresh pip install uses bundled schemas
  • cfn-lint -u downloads to cache, cache takes precedence after
  • Pre-commit (no bundled) auto-downloads to cache on first run
  • pip upgrade with newer bundled schemas takes over from stale cache

kddejong added 2 commits July 7, 2026 10:10
- Schema manager checks package data dir first (bundled PyPI install),
  falls back to user cache dir when bundled schemas don't exist
- update() always writes to cache dir and switches to reading from there
- CD workflow copies schemas from cache into package dir for bundling
Compare schema_date between bundled and cached schemas to determine
which to use. Cache wins if its schema_date is newer than bundled,
enabling cfn-lint -u to take effect. A pip upgrade with newer bundled
schemas will take precedence until user runs -u again.

update() now also fetches version.json from the release and stores
it in the cache directory alongside the schema data.
@kddejong
kddejong force-pushed the fix/configurable-schema-cache-dir branch from af2dcfe to 36218b4 Compare July 7, 2026 17:10
@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.42%. Comparing base (01fda43) to head (f4c7742).

Files with missing lines Patch % Lines
src/cfnlint/schema/manager.py 96.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4573      +/-   ##
==========================================
+ Coverage   94.41%   94.42%   +0.01%     
==========================================
  Files         429      429              
  Lines       15056    15097      +41     
  Branches     2911     2915       +4     
==========================================
+ Hits        14215    14256      +41     
  Misses        461      461              
  Partials      380      380              
Flag Coverage Δ
unittests 94.42% <96.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 ce5288c into aws-cloudformation:main Jul 8, 2026
21 checks passed
@kddejong
kddejong deleted the fix/configurable-schema-cache-dir branch July 8, 2026 20:30
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