# incremental_debugger URL: /api/debug/incremental_debugger/ Section: debug -------------------------------------------------------------------------------- incremental_debugger - Bengal window.BENGAL_THEME_DEFAULTS = { appearance: 'dark', palette: 'snow-lynx' }; // Progressive Enhancement System Configuration window.Bengal = window.Bengal || {}; window.Bengal.enhanceBaseUrl = '/bengal/assets/js/enhancements'; window.Bengal.watchDom = true; window.Bengal.debug = false; (function () { try { var defaults = window.BENGAL_THEME_DEFAULTS || { appearance: 'system', palette: '' }; var defaultAppearance = defaults.appearance; if (defaultAppearance === 'system') { defaultAppearance = (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) ? 'dark' : 'light'; } var storedTheme = localStorage.getItem('bengal-theme'); var storedPalette = localStorage.getItem('bengal-palette'); var theme = storedTheme ? (storedTheme === 'system' ? defaultAppearance : storedTheme) : defaultAppearance; var palette = storedPalette ?? defaults.palette; document.documentElement.setAttribute('data-theme', theme); if (palette) { document.documentElement.setAttribute('data-palette', palette); } } catch (e) { document.documentElement.setAttribute('data-theme', 'light'); } })(); Skip to main content Magnifying Glass ESC Recent Clear Magnifying Glass No results for "" Try different keywords or check your spelling Start typing to search... ↑↓ Navigate ↵ Open ESC Close Powered by Lunr ᓚᘏᗢ Documentation Info About Arrow Clockwise Get Started Note Tutorials File Text Content Palette Theming Settings Building Starburst Extending Bookmark Reference Learning Tracks Releases Dev GitHub API Reference bengal CLI Magnifying Glass Search ⌘K Palette Appearance Chevron Down Mode Monitor System Sun Light Moon Dark Palette Snow Lynx Brown Bengal Silver Bengal Charcoal Bengal Blue Bengal List ᓚᘏᗢ Magnifying Glass Search X Close Documentation Info About Arrow Clockwise Get Started Note Tutorials File Text Content Palette Theming Settings Building Starburst Extending Bookmark Reference Learning Tracks Releases Dev GitHub API Reference bengal CLI Palette Appearance Chevron Down Mode Monitor System Sun Light Moon Dark Palette Snow Lynx Brown Bengal Silver Bengal Charcoal Bengal Blue Bengal API Reference __main__ bengal Caret Right Folder Analysis community_detection graph_analysis graph_reporting graph_visualizer knowledge_graph link_suggestions link_types page_rank path_analysis performance_advisor results Caret Right Folder Assets manifest pipeline Caret Right Folder Autodoc base config docstring_parser utils virtual_orchestrator Caret Right Folder Extractors cli openapi python Caret Right Folder Models cli common openapi python Caret Right Folder Cache asset_dependency_map cache_store cacheable compression dependency_tracker page_discovery_cache query_index query_index_registry taxonomy_index utils Caret Right Folder Build Cache autodoc_tracking core file_tracking fingerprint parsed_content_cache rendered_output_cache taxonomy_index_mixin validation_cache Caret Right Folder Indexes author_index category_index date_range_index section_index Caret Right Folder Cli __main__ base site_templates utils Caret Right Folder Commands assets build clean collections config debug explain fix health init perf project serve site skeleton sources theme utils validate Caret Right Folder Graph __main__ bridges communities orphans pagerank report suggest Caret Right Folder New config presets scaffolds site wizard Caret Right Folder Helpers cli_app_loader cli_output config_validation error_handling menu_config metadata progress site_loader traceback validation Caret Right Folder Skeleton hydrator schema Caret Right Folder Templates base registry Caret Right Folder Blog template Caret Right Folder Changelog template Caret Right Folder Default template Caret Right Folder Docs template Caret Right Folder Landing template Caret Right Folder Portfolio template Caret Right Folder Resume template Caret Right Folder Collections errors loader schemas validator Caret Right Folder Config defaults deprecation directory_loader env_overrides environment feature_mappings hash loader merge origin_tracker validators Caret Right Folder Content Layer entry loaders manager source Caret Right Folder Sources github local notion rest Caret Right Folder Content Types base registry strategies Caret Right Folder Core build_context cascade_engine menu section theme Caret Right Folder Asset asset_core css_transforms Caret Right Folder Page computed content metadata navigation operations page_core proxy relationships utils Caret Right Folder Site core data discovery factories page_caches properties section_registry theme Caret Right Folder Debug base config_inspector content_migrator delta_analyzer dependency_visualizer explainer incremental_debugger models reporter shortcode_sandbox Caret Right Folder Discovery asset_discovery content_discovery Caret Right Folder Fonts downloader generator Caret Right Folder Health autofix base health_check report Caret Right Folder Linkcheck async_checker ignore_policy internal_checker models orchestrator Caret Right Folder Validators anchors assets cache config connectivity cross_ref fonts links menu navigation output performance rendering rss sitemap taxonomy tracks Caret Right Folder Directives analysis checkers constants Caret Right Folder Orchestration asset content full_to_incremental incremental menu postprocess related_posts render section static streaming taxonomy Caret Right Folder Postprocess html_output redirects rss sitemap special_pages Caret Right Folder Output Formats index_generator json_generator llm_generator lunr_index_generator txt_generator utils Caret Right Folder Rendering api_doc_enhancer asset_extractor errors jinja_utils link_transformer link_validator pygments_cache renderer template_context template_profiler validator Caret Right Folder Parsers base factory mistune native_html pygments_patch python_markdown Caret Right Folder Pipeline core output thread_local toc transforms Caret Right Folder Plugins badges cross_references inline_icon term variable_substitution Caret Right Folder Directives _icons admonitions badge base button cache cards checklist code_tabs container contracts data_table dropdown embed errors example_label fenced figure glossary icon include list_table literalinclude marimo navigation options rubric steps tabs target term terminal tokens utils validator video Caret Right Folder Template Engine asset_url core environment manifest menu url_helpers Caret Right Folder Template Functions advanced_collections advanced_strings autodoc collections content crossref data dates debug files get_page i18n icons images math_functions navigation pagination_helpers seo strings tables taxonomies theme urls Caret Right Folder Server build_handler component_preview constants dev_server live_reload pid_manager reload_controller request_handler request_logger resource_manager utils Caret Right Folder Services validation Caret Right Folder Themes config Caret Right Folder Utils atomic_write autodoc build_context build_stats build_summary cli_output css_minifier dates dotdict error_handlers file_io file_lock hashing incremental_constants js_bundler live_progress logger metadata observability page_initializer pagination path_resolver paths performance_collector performance_report profile progress retry rich_console sections swizzle text theme_registry theme_resolution thread_local traceback_config traceback_renderer url_normalization url_strategy API Reference Debug ᗢ Caret Down Link Copy URL External Open LLM text Copy Copy LLM text Share with AI Ask Claude Ask ChatGPT Ask Gemini Ask Copilot Module debug.incremental_debugger Incremental build debugger for diagnosing rebuild issues. Provides diagnostic tools for understanding why pages rebuild, identifying phantom rebuilds, validating cache consistency, and simulating changes. Key Features: Explain why a specific page was rebuilt Find pages that rebuild without apparent cause (phantom rebuilds) Validate cache integrity and consistency Simulate what would rebuild if a file changed Related Modules: bengal.cache.build_cache: Cache storage and tracking bengal.cache.dependency_tracker: Dependency graph construction bengal.orchestration.incremental: Incremental build logic See Also: bengal/debug/base.py: Debug tool infrastructure plan/active/rfc-incremental-builds.md: Incremental build design View source 5 Classes Classes RebuildReason Reasons why a page might be rebuilt. 1 Caret Right Reasons why a page might be rebuilt. Inherits from Enum Methods 1 Tag description property Human-readable description of the reason. str Caret Right 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… 3 Caret Right 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 Tag primary_reason property Get the primary (first) reason for rebuild. RebuildReason Caret Right def primary_reason(self) -> RebuildReason Get the primary (first) reason for rebuild. Returns RebuildReason format_summary Format as brief summary. 0 str Caret Right def format_summary(self) -> str Format as brief summary. Returns str format_detailed Format with full details. 0 str Caret Right 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… 0 Caret Right 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. 1 Caret Right 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 Tag health_score property Calculate cache health as percentage. float Caret Right 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, … 9 Caret Right 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) Inherits from DebugTool Methods 5 analyze Perform comprehensive incremental build analysis. Analyzes cache consistency, … 0 DebugReport Caret Right def analyze(self) -> DebugReport Perform comprehensive incremental build analysis. Analyzes cache consistency, identifies phantom rebuilds, and provides optimization recommendations. Returns DebugReport — DebugReport with findings and recommendations explain_rebuild Explain why a specific page was rebuilt. Analyzes the page's dependencies, cac… 1 RebuildExplanation Caret Right 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 — RebuildExplanation with detailed analysis find_phantom_rebuilds Find pages that rebuilt without apparent dependency changes. Phantom rebuilds … 0 list[PhantomRebuild] Caret Right 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[PhantomRebuild] — List of PhantomRebuild instances validate_cache_consistency Validate cache integrity and consistency. Checks for: - Orphaned entries (file… 0 CacheConsistencyReport Caret Right 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 — CacheConsistencyReport with validation results simulate_change Simulate what would rebuild if a file changed. Useful for understanding the bl… 1 list[str] Caret Right 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[str] — List of page paths that would need to rebuild Internal Methods 4 Caret Right __init__ Initialize incremental build debugger. 4 None Caret Right 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. 3 list[str] Caret Right 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. 0 list[DebugFinding] Caret Right def _analyze_dependency_health(self) -> list[DebugFinding] Analyze the health of dependency tracking. Returns list[DebugFinding] _generate_recommendations Generate recommendations based on analysis. 1 list[str] Caret Right def _generate_recommendations(self, report: DebugReport) -> list[str] Generate recommendations based on analysis. Parameters 1 report DebugReport Returns list[str] ← Previous explainer Next → models List © 2025 Bengal ᓚᘏᗢ window.BENGAL_LAZY_ASSETS = { tabulator: '/bengal/assets/js/tabulator.min.js', dataTable: '/bengal/assets/js/data-table.js', mermaidToolbar: '/bengal/assets/js/mermaid-toolbar.9de5abba.js', mermaidTheme: '/bengal/assets/js/mermaid-theme.344822c5.js', graphMinimap: '/bengal/assets/js/graph-minimap.cc7e42e3.js', graphContextual: '/bengal/assets/js/graph-contextual.440e59c6.js' }; window.BENGAL_ICONS = { close: '/bengal/assets/icons/close.911d4fe1.svg', enlarge: '/bengal/assets/icons/enlarge.652035e5.svg', copy: '/bengal/assets/icons/copy.3d56e945.svg', 'download-svg': '/bengal/assets/icons/download.04f07e1b.svg', 'download-png': '/bengal/assets/icons/image.c34dfd40.svg', 'zoom-in': '/bengal/assets/icons/zoom-in.237b4a83.svg', 'zoom-out': '/bengal/assets/icons/zoom-out.38857c77.svg', reset: '/bengal/assets/icons/reset.d26dba29.svg' }; Arrow Up X -------------------------------------------------------------------------------- Metadata: - Author: lbliii - Word Count: 1927 - Reading Time: 10 minutes