Azure / Azure/azure-dev

[auto] instructions: add self-defending-test and comment-sync rules from PR review signal

Open
#9,700 0 comments 0 reactions 0 assignees View on GitHub
agentic-workflows automation copilot-instructions customer-reported engineering item
Dominant language
Go
Stars
569
Forks
364
Avg merge
2d 19h
Merged PRs (30d)
136

Description

Proposed by the [Update Instructions From PR Reviews](.github/workflows/update-instructions-from-pr-reviews.md) workflow.

**Settings**
- Repo mined: `Azure/azure-dev`
- Range: last 6 months (no prior successful run found)
- Branch: [`automated/update-instructions-from-pr-reviews` @ d577ab7](https://github.com/Azure/azure-dev/tree/automated/update-instructions-from-pr-reviews)

**Stats**
- Signal ratio: ~60 human comments kept / ~80 dropped (bots, acks, short replies)
- Resolved PRs examined: 27 merged PRs

**PR comment themes promoted**

- **Self-defending tests** — tests that pass even when the behavior they protect is removed are a false negative; assert specific observable behavior, not just a side-effect flag — _[#8805](https://github.com/Azure/azure-dev/pull/8805), [#9091](https://github.com/Azure/azure-dev/pull/9091)_ (`RickWinter`, `jongio`)
- **Keep code comments in sync with code** — when a function or value changes, update every comment that describes it: doc comments displaced from their function, inline comments naming removed values, and table rows describing stale emit conditions — _[#9091](https://github.com/Azure/azure-dev/pull/9091)_ (`jongio`, 4+ instances)

Both rules were added to `.github/instructions/go.instructions.md` (scoped to `**/*.go`).

> Generated by [Update Instructions From PR Reviews](https://github.com/Azure/azure-dev/actions/runs/32708435518) · 102.4 AIC · ⌖ 12.2 AIC · ⊞ 8.2K · [◷](https://github.com/search?q=repo%3AAzure%2Fazure-dev+%22gh-aw-workflow-id%3A+update-instructions-from-pr-reviews%22&type=pullrequests)

---

> [!NOTE]
> This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
> The changes have been pushed to branch `automated/update-instructions-from-pr-reviews`.
>
> **[Click here to create the pull request](https://github.com/Azure/azure-dev/compare/main...automated/update-instructions-from-pr-reviews?expand=1&title=%5Bauto%5D%20instructions%3A%20add%20self-defending-test%20and%20comment-sync%20rules%20from%20PR%20review%20signal)**

To fix the permissions issue, go to **Settings** → **Actions** → **General** and enable **Allow GitHub Actions to create and approve pull requests**. See also: [gh-aw FAQ](https://github.github.com/gh-aw/reference/faq/#why-is-my-create-pull-request-workflow-failing-with-github-actions-is-not-permitted-to-create-or-approve-pull-requests)

Show patch preview (59 of 59 lines)

```diff
From d577ab7f866562b517967dcd3200adc600a43018 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]"
Date: Mon, 24 Aug 2026 08:57:13 +0000
Subject: [PATCH] instructions: add self-defending tests and comment-sync rules
from PR review signal
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Two recurring reviewer asks promoted to standing rules:

1. Self-defending tests (#8805, #9091): reviewers RickWinter and jongio
repeatedly flagged tests that pass even when the behavior they protect
is removed. Added guidance to assert specific observable behavior and
not rely on mock-ordering or side-effect-only checks.

2. Keep code comments in sync (#9091): jongio flagged 4+ stale comments
in a single PR — doc comments separated from their functions, inline
comments naming removed values, and table rows describing stale behavior.
Added guidance to update all co-located descriptions when code changes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
.github/instructions/go.instructions.md | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)

diff --git a/.github/instructions/go.instructions.md b/.github/instructions/go.instructions.md
index c39dc04..c36a628 100644
--- a/.github/instructions/go.instructions.md
+++ b/.github/instructions/go.instructions.md
@@ -31,3 +31,24 @@ all existing imports or declarations.

- When reviewing command input resolution, explicit CLI args and flags should win over defaults. Do not prompt the user toward a different default when they provided a valid new value; reserve prompts for ambiguous choices and preserve deterministic `--no-prompt` behavior for CI/scripts.
- When filtering AI models or quota data by location, keep location-specific usage data associated with only the models available in that location. Empty or unknown usage data from an unrelated location must not make a model eligible elsewhere; add
... (truncated)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.