From 47f77c17e0345c4ca268238939c0ceafe75d2030 Mon Sep 17 00:00:00 2001 From: asemabdallah Date: Sun, 11 Oct 2026 02:28:21 +0200 Subject: [PATCH] fix(agent): quote the comma-containing note in the sample dataset --- apps/agent/src/db.csv | 2 +- apps/agent/tests/test_query.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/agent/src/db.csv b/apps/agent/src/db.csv index af058a9..6831665 100644 --- a/apps/agent/src/db.csv +++ b/apps/agent/src/db.csv @@ -1,5 +1,5 @@ date,category,subcategory,amount,type,notes -2026-01-05,Revenue,Enterprise Subscriptions,45000,income,3 new enterprise customers (Acme Corp, TechFlow, DataViz Inc) +2026-01-05,Revenue,Enterprise Subscriptions,45000,income,"3 new enterprise customers (Acme Corp, TechFlow, DataViz Inc)" 2026-01-05,Revenue,Pro Tier Upgrades,12000,income,24 users upgraded from free to pro 2026-01-08,Revenue,API Usage Overages,3500,income,High API usage from top 5 customers 2026-01-10,Expenses,Engineering Salaries,42000,expense,7 engineers + 2 contractors diff --git a/apps/agent/tests/test_query.py b/apps/agent/tests/test_query.py index 8e82622..d835661 100644 --- a/apps/agent/tests/test_query.py +++ b/apps/agent/tests/test_query.py @@ -15,3 +15,11 @@ def test_sample_query_returns_independent_rows(): first['rows'][0]['injected'] = 'changed' second = query_data.invoke({'query': 'all'}) assert 'injected' not in second['rows'][0] + + +def test_sample_rows_parse_into_the_header_columns(): + rows = query_data.invoke({'query': 'all'})['rows'] + columns = ['date', 'category', 'subcategory', 'amount', 'type', 'notes'] + # An unquoted comma in a field would shift values and add a None key. + assert all(list(row) == columns for row in rows) + assert rows[0]['notes'] == '3 new enterprise customers (Acme Corp, TechFlow, DataViz Inc)'