Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(mcp-host): note XLSX rules on a column that mixes percent forms
marcoteb2f8e17d8cf57
diff --git a/mcp-host/src/workflow/__tests__/internalTools.xlsx.values.test.ts b/mcp-host/src/workflow/__tests__/internalTools.xlsx.values.test.tsindex a3095301a..46fd610dd 100644--- a/mcp-host/src/workflow/__tests__/internalTools.xlsx.values.test.ts+++ b/mcp-host/src/workflow/__tests__/internalTools.xlsx.values.test.ts@@ -340,6 +340,26 @@ describe('conditional formatting', () => {})})+describe('rules on a column of mixed percents', () => {+ it('notes that 0.45 and 50% are compared as written', async () => {+ const { result } = await oneSheet([['Share'], [0.45], ['50%'], [0.3]], {+ conditionalFormatting: [+ { column: 'Share', rules: [{ greaterThan: 40, fillColor: '#fee2e2' }] },+ ],+ })+ expect(result.content).toContain('numeric rules compare each as written')+ })++ it('says nothing when the column is sent one way', async () => {+ const { result } = await oneSheet([['Share'], ['45%'], ['50%']], {+ conditionalFormatting: [+ { column: 'Share', rules: [{ greaterThan: 40, fillColor: '#fee2e2' }] },+ ],+ })+ expect(result.content).not.toContain('compare each as written')+ })+})+describe('colors', () => {it('accepts shorthand hex and CSS names, and falls back with a warning otherwise', async () => {const result = await generate({diff --git a/mcp-host/src/workflow/xlsxWorkbook.ts b/mcp-host/src/workflow/xlsxWorkbook.tsindex 3b668048c..c17315c8a 100644--- a/mcp-host/src/workflow/xlsxWorkbook.ts+++ b/mcp-host/src/workflow/xlsxWorkbook.ts@@ -773,6 +773,24 @@ function writeSheet(}const texts = columns[col].map(cell => cell.text)const rules = prepareRules(cf.rules, cfLabel, warnings, texts, ctx.regexBudget)+ // A rule compares each cell as written: '50%' as 50 and 0.45 as 0.45.+ const numeric =+ Array.isArray(cf.rules) &&+ cf.rules.some(+ rule =>+ isRecord(rule) &&+ (rule.greaterThan !== undefined ||+ rule.lessThan !== undefined ||+ rule.between !== undefined)+ )+ const kinds = new Set(columns[col].map(cell => cell.kind))+ if (numeric && kinds.has('percent') && kinds.has('number')) {+ warnings.push(+ `${cfLabel}: the column holds percents written as text ('50%') and plain numbers ` ++ '(0.45); numeric rules compare each as written, 50 and 0.45, so send the column ' ++ 'one way.'+ )+ }for (let r = 0; r < dataRows; r++) {const rule = rules.find(candidate => candidate.matches(columns[col][r]))if (!rule) continue