aglinxinyuan opened a new issue, #7486:
URL: https://github.com/apache/texera/issues/7486

   ### Task Summary
   
   `sendMessage` is the largest untested region in the whole service: lines 
475–712 of
   `texera-agent.ts`, 238 of the file's 292 uncovered lines. The existing 
26-test spec stops at the
   model boundary and never enters it, which leaves the ReAct loop, its usage 
accounting, its branch
   bookkeeping, and every one of its failure paths unexercised.
   
   None of that needs the network. `[email protected]` ships `MockLanguageModelV4` from 
the `ai/test` export,
   and it satisfies the same `LanguageModel` type `TexeraAgentConfig` already 
accepts — so the loop can
   be driven in-process, with `fetch` spied on as a tripwire to prove no call 
escapes.
   
   Five traps are worth writing down, because each one produces a test that 
passes while asserting
   nothing:
   
   1. **`LanguageModelV4Usage` is nested.** A flat `{ inputTokens: 11 }` is 
silently discarded and
      every usage assertion then passes against a gutted mapping.
   2. **`LanguageModelV4FinishReason` is an object** (`{ unified, raw }`), not 
a string. A bare
      `finishReason: "stop"` runs fine under `bun test` and fails `tsc 
--noEmit`.
   3. **A tool call's `input` must be a JSON string**, not an object.
   4. **Setting a delegate config makes the first turn refresh from the 
backend**, and that refresh
      replaces the whole workflow — operators seeded directly on the agent are 
wiped, so they have to
      arrive through the `fetch` stub.
   5. **`maxSteps: 0` is an infinite loop.** `stepCountIs(0)` never fires. Do 
not write that test; it
      hangs the suite rather than failing it.
   
   Only `getStepsById` (line 261) would remain uncovered, and it has no call 
site anywhere in the repo.
   
   ### Task Type
   
   - [ ] Refactor / Cleanup
   - [ ] DevOps / Deployment / CI
   - [x] Testing / QA
   - [ ] Documentation
   - [ ] Performance
   - [ ] Other
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to