docs: add coding guidelines and copilot instructions#482
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds repository-wide coding standards and ensures the agent workflows (and Copilot) explicitly read/follow them, while updating a small bit of code/docs to comply with the new TYPE_CHECKING ban.
Changes:
- Add
.github/CODING_GUIDELINES.mdand.github/copilot-instructions.mdto standardize contributor/agent behavior. - Update all agent workflow instruction files to reference the coding guidelines.
- Remove
TYPE_CHECKING-based typing import usage and related stale references (plus coverage exclusion cleanup).
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/copilot_usage/logging_config.py |
Removes TYPE_CHECKING guard and adds runtime import loguru to support loguru.Record annotation usage. |
src/copilot_usage/docs/changelog.md |
Updates changelog entry to reflect the new logging import approach. |
src/copilot_usage/docs/architecture.md |
Updates component documentation to reflect runtime loguru import approach. |
pyproject.toml |
Removes coverage exclusion line for if TYPE_CHECKING:. |
.github/workflows/test-analysis.md |
Instructs agent to read coding guidelines for standards context. |
.github/workflows/review-responder.md |
Requires coding guideline compliance when addressing review comments. |
.github/workflows/quality-gate.md |
Adds explicit guideline compliance verification step. |
.github/workflows/issue-implementer.md |
Requires implementer to follow coding guidelines for all authored code. |
.github/workflows/code-health.md |
Uses coding guidelines as the standard for flagging cleanup items. |
.github/workflows/ci-fixer.md |
Requires coding guideline compliance when fixing CI. |
.github/copilot-instructions.md |
Adds Copilot instruction pointer to the coding guidelines + repo layout overview. |
.github/CODING_GUIDELINES.md |
Introduces repo-wide coding standards (typing, imports, error handling, testing, security, formatting). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add .github/CODING_GUIDELINES.md with coding standards for all contributors (human and AI): type safety, data modelling, naming, error handling, testing, security, formatting. Add .github/copilot-instructions.md as a pointer — Copilot code review automatically reads this file and follows the link to the guidelines. Update all 6 agent workflow .md files (issue-implementer, review-responder, ci-fixer, quality-gate, code-health, test-analysis) to read and follow the guidelines. Remove TYPE_CHECKING from logging_config.py — replaced with runtime import loguru + string annotation, consistent with the new ban. Remove stale TYPE_CHECKING coverage exclusion from pyproject.toml. Update architecture.md and changelog.md to reflect the change. Closes #110 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
8312d72 to
0a425c6
Compare
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.
Summary
Adds coding guidelines and wires them into the entire agent pipeline.
New files
.github/CODING_GUIDELINES.md— coding standards for all contributors: type safety (pyright strict, no duck typing, no getattr/hasattr, no assert for validation, TYPE_CHECKING banned), data modelling (Pydantic for JSON/API, Click for CLI, frozen dataclasses internally), error handling, logging (loguru), testing, security, formatting..github/copilot-instructions.md— pointer to the guidelines file. Copilot code review reads this automatically and follows the link (verified empirically on PRs test: verify Copilot reads copilot-instructions.md from PR branch #478 and test: verify Copilot follows guidelines link (clean retest) #479).Agent workflow updates
All 6 agent workflows now read and follow the guidelines:
issue-implementer.md— write code following guidelinesreview-responder.md— fix review comments following guidelinesci-fixer.md— don't introduce violations while fixing CIquality-gate.md— verify compliance as part of merge evaluationcode-health.md— flag violations in existing code on maintest-analysis.md— context for coding standardsCode changes
logging_config.py— removedTYPE_CHECKINGguard, replaced with runtimeimport loguru+ string annotation (complies with new ban)pyproject.toml— removed staleif TYPE_CHECKING:coverage exclusionarchitecture.md/changelog.md— updated stale TYPE_CHECKING referencesHow it works
No new workflow needed. The existing pipeline handles everything:
Closes #110