@@ -9,9 +9,9 @@ import type { ComponentApi } from "../../component/_generated/component.js";
99// https://github.com/convex/agent/issues/418
1010// The component runs as the root app here so the test can read stored rows.
1111const component = api as unknown as ComponentApi ;
12- const MiB = 1 << 20 ;
13- // Spaces every 10KB keep the mock's per-word stream chunks few and large.
14- const LONG = Array . from ( { length : 40 } , ( ) => "r" . repeat ( 10_000 ) ) . join ( " " ) ;
12+ // Large enough that storing it three times stands out, small enough to stream
13+ // quickly. Spaces every 10KB keep the mock's per-word chunks few and large.
14+ const LONG = Array . from ( { length : 4 } , ( ) => "r" . repeat ( 10_000 ) ) . join ( " " ) ;
1515const SIGNED = { mock : { signature : "sig-123" } } ;
1616const ENCRYPTED = {
1717 openai : { itemId : "rs_1" , reasoningEncryptedContent : "opaque-blob" } ,
@@ -57,9 +57,7 @@ async function expectStoredOnce(t: T) {
5757 await t . run ( ( ctx ) => ctx . db . query ( "messages" ) . collect ( ) )
5858 ) . filter ( ( doc ) => doc . message ?. role === "assistant" ) ;
5959 expect ( docs ) . toHaveLength ( 1 ) ;
60- expect ( getDocumentSize ( docs [ 0 ] ) ) . toBeLessThan (
61- Math . min ( MiB , LONG . length * 1.5 ) ,
62- ) ;
60+ expect ( getDocumentSize ( docs [ 0 ] ) ) . toBeLessThan ( LONG . length * 1.5 ) ;
6361 return docs [ 0 ] ;
6462}
6563
@@ -77,7 +75,7 @@ async function readAssistant(t: T, threadId: string) {
7775
7876describe ( "step reasoning is stored once and derived on read" , ( ) => {
7977 test . each < Generation > ( [ "generateText" , "streamText" ] ) (
80- "long reasoning saves under the document limit (%s)" ,
78+ "long reasoning is stored once (%s)" ,
8179 async ( how ) => {
8280 const t = initConvexTest ( ) ;
8381 const agent = agentWith ( [
0 commit comments