Skip to content

Commit 3081c4e

Browse files
docs: Enhance issue format documentation for clarity and detail in framing and examples
1 parent d038419 commit 3081c4e

1 file changed

Lines changed: 204 additions & 73 deletions

File tree

src/docs/Ways-of-Working/Issue-Format.md

Lines changed: 204 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ Answers:
6262

6363
Framing by work type:
6464

65-
| Type | Framing |
66-
| -------------- | ---------------------------------------------------------------------- |
67-
| Feature | Desired capability from the user's point of view. |
68-
| Bug / Fix | What happens vs. What is expected. |
69-
| Change request | Current experience vs. Desired experience. |
70-
| Maintenance | User impact — how internal work improves reliability, speed, etc. |
71-
| Documentation | What is confusing or missing — the gap a user runs into. |
65+
| Type | Framing |
66+
| -------------- | ------------------------------------------------------------------------------------ |
67+
| Feature | **Desired capability:** The desired capability from the user's point of view. |
68+
| Bug / Fix | **What happens:** / **What is expected:** Observed vs. expected behavior. |
69+
| Change request | **Current experience:** / **Desired experience:** The shift from the user's lens. |
70+
| Maintenance | **User impact:** How internal work improves reliability, speed, or correctness. |
71+
| Documentation | **What is confusing or missing:** The gap from a user trying to accomplish a task. |
7272

7373
Elements per work type:
7474

@@ -84,7 +84,88 @@ Elements per work type:
8484

8585
✓ = present when applicable, ○ = optional
8686

87-
This section **does not contain** file paths, function internals, API endpoints, or implementation patterns. Those belong in Section 2.
87+
Element definitions:
88+
89+
- **Reproduction steps** — a [minimal reproducible example](https://en.wikipedia.org/wiki/Minimal_reproducible_example): exact steps, inputs, and commands that trigger the problem. Anyone can reproduce the failure without guessing.
90+
- **Environment / version** — module version, PowerShell version (`$PSVersionTable`), and operating system. Other relevant runtime details (host application, execution context) included as applicable. Omitted only when clearly version-independent.
91+
- **Regression indicator** — whether this previously worked, and in which version. If unknown, stated explicitly.
92+
- **Known workarounds** — any mitigation available today, even if ugly or incomplete.
93+
94+
This section contains:
95+
96+
- Context: user story or scenario, background, what the user is trying to accomplish
97+
- Request: the specific problem, gap, or desired change — as the user experiences it
98+
- Current vs. desired experience
99+
- Impact of not addressing this (data loss, confusion, blocked workflows)
100+
- Acceptance criteria — what "done" looks like from the user's perspective
101+
- Applicable work-type-specific elements from the table above
102+
- Links to related issues, PRs, or external references — every external resource is a clickable hyperlink
103+
104+
This section **does not contain** file paths, function internals, API endpoints, or implementation patterns. Those belong in Section 2. The section is understandable by someone who has never read the source code.
105+
106+
**Example (Bug / Fix):**
107+
108+
```markdown
109+
`Get-GitHubRepository` is used in automation to sync all repositories for an account.
110+
The script relies on getting the full list so it can detect new or removed repositories.
111+
112+
## Request
113+
114+
When `Get-GitHubRepository` is called on an account with more than 30 repositories, only 30 results are returned.
115+
There is no indication that results are incomplete, so it appears as though the full list has been retrieved.
116+
The silent truncation causes scripts to miss repositories, which can go unnoticed for weeks.
117+
118+
### Reproduction steps
119+
120+
1. Create or use an account with more than 30 repositories
121+
2. Run `Get-GitHubRepository`
122+
3. Count the returned objects — only 30 are returned regardless of total count
123+
124+
### What is expected
125+
126+
The command should return **all** repositories by default. If there is a way to limit results,
127+
it should be opt-in — not the default.
128+
129+
### Environment
130+
131+
- **Module version:** 0.14.0
132+
- **PowerShell:** 7.4.6 (Linux, Ubuntu 22.04)
133+
134+
### Regression
135+
136+
This appears to have been the behavior since the initial release. Not a regression.
137+
138+
### Workaround
139+
140+
Calling the GitHub REST API directly with manual pagination returns all results.
141+
142+
### Acceptance criteria
143+
144+
- All repositories are returned by default, regardless of how many exist
145+
- Results can be limited with a parameter when only a subset is needed
146+
- No silent data loss — if something limits results, it should be explicit
147+
```
148+
149+
**Example (Feature):**
150+
151+
```markdown
152+
Automation scripts that publish module releases to multiple registries currently call `Publish-PSResource`
153+
in a loop for each target. There is no built-in way to publish to several registries in a single invocation.
154+
155+
## Request
156+
157+
### Desired capability
158+
159+
A `-Repository` parameter on `Publish-Module` that accepts an array of registry names, publishing
160+
the module to each in sequence. If any single publish fails, the error should be reported per-registry
161+
without aborting the remaining targets.
162+
163+
### Acceptance criteria
164+
165+
- `-Repository` accepts one or more registry names
166+
- Each target is attempted independently — a failure on one does not block the others
167+
- Output clearly indicates success or failure per registry
168+
```
88169

89170
## Section 2 — Technical Decisions
90171

@@ -114,6 +195,28 @@ Typical decision areas:
114195
- Breaking changes and backward compatibility.
115196
- Test strategy (unit, integration, mocks).
116197

198+
**Example:**
199+
200+
```markdown
201+
---
202+
203+
## Technical decisions
204+
205+
**Function placement:** New private function goes in `src/functions/private/Utilities/` following the existing
206+
`Invoke-GitHubRestMethod` pattern. Public function stays in `src/functions/public/Repository/`.
207+
208+
**Pagination approach:** Use link-header-based pagination (`rel="next"`) rather than page-number incrementing.
209+
The GitHub REST API uses link headers consistently, and this avoids hardcoding page size assumptions.
210+
211+
**Parameter naming:** Use `-First` (consistent with PowerShell convention and `Select-Object -First`) rather than
212+
`-Limit` or `-MaxResults`.
213+
214+
**Breaking changes:** None. Default behavior changes from returning one page to returning all pages, but since the
215+
previous behavior was undocumented and returning incomplete data, this is treated as a bugfix rather than a breaking change.
216+
217+
**Test approach:** Unit tests with mocked API responses. One test per scenario: single-page, multi-page, and `-First` limiting.
218+
```
219+
117220
## Section 3 — Implementation Plan
118221

119222
The task-level roadmap. Implementers track progress here; reviewers use it to understand scope.
@@ -128,6 +231,31 @@ Structure:
128231

129232
For PBIs and Epics, Section 3 is **a list of links to child issues**, not inline tasks. See [Issue Hierarchy](Issue-Hierarchy.md).
130233

234+
**Example:**
235+
236+
```markdown
237+
---
238+
239+
## Implementation plan
240+
241+
### Core changes
242+
243+
- [ ] Add `Invoke-GitHubRestMethodPaged` private function in `src/functions/private/Utilities/`
244+
- [ ] Update `Get-GitHubRepository` to call paged variant in `src/functions/public/Repository/`
245+
- [ ] Add `-First` parameter with `[int]` type and validation
246+
247+
### Tests
248+
249+
- [ ] Add unit test for single-page response
250+
- [ ] Add unit test for multi-page response
251+
- [ ] Add unit test for `-First` parameter limiting results
252+
253+
### Documentation
254+
255+
- [ ] Update function help with new parameter documentation
256+
- [ ] Add example showing pagination usage
257+
```
258+
131259
## Comments
132260

133261
Every description update is accompanied by a comment. Comments preserve the change history so reasoning is not lost when the description is overwritten.
@@ -138,6 +266,17 @@ A comment contains:
138266
- Bullet points detailing what was added, changed, or removed.
139267
- Any gaps or open questions that need input.
140268

269+
**Example:**
270+
271+
```markdown
272+
Structured the issue description into the standard three-section format.
273+
274+
- Rewrote the context and request to separate user-facing behavior from technical details
275+
- Added technical decisions section based on codebase research
276+
- Created implementation plan with 6 tasks covering core changes, tests, and documentation
277+
- Open question: should `-First` default to unlimited or require explicit opt-in? Marked as open in technical decisions.
278+
```
279+
141280
## Formatting
142281

143282
Issues use [GitHub Flavored Markdown](https://github.github.com/gfm/) with the full feature set:
@@ -154,107 +293,99 @@ Issues use [GitHub Flavored Markdown](https://github.github.com/gfm/) with the f
154293
- `[text](url)` links for all external references.
155294
- **No hard line breaks within a paragraph.** GitHub renders mid-paragraph newlines as spaces, which creates inconsistent visual spacing.
156295

157-
## Examples
296+
## Complete example
158297

159-
### Feature issue
298+
A fully structured bug fix issue:
160299

161-
**Title:** `Add pagination support to Get-GitHubRepository`
300+
**Title:** `Fix silent truncation of results in Get-GitHubRepository`
162301

163-
**Labels:** `Minor`, `Feature`
302+
**Labels:** `Patch`, `Bug`
164303

165304
**Body:**
166305

167306
```markdown
168-
A developer using Get-GitHubRepository to list all repositories in a large organization
169-
receives only the first 30 results. There is no way to request additional pages or
170-
automatically retrieve all results.
171-
172-
The function should support automatic pagination so that all repositories are returned
173-
by default, with an optional parameter to limit the number of results.
174-
175-
**Acceptance criteria:**
307+
`Get-GitHubRepository` is used in automation to sync all repositories for an account.
308+
The script relies on getting the full list so it can detect new or removed repositories.
176309

177-
- Calling `Get-GitHubRepository -Owner 'LargeOrg'` returns all repositories, not just
178-
the first page.
179-
- A `-First` parameter limits the total number of results returned.
180-
- Pagination follows the `Link` header pattern used by the GitHub REST API.
310+
## Request
181311

182-
---
312+
When `Get-GitHubRepository` is called on an account with more than 30 repositories, only
313+
30 results are returned. There is no indication that results are incomplete, so it appears
314+
as though the full list has been retrieved. The silent truncation causes scripts to miss
315+
repositories, which can go unnoticed for weeks.
183316

184-
**Pagination strategy:** Follow the `Link` response header. Parse `rel="next"` and
185-
continue requesting until no next link is present. This matches the approach already
186-
used in `Get-GitHubRelease`.
317+
### Reproduction steps
187318

188-
**Parameter naming:** Use `-First` (consistent with PowerShell conventions and
189-
`Select-Object -First`). Considered `-Limit` but it conflicts with API terminology.
319+
1. Create or use an account with more than 30 repositories
320+
2. Run `Get-GitHubRepository`
321+
3. Count the returned objects — only 30 are returned regardless of total count
190322

191-
**Rate limiting:** No special handling — the existing retry logic in
192-
`Invoke-GitHubAPI` already respects `retry-after` headers.
323+
### What is expected
193324

194-
---
325+
The command should return **all** repositories by default. If there is a way to limit
326+
results, it should be opt-in — not the default.
195327

196-
### Core logic
328+
### Environment
197329

198-
- [ ] Add `Link` header parsing to `Invoke-GitHubAPI` (return next-page URL).
199-
- [ ] Update `Get-GitHubRepository` to loop until no next page or `-First` is reached.
200-
- [ ] Add `-First` parameter with `[int]` type and default of `0` (unlimited).
330+
- **Module version:** 0.14.0
331+
- **PowerShell:** 7.4.6 (Linux, Ubuntu 22.04)
201332

202-
### Tests
333+
### Regression
203334

204-
- [ ] Unit test: `Link` header parsing returns correct next URL.
205-
- [ ] Integration test: paginated request returns more results than a single page.
206-
- [ ] Integration test: `-First 5` stops after 5 results.
335+
This appears to have been the behavior since the initial release. Not a regression.
207336

208-
### Documentation
337+
### Workaround
209338

210-
- [ ] Update `Get-GitHubRepository` comment-based help with `-First` parameter.
211-
```
339+
Calling the GitHub REST API directly with manual pagination returns all results.
212340

213-
### Bug fix issue
341+
### Acceptance criteria
214342

215-
**Title:** `Fix null reference when Context is not resolved`
343+
- All repositories are returned by default, regardless of how many exist
344+
- Results can be limited with a parameter when only a subset is needed
345+
- No silent data loss — if something limits results, it should be explicit
216346

217-
**Labels:** `Patch`, `Bug`
347+
---
218348

219-
**Body:**
349+
## Technical decisions
220350

221-
```markdown
222-
When running `Build-PSModule` in a fresh container where the GitHub context environment
223-
variables are not set, the action fails with:
351+
**Function placement:** New private function goes in `src/functions/private/Utilities/` following
352+
the existing `Invoke-GitHubRestMethod` pattern. Public function stays in
353+
`src/functions/public/Repository/`.
224354

225-
> InvalidOperation: You cannot call a method on a null-valued expression.
355+
**Pagination approach:** Use link-header-based pagination (`rel="next"`) rather than page-number
356+
incrementing. The GitHub REST API uses link headers consistently, and this avoids hardcoding page
357+
size assumptions.
226358

227-
The error occurs on every run in that environment. Expected behaviour is a clear error
228-
message indicating that context is unavailable, not an unhandled null reference.
359+
**Parameter naming:** Use `-First` (consistent with PowerShell convention and `Select-Object -First`)
360+
rather than `-Limit` or `-MaxResults`.
229361

230-
**Reproduction steps:**
362+
**Breaking changes:** None. Default behavior changes from returning one page to returning all pages,
363+
but since the previous behavior was undocumented and returning incomplete data, this is treated as a
364+
bug fix rather than a breaking change.
231365

232-
1. Run `Build-PSModule` locally without setting `GITHUB_CONTEXT`.
233-
2. Observe the null-reference exception in the `Get-PSModuleSettings` step.
366+
**Test approach:** Unit tests with mocked API responses. One test per scenario: single-page,
367+
multi-page, and `-First` limiting.
234368

235-
**Environment:** GitHub Actions runner `ubuntu-latest`, PowerShell 7.4.6.
369+
---
236370

237-
**Acceptance criteria:**
371+
## Implementation plan
238372

239-
- When `GITHUB_CONTEXT` is not set, the action terminates with a descriptive error:
240-
`"GitHub context is not available. Ensure the action runs inside a GitHub Actions workflow."`
241-
- No unhandled null-reference exception reaches the user.
373+
### Core changes
242374

243-
---
375+
- [ ] Add `Invoke-GitHubRestMethodPaged` private function in `src/functions/private/Utilities/`
376+
- [ ] Update `Get-GitHubRepository` to call paged variant in `src/functions/public/Repository/`
377+
- [ ] Add `-First` parameter with `[int]` type and validation
244378

245-
**Guard location:** Add a null check at the top of `src/main.ps1` in Get-PSModuleSettings,
246-
before any property access on the context object. This keeps the fix close to the source
247-
and avoids scattering defensive checks throughout the codebase.
379+
### Tests
248380

249-
**Error style:** Use `throw` with a terminating error rather than `Write-Error`, because
250-
downstream steps cannot proceed without context.
381+
- [ ] Add unit test for single-page response
382+
- [ ] Add unit test for multi-page response
383+
- [ ] Add unit test for `-First` parameter limiting results
251384

252-
---
385+
### Documentation
253386

254-
- [ ] Add null check for `$GitHubContext` at line 12 of `src/main.ps1`.
255-
- [ ] Throw terminating error with descriptive message when null.
256-
- [ ] Add Pester test: mock empty environment, assert correct error message.
257-
- [ ] Add Pester test: mock valid environment, assert no error.
387+
- [ ] Update function help with new parameter documentation
388+
- [ ] Add example showing pagination usage
258389
```
259390

260391
## Labels

0 commit comments

Comments
 (0)