Module

health.validators.cache

Cache validator - checks incremental build cache integrity.

Validates:

  • Cache file exists and is readable
  • Cache is not corrupted
  • Cache size is reasonable
  • Basic dependency tracking works

Classes

CacheValidator
Validates build cache integrity (essential checks only). Checks: - Cache file exists and is readab…
5

Validates build cache integrity (essential checks only).

Checks:

  • Cache file exists and is readable
  • Cache format is valid JSON
  • Cache size is reasonable (not corrupted/bloated)
  • Has expected structure (file_hashes, dependencies)

Skips:

  • Deep dependency graph validation (complex)
  • File hash verification (too slow)
  • Advanced corruption detection (overkill)
Inherits from BaseValidator

Methods 1

validate
Run cache validation checks.
2 list[CheckResult]
def validate(self, site: Site, build_context: BuildContext | Any | None = None) -> list[CheckResult]

Run cache validation checks.

Parameters 2
site Site
build_context BuildContext | Any | None
Returns

list[CheckResult]

Internal Methods 4
_check_cache_readable
Check if cache file is readable and valid JSON.
1 tuple[bool, dict[st…
def _check_cache_readable(self, cache_path: Path) -> tuple[bool, dict[str, Any]]

Check if cache file is readable and valid JSON.

Parameters 1
cache_path Path
Returns

tuple[bool, dict[str, Any]]

_check_cache_structure
Check if cache has expected structure.
1 tuple[bool, list[str]]
def _check_cache_structure(self, cache_data: dict[str, Any]) -> tuple[bool, list[str]]

Check if cache has expected structure.

Parameters 1
cache_data dict[str, Any]
Returns

tuple[bool, list[str]]

_check_cache_size
Check if cache size is reasonable.
2 list[CheckResult]
def _check_cache_size(self, cache_path: Path, cache_data: dict[str, Any]) -> list[CheckResult]

Check if cache size is reasonable.

Parameters 2
cache_path Path
cache_data dict[str, Any]
Returns

list[CheckResult]

_check_dependencies
Check basic dependency tracking.
1 list[CheckResult]
def _check_dependencies(self, cache_data: dict[str, Any]) -> list[CheckResult]

Check basic dependency tracking.

Parameters 1
cache_data dict[str, Any]
Returns

list[CheckResult]