1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
---
name: review-changes
description: Review a pending TeachOS change: a branch or merge request against its base, staged changes, or unstaged changes. Use when asked to review a diff, MR, branch, commit range, or "my changes". For auditing existing code with no diff, use review-subsystem instead.
---
# Review pending changes
Mentor mode applies (AGENTS.md §1): report findings and direction, never patches.
Quote at most a few lines of the changed code to point at a problem.
Deliver the report in the conversation. Do not write it to the repository.
## 1. Pin down the scope
Ask only if unclear.
State which mode you used and the base you chose.
- Branch or MR: `git diff <base>...<head>` and `git log --oneline <base>..<head>`.
Base is `origin/develop`, unless the branch belongs to a thesis (see CONTRIBUTING.rst: `<semester>/develop`, e.g. `fa26/develop`).
Then use that branch.
If you can't tell which, ask.
- Staged: `git diff --staged`.
- Unstaged: `git diff`, plus `git status` for untracked files.
Diffs omit new untracked files, so read those directly.
- If several are non-empty, review what was asked and mention the rest.
Run `git diff --stat` first.
If the change is very large [threshold: ~800 changed lines or ~25 files], say so and propose a reading order (headers, then implementations, then tests) instead of skimming.
## 2. Establish intent before judging
Read commit messages and any MR text.
Write 2-3 sentences on what you think the change is for.
If you can't tell, that is your first finding.
Note whether it is a single logical change (CONTRIBUTING.rst asks for that).
## 3. Read the code, not just the hunks
For each touched non-test file, read the whole enclosing function or class and the header it implements.
For changed signatures, find callers and implementors with `git grep`.
A review from hunks alone misses most real problems.
## 4. What to review
CI covers mechanical style (clang-format, clang-tidy: trailing return types, naming, `enum class`, and so on).
Don't spend findings on those unless the tools were not run.
Lambdas are not covered by the trailing-return check, so glance at them.
Focus on:
a. Correctness:
Trace the real logic, including error paths, boundary values, integer width and sign, lifetimes and ownership, resource cleanup.
b. Architecture against recorded decisions:
AGENTS.md §4 and `docs/briefs/`.
Flag a change that contradicts or silently extends a documented decision.
If the decision isn't documented, say so.
Don't invent one.
c. Execution context and concurrency:
Who calls this, from which context (boot, thread, interrupt), holding what?
Lock ordering.
RAII guards.
d. Freestanding discipline:
Includes outside the freestanding set, hidden allocation, exceptions or RTTI, large stack objects.
e. Tests:
Is new behavior covered, including edge and error cases?
Do tests check the contract or just mirror the implementation?
Name 2-4 missing cases in prose.
f. Clarity for the audience:
Could a bachelor student follow it?
Naming, function size, comments that explain why, abstractions that earn their keep.
g. Docs:
Does a public interface change appear in `docs/`?
Are doc claims still true?
h. Hygiene:
Moved or renamed files: is CMake updated?
Debug leftovers, commented-out code, unowned TODOs, unrelated changes mixed in.
Commit messages against `subsystem: imperative summary`.
Critique only, no rewrites.
Detection helpers (read-only, limit to changed files):
- Layering: `git grep -nE '\b(asm|__asm__)\b|rdmsr|wrmsr' -- kernel libs`
- Banned machinery: `git grep -nE 'dynamic_cast|typeid|\bthrow\b|friend '`
- Hosted headers outside tests: `git grep -nE '#include <(vector|memory|string|map|iostream)>'`
## 5. Verify what you can
Build out of tree and run the host tests (`cmake --preset bht`, `cmake --build --preset bht-dbg`, `ctest --preset bht-dbg`).
Also `clang-format --dry-run --Werror <changed files>` and `reuse lint`.
Anything you can't run goes under "Not verified".
## 6. Report
1. Summary: your reading of the intent, then a one-line verdict.
2. Findings:
Most severe first.
Each has: location (`path:line`), what is wrong, why it matters (cite the principle, decision or precedent), and a direction to fix it, not a patch.
Severity: Blocking / Should fix / Consider / Question.
Mark confidence: verified in code or suspected.
3. Questions for the author where intent is unclear.
Don't assume a bug.
4. Not verified: what you did not run or read.
Rules: a review that finds nothing must still say what was checked.
Look for real problems, including in code the author considers finished.
Separate what you verified from what you suspect.
When citing precedent (Linux, FreeBSD, NetBSD, xnu, Windows, ACPI/UEFI specs), say how sure you are and provide references when possible.
|