From 7cdf8bc5cf376baa8d4a6ba6109a1aecc16e4c93 Mon Sep 17 00:00:00 2001 From: Iven Koo <73214171+IvenKooLab@users.noreply.github.com> Date: Thu, 22 Oct 2026 03:18:21 +0800 Subject: [PATCH] test(native): assert failed-callee call identities and edge caps (#2888) * fix(native): attempt failed value trace selectors once per invocation * test(native): assert failed-callee call identities and edge caps --- .../native/NativeValueTrace.test.ts | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/application/native/NativeValueTrace.test.ts b/src/application/native/NativeValueTrace.test.ts index 7688c9cc94..51702723c9 100644 --- a/src/application/native/NativeValueTrace.test.ts +++ b/src/application/native/NativeValueTrace.test.ts @@ -405,6 +405,11 @@ describe("native value failed-callee traversal", () => { ); }, }; + const expectedCalls = [ + { source: "0x1000/bad-1", target: "0x2000" }, + { source: "0x1000/bad-2", target: "0x2000" }, + { source: "0x1000/good", target: "0x3000" }, + ]; // A new invocation retries the failed selector: failures are not cached // across traces, and successful procedure identity remains separate. for (let run = 0; run < 2; run++) { @@ -426,9 +431,24 @@ describe("native value failed-callee traversal", () => { address: null, reason: expect.stringContaining("Callee unavailable"), }); - expect(trace.edges.filter(({ kind }) => kind === "call")).toHaveLength(3); + expect( + trace.edges + .filter(({ kind }) => kind === "call") + .map(({ source, target }) => ({ source, target })), + ).toEqual(expectedCalls); expect(trace.truncated).toBe(false); } + const capped = await traceNativeValues(port, { + procedure: "0x1000", + max_functions: 3, + max_edges: 2, + }); + if (!capped.ok) throw capped.error; + const cappedTrace = nativeValueTraceSchema.parse(capped.value); + expect( + cappedTrace.edges.map(({ source, target }) => ({ source, target })), + ).toEqual(expectedCalls.slice(0, 2)); + expect(cappedTrace.truncated).toBe(true); }); });