BlueGit

ict rusty-teams

docs: AGENTS.md for contributors' agents, two reviews before a PR

- Minimal AGENTS.md: read-first, commands, rules, PR steps; CLAUDE.md imports it
- At least two independent reviews of the diff before a PR leaves draft, listed in the PR
- CONTRIBUTING points to AGENTS.md for commands; GUARDRAILS notes docs/research stays local
- cargo fmt on calling (main was not fmt-clean)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

metis Daniel Däschle · pushed by metis

Authored 2026-11-25 · 6 days ago

Hash
ed868b9299d0bb38acd86088902804ef76a40d34
Parent
c6ebbc3c
6 files changed +46 −12
.github/pull_request_template.md +4 −0
@@ -6,6 +6,10 @@
6 6
7 7 <!-- Which tool and model wrote the change, e.g. "Claude Code, Opus 4.5" or "Copilot, GPT-5". "None" if written by hand. -->
8 8
9 ## Review
10
11 <!-- At least two independent reviews of the diff (see AGENTS.md). One line per review (what ran it), then one line per finding: fixed, or not fixed and why. -->
12
9 13 ## Screenshot
10 14
11 15 <!-- For every change that is visible in the UI: one shot of the changed area. Delete the section otherwise.
@@ -6,6 +6,10 @@
6
6
7<!-- Which tool and model wrote the change, e.g. "Claude Code, Opus 4.5" or "Copilot, GPT-5". "None" if written by hand. -->
7<!-- Which tool and model wrote the change, e.g. "Claude Code, Opus 4.5" or "Copilot, GPT-5". "None" if written by hand. -->
8
8
9## Review
10
11<!-- At least two independent reviews of the diff (see AGENTS.md). One line per review (what ran it), then one line per finding: fixed, or not fixed and why. -->
12
9## Screenshot
13## Screenshot
10
14
11<!-- For every change that is visible in the UI: one shot of the changed area. Delete the section otherwise.
15<!-- For every change that is visible in the UI: one shot of the changed area. Delete the section otherwise.
AGENTS.md added +34 −0
@@ -0,0 +1,34 @@
1 # AGENTS.md
2
3 Rusty Teams: a native Microsoft Teams client in Rust (GPUI). It must behave like the Teams web client.
4
5 ## Read first
6
7 - `GUARDRAILS.md`: where the app must match Teams and where it may differ. It wins over everything else.
8 - `CONTRIBUTING.md` before you start: scope, when to open an issue first, PR rules.
9
10 ## Commands
11
12 | Task | Command |
13 |---|---|
14 | Run with demo data | `cargo run -p app -- --demo` |
15 | Format | `cargo fmt`. Never `cargo fmt --all`. It rewrites `vendor/`. |
16 | Test | `cargo test -p <package> <module>`: only the changed module. The package is `name` in the crate's `Cargo.toml` (`crates/core` is `teams-core`). |
17 | UI check | `cargo test -p app layout_guard`, then `cargo build -p app && scripts/headless-shot.sh "$(mktemp --suffix=.png)"`. Linux only, needs Xvfb, xdotool and ImageMagick. The script header lists the input options. |
18
19 Code under `cfg(windows)` is not compiled by tests on Linux or macOS. CI builds it on Windows. If you change it and cannot build it, say so in the PR.
20
21 ## Rules
22
23 - No data from a real Teams account in code, tests, logs or screenshots. Use `--demo`.
24 - Testing on a real account follows the table in `GUARDRAILS.md`: nothing to other people without the account owner's yes, clean up afterwards.
25 - Teams behaviour you copy needs a source. `docs/research/` is local and may be missing. Name the source in the PR (Teams docs, a screenshot, the web client). If you have none, ask in the issue.
26 - `vendor/` holds our patched forks. Change it only when the fix belongs there, and say so in the commit body.
27 - Do not commit planning or process folders (OpenSpec, task lists, notes). The PR description carries the why.
28
29 ## Before the PR leaves draft
30
31 1. Commit, run `git fetch origin`, and get at least two independent reviews of `git diff origin/main...HEAD`.
32 2. A reviewer must not have written the change. Use a fresh agent session, a subagent, or a review command such as `/code-review` or `/review`. On Copilot, a Copilot code review on the draft PR counts as one.
33 3. Fix or answer every valid finding. In the PR's Review section, write one line per review (what ran it), then one line per finding: fixed, or not fixed and why.
34 4. Commit and PR title: `type(scope): message`. Type is one of `feat fix perf refactor docs test chore ci build`, the scope is lowercase, no emoji. Write it from the user's view. It becomes the release note line.
@@ -0,0 +1,34 @@
1# AGENTS.md
2
3Rusty Teams: a native Microsoft Teams client in Rust (GPUI). It must behave like the Teams web client.
4
5## Read first
6
7- `GUARDRAILS.md`: where the app must match Teams and where it may differ. It wins over everything else.
8- `CONTRIBUTING.md` before you start: scope, when to open an issue first, PR rules.
9
10## Commands
11
12| Task | Command |
13|---|---|
14| Run with demo data | `cargo run -p app -- --demo` |
15| Format | `cargo fmt`. Never `cargo fmt --all`. It rewrites `vendor/`. |
16| Test | `cargo test -p <package> <module>`: only the changed module. The package is `name` in the crate's `Cargo.toml` (`crates/core` is `teams-core`). |
17| UI check | `cargo test -p app layout_guard`, then `cargo build -p app && scripts/headless-shot.sh "$(mktemp --suffix=.png)"`. Linux only, needs Xvfb, xdotool and ImageMagick. The script header lists the input options. |
18
19Code under `cfg(windows)` is not compiled by tests on Linux or macOS. CI builds it on Windows. If you change it and cannot build it, say so in the PR.
20
21## Rules
22
23- No data from a real Teams account in code, tests, logs or screenshots. Use `--demo`.
24- Testing on a real account follows the table in `GUARDRAILS.md`: nothing to other people without the account owner's yes, clean up afterwards.
25- Teams behaviour you copy needs a source. `docs/research/` is local and may be missing. Name the source in the PR (Teams docs, a screenshot, the web client). If you have none, ask in the issue.
26- `vendor/` holds our patched forks. Change it only when the fix belongs there, and say so in the commit body.
27- Do not commit planning or process folders (OpenSpec, task lists, notes). The PR description carries the why.
28
29## Before the PR leaves draft
30
311. Commit, run `git fetch origin`, and get at least two independent reviews of `git diff origin/main...HEAD`.
322. A reviewer must not have written the change. Use a fresh agent session, a subagent, or a review command such as `/code-review` or `/review`. On Copilot, a Copilot code review on the draft PR counts as one.
333. Fix or answer every valid finding. In the PR's Review section, write one line per review (what ran it), then one line per finding: fixed, or not fixed and why.
344. Commit and PR title: `type(scope): message`. Type is one of `feat fix perf refactor docs test chore ci build`, the scope is lowercase, no emoji. Write it from the user's view. It becomes the release note line.
CLAUDE.md added +1 −0
@@ -0,0 +1 @@
1 @AGENTS.md
@@ -0,0 +1 @@
1@AGENTS.md
CONTRIBUTING.md +3 −10
@@ -16,6 +16,7 @@ Most of this code is written with AI agents, and that is welcome here. Just say
16 16 | Rule | Detail |
17 17 |---|---|
18 18 | Name the model | Every pull request names the tool and model that wrote the change. It tells the reviewer how closely to look. "None" is a valid answer. |
19 | Review before the PR | At least two independent reviews of the local diff, each by a reviewer that did not write the change (a fresh agent session or subagent, or a review command). Fix or answer every valid finding and list them in the PR. Details in [AGENTS.md](AGENTS.md#before-the-pr-leaves-draft). |
19 20 | Report only what ran | Say what you tested and what you could not run. No "works" without a run. |
20 21 | Keep it short | A summary of a few sentences. Long generated descriptions get sent back. |
21 22 | No real data | Nothing from a real Teams account in code, tests, logs or screenshots: no names, chats, ids or tokens. Use `--demo`. |
@@ -23,7 +24,7 @@ Most of this code is written with AI agents, and that is welcome here. Just say
23 24 ## Pull requests
24 25
25 26 - One topic per pull request. No unrelated refactors, no formatting of files you did not change.
26 - The template asks for three things: a summary, the AI model, and a screenshot for UI changes (taken with demo data).
27 - The template asks for four things: a summary, the AI model, the reviews that ran, and a screenshot for UI changes (taken with demo data).
27 28 - CI runs the tests on Linux and Windows for every pull request.
28 29 - Commit and PR title format: `type(scope): message`, with `type` one of `feat`, `fix`, `perf`, `refactor`, `docs`, `test`, `chore`, `ci`, `build`, a lowercase scope and no emoji. CI checks the PR title.
29 30 - The PR title becomes the squash commit and a line in the release notes (`feat` under New, `fix` under Fixes). Write it as a user would read it: `fix(chat): a sent image no longer blinks`, not `fix(chat): handle download race`.
@@ -31,15 +32,7 @@ Most of this code is written with AI agents, and that is welcome here. Just say
31 32
32 33 ## Build and test
33 34
34 Build setup and all commands are in the [README](README.md#quick-start), the Windows cross build in [docs/build-windows.md](docs/build-windows.md).
35
36 | Task | Command |
37 |---|---|
38 | Run with demo data | `cargo run -p app -- --demo` |
39 | Format | `cargo fmt` (not `--all`, it rewrites `vendor/`) |
40 | Tests of the changed module | `cargo test -p <crate> <module>` |
41 | Layout guard for UI changes | `cargo test -p app layout_guard` |
42 | Screenshot without a display | `cargo build -p app && scripts/headless-shot.sh shot.png` |
35 Build setup is in the [README](README.md#quick-start), the Windows cross build in [docs/build-windows.md](docs/build-windows.md). The everyday commands (demo run, format, tests, UI check) are in [AGENTS.md](AGENTS.md#commands).
43 36
44 37 ## Code
45 38
@@ -16,6 +16,7 @@ Most of this code is written with AI agents, and that is welcome here. Just say
16| Rule | Detail |
16| Rule | Detail |
17|---|---|
17|---|---|
18| Name the model | Every pull request names the tool and model that wrote the change. It tells the reviewer how closely to look. "None" is a valid answer. |
18| Name the model | Every pull request names the tool and model that wrote the change. It tells the reviewer how closely to look. "None" is a valid answer. |
19| Review before the PR | At least two independent reviews of the local diff, each by a reviewer that did not write the change (a fresh agent session or subagent, or a review command). Fix or answer every valid finding and list them in the PR. Details in [AGENTS.md](AGENTS.md#before-the-pr-leaves-draft). |
19| Report only what ran | Say what you tested and what you could not run. No "works" without a run. |
20| Report only what ran | Say what you tested and what you could not run. No "works" without a run. |
20| Keep it short | A summary of a few sentences. Long generated descriptions get sent back. |
21| Keep it short | A summary of a few sentences. Long generated descriptions get sent back. |
21| No real data | Nothing from a real Teams account in code, tests, logs or screenshots: no names, chats, ids or tokens. Use `--demo`. |
22| No real data | Nothing from a real Teams account in code, tests, logs or screenshots: no names, chats, ids or tokens. Use `--demo`. |
@@ -23,7 +24,7 @@ Most of this code is written with AI agents, and that is welcome here. Just say
23## Pull requests
24## Pull requests
24
25
25- One topic per pull request. No unrelated refactors, no formatting of files you did not change.
26- One topic per pull request. No unrelated refactors, no formatting of files you did not change.
26- The template asks for three things: a summary, the AI model, and a screenshot for UI changes (taken with demo data).
27- The template asks for four things: a summary, the AI model, the reviews that ran, and a screenshot for UI changes (taken with demo data).
27- CI runs the tests on Linux and Windows for every pull request.
28- CI runs the tests on Linux and Windows for every pull request.
28- Commit and PR title format: `type(scope): message`, with `type` one of `feat`, `fix`, `perf`, `refactor`, `docs`, `test`, `chore`, `ci`, `build`, a lowercase scope and no emoji. CI checks the PR title.
29- Commit and PR title format: `type(scope): message`, with `type` one of `feat`, `fix`, `perf`, `refactor`, `docs`, `test`, `chore`, `ci`, `build`, a lowercase scope and no emoji. CI checks the PR title.
29- The PR title becomes the squash commit and a line in the release notes (`feat` under New, `fix` under Fixes). Write it as a user would read it: `fix(chat): a sent image no longer blinks`, not `fix(chat): handle download race`.
30- The PR title becomes the squash commit and a line in the release notes (`feat` under New, `fix` under Fixes). Write it as a user would read it: `fix(chat): a sent image no longer blinks`, not `fix(chat): handle download race`.
@@ -31,15 +32,7 @@ Most of this code is written with AI agents, and that is welcome here. Just say
31
32
32## Build and test
33## Build and test
33
34
34Build setup and all commands are in the [README](README.md#quick-start), the Windows cross build in [docs/build-windows.md](docs/build-windows.md).
35Build setup is in the [README](README.md#quick-start), the Windows cross build in [docs/build-windows.md](docs/build-windows.md). The everyday commands (demo run, format, tests, UI check) are in [AGENTS.md](AGENTS.md#commands).
35
36| Task | Command |
37|---|---|
38| Run with demo data | `cargo run -p app -- --demo` |
39| Format | `cargo fmt` (not `--all`, it rewrites `vendor/`) |
40| Tests of the changed module | `cargo test -p <crate> <module>` |
41| Layout guard for UI changes | `cargo test -p app layout_guard` |
42| Screenshot without a display | `cargo build -p app && scripts/headless-shot.sh shot.png` |
43
36
44## Code
37## Code
45
38
GUARDRAILS.md +1 −1
@@ -51,6 +51,6 @@ Clean up after every test: delete test messages and recordings, hide test meetin
51 51 ## Before building
52 52
53 53 1. Find how Teams does it: `docs/research/*.md`, then the JS bundle of the Teams web client.
54 2. Write findings back to `docs/research/<topic>.md`.
54 2. Write findings back to `docs/research/<topic>.md`. That folder stays local and untracked; only `internal-endpoints.md` is committed.
55 55 3. If a change has to break a "must match" rule, name the deviation in the commit body.
56 56 4. If the change picks one reasonable path over another, and that choice is not already a rule here, add a short note under `docs/decisions/` (see `docs/decisions/README.md`).
@@ -51,6 +51,6 @@ Clean up after every test: delete test messages and recordings, hide test meetin
51## Before building
51## Before building
52
52
531. Find how Teams does it: `docs/research/*.md`, then the JS bundle of the Teams web client.
531. Find how Teams does it: `docs/research/*.md`, then the JS bundle of the Teams web client.
542. Write findings back to `docs/research/<topic>.md`.
542. Write findings back to `docs/research/<topic>.md`. That folder stays local and untracked; only `internal-endpoints.md` is committed.
553. If a change has to break a "must match" rule, name the deviation in the commit body.
553. If a change has to break a "must match" rule, name the deviation in the commit body.
564. If the change picks one reasonable path over another, and that choice is not already a rule here, add a short note under `docs/decisions/` (see `docs/decisions/README.md`).
564. If the change picks one reasonable path over another, and that choice is not already a rule here, add a short note under `docs/decisions/` (see `docs/decisions/README.md`).
crates/calling/src/device_watch.rs +3 −1
@@ -57,7 +57,9 @@ pub fn endpoint_delta(previous: &[String], current: &[String]) -> Vec<String> {
57 57 for id in previous.iter().chain(current.iter()) {
58 58 let before = previous.iter().any(|key| key.eq_ignore_ascii_case(id));
59 59 let after = current.iter().any(|key| key.eq_ignore_ascii_case(id));
60 let seen = changed.iter().any(|key: &String| key.eq_ignore_ascii_case(id));
60 let seen = changed
61 .iter()
62 .any(|key: &String| key.eq_ignore_ascii_case(id));
61 63 if before != after && !seen {
62 64 changed.push(id.clone());
63 65 }
@@ -57,7 +57,9 @@ pub fn endpoint_delta(previous: &[String], current: &[String]) -> Vec<String> {
57 for id in previous.iter().chain(current.iter()) {
57 for id in previous.iter().chain(current.iter()) {
58 let before = previous.iter().any(|key| key.eq_ignore_ascii_case(id));
58 let before = previous.iter().any(|key| key.eq_ignore_ascii_case(id));
59 let after = current.iter().any(|key| key.eq_ignore_ascii_case(id));
59 let after = current.iter().any(|key| key.eq_ignore_ascii_case(id));
60 let seen = changed.iter().any(|key: &String| key.eq_ignore_ascii_case(id));
60 let seen = changed
61 .iter()
62 .any(|key: &String| key.eq_ignore_ascii_case(id));
61 if before != after && !seen {
63 if before != after && !seen {
62 changed.push(id.clone());
64 changed.push(id.clone());
63 }
65 }