| 1 | ## Code Review Guidelines for WSL |
| 2 | |
| 3 | When reviewing code, enforce the conventions in `.github/copilot-instructions.md`. Focus especially on these high-risk areas: |
| 4 | |
| 5 | ### ABI Safety (Critical) |
| 6 | Only the SDK-facing and public surfaces require a backward-compatible ABI. Every other COM interface (`wslc.idl`, `wslservice.idl`, etc.) is internal and non-stable: shipped in lockstep with its only clients, with the proxy/stub regenerated each build, so methods may be appended to those freely. Do **not** flag internal, non-stable interfaces. |
| 7 | - **Flag** ABI-breaking changes (new, removed, or reordered methods, changed struct layouts) only in the stable surfaces: `WSLCCompat.idl` (the WSLC SDK-facing layer, which must stay backward compatible) and the public plugin API (`WSLPluginHooksV1` / `WSLPluginAPIV1` structs in `WslPluginApi.h`). |
| 8 | - **Do not flag** new methods appended to internal, non-stable interfaces such as `IWSLCSession` in `wslc.idl`, or interfaces in `wslservice.idl`. |
| 9 | |
| 10 | ### Resource Safety |
| 11 | - **Flag** raw `CloseHandle()`, `delete`, `free()`, or manual resource cleanup — require WIL smart pointers |
| 12 | - **Flag** missing `NON_COPYABLE()` / `NON_MOVABLE()` on classes that hold resources |
| 13 | - **Flag** lock usage without `_Guarded_by_()` SAL annotations |
| 14 | |
| 15 | ### User-Facing Changes |
| 16 | - **Flag** hardcoded English strings — require `Localization::MessageXxx()` and Resources.resw entry |
| 17 | - **Flag** new `.wslconfig` settings without corresponding Resources.resw localization string |
| 18 | - **Flag** silent fallback on invalid config values — require `EMIT_USER_WARNING()` |
| 19 | |
| 20 | ### Error Handling |
| 21 | - **Flag** bare `if (FAILED(hr))` — require WIL macros |
| 22 | - **Flag** silently swallowed errors — require `CATCH_LOG()` or `LOG_IF_FAILED()` |
| 23 | - **Flag** telemetry events missing privacy data tags |