Classes
RebuildReason
Reasons why a page might be rebuilt.
RebuildReason
Reasons why a page might be rebuilt.
EnumMethods 1
description
property
Human-readable description of the reason.
description
property def description(self) -> str
Human-readable description of the reason.
Returns
str
RebuildExplanation
dataclass
Detailed explanation of why a page was rebuilt.
Provides comprehensive information about what trig…
RebuildExplanation
dataclass Detailed explanation of why a page was rebuilt.
Provides comprehensive information about what triggered a rebuild, including the chain of dependencies that led to the rebuild.
Attributes
| Name | Type | Description |
|---|---|---|
page_path |
str |
Path to the page that was rebuilt |
reasons |
list[RebuildReason] |
List of reasons why the page was rebuilt |
changed_dependencies |
list[str] |
Files that changed and caused the rebuild |
cache_status |
str |
Status of the page in the cache |
timestamps |
dict[str, str] |
Relevant timestamps (content mtime, cache time, etc.) |
dependency_chain |
list[str] |
Chain of dependencies that triggered rebuild |
suggestions |
list[str] |
Suggestions for optimization if applicable |
Methods 3
primary_reason
property
Get the primary (first) reason for rebuild.
primary_reason
property def primary_reason(self) -> RebuildReason
Get the primary (first) reason for rebuild.
Returns
RebuildReason
format_summary
Format as brief summary.
format_summary
def format_summary(self) -> str
Format as brief summary.
Returns
str
format_detailed
Format with full details.
format_detailed
def format_detailed(self) -> str
Format with full details.
Returns
str
PhantomRebuild
dataclass
A page that rebuilds without apparent cause.
Phantom rebuilds are pages that rebuild even though n…
PhantomRebuild
dataclass A page that rebuilds without apparent cause.
Phantom rebuilds are pages that rebuild even though none of their known dependencies changed. These indicate missing dependency tracking or cache issues.
Attributes
| Name | Type | Description |
|---|---|---|
page_path |
str |
Path to the page with phantom rebuild |
rebuild_count |
int |
Number of times this page has phantom rebuilt |
last_rebuild |
datetime | None |
When the page last rebuilt |
suspected_causes |
list[str] |
Possible causes of the phantom rebuild |
investigation_notes |
list[str] |
Notes from investigation |
CacheConsistencyReport
dataclass
Report on cache consistency and integrity.
CacheConsistencyReport
dataclass Report on cache consistency and integrity.
Attributes
| Name | Type | Description |
|---|---|---|
total_entries |
int |
Total entries in cache |
valid_entries |
int |
Entries that pass validation |
invalid_entries |
int |
Entries that fail validation |
orphaned_entries |
list[str] |
Entries for files that no longer exist |
missing_entries |
list[str] |
Files that should be cached but aren't |
issues |
list[str] |
Specific issues found |
Methods 1
health_score
property
Calculate cache health as percentage.
health_score
property def health_score(self) -> float
Calculate cache health as percentage.
Returns
float
IncrementalBuildDebugger
Debug tool for incremental build issues.
Helps diagnose why pages rebuild, find phantom rebuilds, …
IncrementalBuildDebugger
Debug tool for incremental build issues.
Helps diagnose why pages rebuild, find phantom rebuilds, and validate cache consistency.
Creation:
Direct instantiation or via DebugRegistry:
debugger = IncrementalBuildDebugger(site=site, cache=cache)
debugger = DebugRegistry.create("incremental", site=site, cache=cache)
DebugToolMethods 5
analyze
Perform comprehensive incremental build analysis.
Analyzes cache consistency, …
analyze
def analyze(self) -> DebugReport
Perform comprehensive incremental build analysis.
Analyzes cache consistency, identifies phantom rebuilds, and provides optimization recommendations.
Returns
DebugReport with findings and recommendationsDebugReport
—
explain_rebuild
Explain why a specific page was rebuilt.
Analyzes the page's dependencies, cac…
explain_rebuild
def explain_rebuild(self, page_path: str) -> RebuildExplanation
Explain why a specific page was rebuilt.
Analyzes the page's dependencies, cache status, and file timestamps to determine why it was rebuilt (or would be rebuilt).
Parameters 1
page_path |
str |
Path to the page (relative to content dir or absolute) |
Returns
RebuildExplanation with detailed analysisRebuildExplanation
—
find_phantom_rebuilds
Find pages that rebuilt without apparent dependency changes.
Phantom rebuilds …
find_phantom_rebuilds
def find_phantom_rebuilds(self) -> list[PhantomRebuild]
Find pages that rebuilt without apparent dependency changes.
Phantom rebuilds indicate missing dependency tracking or cache issues.
Returns
List of PhantomRebuild instanceslist[PhantomRebuild]
—
validate_cache_consistency
Validate cache integrity and consistency.
Checks for:
- Orphaned entries (file…
validate_cache_consistency
def validate_cache_consistency(self) -> CacheConsistencyReport
Validate cache integrity and consistency.
Checks for:
- Orphaned entries (files no longer exist)
- Missing entries (files should be cached but aren't)
- Invalid entries (corrupted or malformed)
Returns
CacheConsistencyReport with validation resultsCacheConsistencyReport
—
simulate_change
Simulate what would rebuild if a file changed.
Useful for understanding the bl…
simulate_change
def simulate_change(self, file_path: str) -> list[str]
Simulate what would rebuild if a file changed.
Useful for understanding the blast radius of a change before making it.
Parameters 1
file_path |
str |
Path to the file that would change |
Returns
List of page paths that would need to rebuildlist[str]
—
Internal Methods 4
__init__
Initialize incremental build debugger.
__init__
def __init__(self, site: Site | None = None, cache: BuildCache | None = None, root_path: Path | None = None, rebuild_log: list[str] | None = None)
Initialize incremental build debugger.
Parameters 4
site |
Site | None |
Site instance for page access |
cache |
BuildCache | None |
BuildCache for cache inspection |
root_path |
Path | None |
Root path of the project |
rebuild_log |
list[str] | None |
Optional list of paths that were rebuilt (from last build) |
_build_dependency_chain
Build the chain of dependencies from changed file to target.
_build_dependency_chain
def _build_dependency_chain(self, target: str, changed: str, visited: set[str] | None = None) -> list[str]
Build the chain of dependencies from changed file to target.
Parameters 3
target |
str |
|
changed |
str |
|
visited |
set[str] | None |
Returns
list[str]
_analyze_dependency_health
Analyze the health of dependency tracking.
_analyze_dependency_health
def _analyze_dependency_health(self) -> list[DebugFinding]
Analyze the health of dependency tracking.
Returns
list[DebugFinding]
_generate_recommendations
Generate recommendations based on analysis.
_generate_recommendations
def _generate_recommendations(self, report: DebugReport) -> list[str]
Generate recommendations based on analysis.
Parameters 1
report |
DebugReport |
Returns
list[str]