Skip to content

armgit / rea

Public Imported from GitHub
0

Reverse engineer anything with agents, from app behavior down to native binaries.

fix(qlog): list a hidden stream's records without spreading call arguments (#2860)

Dragolone39f96d7188a7
diff --git a/src/browser/history/QlogCapture.test.ts b/src/browser/history/QlogCapture.test.ts
index bd67d4e80..fb4e10072 100644
--- a/src/browser/history/QlogCapture.test.ts
+++ b/src/browser/history/QlogCapture.test.ts
@@ -186,6 +186,21 @@ it("excludes structural auth material and explicit normalized values without gue
expect(traces[0]?.incomplete_fact_records).toContain(2);
});
+it("omits a hidden derived total for a stream with more contributions than call arguments allow", () => {
+ const events = Array.from({ length: 130 }, (_, index) =>
+ event(
+ Array.from({ length: 1_000 }, (_, offset) =>
+ frame(index * 1_000 + offset, 1),
+ ),
+ ),
+ );
+ const { traces } = facts(capture(events), ["130000"]);
+ expect(traces[0]?.streams).toEqual([]);
+ expect(traces[0]?.incomplete_fact_records).toEqual(
+ Array.from({ length: 130 }, (_, ordinal) => ordinal),
+ );
+});
+
it("hides marked ancestor keys and safe derived sums while still validating hidden subtrees", () => {
const text = capture([event([frame(0, 3), frame(3, 4)])]);
expect(facts(text, ["7"]).traces[0]?.streams).toEqual([]);
diff --git a/src/browser/history/QlogCapture.ts b/src/browser/history/QlogCapture.ts
index 2e8a1f790..8d19fc64f 100644
--- a/src/browser/history/QlogCapture.ts
+++ b/src/browser/history/QlogCapture.ts
@@ -95,10 +95,10 @@ export const decodeQlogCapture = (
...stream.reported_final_sizes,
...stream.covered_ranges.flatMap((r) => [r.start, r.end]),
];
+ // A stream can have more contributions than call arguments allow.
if (numericValues.some(excluded))
- fact.incomplete_fact_records.push(
- ...stream.contributions.map((c) => c.record_ordinal),
- );
+ for (const contribution of stream.contributions)
+ fact.incomplete_fact_records.push(contribution.record_ordinal);
else fact.streams.push(stream);
}
fact.incomplete_fact_records = [...new Set(fact.incomplete_fact_records)];