mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-07-12 21:02:17 +02:00
test(core): fix type errors in the elision test suite
The resolver helper's inline policy type predated middlePaneContent and no longer satisfied ElisionPolicy; use the exported type. Coerce message content to string where the preview assertions call string methods. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
30570a9325
commit
7000f34c48
1 changed files with 7 additions and 11 deletions
|
|
@ -12,6 +12,7 @@ import {
|
|||
elideHistoricMiddlePaneContent,
|
||||
elideHistoricToolResults,
|
||||
loadElisionPolicy,
|
||||
type ElisionPolicy,
|
||||
} from "./context-elision.js";
|
||||
import { TurnRepoContextResolver } from "./context-resolver.js";
|
||||
import { InMemoryTurnRepo } from "./in-memory-turn-repo.js";
|
||||
|
|
@ -189,12 +190,14 @@ describe("elideHistoricToolResults", () => {
|
|||
const content = `SKILL GUIDE${"y".repeat(5000)}`;
|
||||
const [elided] = elideHistoricToolResults([toolMsg(content)], 2500);
|
||||
// Starts with the first 400 chars verbatim, then the marker.
|
||||
expect(elided.content.startsWith(content.slice(0, 400))).toBe(true);
|
||||
expect(String(elided.content).startsWith(content.slice(0, 400))).toBe(true);
|
||||
expect(elided.content).toContain("Rest of tool result elided");
|
||||
expect(elided.content.length).toBeLessThan(700);
|
||||
expect(String(elided.content).length).toBeLessThan(700);
|
||||
// Preview never exceeds a tiny threshold.
|
||||
const [tiny] = elideHistoricToolResults([toolMsg(content)], 50);
|
||||
expect(tiny.content.startsWith(`${content.slice(0, 50)}\n[Rest`)).toBe(true);
|
||||
expect(String(tiny.content).startsWith(`${content.slice(0, 50)}\n[Rest`)).toBe(
|
||||
true,
|
||||
);
|
||||
});
|
||||
|
||||
it("keeps tool results at or below the threshold verbatim", () => {
|
||||
|
|
@ -340,14 +343,7 @@ describe("createContextResolver", () => {
|
|||
});
|
||||
|
||||
describe("ElidingContextResolver", () => {
|
||||
function resolver(
|
||||
repo: InMemoryTurnRepo,
|
||||
policy: {
|
||||
toolResults: boolean;
|
||||
toolResultThresholdChars: number;
|
||||
images: boolean;
|
||||
},
|
||||
) {
|
||||
function resolver(repo: InMemoryTurnRepo, policy: ElisionPolicy) {
|
||||
return new ElidingContextResolver({
|
||||
inner: new TurnRepoContextResolver({ turnRepo: repo }),
|
||||
loadPolicy: () => policy,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue