mirror of
https://github.com/openswarm-ai/openswarm.git
synced 2026-09-13 05:07:40 +02:00
[eric] tests: update providerUsage tests to the landed 150-title cap + convo char budget (4 green)
This commit is contained in:
@@ -21,8 +21,18 @@ test('summary leads with memory, names scale, and lists recent topics', () => {
|
||||
assert.match(s, /Swift concurrency; Deadlift form check; Tax on RSUs/);
|
||||
});
|
||||
|
||||
test('summary is hard-capped so a heavy user never ships a wall of PII', () => {
|
||||
test('titles are capped at 150 for breadth, so a heavy user ships a sample not all of them', () => {
|
||||
const titles = Array.from({ length: 1000 }, (_, i) => `conversation number ${i} about a very specific topic`);
|
||||
const s = summarizeUsage({ ok: true, total: 1000, titles, memories: [] });
|
||||
assert.ok(s.length <= 4000, `summary length ${s.length} exceeded 4000`);
|
||||
const s = summarizeUsage({ ok: true, total: 1000, capped: true, titles, memories: [] });
|
||||
assert.match(s, /1000\+ past AI conversations/); // capped => count is shown as an honest "N+" floor
|
||||
assert.ok(s.includes('conversation number 0'));
|
||||
assert.ok(s.includes('conversation number 149'));
|
||||
assert.ok(!s.includes('conversation number 150'), 'only the first 150 titles ship');
|
||||
});
|
||||
|
||||
test('the full-convo payload (the real substance) is bounded by the char budget', () => {
|
||||
const convos = Array.from({ length: 60 }, (_, i) => ({ title: `t${i}`, text: 'x'.repeat(5000) }));
|
||||
const s = summarizeUsage({ ok: true, total: 60, titles: [], memories: [], convos });
|
||||
// Full recent-conversation text is intentionally large (distilled downstream), but never unbounded.
|
||||
assert.ok(s.length <= 140000, `convo block should honor the ~130K budget, got ${s.length}`);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user