Skip to content

Commit bb8eb44

Browse files
sinacodeditclaude
andcommitted
feat(ios-fix): connect to device first, before/after screenshots
- Phase 0 (new): connect to device before reading source — uses session cache for instant IP, falls back to devicectl discovery. Takes a live 'before' screenshot showing the bug, reads the broken state value. - Phase 4 updated: refreshes tunnel IP after relaunch, navigates to bug location, reads state before vs after, takes 'after' screenshot and adjacent screen regression screenshots. Reads both images visually. - Report now includes before/after screenshot paths with visual description. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent ebb6521 commit bb8eb44

1 file changed

Lines changed: 118 additions & 14 deletions

File tree

ios-fix/SKILL.md.tmpl

Lines changed: 118 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,63 @@ Claude Code (this skill — YOU)
6363

6464
5. **Report what you did.** Output a clear before/after with evidence.
6565

66+
## Phase 0: Connect to Device (Do This First)
67+
68+
Before reading any source, connect to the device and capture the bug state live.
69+
This gives you a "before" screenshot and confirms the bug is reproducible.
70+
71+
### 0a. Get the tunnel IP (check session cache first)
72+
73+
```bash
74+
# Try session cache first — instant
75+
CACHED=$(cat ~/.gstack/ios-qa-session.json 2>/dev/null)
76+
if [ -n "$CACHED" ]; then
77+
TUNNEL_IP=$(echo "$CACHED" | python3 -c "import sys,json; print(json.load(sys.stdin)['tunnelIP'])")
78+
DEVICE_ID=$(echo "$CACHED" | python3 -c "import sys,json; print(json.load(sys.stdin)['deviceId'])")
79+
echo "Using cached device: $DEVICE_ID, IP: $TUNNEL_IP"
80+
fi
81+
82+
# Verify health — if stale, rediscover
83+
DEVICE_URL="http://[$TUNNEL_IP]:9999"
84+
HEALTH=$(curl -s -6 --max-time 3 "$DEVICE_URL/health" 2>/dev/null)
85+
if echo "$HEALTH" | grep -q '"ok"'; then
86+
echo "Device connected ✓"
87+
else
88+
echo "Cache stale — rediscovering device..."
89+
DEVICE_ID=$(xcrun devicectl list devices 2>&1 | grep "connected" | awk '{print $(NF-2)}')
90+
TUNNEL_IP=$(xcrun devicectl device info details --device "$DEVICE_ID" 2>&1 | grep tunnelIPAddress | awk '{print $2}')
91+
DEVICE_URL="http://[$TUNNEL_IP]:9999"
92+
curl -s -6 "$DEVICE_URL/health"
93+
fi
94+
```
95+
96+
### 0b. Take a "before" screenshot — capture the bug live
97+
98+
```bash
99+
mkdir -p /tmp/ios-fix
100+
curl -s -6 "$DEVICE_URL/screenshot" \
101+
| python3 -c "import sys,json,base64; sys.stdout.buffer.write(base64.b64decode(json.load(sys.stdin)['image']))" \
102+
> /tmp/ios-fix/before.png
103+
```
104+
105+
**Read `/tmp/ios-fix/before.png`** — describe what you see. Confirm the bug is
106+
visible in the current state. If the bug requires a specific UI interaction to
107+
trigger, navigate there now using `/tap`, `/type`, `/state` writes to reproduce it,
108+
then take another screenshot.
109+
110+
### 0c. Capture the broken state value
111+
112+
```bash
113+
# Read the state key(s) that show the wrong value
114+
curl -s -6 "$DEVICE_URL/state"
115+
# Then read the specific key from the bug report:
116+
curl -s -6 "$DEVICE_URL/state/<relevant_key>"
117+
```
118+
119+
Record the **wrong value** — you'll compare against this after the fix.
120+
121+
---
122+
66123
## Phase 1: Understand the Bug
67124

68125
Read the bug report. Extract:
@@ -138,23 +195,66 @@ curl -s -6 "$DEVICE_URL/health"
138195

139196
## Phase 4: Verify the Fix
140197

141-
Reproduce the exact steps from the bug report, then verify state:
198+
Reconnect (tunnel IP may have changed after relaunch), then reproduce and verify:
142199

143200
```bash
144-
# Example: reproduce the bug steps
145-
curl -s -6 "$DEVICE_URL/elements"
146-
curl -s -6 -X POST "$DEVICE_URL/tap" -d '{"x": 200, "y": 450}'
201+
# Refresh tunnel IP after relaunch
202+
TUNNEL_IP=$(xcrun devicectl device info details --device "$DEVICE_ID" 2>&1 | grep tunnelIPAddress | awk '{print $2}')
203+
DEVICE_URL="http://[$TUNNEL_IP]:9999"
147204
148-
# Verify state is now correct
149-
curl -s -6 "$DEVICE_URL/state/CartViewModel_total"
150-
# Should now show the correct value
205+
# Wait for app to stabilize
206+
sleep 2
207+
curl -s -6 "$DEVICE_URL/health"
208+
```
151209

152-
# Screenshot for evidence
153-
mkdir -p /tmp/ios-fix
154-
curl -s -6 "$DEVICE_URL/screenshot" | python3 -c "import sys,json,base64; sys.stdout.buffer.write(base64.b64decode(json.load(sys.stdin)['image']))" > /tmp/ios-fix/after-fix.png
210+
### 4a. Navigate to the bug location and reproduce the trigger
211+
212+
Use the same action keys / taps / state writes from Phase 0 to get back to the
213+
same state that showed the bug. Then trigger the failing action:
214+
215+
```bash
216+
# Reset to same starting state
217+
curl -s -6 -X POST "$DEVICE_URL/state/<setup_key>" -d '<setup_value>'
218+
219+
# Trigger the action that was broken
220+
curl -s -6 -X POST "$DEVICE_URL/state/<action_key>" -d '<trigger>'
155221
```
156222

157-
Then **Read** `/tmp/ios-fix/after-fix.png` to visually confirm.
223+
### 4b. Read state — compare before vs after
224+
225+
```bash
226+
# Read the key that was wrong before
227+
curl -s -6 "$DEVICE_URL/state/<relevant_key>"
228+
```
229+
230+
Compare against the **wrong value** captured in Phase 0. It should now be correct.
231+
If it's still wrong, your fix didn't address the root cause — re-analyze.
232+
233+
### 4c. Take the "after" screenshot
234+
235+
```bash
236+
curl -s -6 "$DEVICE_URL/screenshot" \
237+
| python3 -c "import sys,json,base64; sys.stdout.buffer.write(base64.b64decode(json.load(sys.stdin)['image']))" \
238+
> /tmp/ios-fix/after.png
239+
```
240+
241+
**Read `/tmp/ios-fix/after.png`** — visually confirm the UI now shows correct data.
242+
Describe specifically what changed vs the before screenshot.
243+
244+
### 4d. Take screenshots of adjacent screens (regression check)
245+
246+
For each screen that could be affected by the fix, navigate there and screenshot:
247+
248+
```bash
249+
# Navigate to adjacent screen via tab tap or action key
250+
curl -s -6 -X POST "$DEVICE_URL/tap" -d '{"x": <tab_x>, "y": <tab_y>}'
251+
sleep 0.5
252+
curl -s -6 "$DEVICE_URL/screenshot" \
253+
| python3 -c "import sys,json,base64; sys.stdout.buffer.write(base64.b64decode(json.load(sys.stdin)['image']))" \
254+
> /tmp/ios-fix/regression-check.png
255+
```
256+
257+
**Read** the regression screenshot. Confirm nothing else broke.
158258

159259
## Phase 5: Report
160260

@@ -183,10 +283,14 @@ Output a structured fix report:
183283
2. [action taken]
184284
185285
**State before fix:** [key] = [wrong value]
186-
**State after fix:** [key] = [correct value]
187-
**Screenshot:** /tmp/ios-fix/after-fix.png
286+
**State after fix:** [key] = [correct value]
287+
288+
**Before:** /tmp/ios-fix/before.png — [describe what was visually wrong]
289+
**After:** /tmp/ios-fix/after.png — [describe what is now correct]
290+
291+
**Regression check:** /tmp/ios-fix/regression-check.png — [describe adjacent screens look fine]
188292
189-
### Status: VERIFIED FIXED
293+
### Status: VERIFIED FIXED
190294
```
191295

192296
## Error Handling

0 commit comments

Comments
 (0)