Repository navigation
ci: Fail the Blueprint check above 980 distinct templates - #688
Conversation
Spook caches the analysis of up to 1,024 distinct templates, shared with all other automations; above it, every inspection re-parses every template of every panel (issue #636). The Blueprint metrics step now fails when the Blueprint has more than 980 distinct templates, and warns when a pull request increases their number. The limit lives in validate_blueprint.yml, so raising it is a visible decision. Related to #636
|
Sorry @panel-easy-assistant[bot], you've used your own review budget of 250,000 diff characters for the last 7 days. You can request another review in 22 hours and 29 minutes by commenting |
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
Reviewer's GuideThe PR adds a configurable distinct-template ceiling to Blueprint metrics, reports growth against the base revision, and configures CI to fail above 980 templates while preserving the generated metrics report and existing change-based workflow gating. Sequence diagram for Blueprint template limit validationsequenceDiagram
participant CI as GitHub Actions
participant Metrics as blueprint_metrics.py
participant Summary as Job Summary
CI->>Metrics: Run with --base and --max-distinct 980
Metrics->>Metrics: Calculate current and base metrics
Metrics->>Summary: Write metrics report
alt Distinct templates grow
Metrics-->>CI: Emit GitHub Actions warning
end
alt Distinct templates > 980
Metrics-->>CI: Emit GitHub Actions error
Metrics-->>CI: Exit 1
else Limit not exceeded
Metrics-->>CI: Exit 0
end
Flow diagram for the Blueprint template ceilingflowchart TD
A[Blueprint or CI files changed] --> B[Run Blueprint metrics]
B --> C[Compare distinct templates with base]
C --> D[Write metrics report to job summary]
D --> E{Distinct templates above 980?}
E -->|No| F[CI step passes]
E -->|Yes| G[Emit error and fail CI]
G --> H[Reduce templates or deliberately raise limit]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Keeps the Blueprint safely below the size of Spook's template cache, so a future change can't silently bring back the Home Assistant stalls from #636.
Details:
blueprint_metrics.pygets--max-distinct N: above N distinct templates it prints an error and exits with 1, after writing the report to the job summary.--base, it also warns when a pull request increases the number of distinct templates, so the trend is visible before the limit is reached.validate_blueprint.ymlpasses--max-distinct 980(44 below the cache size). Raising it means editing the workflow, which keeps it a deliberate decision. It can be lowered as the Blueprint shrinks.Related to #636
Summary by Sourcery
Protect Blueprint validation from exceeding Spook’s template cache by adding a deliberate distinct-template limit and pull-request growth warnings.
Enhancements:
CI: