Skip to content

Implement Persistent Version Metadata Cache with Security Vulnerability Indexing#74

Merged
shreyasmene06 merged 24 commits intoshreyasmene06:mainfrom
ShaikhWarsi:main
Feb 9, 2026
Merged

Implement Persistent Version Metadata Cache with Security Vulnerability Indexing#74
shreyasmene06 merged 24 commits intoshreyasmene06:mainfrom
ShaikhWarsi:main

Conversation

@ShaikhWarsi
Copy link
Contributor

Fixes #71

PR Summary

  • Adds a local SQLite metadata cache with 24h TTL for Python releases/versions.

  • Implements a background sync worker for python.org; cache-first reads with async refresh.

  • Overhauls version fetching to use the cache; adds filtering API and security-support helper.

  • Improves TUI responsiveness by avoiding blocking network calls.

  • Prepares groundwork for CVE ingestion and additional sources (conda-forge) in future PRs.
    Key Changes

  • New: metadata_store.py (SQLite schema, TTL checks, sync + background worker)

  • Update: version.py (cache integration, advanced filtering, security/EOL helpers)

  • Update: constants.py (METADATA_DB, METADATA_TTL_SECONDS)
    Impact

  • Faster, reliable version data in TUI/CLI with offline support.

  • Consistent status normalization for EOL/security warnings.

  • Extensible path for multi-source metadata and CVE integration

@ShaikhWarsi
Copy link
Contributor Author

Only a few hours left before acwoc ends , please merge this pr before that @shreyasmene06

Copy link
Owner

@shreyasmene06 shreyasmene06 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent implementation of the metadata cache system! This is a substantial, well-designed feature.

What's great

  • SQLite-based persistent cache with proper schema
  • TTL logic with 24h default, configurable via constants
  • Non-blocking background sync using threading
  • Thread-safe with threading.Lock()
  • Graceful fallback to network when cache is empty
  • EOL/security status tracking
  • Advanced filtering API (get_versions_filtered, is_version_security_supported)
  • Clean integration with existing version.py

Suggestions (non-blocking)

1. Add tests

This is a complex feature that really should have tests. Consider adding:

# tests/test_metadata_store.py
def test_cache_creation():
    """Test that cache DB is created."""
def test_is_cache_stale_when_empty():
    """Test stale detection on fresh DB."""
def test_sync_populates_cache():
    """Test that sync adds data to cache."""
def test_background_sync_is_non_blocking():
    """Test that background sync doesn't block."""
def test_get_versions_filtered():
    """Test filtering by min_version and security status."""
  1. Consider adding CLI commands (follow-up PR)
    pyvm cache status # Show cache age, entry count
    pyvm cache refresh # Force sync
    pyvm cache clear # Delete cache
  2. Minor type hint

This is exactly what issue #71 requested - a robust local data engine with caching, EOL tracking, and filtering. Great work on a hard issue!
LGTM! 🎉

@shreyasmene06 shreyasmene06 merged commit 8d0a316 into shreyasmene06:main Feb 9, 2026
12 checks passed
@shreyasmene06 shreyasmene06 added acwoc Indicates this pull request is a part of AcWoC hard Indicates a difficult or complex task. labels Feb 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

acwoc Indicates this pull request is a part of AcWoC hard Indicates a difficult or complex task.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Persistent Version Metadata Cache with Security Vulnerability Indexing

2 participants