diff --git a/.github/instructions/copilot-instructions.md b/.github/instructions/copilot-instructions.md index 3f08bf63..467ff807 100644 --- a/.github/instructions/copilot-instructions.md +++ b/.github/instructions/copilot-instructions.md @@ -171,7 +171,8 @@ Before marking an implementation task as complete, perform the following in orde - **Do NOT** use `--no-verify` to bypass this check unless emergency hotfix 5. **Coverage Testing** (MANDATORY - Non-negotiable): - - **MANDATORY**: Patch coverage must cover 100% of modified lines (Codecov Patch view must be green). If patch coverage fails, add targeted tests for the missing patch line ranges. + - **Overall Coverage**: Minimum 85% coverage is MANDATORY and will fail the PR if not met. + - **Patch Coverage**: Developers should aim for 100% coverage of modified lines (Codecov Patch view). If patch coverage is incomplete, add targeted tests. However, patch coverage is a suggestion and will not block PR approval. - **Backend Changes**: Run the VS Code task "Test: Backend with Coverage" or execute `scripts/go-test-coverage.sh`. - Minimum coverage: 85% (set via `CHARON_MIN_COVERAGE` or `CPM_MIN_COVERAGE`). - If coverage drops below threshold, write additional tests to restore coverage. diff --git a/.github/instructions/testing.instructions.md b/.github/instructions/testing.instructions.md index cbfc5f9f..b682f4d7 100644 --- a/.github/instructions/testing.instructions.md +++ b/.github/instructions/testing.instructions.md @@ -148,8 +148,8 @@ Before pushing code, verify E2E coverage: ## 3. Coverage & Completion * **Coverage Gate:** A task is not "Complete" until a coverage report is generated. * **Threshold Compliance:** You must compare the final coverage percentage against the project's threshold (Default: 85% unless specified otherwise). If coverage drops, you must identify the "uncovered lines" and add targeted tests. -* **Patch Coverage Gate (Codecov):** If production code is modified, Codecov **patch coverage must be 100%** for the modified lines. Do not relax thresholds; add targeted tests. -* **Patch Triage Requirement:** Plans must include the exact missing/partial patch line ranges copied from Codecov’s **Patch** view. +* **Patch Coverage (Suggestion):** Codecov reports patch coverage as an indicator. While developers should aim for 100% coverage of modified lines, patch coverage is **not a hard requirement** and will not block PR approval. If patch coverage is low, consider adding targeted tests to improve the metric. +* **Review Patch Coverage:** When reviewing patch coverage reports, assess whether missing lines represent genuine gaps or are acceptable (e.g., error handling branches, deprecated code paths). Use the report to inform testing decisions, not as an absolute gate. ## 4. GORM Security Validation (Manual Stage) **Requirement:** All backend changes involving GORM models or database interactions must pass the GORM Security Scanner. diff --git a/codecov.yml b/codecov.yml index 37ef53f9..257756f8 100644 --- a/codecov.yml +++ b/codecov.yml @@ -30,7 +30,10 @@ coverage: - lines patch: default: + # Patch coverage is a suggestion only (not required to pass PR) + # Developers should aim for 100% but it won't block the PR target: 100% + required: false only: - lines