Add Milestones domain support to the GitHub simulator#39
Merged
Conversation
Copilot
AI
changed the title
Implement milestones domain for GitHub simulator
Add Milestones domain support to the GitHub simulator
Jun 1, 2026
Copilot created this pull request from a session on behalf of
pmcelhaney
June 1, 2026 00:23
View session
There was a problem hiding this comment.
Pull request overview
This PR adds stateful Milestones support to the @counterfact/github simulator, integrating milestone lifecycle behavior with repository, issue, pull request, route, and scenario state.
Changes:
- Adds milestone storage, CRUD/list APIs, routing, and root context forwarding.
- Seeds milestone fixture data and links a seeded issue to a milestone.
- Expands context, route, and scenario tests for milestone behavior.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
github/routes/repos/_.context.ts |
Adds milestone state, lifecycle methods, list filtering/sorting, and counter synchronization. |
github/routes/_.context.ts |
Forwards milestone methods from root context to repos context. |
github/routes/repos/{owner}/{repo}/milestones.ts |
Implements milestone list/create route handlers. |
github/routes/repos/{owner}/{repo}/milestones/{milestone_number}.ts |
Implements milestone get/update/delete route handlers. |
github/scenarios/index.ts |
Adds milestone seed scenario and wires it into seedGitHub. |
github/test/repos.context.test.ts |
Adds direct context unit tests for milestone CRUD and counters. |
github/test/routes.test.ts |
Adds HTTP route tests for milestone lifecycle and 404 handling. |
github/test/scenarios.test.ts |
Adds scenario assertions for seeded milestones and issue linkage. |
.github/todo/milestones-v2.md |
Removes completed milestone implementation TODO. |
Comment on lines
+1270
to
+1283
| const closedAt = | ||
| input.state === "closed" | ||
| ? (input.closed_at ?? existing?.closed_at ?? now) | ||
| : (input.closed_at ?? existing?.closed_at ?? ""); | ||
| const milestoneItem: milestone = { | ||
| ...(existing ?? {}), | ||
| ...input, | ||
| id, | ||
| node_id: input.node_id ?? existing?.node_id ?? `MS_${id}`, | ||
| number, | ||
| url: `${API_URL}/repos/${owner}/${repo}/milestones/${number}`, | ||
| html_url: `${APP_URL}/${owner}/${repo}/milestone/${number}`, | ||
| labels_url: `${API_URL}/repos/${owner}/${repo}/milestones/${number}/labels`, | ||
| state: input.state ?? existing?.state ?? "open", |
Comment on lines
+1295
to
+1298
| state.milestones.set(number, milestoneItem); | ||
| state.nextMilestoneNumber = Math.max(state.nextMilestoneNumber, number + 1); | ||
| this.nextMilestoneId = Math.max(this.nextMilestoneId, id + 1); | ||
| this.syncMilestoneCounts(state); |
pmcelhaney
requested changes
Jun 1, 2026
Contributor
pmcelhaney
left a comment
There was a problem hiding this comment.
@copilot address both comments
Contributor
Author
Addressed both review items in commit
|
pmcelhaney
approved these changes
Jun 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements the Milestones domain in
@counterfact/githubso milestone endpoints are stateful and aligned with existing repository/issue behavior. It also seeds milestone fixtures and routes milestone state through repo context APIs.Context model + milestone lifecycle
milestones,nextMilestoneNumber) inroutes/repos/_.context.ts.saveMilestone,getMilestone,updateMilestone,deleteMilestone, andlistMilestoneswith generated canonical fields (id,node_id, URLs, timestamps, default creator/state, counters).state,sort,direction, pagination inputs).Cross-domain consistency (issues/PRs ↔ milestones)
Route implementation
GET/POST /repos/{owner}/{repo}/milestonesGET/PATCH/DELETE /repos/{owner}/{repo}/milestones/{milestone_number}Seed data updates
milestonesscenario inscenarios/index.tswith seededv1.0(open) andv0.9(closed) milestones oncounterfact/platform-api.v1.0milestone.seedGitHub.Test coverage expansion