From c3395ef06d38224c6fd22ea554be3c14da1b445b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Mata?= Date: Sat, 10 Jan 2026 20:26:08 +0100 Subject: [PATCH] Fix struct compatibility error in IncomeStatement::Totals (#603) The TotalsRow struct was expanded from 5 to 6 fields in commit a4f70f4 (adding is_uncategorized_investment), but cached data from the old 5-field struct causes "struct size differs" errors when deserialized. This adds a cache version ("v2") to the totals_query cache key to invalidate all old cached structs and force recalculation with the new 6-field definition. Fixes: TypeError (struct IncomeStatement::Totals::TotalsRow not compatible (struct size differs)) Co-authored-by: Claude --- app/models/income_statement.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/income_statement.rb b/app/models/income_statement.rb index 16982eba6..83aa2c9fd 100644 --- a/app/models/income_statement.rb +++ b/app/models/income_statement.rb @@ -130,7 +130,7 @@ class IncomeStatement sql_hash = Digest::MD5.hexdigest(transactions_scope.to_sql) Rails.cache.fetch([ - "income_statement", "totals_query", family.id, sql_hash, family.entries_cache_version + "income_statement", "totals_query", "v2", family.id, sql_hash, family.entries_cache_version ]) { Totals.new(family, transactions_scope: transactions_scope, date_range: date_range).call } end