test(e2e): instrument mock SSE + client stream + fix reachability probe to attribute #90 mode-B (#98)
Adds diagnostics-only instrumentation to attribute the Activation E2E positive flow's "SSE reply never renders" failure (issue #90 mode B) between (a) expo/fetch not streaming the SSE response on the Android release APK, vs (b) a mock-side broadcast bug. Does not change app behavior or fix the root cause — #90 stays open pending the next CI run's enriched logs. - tests/fixtures/mock-opencode-server.ts: per-request logging (method/path/status), per-SSE-connection connect/disconnect logging with live client count, per-broadcast event-type + client-count logging, and a 2s SSE heartbeat comment so client-side silence becomes unambiguous. - src/lib/sdk.ts global.events(): logs on the first successful reader.read() that returns data, and when the stream loop ends — proves/disproves whether expo/fetch ever delivers a byte. - scripts/run-e2e-flows.sh: the emulator->mock reachability probe used toybox wget/nc, which don't work reliably on the API-28 image. Replaced with a probe chain (curl, wget, mksh /dev/tcp, nc, then a host-side fallback) that writes a clear PASS/FAIL/UNKNOWN verdict to artifacts/diag/probe.txt without blocking the flow. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -253,10 +253,19 @@ export function createClient(config: ClientConfig) {
|
||||
const decoder = new TextDecoder()
|
||||
const parser = new SSEParser()
|
||||
|
||||
let receivedFirstByte = false
|
||||
try {
|
||||
while (true) {
|
||||
const { done, value } = await reader.read()
|
||||
if (done) break
|
||||
if (done) {
|
||||
console.log("[SSE] stream ended")
|
||||
break
|
||||
}
|
||||
|
||||
if (!receivedFirstByte) {
|
||||
receivedFirstByte = true
|
||||
console.log(`[SSE] first byte received (${value?.byteLength ?? 0} bytes)`)
|
||||
}
|
||||
|
||||
for (const data of parser.push(decoder.decode(value, { stream: true }))) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user