Skip to content
Open
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
2 changes: 1 addition & 1 deletion src/session/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2216,7 +2216,7 @@ function renderNarrative5Section(args: {
const convMult = Math.max(1, Math.round(convTokensWithout / convTokensWith));
out.push(` Without context-mode ${kb(convBytesWithout).padStart(8)} ${withoutBar} ${fmtNum(convTokensWithout).padStart(7)} tokens`);
out.push(` With context-mode ${kb(convBytesWith).padStart(8)} ${withBar} ${fmtNum(convTokensWith).padStart(7)} tokens`);
out.push(` ${convPct.toFixed(1)}% kept out of context · your AI ran ${convMult}× longer before /compact fired`);
out.push(` ${convPct.toFixed(1)}% kept out of context · ${convMult}× more data diverted from context window`);
out.push("");
}

Expand Down
27 changes: 27 additions & 0 deletions tests/analytics/format-report.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,33 @@ describe("v1.0.148 Bug G — Section 1 bar uses strict-compression formula", ()
expect(pct).toBeGreaterThan(99);
expect(pct).toBeLessThan(100);
});

it("byte ratio uses accurate wording, not time-language (#1023)", () => {
const { conversation, report } = makeNarrativeContext();
const conversationRealBytes = {
eventDataBytes: 0,
bytesAvoided: 100_000,
bytesReturned: 100,
snapshotBytes: 0,
contentBytes: 0,
totalSavedTokens: Math.floor(100_100 / 4),
};

const output = formatReport(report, "1.0.169", null, {
conversation: conversation as any,
realBytes: { conversation: conversationRealBytes as any },
});

const ratioLine = output
.split("\n")
.find((l) => l.includes("kept out of context") && l.includes("%"));
expect(ratioLine, `bar summary line missing in:\n${output}`).toBeDefined();
// Must NOT use time/longevity language for a byte ratio
expect(ratioLine!).not.toContain("ran");
expect(ratioLine!).not.toContain("longer");
// Must still show the multiplier in an accurate form
expect(ratioLine!).toMatch(/\d+×/);
});
});

// ─────────────────────────────────────────────────────────
Expand Down