Skip to content

Commit be4ccb3

Browse files
authored
updated skill to help with pr validation (#4894)
1 parent 83262f9 commit be4ccb3

1 file changed

Lines changed: 72 additions & 1 deletion

File tree

.github/skills/pr-readiness/SKILL.md

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ name: pr-readiness
33
description: >
44
Verify that a pull request into microsoft/vscode-cmake-tools meets contribution
55
requirements. Use when preparing, reviewing, or finalizing a PR to check for a
6-
descriptive title, a meaningful description, and a properly formatted CHANGELOG entry.
6+
descriptive title, a meaningful description, a properly formatted CHANGELOG entry,
7+
code correctness, regression risks, adherence to existing patterns, and whether
8+
documentation updates are needed.
79
---
810

911
# PR Readiness
@@ -94,10 +96,79 @@ Bug Fixes:
9496
- Do **not** use past tense (write "Fix …", not "Fixed …").
9597
- Do **not** omit the issue or PR link.
9698

99+
### 4. Correctness
100+
101+
Review the code changes for logical correctness:
102+
103+
- **Both operating modes**: If the change touches shared logic (configure, build, test, targets, environment), verify it handles both *presets mode* and *kits/variants mode*. Check for `useCMakePresets` branching where appropriate.
104+
- **Both generator types**: If the change involves build-type logic, verify it handles both single-config generators (`CMAKE_BUILD_TYPE` at configure time) and multi-config generators (`--config` at build time).
105+
- **Edge cases**: Look for off-by-one errors, null/undefined access, missing `await` on async calls, and unhandled promise rejections.
106+
- **Error handling**: Verify errors are not silently swallowed. Top-level event handlers should use `rollbar.invokeAsync()` / `rollbar.invoke()`. Empty `catch` blocks are a red flag.
107+
- **Cross-platform**: Check for hardcoded path separators (`/` or `\\`), case-sensitive env var assumptions, or platform-specific APIs used without guards. Paths must use `path.join()` / `path.normalize()`.
108+
109+
### 5. Regression Risks
110+
111+
Identify areas where the change could break existing behavior:
112+
113+
- **Shared utilities**: Changes to `src/expand.ts`, `src/proc.ts`, `src/shlex.ts`, or `src/util.ts` affect many callers — verify all call sites still behave correctly.
114+
- **Driver base class**: Changes to `cmakeDriver.ts` propagate to `cmakeFileApiDriver.ts`, `cmakeLegacyDriver.ts`, and `cmakeServerDriver.ts`. Check that subclass overrides are still compatible.
115+
- **Preset merging**: Changes to `presetsController.ts` or `presetsParser.ts` can alter how presets resolve — verify with nested `include` chains and `CMakeUserPresets.json` overrides.
116+
- **Settings**: Adding or renaming a setting in `package.json` without updating `src/config.ts` (or vice versa) causes silent failures.
117+
- **Task provider**: Changes to `cmakeTaskProvider.ts` can break `tasks.json` definitions that users have already configured.
118+
- **Public API / extensibility**: Changes to exports in `src/api.ts` or types in `EXTENSIBILITY.md` can break dependent extensions.
119+
- **Test coverage**: Flag changes to critical paths that lack corresponding test updates, especially in `src/drivers/`, `src/presets/`, and `src/kits/`. See also section 7 (Test Coverage) for detailed test review guidance.
120+
121+
### 6. Adherence to Existing Patterns
122+
123+
Verify the change follows the project's established conventions:
124+
125+
- **Import style**: Uses `@cmt/*` path aliases (not relative paths from outside `src/`). Uses `import * as nls from 'vscode-nls'` for localization.
126+
- **Logging**: Uses `logging.createLogger('module-name')` — never `console.log`.
127+
- **Localization**: All user-visible strings use `localize('message.key', 'Message text')` with the `vscode-nls` boilerplate at the top of the file.
128+
- **Settings access**: Reads settings through `ConfigurationReader` (`src/config.ts`) — never calls `vscode.workspace.getConfiguration()` directly.
129+
- **Telemetry**: Uses helpers from `src/telemetry.ts` — never calls the VS Code telemetry API directly.
130+
- **Data access**: Uses canonical data paths (e.g., `CMakeProject.targets` for targets, `CMakeDriver.cmakeCacheEntries` for cache) — never parses CMake files or cache directly.
131+
- **Async patterns**: Prefers `async`/`await` over `.then()` chains (exception: fire-and-forget UI calls).
132+
- **Naming and structure**: New files are placed in the correct layer directory (see architecture table in `.github/copilot-instructions.md`). New commands are registered in `src/extension.ts`.
133+
134+
### 7. Test Coverage
135+
136+
Verify that the PR includes adequate tests for the changes:
137+
138+
- **New functionality**: Any new function, command, setting, or behavior branch should have corresponding tests. If the change adds a new helper or utility, check that it has unit tests covering its inputs and edge cases.
139+
- **Bug fixes**: A bug fix should include at least one test that would have caught the original bug — i.e., a test that fails on the base branch and passes with the fix applied.
140+
- **Changed behavior**: If existing behavior is modified, check that existing tests are updated to reflect the new behavior and that no tests are silently broken or deleted without justification.
141+
- **Test location**: Unit tests that don't require VS Code APIs belong in `test/unit-tests/backend/` and run via `yarn backendTests`. Tests that require VS Code belong in `test/unit-tests/` and run via `yarn unitTests`. Check that new tests are placed in the correct location.
142+
- **Test quality**: Tests should be specific and descriptive:
143+
- Test names should clearly state what is being tested and the expected outcome.
144+
- Tests should assert specific values, not just "no error thrown".
145+
- Tests should cover both positive cases (expected input → expected output) and negative/edge cases (invalid input, boundary conditions, fallback paths).
146+
- Comments in tests should be accurate and not misleading about what the test actually exercises.
147+
- **Coverage gaps to flag**: Pay special attention to:
148+
- Code paths that touch `src/drivers/`, `src/presets/`, or `src/kits/` — these are critical and should have test coverage for any non-trivial changes.
149+
- Fallback/error paths — if the PR adds a fallback (e.g., "if X fails, try Y"), both the success and fallback paths should be tested.
150+
- Platform-specific branches — if the code branches on `process.platform`, each branch should ideally be covered.
151+
- **When tests are not feasible**: Some changes (e.g., pure UI wiring, VS Code API integration) are difficult to unit test. In these cases, verify that the manual-checklist or PR description explains how to manually verify the change, and flag the gap rather than ignoring it.
152+
153+
### 8. Documentation Updates
154+
155+
Check whether the change requires documentation updates:
156+
157+
- **New or changed settings**: Must be reflected in all three locations — `package.json` (`contributes.configuration`), `src/config.ts` (`ConfigurationReader`), and `docs/cmake-settings.md`.
158+
- **New commands**: Must be documented in `package.json` (`contributes.commands`) and referenced in the relevant docs page under `docs/`.
159+
- **User-visible behavior changes**: If the change alters how a feature works (not just fixes a bug), check whether `docs/` pages describing that feature need updating.
160+
- **Extensibility changes**: If `src/api.ts` or public types change, update `EXTENSIBILITY.md`.
161+
- **README**: If a new major feature is added, check whether `README.md` should mention it.
162+
97163
## Applying This Skill
98164

99165
When reviewing or preparing a PR:
100166

101167
1. **Check the title** — rewrite it if it is vague or missing context.
102168
2. **Check the description** — ensure it explains what, why, and (if needed) how.
103169
3. **Check `CHANGELOG.md`** — verify an entry exists under the current version in the correct section with the correct format. If missing, add one.
170+
4. **Check correctness** — review code for logical errors, missing mode/generator handling, cross-platform issues, and error handling gaps.
171+
5. **Check regression risks** — identify areas where the change could break existing behavior and flag missing test coverage for critical paths.
172+
6. **Check pattern adherence** — verify the change follows established import, logging, localization, settings access, and architectural conventions.
173+
7. **Check test coverage** — verify that new or changed behavior has corresponding tests, bug fixes include regression tests, and tests are placed in the correct location with good quality.
174+
8. **Check documentation** — verify that new or changed settings, commands, and behavior are reflected in the appropriate docs.

0 commit comments

Comments
 (0)