# delta_analyzer URL: /api/debug/delta_analyzer/ Section: debug -------------------------------------------------------------------------------- delta_analyzer - 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.delta_analyzer Build delta analyzer for comparing builds and explaining changes. Provides tools for comparing two builds to understand what changed, why pages were added/removed/modified, and tracking build evolution over time. Key Features: Compare two build snapshots Identify added, removed, and changed pages Explain timing differences between builds Track build history and trends Related Modules: bengal.utils.build_stats: Build statistics bengal.cache.build_cache: Build cache with timestamps bengal.debug.base: Debug tool infrastructure See Also: bengal/debug/incremental_debugger.py: For cache-specific debugging View source 4 Classes Classes BuildSnapshot dataclass Snapshot of a build state for comparison. Captures key metrics and file lists from a build for del… 4 Caret Right Snapshot of a build state for comparison. Captures key metrics and file lists from a build for delta analysis. Attributes Name Type Description timestamp datetime When the build occurred build_time_ms float Total build time page_count int Number of pages built asset_count int Number of assets processed pages set[str] Set of page paths in this build output_files set[str] Set of output file paths phase_times dict[str, float] Timing by phase (discovery, rendering, etc.) config_hash str | None Hash of configuration at build time metadata dict[str, Any] Additional build metadata Methods 4 from_build_stats classmethod Create snapshot from BuildStats. 2 BuildSnapshot Caret Right def from_build_stats(cls, stats: BuildStats, pages: set[str]) -> BuildSnapshot Create snapshot from BuildStats. Parameters 2 stats BuildStats BuildStats from a completed build pages set[str] Set of page paths that were built Returns BuildSnapshot — BuildSnapshot capturing the build state from_cache classmethod Create snapshot from BuildCache. 1 BuildSnapshot Caret Right def from_cache(cls, cache: BuildCache) -> BuildSnapshot Create snapshot from BuildCache. Parameters 1 cache BuildCache BuildCache with build state Returns BuildSnapshot — BuildSnapshot capturing cached state to_dict Convert to dictionary for JSON serialization. 0 dict[str, Any] Caret Right def to_dict(self) -> dict[str, Any] Convert to dictionary for JSON serialization. Returns dict[str, Any] from_dict classmethod Create from dictionary. 1 BuildSnapshot Caret Right def from_dict(cls, data: dict[str, Any]) -> BuildSnapshot Create from dictionary. Parameters 1 data dict[str, Any] Returns BuildSnapshot BuildDelta dataclass Difference between two builds. Captures what changed between builds including added/removed pages,… 6 Caret Right Difference between two builds. Captures what changed between builds including added/removed pages, timing changes, and configuration differences. Attributes Name Type Description before BuildSnapshot The earlier build snapshot after BuildSnapshot The later build snapshot added_pages set[str] Pages in 'after' but not in 'before' removed_pages set[str] Pages in 'before' but not in 'after' time_change_ms float Change in build time (positive = slower) time_change_pct float Percentage change in build time phase_changes dict[str, float] Changes in phase timings config_changed bool Whether configuration hash changed Methods 5 Tag page_change_count property Total pages added or removed. int Caret Right def page_change_count(self) -> int Total pages added or removed. Returns int Tag is_significant property Check if delta represents significant changes. bool Caret Right def is_significant(self) -> bool Check if delta represents significant changes. Returns bool compute classmethod Compute delta between two builds. 2 BuildDelta Caret Right def compute(cls, before: BuildSnapshot, after: BuildSnapshot) -> BuildDelta Compute delta between two builds. Parameters 2 before BuildSnapshot Earlier build snapshot after BuildSnapshot Later build snapshot Returns BuildDelta — BuildDelta with computed differences 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 Internal Methods 1 Caret Right _format_time_change Format time change with color indicators. 2 str Caret Right def _format_time_change(self, ms: float, pct: float) -> str Format time change with color indicators. Parameters 2 ms float pct float Returns str BuildHistory Tracks build history for trend analysis. Stores snapshots of builds over time and provides trend a… 7 Caret Right Tracks build history for trend analysis. Stores snapshots of builds over time and provides trend analysis. Attributes Name Type Description snapshots — List of build snapshots in chronological order max_snapshots — Maximum number of snapshots to keep Methods 4 add Add a snapshot to history. 1 None Caret Right def add(self, snapshot: BuildSnapshot) -> None Add a snapshot to history. Parameters 1 snapshot BuildSnapshot get_latest Get the N most recent snapshots. 1 list[BuildSnapshot] Caret Right def get_latest(self, n: int = 1) -> list[BuildSnapshot] Get the N most recent snapshots. Parameters 1 n int Returns list[BuildSnapshot] get_baseline Get the baseline (first) snapshot. 0 BuildSnapshot | None Caret Right def get_baseline(self) -> BuildSnapshot | None Get the baseline (first) snapshot. Returns BuildSnapshot | None compute_trend Compute trend statistics over history. 0 dict[str, Any] Caret Right def compute_trend(self) -> dict[str, Any] Compute trend statistics over history. Returns dict[str, Any] Internal Methods 3 Caret Right __init__ Initialize build history. 2 None Caret Right def __init__(self, storage_path: Path | None = None, max_snapshots: int = 50) Initialize build history. Parameters 2 storage_path Path | None Path to store history (defaults to .bengal/build_history.json) max_snapshots int Maximum snapshots to retain _load Load history from disk. 0 None Caret Right def _load(self) -> None Load history from disk. _save Save history to disk. 0 None Caret Right def _save(self) -> None Save history to disk. BuildDeltaAnalyzer Debug tool for comparing builds and explaining changes. Helps understand what changed between buil… 8 Caret Right Debug tool for comparing builds and explaining changes. Helps understand what changed between builds, why build times changed, and track build evolution over time. Creation: Direct instantiation or via DebugRegistry: analyzer = BuildDeltaAnalyzer(site=site, cache=cache) Inherits from DebugTool Methods 5 analyze Analyze build deltas and trends. 0 DebugReport Caret Right def analyze(self) -> DebugReport Analyze build deltas and trends. Returns DebugReport — DebugReport with findings about build changes compare_snapshots Compare two specific snapshots. 2 BuildDelta Caret Right def compare_snapshots(self, before: BuildSnapshot, after: BuildSnapshot) -> BuildDelta Compare two specific snapshots. Parameters 2 before BuildSnapshot Earlier snapshot after BuildSnapshot Later snapshot Returns BuildDelta — BuildDelta with comparison results compare_to_previous Compare current state to most recent snapshot. 0 BuildDelta | None Caret Right def compare_to_previous(self) -> BuildDelta | None Compare current state to most recent snapshot. Returns BuildDelta | None — BuildDelta or None if no history available compare_to_baseline Compare current state to baseline (first) snapshot. 0 BuildDelta | None Caret Right def compare_to_baseline(self) -> BuildDelta | None Compare current state to baseline (first) snapshot. Returns BuildDelta | None — BuildDelta or None if no baseline available save_baseline Save current state as new baseline (clears history). 0 None Caret Right def save_baseline(self) -> None Save current state as new baseline (clears history). Internal Methods 3 Caret Right __init__ Initialize build delta analyzer. 4 None Caret Right def __init__(self, site: Site | None = None, cache: BuildCache | None = None, root_path: Path | None = None, history: BuildHistory | None = None) Initialize build delta analyzer. Parameters 4 site Site | None Site instance for current state cache BuildCache | None BuildCache for cache inspection root_path Path | None Root path of the project history BuildHistory | None Optional BuildHistory for trend analysis _get_current_snapshot Get snapshot of current state. 0 BuildSnapshot | None Caret Right def _get_current_snapshot(self) -> BuildSnapshot | None Get snapshot of current state. Returns BuildSnapshot | None _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 debug Next → dependency_visualizer 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: 2115 - Reading Time: 11 minutes