Skip to content

Document marking leaf component and automation classes as final#157

Open
jesserockz wants to merge 1 commit into
mainfrom
jesserockz-2026-347
Open

Document marking leaf component and automation classes as final#157
jesserockz wants to merge 1 commit into
mainfrom
jesserockz-2026-347

Conversation

@jesserockz

Copy link
Copy Markdown
Member

Summary

Documents the C++ final convention introduced across the esphome/esphome#16952 PR series, which marks leaf, user-configurable component classes and automation Action/Trigger/Condition primitives as final.

  • Adds a "Marking leaf classes as final" coding-standard subsection to docs/contributing/code.md, covering the rule, the "leaf only" caveat (hubs and base *Component classes excluded), and the rationale (API hardening / developer breaking change, intent, devirtualization).
  • Marks the canonical ExampleComponent example final in docs/architecture/components/index.md with a cross-linked note.
  • Marks the Action/Trigger/Condition examples final in docs/architecture/components/automations.md and adds an explanatory note.

Entity base-class docs (sensor, switch, etc.) are intentionally left untouched, since those classes are meant to be subclassed and must not be final.

Adds a coding standard and example updates instructing contributors to
mark leaf component/platform classes and Action/Trigger/Condition
primitives with the C++ final specifier, matching esphome/esphome#16952.
Copilot AI review requested due to automatic review settings June 15, 2026 01:34
@netlify

netlify Bot commented Jun 15, 2026

Copy link
Copy Markdown

Deploy Preview for esphome-dev-docs ready!

Name Link
🔨 Latest commit cd705e1
🔍 Latest deploy log https://app.netlify.com/projects/esphome-dev-docs/deploys/6a2f56b0e94a7800084e9446
😎 Deploy Preview https://deploy-preview-157--esphome-dev-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

This was referenced Jun 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Documents the project-wide C++ convention of marking leaf (non-subclassed in-tree) component/platform classes and automation primitives (Action/Trigger/Condition) as final, including rationale and examples.

Changes:

  • Adds a new coding-standard subsection describing when/how to apply final to leaf classes.
  • Updates the canonical ExampleComponent docs example to be final and cross-links the new guideline.
  • Updates automation primitive examples to be final and adds an explanatory note.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
docs/contributing/code.md Adds a new guideline section documenting the final convention and rationale.
docs/architecture/components/index.md Marks ExampleComponent as final and links to the new guideline.
docs/architecture/components/automations.md Documents and updates automation primitive examples to be final.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/contributing/code.md
Comment thread docs/architecture/components/index.md
Comment thread docs/architecture/components/automations.md
@esphbot

esphbot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

PR Review — Document marking leaf component and automation classes as final

Clean, well-scoped docs PR. Merge-ready.

  • The new code.md subsection is well-structured: it states the rule, the critical "leaf only" caveat (hubs and *Component bases excluded), and three distinct rationales (API hardening as a developer breaking change, intent, devirtualization) with correct cross-links to the existing public-API and breaking-change sections.

  • Examples are consistent across all three files — ExampleComponent, Action/Trigger/Condition all marked final with matching explanatory notes, and the cross-links all point at the same #marking-leaf-classes-as-final anchor.

  • Author has already verified the three Copilot concerns (backticked-heading slug, absolute link path, admonition-title inline code) against the Netlify deploy preview with concrete evidence; all hold for this MkDocs Material + root-hosted site.

  • No correctness, security, or maintainability concerns — documentation-only, no code paths affected.

  • Diff fully delivers what the description promises; entity base classes correctly left untouched.



Automated review by Kōan (Claude) HEAD=cd705e1 24s

@esphbot esphbot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking issues found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants