mirror of
https://github.com/okieselbach/AutopilotMonitor.git
synced 2026-10-24 12:42:38 +00:00
2d5ee887d7
The JSON editors serialize the FORM object, but what users paste is usually a rule EXPORT (e.g. received from another tenant). The create/edit whitelists rebuilt collector parameters and evaluateOn from form fields the export does not carry, so a pasted gather rule silently lost every collector parameter and a pasted analyze rule silently reverted to the enrollment-end default. Both rules pages get a single shape-tolerant mapper in types.ts: - gatherRuleToForm unflattens the nested parameters object (authoritative when present, so edit-merge leftovers cannot leak), maps nullable rule fields to form defaults, imports a missing emitMode as 'always' (the rule's actual behavior) instead of the empty-form on_change default, and now also backs startEditing so edit and paste share one mapping. - analyze jsonToForm maps evaluateOn onto the eval* checkboxes (an explicit evaluateOn wins over stale form flags in edit-mode merges); terminal-only exports fall back to the enrollment-end default. - tags and the folded effective markSessionAsFailed now survive the import: both forms carry tags into the create/save payloads, analyze creates carry markSessionAsFailedDefault. notify/notifyChannelIds stay excluded — channel ids are tenant-specific. 9 new vitest cases pin both shapes, the merge precedence, and the round-trips; full web suite 824/824, tsc and eslint clean. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>