|
| 1 | +# Issue Creation Prompt Template — Code Review |
| 2 | + |
| 3 | +**Purpose:** Reusable template for creating GitHub issues from external code review findings. Designed for findings that fall outside the original ROADMAP phases — discovered by human reviewers or automated analysis tools after the implementation was considered complete. Every issue produced from this template acts as an AI scope-containment boundary. |
| 4 | + |
| 5 | +**Usage:** Copy the template below, fill in the placeholders (marked with `{{...}}`), and create the issue via the GitHub API or UI. |
| 6 | + |
| 7 | +**Version:** 1.0 |
| 8 | +**Date:** March 6, 2026 |
| 9 | +**Complements:** `issue-creation-prompt-template-phase-6.md` (v4.0) — use that template for planned ROADMAP tasks and verification gate failures. Use _this_ template for post-implementation code review findings. |
| 10 | + |
| 11 | +--- |
| 12 | + |
| 13 | +## Before Creating an Issue |
| 14 | + |
| 15 | +1. **Verify ownership** — Determine whether the finding is in code we wrote or pre-existing upstream code: |
| 16 | + - Run `git diff upstream/main clean-fork/clean-pr -- <file>` and check if the affected lines appear in our diff |
| 17 | + - If the lines are **not in our diff**, the finding is **upstream** (pre-existing in camptocamp/ogc-client) |
| 18 | + - If the lines **are in our diff**, the finding is **ours** |
| 19 | + - If our changes interact with upstream code to produce the issue, it is **shared** |
| 20 | +2. **Determine the destination repo:** |
| 21 | + - **Ours:** File on `OS4CSAPI/ogc-client-CSAPI_2` |
| 22 | + - **Upstream:** File on `OS4CSAPI/ogc-client-CSAPI_2` as a tracking item with label `upstream`. Do NOT file directly on `camptocamp/ogc-client` without maintainer relationship context. |
| 23 | + - **Shared:** File on `OS4CSAPI/ogc-client-CSAPI_2` |
| 24 | +3. **Check for duplicates** — Search existing issues to confirm no duplicate already tracks this work |
| 25 | +4. **Read the finding source** — Review the full code review report or analysis output that produced the finding |
| 26 | +5. **Identify the exact files** — List every file that would need to change to resolve the finding |
| 27 | + |
| 28 | +--- |
| 29 | + |
| 30 | +## Template C: Code Review Finding |
| 31 | + |
| 32 | +```markdown |
| 33 | +## Finding |
| 34 | + |
| 35 | +{{One-sentence summary. Example: "Path traversal via unencoded itemId in getCollectionItem" or "parseCollectionResponse<T> casts raw JSON to T[] without validation."}} |
| 36 | + |
| 37 | +**Review Source:** {{Who or what produced this finding — e.g., "Senior developer code review of clean-pr" or "Security analysis agent"}} |
| 38 | +**Severity:** {{P1-Critical / P2-Important / P3-Minor / P4-Informational}} |
| 39 | +**Category:** {{Security / Type Safety / Code Quality / API Design / Documentation / Error Handling}} |
| 40 | +**Ownership:** {{Ours / Upstream / Shared}} |
| 41 | + |
| 42 | +--- |
| 43 | + |
| 44 | +## Problem Statement |
| 45 | + |
| 46 | +{{What the reviewer found. Include the specific code, why it's problematic, and what could go wrong. Be concrete — show the vulnerable or incorrect code and a scenario that demonstrates the issue.}} |
| 47 | + |
| 48 | +**Affected code:** |
| 49 | + |
| 50 | +```typescript |
| 51 | +// Show the problematic code with file path and line reference |
| 52 | +``` |
| 53 | + |
| 54 | +**Scenario:** |
| 55 | + |
| 56 | +```typescript |
| 57 | +// Show a concrete example that demonstrates the problem |
| 58 | +``` |
| 59 | + |
| 60 | +**Impact:** {{What breaks, degrades, or becomes exploitable. Which consumers or callers are affected?}} |
| 61 | + |
| 62 | +## Ownership Verification |
| 63 | + |
| 64 | +{{Paste the evidence from the diff check. This section exists to prevent filing issues against our code for pre-existing upstream problems, and vice versa.}} |
| 65 | + |
| 66 | +``` |
| 67 | +$ git diff upstream/main clean-fork/clean-pr -- <file> | grep -A3 -B3 "<pattern>" |
| 68 | +{{Paste the output, or state "No matches — line is not in our diff"}} |
| 69 | +``` |
| 70 | +
|
| 71 | +**Conclusion:** {{This code is ours / This code is pre-existing upstream / This is a shared concern because...}} |
| 72 | +
|
| 73 | +## Files to Modify |
| 74 | +
|
| 75 | +| File | Action | Est. Lines | Purpose | |
| 76 | +|------|--------|-----------|---------| |
| 77 | +| {{`path/to/file.ts`}} | Modify | {{~N}} | {{Brief purpose}} | |
| 78 | +| {{`path/to/file.spec.ts`}} | Modify | {{~N}} | {{Brief purpose}} | |
| 79 | +
|
| 80 | +## Proposed Solutions |
| 81 | +
|
| 82 | +### Option A: {{Short label}} (Recommended) |
| 83 | +
|
| 84 | +```typescript |
| 85 | +// Show the fix |
| 86 | +``` |
| 87 | + |
| 88 | +**Pros:** {{...}} |
| 89 | +**Cons:** {{...}} |
| 90 | +**Effort:** {{Small / Medium / Large}} | **Risk:** {{None / Low / Medium / Breaking}} |
| 91 | + |
| 92 | +### Option B: {{Short label}} |
| 93 | + |
| 94 | +```typescript |
| 95 | +// Show the alternative |
| 96 | +``` |
| 97 | + |
| 98 | +**Pros:** {{...}} |
| 99 | +**Cons:** {{...}} |
| 100 | +**Effort:** {{Small / Medium / Large}} | **Risk:** {{None / Low / Medium / Breaking}} |
| 101 | + |
| 102 | +## Scope — What NOT to Touch |
| 103 | + |
| 104 | +- ❌ Do NOT modify files outside the "Files to Modify" table above |
| 105 | +- ❌ Do NOT refactor adjacent code that isn't part of this finding |
| 106 | +- ❌ Do NOT change public API signatures unless the finding specifically requires it |
| 107 | +- ❌ {{Additional scope fences specific to this finding}} |
| 108 | + |
| 109 | +## Acceptance Criteria |
| 110 | + |
| 111 | +- [ ] {{Specific fix implemented — describe the concrete change}} |
| 112 | +- [ ] {{Negative test — the problematic scenario no longer produces the bad outcome}} |
| 113 | +- [ ] Existing tests still pass (`npm test`) |
| 114 | +- [ ] No lint errors (`npm run lint`) |
| 115 | +- [ ] All modified files pass `npx prettier --check` |
| 116 | +- [ ] {{Any finding-specific verification step}} |
| 117 | + |
| 118 | +## Dependencies |
| 119 | + |
| 120 | +**Blocked by:** {{Issue #N — title, or "Nothing"}} |
| 121 | +**Blocks:** {{Issue #N — title, or "Nothing"}} |
| 122 | +**Related:** {{Issue #N — title, if findings are related but independent}} |
| 123 | + |
| 124 | +--- |
| 125 | + |
| 126 | +## Operational Constraints |
| 127 | + |
| 128 | +> **⚠️ MANDATORY:** Before starting work on this issue, review [`docs/governance/AI_OPERATIONAL_CONSTRAINTS.md`](AI_OPERATIONAL_CONSTRAINTS.md). |
| 129 | +
|
| 130 | +Key constraints: |
| 131 | +- **Precedence:** OGC specifications → AI Collaboration Agreement → This issue description → Existing code → Conversational context |
| 132 | +- **No scope expansion:** Fix the finding, nothing more |
| 133 | +- **Minimal diffs:** Prefer the smallest change that satisfies the acceptance criteria |
| 134 | +- **Ask when unclear:** If intent is ambiguous, stop and ask for clarification |
| 135 | +- **Respect ownership:** If the finding is upstream, track it but do not modify upstream code unilaterally |
| 136 | + |
| 137 | +### Ownership-Specific Constraints |
| 138 | + |
| 139 | +**If Ours:** |
| 140 | +- Fix on the `phase-6` branch (or the current working branch) |
| 141 | +- Include in the next commit to `clean-pr` if the PR is still open |
| 142 | +- Add tests that cover the finding |
| 143 | + |
| 144 | +**If Upstream:** |
| 145 | +- Do NOT modify the upstream code in our PR — it changes code we didn't write |
| 146 | +- Track the issue for potential future contribution or discussion with the maintainer |
| 147 | +- If the fix is trivial and clearly beneficial, note in the issue that it could be offered as a separate upstream PR |
| 148 | + |
| 149 | +**If Shared:** |
| 150 | +- Fix only the parts that are in our code |
| 151 | +- Document the upstream component as a known limitation |
| 152 | + |
| 153 | +--- |
| 154 | + |
| 155 | +## References |
| 156 | + |
| 157 | +| # | Document | What It Provides | |
| 158 | +|---|----------|------------------| |
| 159 | +| 1 | {{Code review report or analysis output}} | Original finding with full context | |
| 160 | +| 2 | {{Affected source file with line reference}} | Code to modify | |
| 161 | +| 3 | {{OGC spec or MDN reference if applicable}} | Spec-correct behavior | |
| 162 | +| 4 | {{Related existing pattern in codebase}} | Blueprint for the fix | |
| 163 | +``` |
| 164 | +
|
| 165 | +--- |
| 166 | +
|
| 167 | +## Template Usage Notes |
| 168 | +
|
| 169 | +### Severity Levels |
| 170 | +
|
| 171 | +| Level | Meaning | Examples | |
| 172 | +|-------|---------|---------| |
| 173 | +| **P1-Critical** | Security vulnerability or data corruption risk | Path traversal, injection, unchecked casts at trust boundaries | |
| 174 | +| **P2-Important** | Type safety gap or API contract violation that could cause runtime errors | Generic type lies, missing validation at boundaries, incorrect error types | |
| 175 | +| **P3-Minor** | Code quality issue that reduces maintainability but doesn't cause runtime errors | Inconsistent patterns, missing JSDoc, unclear naming | |
| 176 | +| **P4-Informational** | Style preference or minor improvement opportunity | Alternative approach suggestions, documentation enhancements | |
| 177 | +
|
| 178 | +### Categories |
| 179 | +
|
| 180 | +| Category | When to Use | |
| 181 | +|----------|------------| |
| 182 | +| `Security` | Input validation, encoding, injection, traversal, auth | |
| 183 | +| `Type Safety` | Unchecked casts, generic lies, missing validation at type boundaries | |
| 184 | +| `Code Quality` | Patterns, consistency, maintainability, dead code | |
| 185 | +| `API Design` | Public interface clarity, breaking changes, naming | |
| 186 | +| `Documentation` | Missing or incorrect JSDoc, README, inline comments | |
| 187 | +| `Error Handling` | Missing catch, incorrect error types, swallowed errors | |
| 188 | +
|
| 189 | +### Labels |
| 190 | +
|
| 191 | +Apply these labels consistently: |
| 192 | +
|
| 193 | +| Label | When to Use | |
| 194 | +|-------|------------| |
| 195 | +| `code-review` | All issues from this template | |
| 196 | +| `security` | Security category findings | |
| 197 | +| `type-safety` | Type Safety category findings | |
| 198 | +| `code-quality` | Code Quality category findings | |
| 199 | +| `upstream` | Findings in pre-existing upstream code (not our changes) | |
| 200 | +| `post-phase-6` | All findings from post-Phase 6 review | |
| 201 | +| `bug` | Findings that represent actual incorrect behavior | |
| 202 | +| `enhancement` | Findings that represent improvements to working code | |
| 203 | +
|
| 204 | +### Ownership Decision Tree |
| 205 | +
|
| 206 | +``` |
| 207 | +Is the affected code in our diff (git diff upstream/main clean-fork/clean-pr)? |
| 208 | +├── YES → Ownership: Ours |
| 209 | +│ Action: Fix it. Include in clean-pr if PR is open. |
| 210 | +├── NO → Ownership: Upstream |
| 211 | +│ Action: Track it. Do NOT modify in our PR. |
| 212 | +└── PARTIALLY → Ownership: Shared |
| 213 | + Action: Fix our part. Document the upstream part. |
| 214 | +``` |
| 215 | +
|
| 216 | +### Batching Related Findings |
| 217 | +
|
| 218 | +If multiple findings affect the same file or function, consider whether they should be: |
| 219 | +- **One issue** — if fixing one naturally fixes the others (e.g., two encoding issues in the same method) |
| 220 | +- **Separate issues** — if they can be fixed independently and have different severity/ownership (default) |
| 221 | +
|
| 222 | +When in doubt, keep them separate. It's easier to close two issues than to track partial completion of one. |
| 223 | +
|
| 224 | +--- |
| 225 | +
|
| 226 | +## Relationship to Other Templates |
| 227 | +
|
| 228 | +| Template | File | Use When | |
| 229 | +|----------|------|----------| |
| 230 | +| Phase 6 ROADMAP / Verification | `issue-creation-prompt-template-phase-6.md` | Planned tasks or verification gate failures | |
| 231 | +| Phase 5 Parsers | `issue-creation-prompt-template-phase-5.md` | Parser implementation tasks | |
| 232 | +| **Code Review (this template)** | `issue-creation-prompt-template-code-review.md` | Post-implementation findings from human or automated review | |
0 commit comments