Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/browser/history/QlogCapture.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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([]);
Expand Down
6 changes: 3 additions & 3 deletions src/browser/history/QlogCapture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)];
Expand Down
Loading