test: cover resolveShareAiMaxOutputTokens output-token cap (#60) #104

Closed
opened 2026-06-21 05:05:39 +03:00 by Ghost · 0 comments

PR #101 (commit 05a7a400, closes #60) added resolveShareAiMaxOutputTokens() — apps/server/src/core/ai-chat/public-share-chat.service.ts:78, used at L230 — bounding per-request output tokens for the anonymous assistant.

Gap: untested, while its identical sibling resolveShareAiWorkspaceMax has 5 dedicated tests in public-share-chat.spec.ts.

Needed: mirror the sibling test block: valid int; float floors via Math.floor; NaN/unset → default (512); zero/negative → default. Regression risk: dropping the raw > 0 check lets env 0 disable the cap → unbounded billable output.

Found in code review of PR #101.

PR #101 (commit 05a7a400, closes #60) added `resolveShareAiMaxOutputTokens()` — apps/server/src/core/ai-chat/public-share-chat.service.ts:78, used at L230 — bounding per-request output tokens for the anonymous assistant. **Gap:** untested, while its identical sibling `resolveShareAiWorkspaceMax` has 5 dedicated tests in `public-share-chat.spec.ts`. **Needed:** mirror the sibling test block: valid int; float floors via `Math.floor`; NaN/unset → default (512); zero/negative → default. Regression risk: dropping the `raw > 0` check lets env `0` disable the cap → unbounded billable output. _Found in code review of PR #101._
Ghost added the testsecurity labels 2026-06-21 05:05:39 +03:00
Ghost closed this issue 2026-06-21 14:10:35 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: vvzvlad/gitmost#104