Multiple locations in ReviewSettings.tsx call .includes() or .filter()
on variables that could theoretically be non-arrays:
1. availableFields.filter/.includes - added safeAvailableFields guard
2. newFields.map field.includes('_') - added typeof===string guard + filter
3. (prior fix) cfgAvailableFields includes/every in renderRuleConfig
4. (prior fix) selectedFields includes in renderFieldTags
These prevent TypeError crashes when config objects contain unexpected
types (e.g. {} instead of []) from stale API data.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
config.availableFields may be undefined or a non-array value (e.g. {}),
causing TypeError when calling .includes/.every directly on it.
Precompute cfgAvailableFields with Array.isArray guard before use.
Fixes: N.includes is not a function on rules/new page.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When config.fields is a non-array value (e.g. empty object {}),
the fallback logic could still result in a non-array if both
config.fields and config.selectedFields are abnormal values.
Added double-guard: after the fallback chain, explicitly assert
Array.isArray before using selectedFields.includes().
Fixes: TypeError: _.includes is not a function on rules/new page.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- evaluation_points.ts: LLMFieldConfig type, LLMFieldType union,
VLMField.multi_entity
- ExtractionSettings.tsx:
- LLM fields render as colored buttons (green=multi_entity, gray=normal)
- Click to toggle individual field multi_entity when switch is on
- Toggle switch on: converts all string fields to {name, multi_entity:true}
- Toggle switch off: converts back to plain strings
- New fields default to multi_entity:true when switch is on
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>