Skip to content

Commit b07b6d0

Browse files
committed
Add test comment to DatafileProjectConfig
1 parent 77c4cfc commit b07b6d0

File tree

2 files changed

+254
-0
lines changed

2 files changed

+254
-0
lines changed
Lines changed: 253 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,253 @@
1+
---
2+
name: create-pr-current
3+
displayName: Create PR for Current Branch
4+
description: Creates a pull request for the current branch in java-sdk repository. Must be explicitly invoked with /create-pr-current to avoid confusion with create-prs agent.
5+
version: 1.0.0
6+
disable-model-invocation: true
7+
requiredTools:
8+
- Bash
9+
- Read
10+
- mcp__github__create_pull_request
11+
---
12+
13+
# Create PR for Current Branch
14+
15+
Creates a pull request for the current branch in the java-sdk repository.
16+
17+
## Instructions
18+
19+
When invoked, follow these steps:
20+
21+
**🚨 CRITICAL: Before starting the workflow, use TodoWrite to set up all steps as pending todos.**
22+
23+
**Step Setup (Use TodoWrite tool immediately):**
24+
```
25+
1. Get current branch information
26+
2. Check for merge conflicts with master branch
27+
3. Get repository information
28+
4. Push current branch
29+
5. Generate PR title and description
30+
6. Create pull request
31+
7. Report results
32+
```
33+
34+
**TodoWrite Setup Example:**
35+
```json
36+
{
37+
"todos": [
38+
{
39+
"content": "Get current branch information",
40+
"activeForm": "Getting current branch information",
41+
"status": "pending"
42+
},
43+
{
44+
"content": "Check for merge conflicts with master branch",
45+
"activeForm": "Checking for merge conflicts with master branch",
46+
"status": "pending"
47+
},
48+
{
49+
"content": "Get repository information",
50+
"activeForm": "Getting repository information",
51+
"status": "pending"
52+
},
53+
{
54+
"content": "Push current branch",
55+
"activeForm": "Pushing current branch",
56+
"status": "pending"
57+
},
58+
{
59+
"content": "Generate PR title and description",
60+
"activeForm": "Generating PR title and description",
61+
"status": "pending"
62+
},
63+
{
64+
"content": "Create pull request",
65+
"activeForm": "Creating pull request",
66+
"status": "pending"
67+
},
68+
{
69+
"content": "Report results",
70+
"activeForm": "Reporting results",
71+
"status": "pending"
72+
}
73+
]
74+
}
75+
```
76+
77+
**After completing each step, use TodoWrite to mark it as completed before proceeding to the next step.**
78+
79+
---
80+
81+
### 1. Get Current Branch Information
82+
**Mark this step as in_progress using TodoWrite**
83+
- Use `git branch --show-current` to get the current branch name
84+
- Use `git status` to verify there are no uncommitted changes
85+
- If uncommitted changes exist, warn user and ask if they want to commit first
86+
87+
**Mark Step 1 as completed using TodoWrite before proceeding**
88+
89+
---
90+
91+
### 2. Check for Merge Conflicts with Master Branch
92+
**Mark this step as in_progress using TodoWrite**
93+
94+
#### a. Detect Potential Conflicts (Physical and Logical)
95+
- Fetch latest master: `git fetch origin master`
96+
- Check for physical conflicts: `git merge-tree $(git merge-base HEAD origin/master) HEAD origin/master`
97+
- Check for .md file changes: `git diff --name-only origin/master...HEAD | grep '\.md$'`
98+
- **Decision logic**:
99+
- If .md files changed → ALWAYS proceed to conflict analysis (even if no physical conflicts)
100+
- Reason: Logical conflicts in agent configs/prompts cannot be detected by git
101+
- If only non-.md files changed AND no physical conflicts → Skip to step 3
102+
- If physical conflicts detected → Proceed to conflict analysis
103+
104+
#### b-h. Resolve Conflicts with Semantic Evaluation
105+
106+
**🚨 CRITICAL: Follow the detailed process in [prompts/rules/git-logical-merge.md](../../prompts/rules/git-logical-merge.md)**
107+
108+
This process handles both physical conflicts (detected by git) and logical conflicts (semantic incompatibilities in .md files that git cannot detect).
109+
110+
**The process includes these critical steps:**
111+
- **Step b**: Analyze files with semantic evaluation (understand what EACH side added)
112+
- **Step c**: Categorize conflict severity (CRITICAL/HIGH/MEDIUM/LOW)
113+
- **Step d**: Present critical conflicts to user with impact assessment
114+
- **Step e**: **BLOCKING** - Use AskUserQuestion tool for user decision (MANDATORY)
115+
- **Step f**: Execute resolution strategy based on user choice
116+
- **Step g**: **MANDATORY** - Verify resolution preserves intent using Read tool
117+
- **Step h**: **GATE CHECK** - Pre-commit checklist (all answers must be YES)
118+
119+
**⚠️ You MUST follow every step in git-logical-merge.md. Do NOT skip steps e, g, or h - they contain blocking requirements and verification gates.**
120+
121+
See [git-logical-merge.md](../../prompts/rules/git-logical-merge.md) for complete step-by-step instructions with examples.
122+
123+
**Mark Step 2 as completed using TodoWrite before proceeding**
124+
125+
---
126+
127+
### 3. Get Repository Information
128+
**Mark this step as in_progress using TodoWrite**
129+
- Repository owner: Extract from git remote (e.g., "optimizely")
130+
- Repository name: "java-sdk"
131+
- Base branch: Typically "master" (verify with `git remote show origin | grep "HEAD branch"`)
132+
133+
**Mark Step 3 as completed using TodoWrite before proceeding**
134+
135+
---
136+
137+
### 4. Push Current Branch
138+
**Mark this step as in_progress using TodoWrite**
139+
- Push branch to remote: `git push -u origin <branch-name>`
140+
- Verify push succeeded
141+
142+
**Mark Step 4 as completed using TodoWrite before proceeding**
143+
144+
---
145+
146+
### 5. Generate PR Title and Description
147+
**Mark this step as in_progress using TodoWrite**
148+
149+
#### PR Title (Local Rule - java-sdk Repository)
150+
- **Format:** `[TICKET-ID] Brief description of changes`
151+
- **Ticket ID:** Use uppercase format (e.g., `[FSSDK-12345]`) or `[FSSDK-0000]` if no ticket
152+
- **Example:** `[FSSDK-12345] Add feature rollout support`
153+
154+
#### PR Body/Description (Follow pr-format.md)
155+
156+
**🚨 CRITICAL WORKFLOW - Follow these steps exactly:**
157+
158+
**Step 1: Read the Template**
159+
- ALWAYS read `prompts/rules/pr-format.md` first (lines 55-70 for template)
160+
- The template has ONLY these sections:
161+
- ## Summary
162+
- ## Changes
163+
- ## Jira Ticket
164+
- ## Notes (Optional - only for breaking changes)
165+
166+
**Step 2: Read Forbidden Sections**
167+
- Read pr-format.md lines 48-53 for what NOT to include
168+
- NEVER add: Testing, Test Coverage, Quality Assurance, Files Modified, Implementation Details
169+
- NEVER add: Commits section (similar to Files Modified)
170+
171+
**Step 3: Generate PR Description**
172+
- Use ONLY the template sections from pr-format.md
173+
- Summary: 2-3 sentences max
174+
- Changes: 3-5 bullet points, high-level only
175+
- Jira Ticket: `[FSSDK-0000](https://optimizely-ext.atlassian.net/browse/FSSDK-0000)` or actual ticket
176+
- Notes: Only if breaking changes exist
177+
178+
**Step 4: Verify Before Sending**
179+
- Check: Does output have exactly Summary, Changes, Jira Ticket (and optionally Notes)?
180+
- Check: Does output have ANY sections not in the template (Commits, Files, Tests, etc.)?
181+
- If ANY extra sections exist → REMOVE THEM
182+
- Only proceed when output matches template exactly
183+
184+
**Mark Step 5 as completed using TodoWrite before proceeding**
185+
186+
---
187+
188+
### 6. Create or Update Pull Request
189+
**Mark this step as in_progress using TodoWrite**
190+
191+
#### a. Check if PR already exists
192+
- Use `mcp__github__list_pull_requests` with `head` parameter to check for existing PR
193+
- Search for PRs with head branch matching current branch
194+
195+
#### b. If PR exists - Update it
196+
- Use `mcp__github__update_pull_request` with PR number
197+
- Parameters:
198+
- `owner`: Repository owner
199+
- `repo`: "java-sdk"
200+
- `pullNumber`: Existing PR number
201+
- `title`: New PR title
202+
- `body`: New PR description
203+
- Report: "Updated existing PR #X"
204+
205+
#### c. If PR does not exist - Create it
206+
- **CRITICAL:** Use GitHub MCP tool `mcp__github__create_pull_request`
207+
- **NEVER** use `gh pr create` via Bash
208+
- Parameters:
209+
- `owner`: Repository owner
210+
- `repo`: "java-sdk"
211+
- `title`: PR title
212+
- `head`: Current branch name
213+
- `base`: Base branch (usually "master")
214+
- `body`: PR description
215+
- Report: "Created new PR #X"
216+
217+
**Mark Step 6 as completed using TodoWrite before proceeding**
218+
219+
---
220+
221+
### 7. Report Results
222+
**Mark this step as in_progress using TodoWrite**
223+
- Display PR URL
224+
- Show PR title and base branch
225+
- Confirm PR was created successfully
226+
227+
**Mark Step 7 as completed using TodoWrite - PR creation complete!**
228+
229+
---
230+
231+
## Example Usage
232+
233+
User: "/create-pr-current"
234+
235+
Assistant executes:
236+
1. Gets current branch: `jae/add-feature`
237+
2. Checks for merge conflicts with master (if any, resolves interactively)
238+
3. Gets repository information
239+
4. Pushes: `git push -u origin jae/add-feature`
240+
5. Generates PR title and description
241+
6. Creates PR using `mcp__github__create_pull_request`
242+
7. Returns PR URL
243+
244+
**Note:** Triggers are disabled to avoid confusion with create-prs agent.
245+
Must be explicitly invoked with `/create-pr-current` command.
246+
247+
## Error Handling
248+
249+
- If no git repository: Report error
250+
- If on master/main branch: Warn and ask for confirmation
251+
- If uncommitted changes: Offer to show status and ask to commit first
252+
- If push fails: Report error and abort
253+
- If GitHub MCP fails: Report error (do NOT fall back to gh CLI)

core-api/src/main/java/com/optimizely/ab/config/DatafileProjectConfig.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,7 @@ private List<Experiment> injectFeatureRolloutVariations(
383383
}
384384
}
385385

386+
// [TESTING]
386387
// Build experiment ID to index mapping for quick lookup
387388
Map<String, Integer> experimentIndexMap = new HashMap<>();
388389
for (int i = 0; i < allExperiments.size(); i++) {

0 commit comments

Comments
 (0)