fix(web): close P3 chat re-review findings

This commit is contained in:
shaggy (mosaic-dev box)
2026-08-10 01:58:27 -05:00
parent caebf9ef70
commit 48bb19310d
10 changed files with 774 additions and 65 deletions
+8 -1
View File
@@ -1,5 +1,6 @@
import type { ReactElement } from 'react';
import type { SessionInfoPayload } from '@/lib/chat-contract';
import { MAX_MANIFEST_ITEMS } from './limits';
import { asString, asStringArray } from './runtime-guards';
interface SessionPanelProps {
@@ -15,7 +16,13 @@ export function SessionPanel({
}: SessionPanelProps): ReactElement | null {
if (!sessionInfo) return null;
const availableThinkingLevels = asStringArray(sessionInfo.availableThinkingLevels);
// The reducer already caps this before storing it, but the render site
// defends independently — a hostile payload must never be able to force
// this <select> to lay out an unbounded number of options.
const availableThinkingLevels = asStringArray(sessionInfo.availableThinkingLevels).slice(
0,
MAX_MANIFEST_ITEMS,
);
const hasThinkingLevels = availableThinkingLevels.length > 0;
return (