# General
Ensure you carefully consult the in-code documentation and inline comments when generating code.
## `test::` module
The `test` module is used to simulate a virtual Company which business is about online retail. The company is successful and has steadily growing user base. The growth is simulated by a generalized logistics model (Richard's) with growth reaching a plateau at ~1/3 of the maximum user base (market capacity). The lifecycle of the company is generated by the Scenario object which produces scenario steps (module test::scenario). The scenario steps are executed by the company and the results are stored in the database. The idea behind the test is to try cached and non-cached approaches to working with the DB and see how they perform and compare the results. The results are expected to be identical. While working with the code always consult with comments in the source files to be updated with the details of the implementation.
The plan is to create a complex simulation to test the performance benefits of a write-back cache Rust crate. The simulation will model a retail company that features a growing customer base, a fixed number of items for sale, an inventory that is periodically replenished (with occasional stockouts), and a sequence of customer orders. Orders follow a lifecycle: new, pending, fulfilled, and sometimes returned, while customer purchasing habits vary.
Whenever a file within any module of the test::db::entity namespace is modified, update the corresponding entry in the SeaORM migrations (test::db::migrations namespace) by re-using the existing migration module. Note that this is not a production case—the database is regenerated for each test run. For example, if a modification is requested for the `customer` entity then `test::db::migrations::customer` migration is to be edited for match the entity declaration.
The simulation runs with sequential day numbers beginning at day 0—marking the epoch when everything started from nothing. On day 1, the first customer is acquired, and the process begins.
When a migration module in test::db::migrations:: is changed check if the change is synchronized with corresponding entity file in test::db::entity.