Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

feat(core): fail new-integration PRs that change files outside the integration - #103

Open
joostlek wants to merge 5 commits into
mainfrom
clanker/loving-cerf-ymm636
Open

joostlek wants to merge 5 commits into
mainfrom
clanker/loving-cerf-ymm636

Conversation

@joostlek

@joostlek joostlek commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Proposed change

New-integration PRs regularly come in with leftovers from a custom integration or from the contributor's local tooling (about 20 recent PRs). This catches them in two places:

  • forbidden-files (all PRs into dev): adds a core entry for README.md, hacs.json or info.md added directly in homeassistant/components/<domain>/ (case-insensitive). Existing READMEs (prometheus, tplink, zwave_js) can still be edited or removed. The message points to home-assistant.io for documentation.
  • new-integration-validation: fails when a new-integration PR changes files outside the new integration's own homeassistant/components/<domain>/ and tests/components/<domain>/ folders, other than an allowlist: homeassistant/generated/**, homeassistant/brands/*.json, CODEOWNERS, requirements_all.txt, requirements_test_all.txt, .strict-typing and mypy.ini. That covers copilot instructions, CLAUDE.md, AGENTS.md, .pre-commit-config.yaml and anything else, including other integrations. Integrations with quality_scale: internal are exempt, since they often extend hassfest, the loader or other integrations. Against the 30 most recently merged new-integration PRs in core this flags none; the only one touching other files (voice_support) is internal.

Type of change

  • Dependency upgrade
  • Bugfix
  • New rule or command
  • New repository manifest (enable the bot on another repo)
  • New feature (which adds functionality to an existing engine)
  • Code quality improvement or refactor (incl. tests)

Additional information

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass (mise run test). Your PR cannot be merged unless tests pass.
  • Lint and type checks pass (mise run check).
  • The code has been formatted (mise run format).
  • Tests have been added to verify that the new code works.
  • There is no commented out or debug code in this PR.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If behaviour, configuration, or environment variables changed:

  • README.md and .env.example have been updated accordingly.

https://claude.ai/code/session_01SLHDn8LpzmRxdqCcYbr6Zs


Generated by Claude Code

Flag README.md, hacs.json and info.md in the integration folder, and
changes to copilot instructions, CLAUDE.md, AGENTS.md or
.pre-commit-config.yaml.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SLHDn8LpzmRxdqCcYbr6Zs
README.md, hacs.json and info.md added in an integration folder are now
reported by the core forbidden-files check for every PR. The
new-integration check keeps flagging changes to copilot instructions,
CLAUDE.md, AGENTS.md and .pre-commit-config.yaml.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SLHDn8LpzmRxdqCcYbr6Zs
@joostlek joostlek changed the title feat(core): fail new-integration PRs that include stray files feat(core): fail PRs that add stray custom-integration and tooling files Nov 10, 2026
@justanotherariel

Copy link
Copy Markdown
Member

@copilot resolve the merge conflicts in this pull request

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SLHDn8LpzmRxdqCcYbr6Zs

Copy link
Copy Markdown
Member Author

Merge conflicts are resolved: I merged main into this branch in 1e3ae55, rebuilt on top of the new reauth/reconfigure and actions checks and the brand-folder forbidden-files entry. Lint, typecheck and the full test suite pass locally.


Generated by Claude Code

Copilot AI commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Resolved in 1e3ae55. The full test suite, lint, typecheck, and build pass.

Comment on lines +12 to +17
const STRAY_REPO_FILES = new Set([
"copilot-instructions.md",
"claude.md",
"agents.md",
".pre-commit-config.yaml",
]);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would it make sense to make it a whitelist instead of a blacklist? Say we ban everything that changes files outside the integration folder + a few exceptions like homeassistant/generated/**, CODEOWNERS, etc.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Hmm, I guess that could make sense, and we could make it so that we do allow it when the quality scale is internal, as adding a new entity platform or whatever feature, can cover more files (like the location suggestion PR also touches stuff like hassfest and the loader)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Switched to an allowlist in b899339. A new-integration PR may now only change the new integration's own homeassistant/components/<domain>/ and tests/components/<domain>/ folders, plus:

  • homeassistant/generated/**
  • homeassistant/brands/*.json
  • CODEOWNERS
  • requirements_all.txt and requirements_test_all.txt
  • .strict-typing and mypy.ini

Anything else, including other integrations, is listed (up to five paths) with a request to move it to a separate PR. When the new integration's manifest has quality_scale: internal, the check is skipped.

I checked this against the 30 most recently merged new-integration PRs in core. None of them would be flagged. The only one that touched files outside this list (voice_support: assist_pipeline, script/hassfest/quality_scale.py, tests/snapshots/test_bootstrap.ambr) is internal.


Generated by Claude Code

…its folder

Replace the list of stray tooling files with an allowlist: a new-integration
PR may only change its own integration and test folders, generated files,
brand metadata, CODEOWNERS, requirements and typing config. Internal
integrations are exempt, since they often extend hassfest, the loader or
other integrations.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SLHDn8LpzmRxdqCcYbr6Zs
@joostlek joostlek changed the title feat(core): fail PRs that add stray custom-integration and tooling files feat(core): fail new-integration PRs that change files outside the integration Nov 30, 2026
Use the newIntegrationDomains helper from main instead of a local copy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SLHDn8LpzmRxdqCcYbr6Zs
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