Skip to content

Commit c3135f6

Browse files
committed
docs(showcase): add PocketBase D5 history analysis to DEBUGGING.md
Strategy 9: pull all D5 status records from PocketBase in one request, categorize errors, cross-reference with deploy history, and compute per-service flapping rates to distinguish real bugs from transient production issues.
1 parent d571161 commit c3135f6

1 file changed

Lines changed: 65 additions & 0 deletions

File tree

showcase/DEBUGGING.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,71 @@ RAILWAY_PROJECT_ID=6f8c6bff-a80d-4f8f-b78d-50b32bcf4479 \
382382

383383
Missing `ANTHROPIC_BASE_URL` or `GOOGLE_GEMINI_BASE_URL` means the service bypasses aimock and hits the real API. This produces non-deterministic results that look like flapping. Local docker-compose sets ALL providers to aimock — production must match.
384384

385+
### Strategy 9: Pull PocketBase D5 history to distinguish bugs from flapping
386+
387+
**When**: Production shows blues (D4) but everything passes locally. You need to know if a feature is genuinely broken or just flapping from transient production conditions.
388+
389+
**Do**: Pull the current D5 status records from PocketBase in one request and categorize the errors. PocketBase stores ONE record per `d5:<slug>/<featureType>` key (upsert), with `fail_count` tracking consecutive failures.
390+
391+
```sh
392+
# Get ALL currently-red D5 records with error details:
393+
curl -s 'https://showcase-pocketbase-production.up.railway.app/api/collections/status/records?sort=-updated&perPage=200&filter=key~%22d5:%22%20%26%26%20state!=%22green%22' | \
394+
python3 -c "
395+
import json, sys
396+
data = json.load(sys.stdin)
397+
items = data.get('items', [])
398+
print(f'{len(items)} RED D5 records')
399+
for item in items:
400+
key = item.get('key', '?').replace('d5:showcase-','')
401+
fc = item.get('fail_count', 0)
402+
signal = item.get('signal', {})
403+
error = signal.get('errorDesc', '') if isinstance(signal, dict) else ''
404+
print(f'{key:<50} fc={fc:<3} {error[:80]}')
405+
"
406+
```
407+
408+
**How to read it:**
409+
- `fail_count=1` → just flipped red on the last cycle (likely flapper)
410+
- `fail_count>=3` → consistently failing (likely a real bug)
411+
- `fail_count=0` with `state!=green` → transitional state, check again next cycle
412+
413+
**Categorize errors** to find the root cause pattern:
414+
- `page.fill: Timeout` → React hydration too slow (probe infrastructure issue)
415+
- `assistant did not respond within 30000ms` → backend or aimock not returning
416+
- `chat input not found` → selector cascade failed (page didn't render)
417+
- `keyword missing` → aimock returned wrong fixture
418+
- `auth: after clicking sign-out` → auth probe timing race
419+
420+
**Cross-reference with deploy history** to identify deploy churn:
421+
```sh
422+
gh run list --branch main --limit 10 -R CopilotKit/CopilotKit --workflow "Showcase: Build & Push"
423+
```
424+
425+
If a feature flipped red right when a deploy happened and `fail_count=1`, it's deploy churn — the Railway service restarted mid-probe. Wait one cycle and re-check.
426+
427+
**Get per-service flapping rates** from the harness API (last 10 probe runs):
428+
```sh
429+
curl -s 'https://showcase-harness-production.up.railway.app/api/probes/probe:e2e-deep' | \
430+
python3 -c "
431+
import json, sys
432+
data = json.load(sys.stdin)
433+
runs = [r for r in data.get('runs', []) if r.get('state') == 'completed' and r.get('summary')][:10]
434+
stats = {}
435+
for run in runs:
436+
for svc in run['summary'].get('services', []):
437+
slug = svc.get('slug','?').replace('e2e-deep:showcase-','')
438+
result = svc.get('result', '?')
439+
stats.setdefault(slug, {'green': 0, 'red': 0})
440+
stats[slug]['green' if result == 'green' else 'red'] += 1
441+
for slug in sorted(stats):
442+
s = stats[slug]
443+
rate = s['green'] / (s['green'] + s['red']) * 100
444+
print(f'{slug:<25} {s[\"green\"]}/{s[\"green\"]+s[\"red\"]} green ({rate:.0f}%)')
445+
"
446+
```
447+
448+
**Key insight**: If ALL integrations flap at similar rates (50-70% green), the problem is systemic (probe infrastructure), not per-integration code bugs. If only one integration is consistently red while others are green, it's a real code bug in that integration.
449+
385450
## Quick Diagnostic Commands
386451

387452
```sh

0 commit comments

Comments
 (0)