Skip to content

Commit b6f0817

Browse files
committed
Proceed with Phase 02
1 parent a5b7862 commit b6f0817

14 files changed

Lines changed: 4006 additions & 0 deletions

80-java-monorepo-add-01-remove-before-merge/20260512-prompts.md

Lines changed: 432 additions & 0 deletions
Large diffs are not rendered by default.

80-java-monorepo-add-01-remove-before-merge/20260513-prompts.md

Lines changed: 442 additions & 0 deletions
Large diffs are not rendered by default.

80-java-monorepo-add-01-remove-before-merge/20260515-prompts.md

Lines changed: 536 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
## ghcp-sp-95
2+
3+
### 10:44 Prompt
4+
5+
In issue 95, you stated exactly this as the remedy for the branch protection problem.
6+
7+
```bash
8+
gh api repos/github/copilot-sdk/rulesets \
9+
-X POST \
10+
--input - <<'EOF'
11+
{
12+
"name": "ghcp-sp-95-java-branch-protection",
13+
"target": "branch",
14+
"enforcement": "active",
15+
"conditions": {
16+
"ref_name": {
17+
"include": ["refs/heads/main"],
18+
"exclude": []
19+
}
20+
},
21+
"bypass_actors": [
22+
{
23+
"actor_id": 5,
24+
"actor_type": "RepositoryRole",
25+
"bypass_mode": "always"
26+
}
27+
],
28+
"rules": [
29+
{ "type": "deletion" },
30+
{
31+
"type": "pull_request",
32+
"parameters": {
33+
"required_approving_review_count": 1,
34+
"dismiss_stale_reviews_on_push": false,
35+
"require_code_owner_review": false,
36+
"require_last_push_approval": false,
37+
"required_review_thread_resolution": false,
38+
"allowed_merge_methods": ["merge", "squash", "rebase"]
39+
}
40+
},
41+
{ "type": "non_fast_forward" }
42+
]
43+
}
44+
EOF
45+
```
46+
47+
I have approval from the stakeholders to do this. But because I'm very new to the repo and want to protect my reputation as a careful and risk-averse engineer, I want to know exactly how I can revert exactly this change, should problems arise.
48+
49+
Can you give me the command that will effectively "undo" the operation?
50+
51+
### 10:48 Response
52+
53+
The POST will return a JSON response containing an `id` field. To undo, you delete that specific ruleset:
54+
55+
```bash
56+
gh api repos/github/copilot-sdk/rulesets/<RULESET_ID> -X DELETE
57+
```
58+
59+
### Practical workflow:
60+
61+
1. **When you create it**, capture the ID from the response:
62+
63+
```bash
64+
gh api repos/github/copilot-sdk/rulesets \
65+
-X POST \
66+
--input - <<'EOF'
67+
... (your payload) ...
68+
EOF
69+
```
70+
71+
The response JSON will include `"id": 12345678`. Note that number.
72+
73+
2. **If you need to revert:**
74+
75+
```bash
76+
gh api repos/github/copilot-sdk/rulesets/12345678 -X DELETE
77+
```
78+
79+
3. **If you lose the ID**, you can find it:
80+
```bash
81+
gh api repos/github/copilot-sdk/rulesets --jq '.[] | select(.name == "Protect main") | .id'
82+
```
83+
84+
The DELETE removes the ruleset entirely — returning the repo to the state before you created it (assuming step 1 from the issue, deleting the classic branch protection, has already been done separately). There is no partial state; it's a clean removal.
85+
86+
### 10:50 Prompt
87+
88+
Here is the post again. I've changed the "name":
89+
90+
```bash
91+
gh api repos/github/copilot-sdk/rulesets \
92+
-X POST \
93+
--input - <<'EOF'
94+
{
95+
"name": "ghcp-sp-95-java-branch-protection",
96+
"target": "branch",
97+
"enforcement": "active",
98+
"conditions": {
99+
"ref_name": {
100+
"include": ["refs/heads/main"],
101+
"exclude": []
102+
}
103+
},
104+
"bypass_actors": [
105+
{
106+
"actor_id": 5,
107+
"actor_type": "RepositoryRole",
108+
"bypass_mode": "always"
109+
}
110+
],
111+
"rules": [
112+
{ "type": "deletion" },
113+
{
114+
"type": "pull_request",
115+
"parameters": {
116+
"required_approving_review_count": 1,
117+
"dismiss_stale_reviews_on_push": false,
118+
"require_code_owner_review": false,
119+
"require_last_push_approval": false,
120+
"required_review_thread_resolution": false,
121+
"allowed_merge_methods": ["merge", "squash", "rebase"]
122+
}
123+
},
124+
{ "type": "non_fast_forward" }
125+
]
126+
}
127+
EOF
128+
```
129+
130+
Can you please write a PowerShell script I can execute that does the command and make s it so I can capture the necessary response? Write it to `temporary-prompts/ghcp-sp-95-enable-java-branch-protection.ps1`.
131+
132+
### 10:55 Response
133+
134+
Created [](file:///e%3A/workareas/copilot-sdk-java-00/temporary-prompts/ghcp-sp-95-enable-java-branch-protection.ps1)
135+
136+
Created at ghcp-sp-95-enable-java-branch-protection.ps1. It pipes the JSON payload to `gh api`, parses the response to extract the ruleset ID, and prints the exact DELETE command you'd need to revert.
137+
138+
Made changes.
139+
140+
### 10:54 Prompt
141+
142+
Here is the output
143+
144+
```
145+
Ruleset created successfully.
146+
Name: ghcp-sp-95-java-branch-protection
147+
ID: 16552308
148+
149+
To revert this change:
150+
gh api repos/github/copilot-sdk/rulesets/16552308 -X DELETE
151+
```
152+
153+
### 20:00 Response
154+
155+
Phase 1 is complete. Here's a summary:
156+
157+
Phase 1 Complete ✅
158+
159+
Two commits made on edburns/80-java-monorepo-add-01:
160+
161+
1. 446547c — Copied all Java SDK source files into java/ (src, pom.xml, config, scripts, docs, mvnw, etc.)
162+
2. f0aebe7 — Updated pom.xml to use local monorepo test harness instead of git clone:
163+
- Removed antrun git-clone plugin entirely
164+
- Changed copilot.sdk.clone.dir to ${project.basedir}/.. (monorepo root)
165+
- Updated <scm> URLs to github/copilot-sdk
166+
- Updated comments to reflect monorepo layout
167+
168+
Verification: mvn clean verify passes — BUILD SUCCESS (9 min, all tests green).
169+
170+
## dd-2989720-move-to-monorepo
171+
172+
The file `80-java-monorepo-add-01-remove-before-merge\dd-2989727-move-java-to-monorepo-plan.md` is a high-level plan for migrating the code in `..\copilot-sdk-java-00` (source), which is a local clone of https://github.com/github/copilot-sdk-java , to reside in the `java` directory within `copilot-sdk-00` (dest), which is a local clone of https://github.com/github/copilot-sdk .
173+
174+
Read the whole thing now.
175+
176+
Next, I want the agent to handle "Phase 1: Copy Source Code (No Workflows Yet)". Note that the markdown strikethrough steps have already been completed.
177+
178+
Next, write out a fully detailed prompt sufficient to feed to an agent with `copilot --yolo` to instruct the agent to do Phase 1.
179+
180+
- ✅✅✅ Assume copilot will be invoked in `copilot-sdk-00` (dest) and that `..\copilot-sdk-java-00` is the correct relative path for the source.
181+
- ✅✅✅ Tell the agent about the paths.
182+
- ✅✅✅ Tell the agent it is safe to do the work in the current topic branch, making fine-grained commits with reasonable commit log messages.
183+
- Tell the agent to read `80-java-monorepo-add-01-remove-before-merge\dd-2989727-move-java-to-monorepo-plan.md` first.
184+
- ❌❌❌ Tell the agent to not do any other phases.
185+
186+
Write the prompt to the file `80-java-monorepo-add-01-remove-before-merge\dd-2997995.md`.
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
### 16:23 Prompt
2+
3+
Evaluate `java-sdk-tests.yml` and show me the differences with the file from which it was derived, `copilot-sdk-java-00/.github/workflows/build-test.yml`.
4+
5+
6+
### 16:25 Response
7+
8+
Read [](file:///c%3A/Users/edburns/workareas/copilot-sdk-00/.github/workflows/java-sdk-tests.yml)
9+
10+
Read [](file:///c%3A/Users/edburns/workareas/copilot-sdk-java-00/.github/workflows/build-test.yml#1-1), lines 1 to 150
11+
12+
Here's a comparison of the key differences:
13+
14+
## Structural Differences
15+
16+
| Aspect | build-test.yml (source) | java-sdk-tests.yml (new) |
17+
|--------|--------------------------|---------------------------|
18+
| **Name** | "Build & Test" | "Java SDK Tests" |
19+
| **Schedule trigger** | Weekly cron (Sundays 00:00 UTC) | Removed |
20+
| **Push paths** | `paths-ignore` (README, LICENSE, .github) | No path filter on push to main |
21+
| **PR paths** | `paths-ignore` pattern | `paths` include pattern (`java/**`, `test/**`, workflow file) with doc exclusions |
22+
| **OS matrix** | `ubuntu-latest` only | 3-OS matrix (`ubuntu`, `macos`, `windows`) |
23+
| **Working directory** | None (repo root = java root) | `working-directory: ./java` |
24+
| **Smoke test job** | Yes (calls `run-smoke-test.yml`, gates main job) | Removed (deferred to Phase 3) |
25+
| **Permissions** | `contents: write`, `checks: write`, `pull-requests: write` | `contents: read` only |
26+
27+
## Removed Features (intentionally per plan)
28+
29+
- **Smoke test job** — Phase 3 concern
30+
- **JaCoCo badge generation** + PR creation — not needed in monorepo CI
31+
- **`validate reference-impl-sync completeness` step** — Phase 4 concern
32+
- **Upload test results for site generation** — not needed in monorepo CI
33+
- **`COPILOT_GITHUB_TOKEN` / `COPILOT_CLI_PATH` env vars** — not used
34+
- **Clone-based test harness setup** (`cd target/copilot-sdk/nodejs && npm ci`) — replaced by local harness install
35+
36+
## Added/Changed Features
37+
38+
- **3-OS matrix** — matches other monorepo SDK test workflows
39+
- **Explicit Node.js setup** + `npm ci` on nodejs and harness — replaces the clone-based approach since harness is now local
40+
- **Path-scoped PR triggers** — only fires when java, test, or the workflow itself changes
41+
- **Spotless/Javadoc gated to Linux only** (`if: runner.os == 'Linux'`) — avoids redundant formatting checks on all 3 OS
42+
- **Action versions use tags** (`@v6.0.2`) instead of pinned commit SHAs — less secure but more readable; the source used full SHA pins
43+
44+
## Potential Concerns
45+
46+
1. **No SHA-pinned actions** — The source pinned actions to exact commit SHAs (e.g., `actions/checkout@de0fac2e...`). The new file uses version tags (`@v6.0.2`, `@v5`, `@v6`). This is less secure against supply-chain attacks but matches the style used in some monorepo workflows.
47+
48+
2. **Missing `persist-credentials: false`** on checkout — the source had this explicitly set for security.
49+
50+
3. **No `COPILOT_GITHUB_TOKEN`** — The source passed this to `mvn verify` for E2E tests that talk to a live Copilot CLI. If E2E tests in the monorepo still need a real token (vs. only the replay proxy), this would cause test failures. However, since the monorepo E2E tests use the replay proxy from harness, this is likely fine.
51+
52+
4. **`distribution: "microsoft"`** for JDK — both files use this, which is consistent.
53+
54+
5. **Push trigger has no path filter** — PRs are path-filtered, but pushes to `main` will run on every push regardless of which files changed. Other monorepo workflows (e.g., `dotnet-sdk-tests.yml`) may or may not have this same pattern — worth checking for consistency.
55+
56+
### 16:25 Response
57+
58+
Concerns
59+
60+
1. I want a push path filter. Should only run on channges to `/java`.
61+
62+
2. For the 3-OS matrix, make it only for `ubuntu-latest`.
63+
64+
3. For permissions, make it have the same as `build-tests.yml`.
65+
66+
4. Yes, I do want the Jacoco badge creation. Copy that entire mechanism from `copilot-sdk-java-00`.
67+
68+
5. You stated
69+
70+
`COPILOT_GITHUB_TOKEN / COPILOT_CLI_PATH env vars — not used`
71+
72+
Why is this? Looking at `build-tests.yml` those things are clearly in there:
73+
74+
```yml
75+
- name: Run Java SDK tests
76+
env:
77+
CI: "true"
78+
COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}
79+
COPILOT_CLI_PATH: ${{ steps.setup-copilot.outputs.path }}
80+
run: mvn verify
81+
```
82+
83+
Surely we need them on the `copilot-sdk-00` side as well. There are Java tests that don't just use the relay proxy.
84+
85+
6. Consider this review comment:
86+
87+
> No SHA-pinned actions — The source pinned actions to exact commit SHAs (e.g., actions/checkout@de0fac2e...). The new file uses version tags (@v6.0.2, @v5, @v6). This is less secure against supply-chain attacks but matches the style used in some monorepo workflows.
88+
89+
I want the pinned actions.
90+
91+
7. Consider this review comment:
92+
93+
> Missing persist-credentials: false on checkout — the source had this explicitly set for security.
94+
95+
I want this set here as well.

0 commit comments

Comments
 (0)