Add Copilot code review instructions#171
Merged
agners merged 2 commits intoMay 12, 2026
Merged
Conversation
Captures the conventions Copilot's PR reviewer should follow when reviewing this repo: review-style rules at the top (avoid commenting on lint/formatting since CI already enforces it), public API conventions (TypedDicts + cast at JSON boundaries is intentional, NotRequired over T | None, T | None reserved for "no data" return paths), test layout (respx + optional integration marker), and semver expectations for TypedDict shape changes. Standalone — no generator script like home-assistant/core has; the file is small enough to maintain by hand. Some of the conventions described (mypy strict, cast() pattern, PrinterInfo NotRequired migration, get_job() -> JobInfo | None) are landing as part of the upcoming 3.0.0 release in home-assistant-libs#167 / home-assistant-libs#169 / home-assistant-libs#170. The file describes the end state; once 3.0.0 ships, everything in here will be true on main. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
agners
requested changes
May 12, 2026
- Drop "PrusaLink v2 API" framing — agners pointed out that the endpoints aren't versioned that way and the library also covers a few legacy paths (/api/version, /api/printer). Replace with "PrusaLink HTTP API" and explicitly mention both endpoint families. - Drop the blanket "suggest fixes at the library level" rule. As agners noted, that's case-by-case rather than a general principle. - Drop "thin wrapper" framing in favour of "the shape is weighted toward what serves the HA integration best". - Add concrete examples of helpful vs unhelpful Copilot feedback so the rule list isn't just abstract dos/don'ts. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
agners
approved these changes
May 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
GitHub Copilot's PR reviewer fires on this repo (we saw it on #167) but it has no project-specific guidance, so it sometimes suggests things that don't match our conventions (e.g. swapping
cast()for pydantic, commenting on style that CI already enforces). Adding.github/copilot-instructions.mdis the standard way to give it that guidance.What's in the file
TypedDicts withcast()at JSON boundaries is deliberate (not a gap to fill with pydantic/msgspec),NotRequired[T]overT | None,T | Nonefor return types where the resource may be absent.respxfor HTTP mocking,pytest.mark.integrationopt-in, deps inpyproject.toml.Timing note
Some of the conventions described (mypy strict, the
cast()pattern,PrinterInfomigrating toNotRequired,get_job() -> JobInfo | None) are landing as part of the upcoming 3.0.0 release in #167 / #169 / #170. The file describes the end state; everything in it will be true onmainonce those merge. Happy to wait on this PR until after 3.0.0 lands if you'd prefer — but the file is harmless before then, and waiting just means Copilot keeps reviewing PRs without context.Suggested follow-up: enable automatic review
Right now Copilot review fires on this repo on demand but not automatically — for example #169 and #170 (both just opened) haven't been reviewed by Copilot. If you'd like reviews to run on every new PR, it can be enabled in repo Settings → Code & automation → Copilot code review → "Automatically review new pull requests". Up to you whether the trade-off is worth it.
Test plan
home-assistant/core's.github/copilot-instructions.md.