Debian Codegraph @

ansible_collections/community/clickhouse/.agents/skills/pr-review/SKILL.md

raw symbols SCIP
1 ---
2 name: pr-review
3 description: Reviews pull requests and code changes in the community.clickhouse Ansible collection against project standards and the Ansible Collection Review Checklist. Use when asked to review a PR, patch, diff, or set of code changes. Do not use for GitHub Issues or general Q&A.
4 ---
5
6 # Skill: pr-reviewer
7
8 ## Purpose
9
10 Review pull requests and code changes in the `community.clickhouse` Ansible collection.
11
12 ## When to Invoke
13
14 TRIGGER when:
15 - A user asks to review a PR, patch, diff, or set of code changes
16 - Validating changes against project standards before merge
17
18 DO NOT TRIGGER when:
19 - Reviewing GitHub Issues (not PRs/code changes)
20 - General Q&A, documentation lookup, or debugging unrelated to a changeset
21
22 ## Inputs
23
24 - `target` (optional): PR number, branch name, commit hash, or file path.
25 - If omitted, review the current working changes via `git diff HEAD`.
26
27 ## Approach
28
29 ### Step 1 — Gather the changeset
30
31 Obtain the diff using the appropriate method:
32 - PR number provided → read changed files and their diffs
33 - Branch or commit reference → run `git diff <base>..<ref>` or `git show <ref>`
34 - File path provided → read the file and review it in full
35 - No target → run `git diff HEAD` to capture all current changes
36
37 Read every changed file completely before forming any judgment.
38
39 ### Step 2 — Run all review checks in parallel
40
41 Execute all checks in the checklist below concurrently. Collect findings per category. For categories not listed below, apply the rules from the corresponding sections in `AGENTS.md`.
42
43 ### Step 3 — Report
44
45 Produce the structured report described in the **Output Format** section.
46
47 ---
48
49 ## Review Checklist
50
51 Architecture, check_mode, and Type Conversion categories are fully covered by `AGENTS.md` — apply those sections directly.
52
53 ### Collection Metadata
54
55 - `galaxy.yml`: `version`, `description`, `tags`, `dependencies` are accurate and up to date.
56 - `meta/runtime.yml`: `requires_ansible` minimum version reflects any new Ansible features used.
57 - New Python dependencies added to both `requirements.txt` and `meta/ee-requirements.txt`.
58
59 ### Module Documentation
60
61 - Every public parameter has a `description`, `type`, and `required` or `default`.
62 - The `EXAMPLES` block is present, valid YAML, and covers the primary use cases.
63 - The `RETURN` block accurately describes every key returned by the module.
64 - Module short description (`short_description`) is concise and accurate.
65 - `author` field is present and correctly formatted.
66
67 ### Naming and Style
68
69 - Module file names follow the `clickhouse_<noun>` pattern.
70 - No abbreviations that reduce readability.
71
72 ### Idempotency
73
74 - `result['changed']` is `False` when no real change is made.
75 - Repeated runs with the same arguments produce the same outcome with no spurious changes.
76
77 ### Sensitive Data
78
79 - All sensitive parameters (passwords, tokens, secrets) set `no_log=True`.
80 - No sensitive data appears in `executed_statements` or module return values in plaintext.
81
82 ### Error Handling
83
84 - All errors call `module.fail_json(msg=...)` with a descriptive, actionable message — no bare `raise` or `sys.exit()`.
85 - `clickhouse_info` and similar read-only modules handle privilege errors gracefully (return partial results, not a failure).
86 - `execute_query()` from `module_utils/clickhouse.py` is used for all query execution.
87
88 ### Testing
89
90 - Sanity checks pass: `ansible-test sanity <changed_file> --docker -v`
91 - Unit tests are present for any new or modified logic in `module_utils` or non-trivial module functions. Located under `tests/unit/plugins/`.
92 - Integration tests are required for any non-refactoring, non-documentation code change. Located under `tests/integration/targets/<module_name>/`.
93 - Integration test pattern is followed:
94 1. Call module → `register: result`
95 2. `ansible.builtin.assert` on `result`
96 3. Verify DB state using `community.clickhouse.clickhouse_client` → `register: result` → `ansible.builtin.assert`
97 - Each integration test target has `tests/integration/targets/<name>/meta/main.yml` declaring `setup_clickhouse` as a dependency.
98 - Tests cover both the happy path and idempotency (running the same task twice).
99 - Tests cover the `state: absent` path where applicable.
100
101 ### Backwards Compatibility
102
103 - No existing parameters are removed or renamed without a deprecation notice.
104 - No existing return values are removed or their types changed.
105 - Breaking changes are flagged explicitly and justified.
106 - Deprecations use the Ansible deprecation mechanism (`module.deprecate()`).
107
108 ### Changelog Fragment
109
110 - Fragment content is concise, written in past tense, and references the module name.
111
112 ### Code Quality
113
114 - No dead code, commented-out blocks, or debug statements left in.
115 - No feature flags or backwards-compatibility shims for hypothetical future use.
116 - No premature abstractions (helpers/utilities created for a single use case).
117 - No security vulnerabilities: no shell injection, no unvalidated external input passed to queries, no hardcoded credentials.
118
119 ---
120
121 ## Output Format
122
123 Structure the review as follows:
124
125 ```
126 ## PR Review: <target or "Current Changes">
127
128 ### Summary
129 <One-paragraph overall assessment: scope of the change, general quality, primary concerns.>
130
131 ### Findings
132
133 #### Blockers (must fix before merge)
134 - [CATEGORY] <File>:<line> — <description of the issue>
135
136 #### Warnings (should fix, not strictly blocking)
137 - [CATEGORY] <File>:<line> — <description of the issue>
138
139 #### Suggestions (optional improvements)
140 - [CATEGORY] <File>:<line> — <description of the issue>
141
142 ### Checklist Status
143 | Category | Status | Notes |
144 |---|---|---|
145 | Collection Metadata | PASS / FAIL / N/A | ... |
146 | Module Documentation | PASS / FAIL / N/A | ... |
147 | Naming and Style | PASS / FAIL / N/A | ... |
148 | Architecture | PASS / FAIL / N/A | ... |
149 | Idempotency | PASS / FAIL / N/A | ... |
150 | check_mode | PASS / FAIL / N/A | ... |
151 | Sensitive Data | PASS / FAIL / N/A | ... |
152 | Error Handling | PASS / FAIL / N/A | ... |
153 | Type Conversion | PASS / FAIL / N/A | ... |
154 | Testing | PASS / FAIL / N/A | ... |
155 | Backwards Compatibility | PASS / FAIL / N/A | ... |
156 | Changelog Fragment | PASS / FAIL / N/A | ... |
157 | Code Quality | PASS / FAIL / N/A | ... |
158
159 ### Verdict
160 APPROVE / REQUEST CHANGES / COMMENT
161
162 <One sentence justifying the verdict.>
163 ```
164
165 Use `N/A` for categories that do not apply to the changeset (e.g., type conversion for a docs-only PR). Be specific: always reference the file and line number when citing a finding.