diff --git a/jest.config.js b/jest.config.js index b2017ea..bf9b73f 100644 --- a/jest.config.js +++ b/jest.config.js @@ -23,6 +23,5 @@ module.exports = { ], }, '/verify/jest/jest.scenarios.config.js', - // the degraded project lives under verify/jest/ (later task) ], }; diff --git a/verify/expected/async-generator.js.otlp.json b/verify/expected/async-generator.js.otlp.json new file mode 100644 index 0000000..cbf84fd --- /dev/null +++ b/verify/expected/async-generator.js.otlp.json @@ -0,0 +1,79 @@ +{ + "resourceSpans": [ + { + "resource": { + "attributes": [ + { + "key": "service.name", + "value": { + "stringValue": "verify" + } + } + ] + }, + "scopeSpans": [ + { + "scope": { + "name": "verify" + }, + "spans": [ + { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000001", + "name": "root", + "kind": 1, + "startTimeUnixNano": "1767225600000000000", + "endTimeUnixNano": "1767225600000060000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000002", + "parentSpanId": "0a00000000000001", + "name": "gen.0", + "kind": 1, + "startTimeUnixNano": "1767225600000010000", + "endTimeUnixNano": "1767225600000011000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000003", + "parentSpanId": "0a00000000000001", + "name": "loop.0", + "kind": 1, + "startTimeUnixNano": "1767225600000020000", + "endTimeUnixNano": "1767225600000021000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000004", + "parentSpanId": "0a00000000000001", + "name": "gen.1", + "kind": 1, + "startTimeUnixNano": "1767225600000030000", + "endTimeUnixNano": "1767225600000031000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000005", + "parentSpanId": "0a00000000000001", + "name": "loop.1", + "kind": 1, + "startTimeUnixNano": "1767225600000040000", + "endTimeUnixNano": "1767225600000041000", + "status": {}, + "flags": 257 + } + ] + } + ] + } + ] +} diff --git a/verify/expected/batching-shared-queue.js.otlp.json b/verify/expected/batching-shared-queue.js.otlp.json new file mode 100644 index 0000000..0b41dc0 --- /dev/null +++ b/verify/expected/batching-shared-queue.js.otlp.json @@ -0,0 +1,67 @@ +{ + "resourceSpans": [ + { + "resource": { + "attributes": [ + { + "key": "service.name", + "value": { + "stringValue": "verify" + } + } + ] + }, + "scopeSpans": [ + { + "scope": { + "name": "verify" + }, + "spans": [ + { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000001", + "name": "h1", + "kind": 1, + "startTimeUnixNano": "1767225600000000000", + "endTimeUnixNano": "1767225600000001000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000002", + "spanId": "0a00000000000002", + "name": "h2", + "kind": 1, + "startTimeUnixNano": "1767225600000002000", + "endTimeUnixNano": "1767225600000003000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000003", + "parentSpanId": "0a00000000000001", + "name": "h1.work", + "kind": 1, + "startTimeUnixNano": "1767225600000010000", + "endTimeUnixNano": "1767225600000011000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000004", + "parentSpanId": "0a00000000000001", + "name": "h2.work", + "kind": 1, + "startTimeUnixNano": "1767225600000020000", + "endTimeUnixNano": "1767225600000021000", + "status": {}, + "flags": 257 + } + ] + } + ] + } + ] +} diff --git a/verify/expected/captured-then.js.otlp.json b/verify/expected/captured-then.js.otlp.json new file mode 100644 index 0000000..b57eb7e --- /dev/null +++ b/verify/expected/captured-then.js.otlp.json @@ -0,0 +1,56 @@ +{ + "resourceSpans": [ + { + "resource": { + "attributes": [ + { + "key": "service.name", + "value": { + "stringValue": "verify" + } + } + ] + }, + "scopeSpans": [ + { + "scope": { + "name": "verify" + }, + "spans": [ + { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000001", + "name": "parent", + "kind": 1, + "startTimeUnixNano": "1767225600000000000", + "endTimeUnixNano": "1767225600000030000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000002", + "parentSpanId": "0a00000000000001", + "name": "kept", + "kind": 1, + "startTimeUnixNano": "1767225600000010000", + "endTimeUnixNano": "1767225600000011000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000002", + "spanId": "0a00000000000003", + "name": "lost", + "kind": 1, + "startTimeUnixNano": "1767225600000020000", + "endTimeUnixNano": "1767225600000021000", + "status": {}, + "flags": 257 + } + ] + } + ] + } + ] +} diff --git a/verify/expected/concurrent-interleaved.js.otlp.json b/verify/expected/concurrent-interleaved.js.otlp.json new file mode 100644 index 0000000..3428488 --- /dev/null +++ b/verify/expected/concurrent-interleaved.js.otlp.json @@ -0,0 +1,99 @@ +{ + "resourceSpans": [ + { + "resource": { + "attributes": [ + { + "key": "service.name", + "value": { + "stringValue": "verify" + } + } + ] + }, + "scopeSpans": [ + { + "scope": { + "name": "verify" + }, + "spans": [ + { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000001", + "name": "a", + "kind": 1, + "startTimeUnixNano": "1767225600000000000", + "endTimeUnixNano": "1767225600000030000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000002", + "spanId": "0a00000000000002", + "name": "b", + "kind": 1, + "startTimeUnixNano": "1767225600000001000", + "endTimeUnixNano": "1767225600000031000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000003", + "parentSpanId": "0a00000000000001", + "name": "a.1", + "kind": 1, + "startTimeUnixNano": "1767225600000010000", + "endTimeUnixNano": "1767225600000011000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000002", + "spanId": "0a00000000000004", + "parentSpanId": "0a00000000000002", + "name": "b.1", + "kind": 1, + "startTimeUnixNano": "1767225600000011000", + "endTimeUnixNano": "1767225600000012000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000005", + "parentSpanId": "0a00000000000001", + "name": "a.2", + "kind": 1, + "startTimeUnixNano": "1767225600000020000", + "endTimeUnixNano": "1767225600000021000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000002", + "spanId": "0a00000000000006", + "parentSpanId": "0a00000000000002", + "name": "b.2", + "kind": 1, + "startTimeUnixNano": "1767225600000021000", + "endTimeUnixNano": "1767225600000022000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000003", + "spanId": "0a00000000000007", + "name": "after.all", + "kind": 1, + "startTimeUnixNano": "1767225600000040000", + "endTimeUnixNano": "1767225600000041000", + "status": {}, + "flags": 257 + } + ] + } + ] + } + ] +} diff --git a/verify/expected/degraded-probe.shape.json b/verify/expected/degraded-probe.shape.json deleted file mode 100644 index 9f48b6b..0000000 --- a/verify/expected/degraded-probe.shape.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "resource": ["service.name"], - "scope": ["com.callstack.context.degraded"], - "traces": [[ - {"name":"parent","kind":1,"parent":null,"status":0,"links":[],"attributes":{}} - ], [ - {"name":"after_await","kind":1,"parent":null,"status":0,"links":[],"attributes":{}} - ]] -} diff --git a/verify/expected/error-in-callback.js.otlp.json b/verify/expected/error-in-callback.js.otlp.json new file mode 100644 index 0000000..22eccaa --- /dev/null +++ b/verify/expected/error-in-callback.js.otlp.json @@ -0,0 +1,67 @@ +{ + "resourceSpans": [ + { + "resource": { + "attributes": [ + { + "key": "service.name", + "value": { + "stringValue": "verify" + } + } + ] + }, + "scopeSpans": [ + { + "scope": { + "name": "verify" + }, + "spans": [ + { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000001", + "name": "parent", + "kind": 1, + "startTimeUnixNano": "1767225600000000000", + "endTimeUnixNano": "1767225600000040000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000002", + "parentSpanId": "0a00000000000001", + "name": "throws", + "kind": 1, + "startTimeUnixNano": "1767225600000010000", + "endTimeUnixNano": "1767225600000011000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000002", + "spanId": "0a00000000000003", + "name": "root.next", + "kind": 1, + "startTimeUnixNano": "1767225600000030000", + "endTimeUnixNano": "1767225600000031000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000004", + "parentSpanId": "0a00000000000001", + "name": "caught", + "kind": 1, + "startTimeUnixNano": "1767225600000020000", + "endTimeUnixNano": "1767225600000021000", + "status": {}, + "flags": 257 + } + ] + } + ] + } + ] +} diff --git a/verify/expected/smoke-js.js.otlp.json b/verify/expected/event-emitter-listener.js.otlp.json similarity index 56% rename from verify/expected/smoke-js.js.otlp.json rename to verify/expected/event-emitter-listener.js.otlp.json index 690cc72..71f62e7 100644 --- a/verify/expected/smoke-js.js.otlp.json +++ b/verify/expected/event-emitter-listener.js.otlp.json @@ -20,10 +20,21 @@ { "traceId": "0a000000000000000000000000000001", "spanId": "0a00000000000001", - "name": "smoke", + "name": "emit", "kind": 1, "startTimeUnixNano": "1767225600000000000", - "endTimeUnixNano": "1767225600000001000", + "endTimeUnixNano": "1767225600000020000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000002", + "parentSpanId": "0a00000000000001", + "name": "listener", + "kind": 1, + "startTimeUnixNano": "1767225600000010000", + "endTimeUnixNano": "1767225600000011000", "status": {}, "flags": 257 } diff --git a/verify/expected/interval-new-root.js.otlp.json b/verify/expected/interval-new-root.js.otlp.json new file mode 100644 index 0000000..3923a1e --- /dev/null +++ b/verify/expected/interval-new-root.js.otlp.json @@ -0,0 +1,66 @@ +{ + "resourceSpans": [ + { + "resource": { + "attributes": [ + { + "key": "service.name", + "value": { + "stringValue": "verify" + } + } + ] + }, + "scopeSpans": [ + { + "scope": { + "name": "verify" + }, + "spans": [ + { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000001", + "name": "tap", + "kind": 1, + "startTimeUnixNano": "1767225600000000000", + "endTimeUnixNano": "1767225600000400000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000002", + "spanId": "0a00000000000002", + "name": "tick", + "kind": 1, + "startTimeUnixNano": "1767225600000100000", + "endTimeUnixNano": "1767225600000101000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000003", + "spanId": "0a00000000000003", + "name": "tick", + "kind": 1, + "startTimeUnixNano": "1767225600000200000", + "endTimeUnixNano": "1767225600000201000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000004", + "parentSpanId": "0a00000000000001", + "name": "load", + "kind": 1, + "startTimeUnixNano": "1767225600000300000", + "endTimeUnixNano": "1767225600000301000", + "status": {}, + "flags": 257 + } + ] + } + ] + } + ] +} diff --git a/verify/expected/nest-promise-all-race.js.otlp.json b/verify/expected/nest-promise-all-race.js.otlp.json new file mode 100644 index 0000000..57ceef3 --- /dev/null +++ b/verify/expected/nest-promise-all-race.js.otlp.json @@ -0,0 +1,90 @@ +{ + "resourceSpans": [ + { + "resource": { + "attributes": [ + { + "key": "service.name", + "value": { + "stringValue": "verify" + } + } + ] + }, + "scopeSpans": [ + { + "scope": { + "name": "verify" + }, + "spans": [ + { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000001", + "name": "root", + "kind": 1, + "startTimeUnixNano": "1767225600000000000", + "endTimeUnixNano": "1767225600000060000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000002", + "parentSpanId": "0a00000000000001", + "name": "all.a", + "kind": 1, + "startTimeUnixNano": "1767225600000010000", + "endTimeUnixNano": "1767225600000011000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000003", + "parentSpanId": "0a00000000000001", + "name": "all.b", + "kind": 1, + "startTimeUnixNano": "1767225600000020000", + "endTimeUnixNano": "1767225600000021000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000004", + "parentSpanId": "0a00000000000001", + "name": "race.a", + "kind": 1, + "startTimeUnixNano": "1767225600000030000", + "endTimeUnixNano": "1767225600000031000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000005", + "parentSpanId": "0a00000000000001", + "name": "race.b", + "kind": 1, + "startTimeUnixNano": "1767225600000040000", + "endTimeUnixNano": "1767225600000041000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000006", + "parentSpanId": "0a00000000000001", + "name": "after", + "kind": 1, + "startTimeUnixNano": "1767225600000050000", + "endTimeUnixNano": "1767225600000051000", + "status": {}, + "flags": 257 + } + ] + } + ] + } + ] +} diff --git a/verify/expected/handoff-basic.js.otlp.json b/verify/expected/nest-raf.js.otlp.json similarity index 59% rename from verify/expected/handoff-basic.js.otlp.json rename to verify/expected/nest-raf.js.otlp.json index 6876639..947dddf 100644 --- a/verify/expected/handoff-basic.js.otlp.json +++ b/verify/expected/nest-raf.js.otlp.json @@ -23,15 +23,18 @@ "name": "root", "kind": 1, "startTimeUnixNano": "1767225600000000000", - "endTimeUnixNano": "1767225600000100000", - "attributes": [ - { - "key": "app.step", - "value": { - "stringValue": "one" - } - } - ], + "endTimeUnixNano": "1767225600000020000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000002", + "parentSpanId": "0a00000000000001", + "name": "frame", + "kind": 1, + "startTimeUnixNano": "1767225600000010000", + "endTimeUnixNano": "1767225600000011000", "status": {}, "flags": 257 } diff --git a/verify/expected/nest-timers-microtasks.js.otlp.json b/verify/expected/nest-timers-microtasks.js.otlp.json new file mode 100644 index 0000000..c730379 --- /dev/null +++ b/verify/expected/nest-timers-microtasks.js.otlp.json @@ -0,0 +1,90 @@ +{ + "resourceSpans": [ + { + "resource": { + "attributes": [ + { + "key": "service.name", + "value": { + "stringValue": "verify" + } + } + ] + }, + "scopeSpans": [ + { + "scope": { + "name": "verify" + }, + "spans": [ + { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000001", + "name": "root", + "kind": 1, + "startTimeUnixNano": "1767225600000000000", + "endTimeUnixNano": "1767225600000050000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000002", + "parentSpanId": "0a00000000000001", + "name": "timeout", + "kind": 1, + "startTimeUnixNano": "1767225600000010000", + "endTimeUnixNano": "1767225600000011000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000003", + "parentSpanId": "0a00000000000001", + "name": "immediate", + "kind": 1, + "startTimeUnixNano": "1767225600000020000", + "endTimeUnixNano": "1767225600000021000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000004", + "parentSpanId": "0a00000000000001", + "name": "microtask", + "kind": 1, + "startTimeUnixNano": "1767225600000030000", + "endTimeUnixNano": "1767225600000031000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000005", + "parentSpanId": "0a00000000000001", + "name": "timeout.microtask", + "kind": 1, + "startTimeUnixNano": "1767225600000040000", + "endTimeUnixNano": "1767225600000041000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000006", + "parentSpanId": "0a00000000000001", + "name": "after.end", + "kind": 1, + "startTimeUnixNano": "1767225600000060000", + "endTimeUnixNano": "1767225600000061000", + "status": {}, + "flags": 257 + } + ] + } + ] + } + ] +} diff --git a/verify/expected/never-settling-promise.js.otlp.json b/verify/expected/never-settling-promise.js.otlp.json new file mode 100644 index 0000000..a71e213 --- /dev/null +++ b/verify/expected/never-settling-promise.js.otlp.json @@ -0,0 +1,66 @@ +{ + "resourceSpans": [ + { + "resource": { + "attributes": [ + { + "key": "service.name", + "value": { + "stringValue": "verify" + } + } + ] + }, + "scopeSpans": [ + { + "scope": { + "name": "verify" + }, + "spans": [ + { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000001", + "name": "parent", + "kind": 1, + "startTimeUnixNano": "1767225600000000000", + "endTimeUnixNano": "1767225600000020000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000002", + "parentSpanId": "0a00000000000001", + "name": "child", + "kind": 1, + "startTimeUnixNano": "1767225600000010000", + "endTimeUnixNano": "1767225600000011000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000002", + "spanId": "0a00000000000003", + "name": "later.await", + "kind": 1, + "startTimeUnixNano": "1767225600000030000", + "endTimeUnixNano": "1767225600000031000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000003", + "spanId": "0a00000000000004", + "name": "later.timeout", + "kind": 1, + "startTimeUnixNano": "1767225600000040000", + "endTimeUnixNano": "1767225600000041000", + "status": {}, + "flags": 257 + } + ] + } + ] + } + ] +} diff --git a/verify/expected/odd-attributes.js.otlp.json b/verify/expected/odd-attributes.js.otlp.json deleted file mode 100644 index b82c28d..0000000 --- a/verify/expected/odd-attributes.js.otlp.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "resourceSpans": [ - { - "resource": { - "attributes": [ - { - "key": "service.name", - "value": { - "stringValue": "verify" - } - } - ] - }, - "scopeSpans": [ - { - "scope": { - "name": "verify" - }, - "spans": [ - { - "traceId": "0a000000000000000000000000000001", - "spanId": "0a00000000000001", - "name": "odd", - "kind": 1, - "startTimeUnixNano": "1767225600000000000", - "endTimeUnixNano": "1767225600000010000", - "attributes": [ - { - "key": "big", - "value": { - "intValue": "9007199254740994" - } - }, - { - "key": "empty", - "value": { - "arrayValue": {} - } - }, - { - "key": "inf", - "value": { - "doubleValue": "Infinity" - } - }, - { - "key": "nan", - "value": { - "doubleValue": "NaN" - } - }, - { - "key": "negZero", - "value": { - "intValue": "0" - } - } - ], - "status": {}, - "flags": 257 - } - ] - } - ] - } - ] -} diff --git a/verify/expected/root-no-leak.js.otlp.json b/verify/expected/root-no-leak.js.otlp.json new file mode 100644 index 0000000..b72d020 --- /dev/null +++ b/verify/expected/root-no-leak.js.otlp.json @@ -0,0 +1,76 @@ +{ + "resourceSpans": [ + { + "resource": { + "attributes": [ + { + "key": "service.name", + "value": { + "stringValue": "verify" + } + } + ] + }, + "scopeSpans": [ + { + "scope": { + "name": "verify" + }, + "spans": [ + { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000001", + "name": "scoped", + "kind": 1, + "startTimeUnixNano": "1767225600000000000", + "endTimeUnixNano": "1767225600000020000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000002", + "parentSpanId": "0a00000000000001", + "name": "scoped.child", + "kind": 1, + "startTimeUnixNano": "1767225600000010000", + "endTimeUnixNano": "1767225600000011000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000002", + "spanId": "0a00000000000003", + "name": "after.sync", + "kind": 1, + "startTimeUnixNano": "1767225600000030000", + "endTimeUnixNano": "1767225600000031000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000003", + "spanId": "0a00000000000004", + "name": "after.await", + "kind": 1, + "startTimeUnixNano": "1767225600000040000", + "endTimeUnixNano": "1767225600000041000", + "status": {}, + "flags": 257 + }, + { + "traceId": "0a000000000000000000000000000004", + "spanId": "0a00000000000005", + "name": "after.timeout", + "kind": 1, + "startTimeUnixNano": "1767225600000050000", + "endTimeUnixNano": "1767225600000051000", + "status": {}, + "flags": 257 + } + ] + } + ] + } + ] +} diff --git a/verify/expected/smoke-device.shape.json b/verify/expected/smoke-device.shape.json deleted file mode 100644 index 37de82c..0000000 --- a/verify/expected/smoke-device.shape.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "resource": ["service.name"], - "scope": [], - "traces": [[ - {"name":"smoke","kind":1,"parent":null,"status":0,"links":[],"attributes":{}} - ]] -} diff --git a/verify/expected/smoke-js.shape.json b/verify/expected/smoke-js.shape.json deleted file mode 100644 index af726cc..0000000 --- a/verify/expected/smoke-js.shape.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "resource": ["service.name"], - "scope": [], - "traces": [[{"name": "smoke", "kind": 1, "parent": null, "status": 0, "links": [], "attributes": {}}]] -} diff --git a/verify/fixtures/async-generator.handoff.json b/verify/fixtures/async-generator.handoff.json new file mode 100644 index 0000000..3fac4bb --- /dev/null +++ b/verify/fixtures/async-generator.handoff.json @@ -0,0 +1,149 @@ +{ + "config": { + "serviceName": "verify", + "resourceAttributes": [], + "exportUrl": "", + "exportHeaders": [] + }, + "spans": [ + { + "context": { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000002", + "traceFlags": 1 + }, + "parentSpanId": "0a00000000000001", + "name": "gen.0", + "kind": 0, + "start": [ + 1767225600, + 10000 + ], + "end": [ + 1767225600, + 11000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + }, + { + "context": { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000003", + "traceFlags": 1 + }, + "parentSpanId": "0a00000000000001", + "name": "loop.0", + "kind": 0, + "start": [ + 1767225600, + 20000 + ], + "end": [ + 1767225600, + 21000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + }, + { + "context": { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000004", + "traceFlags": 1 + }, + "parentSpanId": "0a00000000000001", + "name": "gen.1", + "kind": 0, + "start": [ + 1767225600, + 30000 + ], + "end": [ + 1767225600, + 31000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + }, + { + "context": { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000005", + "traceFlags": 1 + }, + "parentSpanId": "0a00000000000001", + "name": "loop.1", + "kind": 0, + "start": [ + 1767225600, + 40000 + ], + "end": [ + 1767225600, + 41000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + }, + { + "context": { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000001", + "traceFlags": 1 + }, + "name": "root", + "kind": 0, + "start": [ + 1767225600, + 0 + ], + "end": [ + 1767225600, + 60000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + } + ] +} diff --git a/verify/fixtures/batching-shared-queue.handoff.json b/verify/fixtures/batching-shared-queue.handoff.json new file mode 100644 index 0000000..774d444 --- /dev/null +++ b/verify/fixtures/batching-shared-queue.handoff.json @@ -0,0 +1,120 @@ +{ + "config": { + "serviceName": "verify", + "resourceAttributes": [], + "exportUrl": "", + "exportHeaders": [] + }, + "spans": [ + { + "context": { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000001", + "traceFlags": 1 + }, + "name": "h1", + "kind": 0, + "start": [ + 1767225600, + 0 + ], + "end": [ + 1767225600, + 1000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + }, + { + "context": { + "traceId": "0a000000000000000000000000000002", + "spanId": "0a00000000000002", + "traceFlags": 1 + }, + "name": "h2", + "kind": 0, + "start": [ + 1767225600, + 2000 + ], + "end": [ + 1767225600, + 3000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + }, + { + "context": { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000003", + "traceFlags": 1 + }, + "parentSpanId": "0a00000000000001", + "name": "h1.work", + "kind": 0, + "start": [ + 1767225600, + 10000 + ], + "end": [ + 1767225600, + 11000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + }, + { + "context": { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000004", + "traceFlags": 1 + }, + "parentSpanId": "0a00000000000001", + "name": "h2.work", + "kind": 0, + "start": [ + 1767225600, + 20000 + ], + "end": [ + 1767225600, + 21000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + } + ] +} diff --git a/verify/fixtures/captured-then.handoff.json b/verify/fixtures/captured-then.handoff.json new file mode 100644 index 0000000..925e406 --- /dev/null +++ b/verify/fixtures/captured-then.handoff.json @@ -0,0 +1,92 @@ +{ + "config": { + "serviceName": "verify", + "resourceAttributes": [], + "exportUrl": "", + "exportHeaders": [] + }, + "spans": [ + { + "context": { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000002", + "traceFlags": 1 + }, + "parentSpanId": "0a00000000000001", + "name": "kept", + "kind": 0, + "start": [ + 1767225600, + 10000 + ], + "end": [ + 1767225600, + 11000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + }, + { + "context": { + "traceId": "0a000000000000000000000000000002", + "spanId": "0a00000000000003", + "traceFlags": 1 + }, + "name": "lost", + "kind": 0, + "start": [ + 1767225600, + 20000 + ], + "end": [ + 1767225600, + 21000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + }, + { + "context": { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000001", + "traceFlags": 1 + }, + "name": "parent", + "kind": 0, + "start": [ + 1767225600, + 0 + ], + "end": [ + 1767225600, + 30000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + } + ] +} diff --git a/verify/fixtures/concurrent-interleaved.handoff.json b/verify/fixtures/concurrent-interleaved.handoff.json new file mode 100644 index 0000000..2585051 --- /dev/null +++ b/verify/fixtures/concurrent-interleaved.handoff.json @@ -0,0 +1,203 @@ +{ + "config": { + "serviceName": "verify", + "resourceAttributes": [], + "exportUrl": "", + "exportHeaders": [] + }, + "spans": [ + { + "context": { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000003", + "traceFlags": 1 + }, + "parentSpanId": "0a00000000000001", + "name": "a.1", + "kind": 0, + "start": [ + 1767225600, + 10000 + ], + "end": [ + 1767225600, + 11000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + }, + { + "context": { + "traceId": "0a000000000000000000000000000002", + "spanId": "0a00000000000004", + "traceFlags": 1 + }, + "parentSpanId": "0a00000000000002", + "name": "b.1", + "kind": 0, + "start": [ + 1767225600, + 11000 + ], + "end": [ + 1767225600, + 12000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + }, + { + "context": { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000005", + "traceFlags": 1 + }, + "parentSpanId": "0a00000000000001", + "name": "a.2", + "kind": 0, + "start": [ + 1767225600, + 20000 + ], + "end": [ + 1767225600, + 21000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + }, + { + "context": { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000001", + "traceFlags": 1 + }, + "name": "a", + "kind": 0, + "start": [ + 1767225600, + 0 + ], + "end": [ + 1767225600, + 30000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + }, + { + "context": { + "traceId": "0a000000000000000000000000000002", + "spanId": "0a00000000000006", + "traceFlags": 1 + }, + "parentSpanId": "0a00000000000002", + "name": "b.2", + "kind": 0, + "start": [ + 1767225600, + 21000 + ], + "end": [ + 1767225600, + 22000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + }, + { + "context": { + "traceId": "0a000000000000000000000000000002", + "spanId": "0a00000000000002", + "traceFlags": 1 + }, + "name": "b", + "kind": 0, + "start": [ + 1767225600, + 1000 + ], + "end": [ + 1767225600, + 31000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + }, + { + "context": { + "traceId": "0a000000000000000000000000000003", + "spanId": "0a00000000000007", + "traceFlags": 1 + }, + "name": "after.all", + "kind": 0, + "start": [ + 1767225600, + 40000 + ], + "end": [ + 1767225600, + 41000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + } + ] +} diff --git a/verify/fixtures/error-in-callback.handoff.json b/verify/fixtures/error-in-callback.handoff.json new file mode 100644 index 0000000..d082b48 --- /dev/null +++ b/verify/fixtures/error-in-callback.handoff.json @@ -0,0 +1,120 @@ +{ + "config": { + "serviceName": "verify", + "resourceAttributes": [], + "exportUrl": "", + "exportHeaders": [] + }, + "spans": [ + { + "context": { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000002", + "traceFlags": 1 + }, + "parentSpanId": "0a00000000000001", + "name": "throws", + "kind": 0, + "start": [ + 1767225600, + 10000 + ], + "end": [ + 1767225600, + 11000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + }, + { + "context": { + "traceId": "0a000000000000000000000000000002", + "spanId": "0a00000000000003", + "traceFlags": 1 + }, + "name": "root.next", + "kind": 0, + "start": [ + 1767225600, + 30000 + ], + "end": [ + 1767225600, + 31000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + }, + { + "context": { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000004", + "traceFlags": 1 + }, + "parentSpanId": "0a00000000000001", + "name": "caught", + "kind": 0, + "start": [ + 1767225600, + 20000 + ], + "end": [ + 1767225600, + 21000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + }, + { + "context": { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000001", + "traceFlags": 1 + }, + "name": "parent", + "kind": 0, + "start": [ + 1767225600, + 0 + ], + "end": [ + 1767225600, + 40000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + } + ] +} diff --git a/verify/fixtures/export-headers.handoff.json b/verify/fixtures/export-headers.handoff.json new file mode 100644 index 0000000..d6e97a5 --- /dev/null +++ b/verify/fixtures/export-headers.handoff.json @@ -0,0 +1,42 @@ +{ + "config": { + "serviceName": "verify", + "resourceAttributes": [], + "exportUrl": "", + "exportHeaders": [ + { + "key": "x-api-key", + "value": "test" + } + ] + }, + "spans": [ + { + "context": { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000001", + "traceFlags": 1 + }, + "name": "headers", + "kind": 0, + "start": [ + 1767225600, + 0 + ], + "end": [ + 1767225600, + 10000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + } + ] +} diff --git a/verify/fixtures/handoff-basic.handoff.json b/verify/fixtures/handoff-basic.handoff.json index b79b98a..28df8f9 100644 --- a/verify/fixtures/handoff-basic.handoff.json +++ b/verify/fixtures/handoff-basic.handoff.json @@ -1,7 +1,6 @@ { "config": { "serviceName": "verify", - "serviceVersion": "0.0.0", "resourceAttributes": [], "exportUrl": "", "exportHeaders": [] diff --git a/verify/fixtures/interval-new-root.handoff.json b/verify/fixtures/interval-new-root.handoff.json new file mode 100644 index 0000000..a245d81 --- /dev/null +++ b/verify/fixtures/interval-new-root.handoff.json @@ -0,0 +1,119 @@ +{ + "config": { + "serviceName": "verify", + "resourceAttributes": [], + "exportUrl": "", + "exportHeaders": [] + }, + "spans": [ + { + "context": { + "traceId": "0a000000000000000000000000000002", + "spanId": "0a00000000000002", + "traceFlags": 1 + }, + "name": "tick", + "kind": 0, + "start": [ + 1767225600, + 100000 + ], + "end": [ + 1767225600, + 101000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + }, + { + "context": { + "traceId": "0a000000000000000000000000000003", + "spanId": "0a00000000000003", + "traceFlags": 1 + }, + "name": "tick", + "kind": 0, + "start": [ + 1767225600, + 200000 + ], + "end": [ + 1767225600, + 201000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + }, + { + "context": { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000004", + "traceFlags": 1 + }, + "parentSpanId": "0a00000000000001", + "name": "load", + "kind": 0, + "start": [ + 1767225600, + 300000 + ], + "end": [ + 1767225600, + 301000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + }, + { + "context": { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000001", + "traceFlags": 1 + }, + "name": "tap", + "kind": 0, + "start": [ + 1767225600, + 0 + ], + "end": [ + 1767225600, + 400000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + } + ] +} diff --git a/verify/fixtures/nest-after-await.handoff.json b/verify/fixtures/nest-after-await.handoff.json index b4b0658..3ffc349 100644 --- a/verify/fixtures/nest-after-await.handoff.json +++ b/verify/fixtures/nest-after-await.handoff.json @@ -1,7 +1,6 @@ { "config": { "serviceName": "verify", - "serviceVersion": "0.0.0", "resourceAttributes": [], "exportUrl": "", "exportHeaders": [] diff --git a/verify/fixtures/nest-promise-all-race.handoff.json b/verify/fixtures/nest-promise-all-race.handoff.json new file mode 100644 index 0000000..0b97d5f --- /dev/null +++ b/verify/fixtures/nest-promise-all-race.handoff.json @@ -0,0 +1,177 @@ +{ + "config": { + "serviceName": "verify", + "resourceAttributes": [], + "exportUrl": "", + "exportHeaders": [] + }, + "spans": [ + { + "context": { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000002", + "traceFlags": 1 + }, + "parentSpanId": "0a00000000000001", + "name": "all.a", + "kind": 0, + "start": [ + 1767225600, + 10000 + ], + "end": [ + 1767225600, + 11000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + }, + { + "context": { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000003", + "traceFlags": 1 + }, + "parentSpanId": "0a00000000000001", + "name": "all.b", + "kind": 0, + "start": [ + 1767225600, + 20000 + ], + "end": [ + 1767225600, + 21000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + }, + { + "context": { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000004", + "traceFlags": 1 + }, + "parentSpanId": "0a00000000000001", + "name": "race.a", + "kind": 0, + "start": [ + 1767225600, + 30000 + ], + "end": [ + 1767225600, + 31000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + }, + { + "context": { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000005", + "traceFlags": 1 + }, + "parentSpanId": "0a00000000000001", + "name": "race.b", + "kind": 0, + "start": [ + 1767225600, + 40000 + ], + "end": [ + 1767225600, + 41000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + }, + { + "context": { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000006", + "traceFlags": 1 + }, + "parentSpanId": "0a00000000000001", + "name": "after", + "kind": 0, + "start": [ + 1767225600, + 50000 + ], + "end": [ + 1767225600, + 51000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + }, + { + "context": { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000001", + "traceFlags": 1 + }, + "name": "root", + "kind": 0, + "start": [ + 1767225600, + 0 + ], + "end": [ + 1767225600, + 60000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + } + ] +} diff --git a/verify/fixtures/nest-timers-microtasks.handoff.json b/verify/fixtures/nest-timers-microtasks.handoff.json new file mode 100644 index 0000000..1beda0c --- /dev/null +++ b/verify/fixtures/nest-timers-microtasks.handoff.json @@ -0,0 +1,177 @@ +{ + "config": { + "serviceName": "verify", + "resourceAttributes": [], + "exportUrl": "", + "exportHeaders": [] + }, + "spans": [ + { + "context": { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000002", + "traceFlags": 1 + }, + "parentSpanId": "0a00000000000001", + "name": "timeout", + "kind": 0, + "start": [ + 1767225600, + 10000 + ], + "end": [ + 1767225600, + 11000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + }, + { + "context": { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000003", + "traceFlags": 1 + }, + "parentSpanId": "0a00000000000001", + "name": "immediate", + "kind": 0, + "start": [ + 1767225600, + 20000 + ], + "end": [ + 1767225600, + 21000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + }, + { + "context": { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000004", + "traceFlags": 1 + }, + "parentSpanId": "0a00000000000001", + "name": "microtask", + "kind": 0, + "start": [ + 1767225600, + 30000 + ], + "end": [ + 1767225600, + 31000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + }, + { + "context": { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000005", + "traceFlags": 1 + }, + "parentSpanId": "0a00000000000001", + "name": "timeout.microtask", + "kind": 0, + "start": [ + 1767225600, + 40000 + ], + "end": [ + 1767225600, + 41000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + }, + { + "context": { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000001", + "traceFlags": 1 + }, + "name": "root", + "kind": 0, + "start": [ + 1767225600, + 0 + ], + "end": [ + 1767225600, + 50000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + }, + { + "context": { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000006", + "traceFlags": 1 + }, + "parentSpanId": "0a00000000000001", + "name": "after.end", + "kind": 0, + "start": [ + 1767225600, + 60000 + ], + "end": [ + 1767225600, + 61000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + } + ] +} diff --git a/verify/fixtures/never-settling-promise.handoff.json b/verify/fixtures/never-settling-promise.handoff.json new file mode 100644 index 0000000..463e62d --- /dev/null +++ b/verify/fixtures/never-settling-promise.handoff.json @@ -0,0 +1,119 @@ +{ + "config": { + "serviceName": "verify", + "resourceAttributes": [], + "exportUrl": "", + "exportHeaders": [] + }, + "spans": [ + { + "context": { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000002", + "traceFlags": 1 + }, + "parentSpanId": "0a00000000000001", + "name": "child", + "kind": 0, + "start": [ + 1767225600, + 10000 + ], + "end": [ + 1767225600, + 11000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + }, + { + "context": { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000001", + "traceFlags": 1 + }, + "name": "parent", + "kind": 0, + "start": [ + 1767225600, + 0 + ], + "end": [ + 1767225600, + 20000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + }, + { + "context": { + "traceId": "0a000000000000000000000000000002", + "spanId": "0a00000000000003", + "traceFlags": 1 + }, + "name": "later.await", + "kind": 0, + "start": [ + 1767225600, + 30000 + ], + "end": [ + 1767225600, + 31000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + }, + { + "context": { + "traceId": "0a000000000000000000000000000003", + "spanId": "0a00000000000004", + "traceFlags": 1 + }, + "name": "later.timeout", + "kind": 0, + "start": [ + 1767225600, + 40000 + ], + "end": [ + 1767225600, + 41000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + } + ] +} diff --git a/verify/fixtures/odd-attributes.handoff.json b/verify/fixtures/odd-attributes.handoff.json index 95ea2f5..bb85702 100644 --- a/verify/fixtures/odd-attributes.handoff.json +++ b/verify/fixtures/odd-attributes.handoff.json @@ -1,7 +1,6 @@ { "config": { "serviceName": "verify", - "serviceVersion": "0.0.0", "resourceAttributes": [], "exportUrl": "", "exportHeaders": [] diff --git a/verify/fixtures/rich-span.handoff.json b/verify/fixtures/rich-span.handoff.json index 558fe3d..034d94a 100644 --- a/verify/fixtures/rich-span.handoff.json +++ b/verify/fixtures/rich-span.handoff.json @@ -1,7 +1,6 @@ { "config": { "serviceName": "verify", - "serviceVersion": "0.0.0", "resourceAttributes": [], "exportUrl": "", "exportHeaders": [] diff --git a/verify/fixtures/root-no-leak.handoff.json b/verify/fixtures/root-no-leak.handoff.json new file mode 100644 index 0000000..8821bb2 --- /dev/null +++ b/verify/fixtures/root-no-leak.handoff.json @@ -0,0 +1,146 @@ +{ + "config": { + "serviceName": "verify", + "resourceAttributes": [], + "exportUrl": "", + "exportHeaders": [] + }, + "spans": [ + { + "context": { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000002", + "traceFlags": 1 + }, + "parentSpanId": "0a00000000000001", + "name": "scoped.child", + "kind": 0, + "start": [ + 1767225600, + 10000 + ], + "end": [ + 1767225600, + 11000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + }, + { + "context": { + "traceId": "0a000000000000000000000000000001", + "spanId": "0a00000000000001", + "traceFlags": 1 + }, + "name": "scoped", + "kind": 0, + "start": [ + 1767225600, + 0 + ], + "end": [ + 1767225600, + 20000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + }, + { + "context": { + "traceId": "0a000000000000000000000000000002", + "spanId": "0a00000000000003", + "traceFlags": 1 + }, + "name": "after.sync", + "kind": 0, + "start": [ + 1767225600, + 30000 + ], + "end": [ + 1767225600, + 31000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + }, + { + "context": { + "traceId": "0a000000000000000000000000000003", + "spanId": "0a00000000000004", + "traceFlags": 1 + }, + "name": "after.await", + "kind": 0, + "start": [ + 1767225600, + 40000 + ], + "end": [ + 1767225600, + 41000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + }, + { + "context": { + "traceId": "0a000000000000000000000000000004", + "spanId": "0a00000000000005", + "traceFlags": 1 + }, + "name": "after.timeout", + "kind": 0, + "start": [ + 1767225600, + 50000 + ], + "end": [ + 1767225600, + 51000 + ], + "attributes": [], + "events": [], + "links": [], + "status": { + "code": 0 + }, + "scope": { + "name": "verify", + "attributes": [] + } + } + ] +} diff --git a/verify/harness/__tests__/collector.test.ts b/verify/harness/__tests__/collector.test.ts index 4977590..bdff426 100644 --- a/verify/harness/__tests__/collector.test.ts +++ b/verify/harness/__tests__/collector.test.ts @@ -93,3 +93,15 @@ test('begin rejects unsafe scenario/platform names', async () => { }); expect(r.status).toBe(400); }); + +test('collector gunzips content-encoding: gzip bodies', async () => { + c.begin('g', 'ios'); + const r = await fetch(`${c.url}/v1/traces`, { + method: 'POST', + headers: {'content-type': 'application/json', 'content-encoding': 'gzip'}, + body: require('zlib').gzipSync(body('zipped')), + }); + expect(r.status).toBe(200); + const out = await c.end(); + expect(out.resourceSpans![0].scopeSpans[0].spans.map((s: any) => s.name)).toEqual(['zipped']); +}); diff --git a/verify/harness/__tests__/compare.test.ts b/verify/harness/__tests__/compare.test.ts index 47794d7..6fb248f 100644 --- a/verify/harness/__tests__/compare.test.ts +++ b/verify/harness/__tests__/compare.test.ts @@ -86,6 +86,19 @@ describe('compareToExpected', () => { expect(r.report).toContain('got (none)'); }); + test('draft writes a missing file but still fails, and never overwrites', () => { + const o = otlp(); + writeShape(o); + const f = path.join(dir, 'expected/sc.js.otlp.json'); + const r = compareToExpected('sc', 'js', o, {draft: true}); + expect(r).toEqual({ok: false, report: 'drafted verify/expected/sc.js.otlp.json, review it'}); + expect(JSON.parse(fs.readFileSync(f, 'utf8'))).toEqual(o); + expect(compareToExpected('sc', 'js', o, {draft: true}).ok).toBe(true); + const r2 = compareToExpected('sc', 'js', otlp({status: {code: 1}}), {draft: true}); + expect(r2.ok).toBe(false); + expect(JSON.parse(fs.readFileSync(f, 'utf8'))).toEqual(o); + }); + test('shape mismatch report points at the shape file', () => { writeShape(otlp()); const r = compareToExpected('sc', 'js', otlp({name: 'other'})); diff --git a/verify/harness/collector.ts b/verify/harness/collector.ts index 748a6a5..1aae8ec 100644 --- a/verify/harness/collector.ts +++ b/verify/harness/collector.ts @@ -1,6 +1,7 @@ import fs from 'fs'; import http from 'http'; import path from 'path'; +import zlib from 'zlib'; import {normalize} from './normalize'; import {decodeRequest, toOtlpJson, type OtlpJson} from './otlpJson'; @@ -9,6 +10,8 @@ export type Collector = { begin(scenario: string, platform: string): void; end(): Promise; refuse(status: number, count: number): void; + /** Export requests accepted since `begin`. */ + received(): number; close(): Promise; }; @@ -29,7 +32,7 @@ export async function startCollector( const chunks: Buffer[] = []; req.on('data', c => chunks.push(c)); req.on('end', () => { - const body = Buffer.concat(chunks); + let body = Buffer.concat(chunks); const send = (status: number, payload?: unknown) => { res.writeHead(status, { ...CORS, @@ -38,6 +41,8 @@ export async function startCollector( res.end(payload === undefined ? undefined : JSON.stringify(payload)); }; try { + // opentelemetry-swift gzips by default; the raw/ files keep the decoded body + if (req.headers['content-encoding'] === 'gzip') body = zlib.gunzipSync(body); const route = `${req.method} ${req.url?.split('?')[0]}`; if (req.method === 'OPTIONS') return send(204); if (route === 'POST /v1/traces') { @@ -113,6 +118,7 @@ export async function startCollector( refuse(status, count) { refusal = {status, count}; }, + received: () => cur?.n ?? 0, close: () => new Promise(r => { server.closeAllConnections(); diff --git a/verify/harness/compare.ts b/verify/harness/compare.ts index db7c74a..79d15a8 100644 --- a/verify/harness/compare.ts +++ b/verify/harness/compare.ts @@ -96,7 +96,16 @@ const write = (f: string, o: unknown) => { fs.writeFileSync(f, JSON.stringify(o, null, 2) + '\n'); }; -export function compareToExpected(scenario: string, platform: Platform, actual: OtlpJson): {ok: boolean; report: string} { +/** + * `draft` (e2e only, `VERIFY_E2E_DRAFT=1`): a missing expected file is written from `actual` and the compare still + * fails, so a draft never passes unreviewed. An existing file is never overwritten. + */ +export function compareToExpected( + scenario: string, + platform: Platform, + actual: OtlpJson, + {draft = false}: {draft?: boolean} = {}, +): {ok: boolean; report: string} { const fail = (diffs: Diff[], expectedFile?: string) => { write(abs('artifacts', scenario, `${platform}.otlp.json`), actual); return {ok: false, report: formatReport(scenario, platform, diffs, expectedFile)}; @@ -108,7 +117,11 @@ export function compareToExpected(scenario: string, platform: Platform, actual: write(f, actual); return {ok: true, report: `updated ${f}`}; } - if (!fs.existsSync(f)) return fail([{path: 'file', expected: f, actual: undefined}]); + if (!fs.existsSync(f)) { + if (!draft) return fail([{path: 'file', expected: f, actual: undefined}]); + write(f, actual); + return {ok: false, report: `drafted ${rel('expected', scenario, `${platform}.otlp.json`)}, review it`}; + } const diffs = diffOtlp(JSON.parse(fs.readFileSync(f, 'utf8')), actual); return diffs.length ? fail(diffs) : {ok: true, report: ''}; } diff --git a/verify/harness/scenario.ts b/verify/harness/scenario.ts index c359620..7b0ce82 100644 --- a/verify/harness/scenario.ts +++ b/verify/harness/scenario.ts @@ -1,20 +1,32 @@ import type {HrTime, Tracer, TracerOptions} from '@opentelemetry/api'; -// TestNative (ctx.native) arrives with Task 26. +/** The example app's TestNative HybridObject (Task 26): app native code using the public `RNOtel` helpers. + * Mirrors example/modules/test-native/src/TestNative.nitro.ts by hand, so the harness needs no Nitro import. */ +export interface TestNative { + /** Starts and ends native `native.work` under `traceparent` ('' = a root), returns its traceparent. */ + doWork(traceparent: string, start: HrTime, end: HrTime): string; +} + export type ScenarioCtx = { tracer: Tracer; /** Extra tracers, for scenarios that need their own scope (version, schemaUrl). */ getTracer(name: string, version?: string, options?: TracerOptions): Tracer; at(us: number): HrTime; + /** Only on devices (the example app); e2e-only scenarios use it. */ + native?: TestNative; }; -/** `jest-degraded`: the Jest project that keeps native `async` (Task 11). */ -export type Runner = 'jest' | 'jest-degraded' | 'e2e'; -export type Target = 'android' | 'ios' | 'web'; +/** + * `jest`: Jest records the hand-off fixture and compares the JS output to `.js.otlp.json`. + * `seam`: Jest records only the hand-off fixture, for scenarios whose JS output would be upstream's alone. + */ +export type Runner = 'jest' | 'seam' | 'e2e'; +/** A platform, or one e2e target (`android-bare`, `ios-expo`, …) for what only one app can run. */ +export type Target = 'android' | 'ios' | 'web' | `${'android' | 'ios'}-${'bare' | 'expo'}`; export type Scenario = { name: string; run: (ctx: ScenarioCtx) => Promise; runners: Runner[]; - /** e2e targets it runs on. */ + /** e2e targets it runs on: platforms or target names. */ targets: Target[]; pending: boolean; }; diff --git a/verify/jest/fixtures.test.ts b/verify/jest/fixtures.test.ts index 215f46d..fe20b74 100644 --- a/verify/jest/fixtures.test.ts +++ b/verify/jest/fixtures.test.ts @@ -11,14 +11,15 @@ import type {Otel, SeamSpan} from '../../src/native/Otel.nitro'; import {allScenarios} from '../scenarios'; import {pendingScenarios} from '../harness/compare'; -const NAMES = ['handoff-basic', 'rich-span', 'odd-attributes', 'nest-after-await']; const CONFIG = { serviceName: 'verify', - serviceVersion: '0.0.0', resourceAttributes: [], exportUrl: '', exportHeaders: [], }; +// R11: per-scenario config; export-headers proves the headers reach the collector (fast-jvm asserts headers.json) +const configFor = (name: string) => + name === 'export-headers' ? {...CONFIG, exportHeaders: [{key: 'x-api-key', value: 'test'}]} : CONFIG; const dir = path.join(process.env.VERIFY_DIR ?? path.join(__dirname, '..'), 'fixtures'); function setup() { @@ -81,11 +82,11 @@ describe('NativeHandOffProcessor', () => { }); }); -for (const name of NAMES) { - const s = allScenarios().find(x => x.name === name); - if (!s) throw new Error('unknown fixture scenario ' + name); +// R6: every active Jest scenario has a seam fixture +for (const s of allScenarios().filter(x => !x.pending && (x.runners.includes('jest') || x.runners.includes('seam')))) { + const name = s.name; // a pending body is not its final version yet: keep the reviewed fixture until the owning task un-pends it - if (s.pending || pendingScenarios.has(name)) { + if (pendingScenarios.has(name)) { test.todo(`${name} fixture matches hand-off payloads`); continue; } @@ -96,8 +97,8 @@ for (const name of NAMES) { const file = path.join(dir, `${name}.handoff.json`); if (process.env.VERIFY_UPDATE === '1') { fs.mkdirSync(dir, {recursive: true}); - fs.writeFileSync(file, encodeFixture({config: CONFIG, spans: actual}) + '\n'); + fs.writeFileSync(file, encodeFixture({config: configFor(name), spans: actual}) + '\n'); } - expect(decodeFixture(fs.readFileSync(file, 'utf8'))).toStrictEqual({config: CONFIG, spans: actual}); + expect(decodeFixture(fs.readFileSync(file, 'utf8'))).toStrictEqual({config: configFor(name), spans: actual}); }); } diff --git a/verify/jest/jest.scenarios.config.js b/verify/jest/jest.scenarios.config.js index 3e44d04..ad092a7 100644 --- a/verify/jest/jest.scenarios.config.js +++ b/verify/jest/jest.scenarios.config.js @@ -4,5 +4,6 @@ module.exports = { rootDir: '../..', testEnvironment: 'node', transform: {'\\.[jt]sx?$': ['babel-jest', {presets: ['@react-native/babel-preset']}]}, + setupFiles: ['/src/setup.ts'], testMatch: ['/verify/jest/scenarios.test.ts', '/verify/jest/fixtures.test.ts'], }; diff --git a/verify/scenarios/async-generator.ts b/verify/scenarios/async-generator.ts index e49a711..d7d59a8 100644 --- a/verify/scenarios/async-generator.ts +++ b/verify/scenarios/async-generator.ts @@ -16,5 +16,4 @@ export default scenario( root.end(at(60)); }); }, - {pending: true}, // Task 10 ); diff --git a/verify/scenarios/background-flush.ts b/verify/scenarios/background-flush.ts index a5164e3..3cda83f 100644 --- a/verify/scenarios/background-flush.ts +++ b/verify/scenarios/background-flush.ts @@ -9,5 +9,5 @@ export default scenario( async ({tracer, at}) => { tracer.startSpan('before_background', {startTime: at(0)}).end(at(10)); }, - {runners: ['e2e'], targets: ['android', 'ios'], pending: true}, + {runners: ['e2e'], targets: ['android', 'ios']}, ); diff --git a/verify/scenarios/batching-shared-queue.ts b/verify/scenarios/batching-shared-queue.ts index 34fc79a..097fb46 100644 --- a/verify/scenarios/batching-shared-queue.ts +++ b/verify/scenarios/batching-shared-queue.ts @@ -28,5 +28,4 @@ export default scenario( }); await done; }, - {pending: true}, // Task 10 ); diff --git a/verify/scenarios/captured-then.ts b/verify/scenarios/captured-then.ts index 0452e2f..3b0731e 100644 --- a/verify/scenarios/captured-then.ts +++ b/verify/scenarios/captured-then.ts @@ -15,5 +15,4 @@ export default scenario( parent.end(at(30)); }); }, - {pending: true}, // Task 10 ); diff --git a/verify/scenarios/collector-down.ts b/verify/scenarios/collector-down.ts index 734d08a..331092c 100644 --- a/verify/scenarios/collector-down.ts +++ b/verify/scenarios/collector-down.ts @@ -10,5 +10,5 @@ export default scenario( async ({tracer, at}) => { tracer.startSpan('work', {startTime: at(0)}).end(at(10)); }, - {runners: ['e2e'], pending: true}, + {runners: ['e2e']}, ); diff --git a/verify/scenarios/concurrent-interleaved.ts b/verify/scenarios/concurrent-interleaved.ts index 7c269a0..92a4624 100644 --- a/verify/scenarios/concurrent-interleaved.ts +++ b/verify/scenarios/concurrent-interleaved.ts @@ -18,5 +18,4 @@ export default scenario( // back at ROOT after the join: guards the ROOT fast path (§6.1) tracer.startSpan('after.all', {startTime: at(40)}).end(at(41)); }, - {pending: true}, // Task 10 ); diff --git a/verify/scenarios/cross-js-to-native.ts b/verify/scenarios/cross-js-to-native.ts index b2c6b87..b55d431 100644 --- a/verify/scenarios/cross-js-to-native.ts +++ b/verify/scenarios/cross-js-to-native.ts @@ -4,6 +4,17 @@ import {scenario} from '../harness/scenario'; * A native span started from JS is a child of the active JS span (Task 26). * Steps: JS span `js.parent` active → `ctx.native.doWork(traceparent, start, end)` starts and ends native * `native.work` with `contextFrom(traceparent)` as parent. Proof: one trace, `native.work` (a `0b…` id) - * has `js.parent` as parent. Body lands with `ScenarioCtx.native`. + * has `js.parent` as parent. */ -export default scenario('cross-js-to-native', async () => {}, {runners: ['e2e'], targets: ['android', 'ios'], pending: true}); +export default scenario( + 'cross-js-to-native', + async ({tracer, at, native}) => { + if (!native) throw new Error('cross-js-to-native needs ctx.native (TestNative)'); + tracer.startActiveSpan('js.parent', {startTime: at(0)}, span => { + const {traceId, spanId, traceFlags} = span.spanContext(); + native.doWork(`00-${traceId}-${spanId}-${traceFlags.toString(16).padStart(2, '0')}`, at(100), at(200)); + span.end(at(300)); + }); + }, + {runners: ['e2e'], targets: ['android', 'ios']}, +); diff --git a/verify/scenarios/cross-native-to-js.ts b/verify/scenarios/cross-native-to-js.ts index 702c26d..0463b4a 100644 --- a/verify/scenarios/cross-native-to-js.ts +++ b/verify/scenarios/cross-native-to-js.ts @@ -1,9 +1,21 @@ +import {context, trace} from '@opentelemetry/api'; import {scenario} from '../harness/scenario'; /** * A JS span started under a native span's context is its child (Task 26). - * Steps: at ROOT, `ctx.native.doWork(...)` starts and ends root `native.work` and returns its traceparent → - * JS starts `js.after_native` under `trace.wrapSpanContext()`. Proof: one trace, - * `js.after_native` has `native.work` as parent. Body lands with `ScenarioCtx.native`. + * Steps: at ROOT, `ctx.native.doWork('', …)` starts and ends root `native.work` and returns its traceparent → + * JS starts `js.after_native` under `trace.wrapSpanContext()` (non-remote, spec §4.3). + * Proof: one trace, `js.after_native` has `native.work` as parent. */ -export default scenario('cross-native-to-js', async () => {}, {runners: ['e2e'], targets: ['android', 'ios'], pending: true}); +export default scenario( + 'cross-native-to-js', + async ({tracer, at, native}) => { + if (!native) throw new Error('cross-native-to-js needs ctx.native (TestNative)'); + const [, traceId = '', spanId = '', flags = ''] = native.doWork('', at(0), at(100)).split('-'); + const b = trace.wrapSpanContext({traceId, spanId, traceFlags: parseInt(flags, 16), isRemote: false}); + context.with(trace.setSpan(context.active(), b), () => + tracer.startSpan('js.after_native', {startTime: at(200)}).end(at(300)), + ); + }, + {runners: ['e2e'], targets: ['android', 'ios']}, +); diff --git a/verify/scenarios/degraded-probe.ts b/verify/scenarios/degraded-probe.ts deleted file mode 100644 index a564896..0000000 --- a/verify/scenarios/degraded-probe.ts +++ /dev/null @@ -1,19 +0,0 @@ -import {scenario} from '../harness/scenario'; - -/** - * When the startup probe finds that context does not survive `await` (native async, §6.1.4), the JS tracers' - * scope carries `com.callstack.context.degraded=true` and spans after `await` are roots, never wrongly parented. - * Runs only in the Jest project that keeps native `async` (Task 11). Task 11 must hand this scenario a tracer - * from the SDK path, so the scope attribute can appear: a bare harness `TracerProvider` cannot carry it. - */ -export default scenario( - 'degraded-probe', - async ({tracer, at}) => { - await tracer.startActiveSpan('parent', {startTime: at(0)}, async parent => { - await Promise.resolve(); - tracer.startSpan('after_await', {startTime: at(10)}).end(at(11)); - parent.end(at(20)); - }); - }, - {runners: ['jest-degraded'], pending: true}, // Task 11 -); diff --git a/verify/scenarios/error-in-callback.ts b/verify/scenarios/error-in-callback.ts index ef21c12..5067199 100644 --- a/verify/scenarios/error-in-callback.ts +++ b/verify/scenarios/error-in-callback.ts @@ -19,5 +19,4 @@ export default scenario( await Promise.all([caught, next]); parent.end(at(40)); }, - {pending: true}, // Task 10 ); diff --git a/verify/scenarios/event-emitter-listener.ts b/verify/scenarios/event-emitter-listener.ts index 879d591..15a2cc0 100644 --- a/verify/scenarios/event-emitter-listener.ts +++ b/verify/scenarios/event-emitter-listener.ts @@ -18,6 +18,5 @@ export default scenario( sub.remove(); } }, - // web: DeviceEventEmitter on react-native-web not confirmed - {runners: ['e2e'], targets: ['android', 'ios'], pending: true}, // Task 13 + {runners: ['e2e'], targets: ['android', 'ios']} ); diff --git a/verify/scenarios/export-headers.ts b/verify/scenarios/export-headers.ts index 3d6bf63..bb4c5b1 100644 --- a/verify/scenarios/export-headers.ts +++ b/verify/scenarios/export-headers.ts @@ -2,13 +2,12 @@ import {scenario} from '../harness/scenario'; /** * Configured export headers are sent on every export request: the collector's `.headers.json` for this - * scenario contains `x-api-key: test`. Tasks 16/19 add it to the fixtures `NAMES` with a per-scenario fixture - * config `exportHeaders: [{key: 'x-api-key', value: 'test'}]` and assert `headers.json` explicitly. + * scenario contains `x-api-key: test`. Its seam fixture carries a per-scenario config `exportHeaders: [{key: 'x-api-key', value: 'test'}]`; fast-jvm asserts `headers.json`. */ export default scenario( 'export-headers', async ({tracer, at}) => { tracer.startSpan('headers', {startTime: at(0)}).end(at(10)); }, - {runners: ['e2e'], pending: true}, // Tasks 16, 19 + {runners: ['seam', 'e2e'], targets: ['android', 'ios', 'web']}, // every example app's init sends x-api-key: test ); diff --git a/verify/scenarios/fast-refresh-idempotent.ts b/verify/scenarios/fast-refresh-idempotent.ts index 0147acc..57d4e95 100644 --- a/verify/scenarios/fast-refresh-idempotent.ts +++ b/verify/scenarios/fast-refresh-idempotent.ts @@ -9,4 +9,4 @@ import nestAfterAwait from './nest-after-await'; * (b) the refresh edit re-evaluates the patch module (otherwise (a) holds trivially). * The `nest-after-await` body then still gives its usual output (one `child` under `parent`). */ -export default scenario('fast-refresh-idempotent', nestAfterAwait.run, {runners: ['e2e'], pending: true}); +export default scenario('fast-refresh-idempotent', nestAfterAwait.run, {runners: ['e2e'], targets: ['android', 'ios']}); diff --git a/verify/scenarios/flush-after-reload.ts b/verify/scenarios/flush-after-reload.ts index b0f69d0..d5d2d34 100644 --- a/verify/scenarios/flush-after-reload.ts +++ b/verify/scenarios/flush-after-reload.ts @@ -9,5 +9,5 @@ export default scenario( async ({tracer, at}) => { tracer.startSpan('before_reload', {startTime: at(0)}).end(at(10)); }, - {runners: ['e2e'], targets: ['android', 'ios'], pending: true}, + {runners: ['e2e'], targets: ['android', 'ios']}, ); diff --git a/verify/scenarios/handoff-basic.ts b/verify/scenarios/handoff-basic.ts index a45c6f9..c92538a 100644 --- a/verify/scenarios/handoff-basic.ts +++ b/verify/scenarios/handoff-basic.ts @@ -3,4 +3,4 @@ import {scenario} from '../harness/scenario'; export default scenario('handoff-basic', async ({tracer, at}) => { const root = tracer.startSpan('root', {startTime: at(0), attributes: {'app.step': 'one'}}); root.end(at(100)); -}); +}, {runners: ['seam', 'e2e']}); diff --git a/verify/scenarios/index.ts b/verify/scenarios/index.ts index c351a81..59e7362 100644 --- a/verify/scenarios/index.ts +++ b/verify/scenarios/index.ts @@ -8,7 +8,6 @@ import collectorDown from './collector-down'; import concurrentInterleaved from './concurrent-interleaved'; import crossJsToNative from './cross-js-to-native'; import crossNativeToJs from './cross-native-to-js'; -import degradedProbe from './degraded-probe'; import errorInCallback from './error-in-callback'; import eventEmitterListener from './event-emitter-listener'; import exportHeaders from './export-headers'; @@ -28,6 +27,5 @@ import perfBudget from './perf-budget'; import richSpan from './rich-span'; import rootNoLeak from './root-no-leak'; import smokeDevice from './smoke-device'; -import smokeJs from './smoke-js'; -export const allScenarios = (): Scenario[] => [asyncGenerator, backgroundFlush, batchingSharedQueue, capturedThen, collectorDown, concurrentInterleaved, crossJsToNative, crossNativeToJs, degradedProbe, errorInCallback, eventEmitterListener, exportHeaders, fastRefreshIdempotent, flushAfterReload, handoffBasic, interactionManager, intervalNewRoot, nativeInitFailure, nestAfterAwait, nestPromiseAllRace, nestRaf, nestTimersMicrotasks, neverSettlingPromise, oddAttributes, perfBudget, richSpan, rootNoLeak, smokeDevice, smokeJs]; +export const allScenarios = (): Scenario[] => [asyncGenerator, backgroundFlush, batchingSharedQueue, capturedThen, collectorDown, concurrentInterleaved, crossJsToNative, crossNativeToJs, errorInCallback, eventEmitterListener, exportHeaders, fastRefreshIdempotent, flushAfterReload, handoffBasic, interactionManager, intervalNewRoot, nativeInitFailure, nestAfterAwait, nestPromiseAllRace, nestRaf, nestTimersMicrotasks, neverSettlingPromise, oddAttributes, perfBudget, richSpan, rootNoLeak, smokeDevice]; diff --git a/verify/scenarios/interaction-manager.ts b/verify/scenarios/interaction-manager.ts index ecccd88..2dc3c9c 100644 --- a/verify/scenarios/interaction-manager.ts +++ b/verify/scenarios/interaction-manager.ts @@ -20,5 +20,7 @@ export default scenario( parent.end(at(20)); }); }, - {runners: ['e2e'], pending: true}, // Task 13 + // RN 0.88 (the example) removed InteractionManager from core (dev: invariant; release: undefined). Kept pending until + // an example on an RN that still ships it exists; the RN replacement, requestIdleCallback, is not in the §6.1 patch list. + {runners: ['e2e'], pending: true}, ); diff --git a/verify/scenarios/interval-new-root.ts b/verify/scenarios/interval-new-root.ts index 8f5a537..44e6ea8 100644 --- a/verify/scenarios/interval-new-root.ts +++ b/verify/scenarios/interval-new-root.ts @@ -23,5 +23,4 @@ export default scenario( tap.end(at(400)); }); }, - {pending: true}, // Task 10 ); diff --git a/verify/scenarios/native-init-failure.ts b/verify/scenarios/native-init-failure.ts index 980d73b..93365e0 100644 --- a/verify/scenarios/native-init-failure.ts +++ b/verify/scenarios/native-init-failure.ts @@ -9,5 +9,6 @@ export default scenario( async ({tracer, at}) => { tracer.startSpan('dropped', {startTime: at(0)}).end(at(10)); }, - {runners: ['e2e'], targets: ['android', 'ios'], pending: true}, + // bare only: the bad URL goes to the bare example's native init; the Expo app has none (it inits from JS) + {runners: ['e2e'], targets: ['android-bare', 'ios-bare']}, ); diff --git a/verify/scenarios/nest-after-await.ts b/verify/scenarios/nest-after-await.ts index 4aa98f6..c05939b 100644 --- a/verify/scenarios/nest-after-await.ts +++ b/verify/scenarios/nest-after-await.ts @@ -10,5 +10,4 @@ export default scenario( parent.end(at(30)); }); }, - {pending: true}, // Task 10 ); diff --git a/verify/scenarios/nest-promise-all-race.ts b/verify/scenarios/nest-promise-all-race.ts index 0d7626a..89d52e1 100644 --- a/verify/scenarios/nest-promise-all-race.ts +++ b/verify/scenarios/nest-promise-all-race.ts @@ -16,5 +16,4 @@ export default scenario( root.end(at(60)); }); }, - {pending: true}, // Task 10 ); diff --git a/verify/scenarios/nest-raf.ts b/verify/scenarios/nest-raf.ts index 0ff14db..e48d67c 100644 --- a/verify/scenarios/nest-raf.ts +++ b/verify/scenarios/nest-raf.ts @@ -14,5 +14,5 @@ export default scenario( root.end(at(20)); }); }, - {runners: ['e2e'], pending: true}, // Task 13 + {runners: ['e2e']} ); diff --git a/verify/scenarios/nest-timers-microtasks.ts b/verify/scenarios/nest-timers-microtasks.ts index 985d46a..977f4fc 100644 --- a/verify/scenarios/nest-timers-microtasks.ts +++ b/verify/scenarios/nest-timers-microtasks.ts @@ -16,7 +16,8 @@ export default scenario( }), ); await inCallback(cb => setTimeout(cb, 0), 'timeout', 10); - await inCallback(cb => setImmediate(cb), 'immediate', 20); + // browsers have no setImmediate: there the step is one more setTimeout, so every runner keeps one shape + await inCallback(cb => (typeof setImmediate === 'function' ? setImmediate(cb) : setTimeout(cb, 0)), 'immediate', 20); await inCallback(cb => queueMicrotask(cb), 'microtask', 30); // scheduled from inside a callback: the context is carried twice await inCallback(cb => setTimeout(() => queueMicrotask(cb), 0), 'timeout.microtask', 40); @@ -25,5 +26,4 @@ export default scenario( await inCallback(cb => setTimeout(cb, 0), 'after.end', 60); }); }, - {pending: true}, // Task 10 ); diff --git a/verify/scenarios/never-settling-promise.ts b/verify/scenarios/never-settling-promise.ts index 422b335..3b6f678 100644 --- a/verify/scenarios/never-settling-promise.ts +++ b/verify/scenarios/never-settling-promise.ts @@ -15,5 +15,4 @@ export default scenario( await new Promise(r => setTimeout(r, 0)); tracer.startSpan('later.timeout', {startTime: at(40)}).end(at(41)); }, - {pending: true}, // Task 10 ); diff --git a/verify/scenarios/odd-attributes.ts b/verify/scenarios/odd-attributes.ts index 4076cfb..2ea5d32 100644 --- a/verify/scenarios/odd-attributes.ts +++ b/verify/scenarios/odd-attributes.ts @@ -7,4 +7,4 @@ export default scenario('odd-attributes', async ({tracer, at}) => { attributes: {nan: NaN, inf: Infinity, negZero: -0, big: 2 ** 53 + 2, empty: []}, }) .end(at(10)); -}); +}, {runners: ['seam', 'e2e']}); diff --git a/verify/scenarios/perf-budget.ts b/verify/scenarios/perf-budget.ts index fbf0957..ab22477 100644 --- a/verify/scenarios/perf-budget.ts +++ b/verify/scenarios/perf-budget.ts @@ -1,8 +1,82 @@ +import {context, trace} from '@opentelemetry/api'; import {scenario} from '../harness/scenario'; +const SPANS = 1_000; +const WARMUP = 100; +const AWAITS = 20_000; +const ROUNDS = 5; +const P = 'com.callstack.perf.'; + +const pct = (xs: number[], p: number) => [...xs].sort((a, b) => a - b)[Math.min(xs.length - 1, Math.floor(xs.length * p))]!; +const us = (ms: number) => ms * 1000; // unrounded: perf.e2e.ts gates on these and rounds only for the report + +async function awaits(n: number) { + const t0 = performance.now(); + for (let i = 0; i < n; i++) await null; + return performance.now() - t0; +} + /** * Performance guardrail (§9.2, Task 29), `android-bare` only: (a) 1,000 spans × 10 attributes through the real - * hand-off, p50/p95 µs per span; (b) 10,000 awaits with the patch on vs off. Fails only if hand-off p50 ≥ 100 µs - * or the patch ratio ≥ 3×. Output is `verify/artifacts/perf.json`, not spans: no shape file. + * hand-off, p50/p95 µs per span; (b) 5 alternating rounds of 20,000 awaits inside an active span, patch on vs off (R27: `then` + * restored from the patch marker for the off leg). The numbers leave as the attributes of one `perf-result` span; + * verify/e2e/perf.e2e.ts writes `verify/artifacts/perf.json` and applies the budgets. No shape file. */ -export default scenario('perf-budget', async () => {}, {runners: ['e2e'], targets: ['android'], pending: true}); +export default scenario( + 'perf-budget', + async ({tracer}) => { + const total: number[] = []; + const end: number[] = []; + for (let i = 0; i < WARMUP + SPANS; i++) { + const t0 = performance.now(); + const span = tracer.startSpan('perf'); + for (let a = 0; a < 10; a++) span.setAttribute(`a${a}`, i); + const t1 = performance.now(); + span.end(); + const t2 = performance.now(); + if (i < WARMUP) continue; + total.push(t2 - t0); + end.push(t2 - t1); + } + + const marker = (globalThis as any)[Symbol.for('com.callstack.otel.patched')]; + if (!marker) throw new Error('perf-budget: the context patch is not installed'); + const patched = Promise.prototype.then; + // inside an active span: the wrapped path (at ROOT the patch calls the original `then` directly). Each leg + // enters the span's context itself, since the off leg loses it after its first await. + const span = tracer.startSpan('perf.awaits'); + const inSpan = (n: number) => context.with(trace.setSpan(context.active(), span), () => awaits(n)); + await inSpan(1_000); // warm-up + // alternating legs (on, off, on, off, …): perf.e2e.ts gates on median(on) / median(off), so one GC pause or a + // warm-up drift in either leg does not decide the ratio + const onMs: number[] = []; + const offMs: number[] = []; + for (let r = 0; r < ROUNDS; r++) { + onMs.push(await inSpan(AWAITS)); + Promise.prototype.then = marker.then; + try { + offMs.push(await inSpan(AWAITS)); + } finally { + Promise.prototype.then = patched; + } + } + span.end(); + + tracer + .startSpan('perf-result', { + attributes: { + [`${P}handoff.spans`]: SPANS, + [`${P}handoff.warmup`]: WARMUP, + [`${P}handoff.p50_us`]: us(pct(total, 0.5)), + [`${P}handoff.p95_us`]: us(pct(total, 0.95)), + [`${P}handoff.end_p50_us`]: us(pct(end, 0.5)), + [`${P}await.count`]: AWAITS, + [`${P}await.rounds`]: ROUNDS, + [`${P}await.on_ms`]: onMs, + [`${P}await.off_ms`]: offMs, + }, + }) + .end(); + }, + {runners: ['e2e'], targets: ['android-bare']}, +); diff --git a/verify/scenarios/rich-span.ts b/verify/scenarios/rich-span.ts index dee2afb..fab19f1 100644 --- a/verify/scenarios/rich-span.ts +++ b/verify/scenarios/rich-span.ts @@ -1,10 +1,10 @@ import {createTraceState, SpanKind, SpanStatusCode, TraceFlags} from '@opentelemetry/api'; import {scenario} from '../harness/scenario'; +import {stampScope} from '../../src/context/scope'; export default scenario('rich-span', async ({getTracer, at}) => { const tracer = getTracer('verify.rich', '1.2.3', {schemaUrl: 'https://opentelemetry.io/schemas/1.40.0'}); - // sdk-trace 3.1 has no API for scope attributes; its OTLP exporter reads them off the scope at runtime. - Object.assign((tracer as any).instrumentationScope, {attributes: {'scope.key': 'scope-value'}}); + stampScope(tracer, {'scope.key': 'scope-value'}); const span = tracer.startSpan('rich', { startTime: at(0), kind: SpanKind.CLIENT, diff --git a/verify/scenarios/root-no-leak.ts b/verify/scenarios/root-no-leak.ts index eee3dd6..ede92db 100644 --- a/verify/scenarios/root-no-leak.ts +++ b/verify/scenarios/root-no-leak.ts @@ -18,5 +18,4 @@ export default scenario( await new Promise(r => setTimeout(r, 0)); tracer.startSpan('after.timeout', {startTime: at(50)}).end(at(51)); }, - {pending: true}, // Task 10 ); diff --git a/verify/scenarios/smoke-device.ts b/verify/scenarios/smoke-device.ts index a3d9925..096deb6 100644 --- a/verify/scenarios/smoke-device.ts +++ b/verify/scenarios/smoke-device.ts @@ -9,5 +9,5 @@ export default scenario( async ({tracer}) => { tracer.startSpan('smoke').end(); }, - {runners: ['e2e'], targets: ['android', 'ios'], pending: true}, + {runners: ['e2e'], targets: ['android', 'ios']}, ); diff --git a/verify/scenarios/smoke-js.ts b/verify/scenarios/smoke-js.ts deleted file mode 100644 index 657b080..0000000 --- a/verify/scenarios/smoke-js.ts +++ /dev/null @@ -1,9 +0,0 @@ -import {scenario} from '../harness/scenario'; - -export default scenario( - 'smoke-js', - async ({tracer, at}) => { - tracer.startSpan('smoke', {startTime: at(0)}).end(at(1)); - }, - {runners: ['jest']}, -);