Realistic demo data for performance testing #2361
Reference in New Issue
Block a user
Delete Branch "zachgoll/more-realistic-demo-data-generator-for-performance-testing"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Demo data was not very realistic before and made it hard to do any sort of performance work locally. Since our DB data is sensitive, this approach helps us avoid having to scrub PII from prod data to pull down locally for this sort of testing.
Bug: Invalid Nested Attributes in Entry Creation
The
create_transaction!andcreate_trade!methods inDemo::TransactionGeneratorattempt to create polymorphicEntryassociations usingentryable_attributes. This is not a standard Rails parameter forEntry.create!and will cause a runtime error, as theEntrymodel is not configured to accept nested attributes in this manner.app/models/demo/transaction_generator.rb#L17-L2387bd3734f4/app/models/demo/transaction_generator.rb (L17-L23)Fix in Cursor
Bug: Bulk Duplication Fails Due to Parent ID Mismatch
During bulk category duplication, the
parent_idis copied directly from the template category. This leads to foreign key constraint violations or orphaned categories because the templateparent_iddoes not exist in the newly created family.app/models/demo/scenarios/performance_testing.rb#L213-L21487bd3734f4/app/models/demo/scenarios/performance_testing.rb (L213-L214)Fix in Cursor
Bug: Email Collision in Bulk Family Creation
The
PerformanceTestingscenario's bulk family creation (create_family_copiesmethod) causes an email collision and inconsistent numbering for duplicated users. The template family uses emails like 'user@maybe.local'. The duplication loop startsifrom 2, and the email generation logicuser#{i == 2 ? "" : i}@maybe.localincorrectly assigns 'user@maybe.local' to the first duplicated family (wheni=2). This conflicts with the template family's users, leading to unique constraint violations and an inconsistent numbering pattern where only families fromi=3onwards are sequentially numbered (e.g., 'user3@maybe.local').app/models/demo/scenarios/performance_testing.rb#L129-L14487bd3734f4/app/models/demo/scenarios/performance_testing.rb (L129-L144)Fix in Cursor
Was this report helpful? Give feedback by reacting with 👍 or 👎
Bug: Category Duplication Fails to Map Parent IDs
When duplicating categories for new families, the
parent_idis copied directly from the template category. This creates invalid foreign key references because the parent categories in the new family have different IDs than in the template family. This leads to foreign key constraint violations or orphaned category relationships, as subcategories attempt to reference non-existent parent IDs. Theparent_idmust be mapped to the corresponding new category ID within the target family.app/models/demo/scenarios/performance_testing.rb#L203-L221bdda780144/app/models/demo/scenarios/performance_testing.rb (L203-L221)Fix in Cursor
Bug: Email Duplication in Family Copies
The
create_family_copiesmethod generates duplicate user emails. For the first duplicated family (wheni=2in the loop), the email patternuser#{i == 2 ? "" : i}@maybe.local(and similar for member users) creates "user@maybe.local" and "member_user@maybe.local". These emails conflict with those of the initial template family, violating unique email constraints.app/models/demo/scenarios/performance_testing.rb#L129-L144bdda780144/app/models/demo/scenarios/performance_testing.rb (L129-L144)Fix in Cursor
Was this report helpful? Give feedback by reacting with 👍 or 👎
Bug: Demo Data Currency Mismatch
The multi-currency demo data generation incorrectly creates families with USD currency instead of EUR. This occurs because the refactored
Demo::Generatorno longer passes thecurrency: "EUR"option to the family creation method, despite theMultiCurrencyscenario expecting EUR as its primary currency.app/models/demo/generator.rb#L20-L24350ba18101/app/models/demo/generator.rb (L20-L24)Fix in Cursor
Was this report helpful? Give feedback by reacting with 👍 or 👎
Bug: Transaction Log Miscalculation
The log message for transaction creation in
create_sample_categorized_transactions!incorrectly adds+1toTARGET_TRANSACTIONS_PER_FAMILY. It reports 5 transactions when only 4 (1 income, 3 expenses) are created, which matches theTARGET_TRANSACTIONS_PER_FAMILYvalue of 4.app/models/demo/scenarios/basic_budget.rb#L122-L1237353d27ebc/app/models/demo/scenarios/basic_budget.rb (L122-L123)Fix in Cursor
Was this report helpful? Give feedback by reacting with 👍 or 👎