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

   ### What happened?
   
   The agent service turns pretty logging **on** when `LOG_PRETTY` is set to 
`false` or `0`.
   
   **Root cause:** `agent-service/src/config/env.ts` parses it with 
`z.coerce.boolean()`. That coercion is plain `Boolean(value)`, so any non-empty 
string is `true`:
   
   ```
   LOG_PRETTY=false  ->  true   (pino-pretty transport attached)
   LOG_PRETTY=0      ->  true
   LOG_PRETTY=       ->  false
   unset             ->  false
   ```
   
   `logger.spec.ts` doesn't catch this, because it mocks `env` with a real 
boolean and never goes through the parser. A deployment that writes 
`LOG_PRETTY=false` to turn pretty output off gets pino-pretty instead of the 
plain JSON lines a log collector expects.
   
   Expected: `true`/`1` turn it on, `false`/`0`/empty/unset leave it off, and 
any other value fails at startup like the other invalid settings in that schema.
   
   ### How to reproduce?
   
   From `agent-service/`:
   
   ```ts
   import { z } from "zod";
   z.coerce.boolean().default(false).parse("false"); // true
   z.coerce.boolean().default(false).parse("0");     // true
   ```
   
   Or start the service with `LOG_PRETTY=false bun run src/server.ts`: the 
output is pretty-printed, not JSON.
   


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