aglinxinyuan opened a new pull request, #7383:
URL: https://github.com/apache/texera/pull/7383

   ### What changes were proposed in this PR?
   
   `ReportGenerationService` had no spec. It assembles the downloadable 
workflow report, and every branch deciding what a given operator contributes to 
it was unexercised.
   
   Adds 16 tests. The core of it is that `retrieveOperatorInfoReport` picks one 
of five renderings per operator:
   
   | Operator has | Report shows |
   |---|---|
   | paginated service, page non-empty | a table of the first 10 rows |
   | paginated service, page empty | "No results found for operator" |
   | paginated service, page fetch fails | a notification naming the operator, 
and the observable errors |
   | plain result service with a snapshot | the **last** snapshot, resized to 
fit |
   | plain result service, no snapshot | "No data found for operator" |
   | neither service | "No results found for operator" |
   
   The failure mode here is a silently wrong report rather than an exception, 
which is what makes the assertions worth having: showing the first 
visualization snapshot instead of the latest is invisible until someone 
compares the report against the canvas.
   
   Also covered: both prompt builders, the assembly and download of the final 
document, and the missing-editor path of `generateWorkflowSnapshot`.
   
   **Verified by mutation**, all reverted (production diff empty):
   
   | Mutation | Result |
   |---|---|
   | render the first snapshot instead of the last | red |
   | drop the empty-page branch | red |
   | drop the workflow name from the filename | red |
   | make the summary prompt ask for 80 words like the per-operator one | red |
   | request page 0 instead of page 1 | red |
   | stop resizing the embedded chart | red |
   | drop the error notification | red |
   
   Two jsdom details are commented in the spec: `Blob` has no `text()` so the 
document is read back through a `FileReader`, and the anchor is built before 
`document.createElement` is stubbed so the stub does not intercept its own 
creation.
   
   One thing found but deliberately **not** changed, to avoid cementing it: the 
service injects `HttpClient` and declares an `isAIAssistantEnabled` field, and 
neither is ever used. `retrieveOperatorInfoReport` also subscribes to 
`isOpenAIEnabled()` and ignores the emitted value, so the flag gates nothing 
while still being able to stall the report if it never emits — there is a test 
pinning that stall.
   
   No production file is touched.
   
   ### Any related issues, documentation, discussions?
   
   Closes #7380
   
   ### How was this PR tested?
   
   ```
   npx ng test --watch=false --include="**/report-generation.service.spec.ts"
   ```
   
   ```
    Test Files  1 passed (1)
         Tests  16 passed (16)
   ```
   
   `yarn format:ci` passes.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Opus 5)
   
   


-- 
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