Commit Graph

45 Commits

Author SHA1 Message Date
Pekka Enberg
7967cc5efc core: Kill Rows wrapper struct
It's just an useless wrapper, kill it.
2025-01-26 16:27:19 +02:00
Pekka Enberg
0d0906dce4 Merge 'simulator: implement --load and --watch flags' from Alperen Keleş
The current status of the PR is halfway. The new framing of simulation
runner where `setup_simulation` is separated from `run_simulation`
allows for injecting custom plans easily. The PR is currently missing
the functionality to update the `SimulatorEnv` ad hoc from the plan, as
the environment tables were typically created during the planning phase.
The next steps will be to implement a function `fn
mk_env(InteractionPlan, SimulatorEnv) -> SimulatorEnv`, add `--load`
flag to the CLI for loading a serialized plan file, making a
corresponding environment and running the simulation.
We can optionally combine this with a `--save` option, in which we keep
a seed-vault as part of limbo simulator, corresponding each seed with
its generated plan and save the time to regenerate existing seeds by
just loading them into memory. I am curious to hear thoughts on this?
Would the maintainers be open to adding such a seed-vault? Do you think
the saved time would be worth the complexity of the approach?

Reviewed-by: Pere Diaz Bou <pere-altea@homail.com>

Closes #720
2025-01-26 08:52:58 +02:00
sonhmai
75f0cf9e20 chore: make clippy happy 2025-01-20 13:29:23 +07:00
alpaylan
e476b9f697 implement watch mode
- add `--watch` flag
- start saving seeds in persistent storage
- make a separate version of execution functions that use `vector of interaction` instead of `InteractionPlan`
2025-01-18 23:54:03 +03:00
Jorge López
f160206cdd syntactic changes: replace unwrap() with ? in functions that return Result<...> 2025-01-18 18:33:43 +01:00
Jorge López
86a4714711 syntactic changes: remove unneeded paths when the type is already imported 2025-01-18 18:29:12 +01:00
alpaylan
c30e2757b4 - implement '--load <PATH>' flag that loads an interaction plan and executes it instead of generating one from scratch
- save a json serialization of the generated plans to `<tempdir>/simulator.plan.json`
2025-01-17 22:04:55 +03:00
alpaylan
28cde537a8 this commit;
- makes interaction plans serializable
- fixes the shadowing bug where non-created tables were assumed to be created in the shadow tables map
- makes small changes to make clippy happy
- reorganizes simulation running flow to remove unnecessary plan regenerations while shrinking and double checking
2025-01-17 01:30:46 +03:00
Jussi Saurio
0f4cc8f0cc Simulator: expose inner error in assertion failure, if any 2025-01-15 19:22:05 +02:00
alpaylan
ea6ad8d414 remove debug print 2025-01-15 12:44:43 +03:00
alpaylan
c446e29a50 add missed updates from the merge 2025-01-15 11:42:48 +03:00
alpaylan
ecb0f782ac Merge branch 'main' of https://github.com/tursodatabase/limbo 2025-01-15 10:59:46 +03:00
Pekka Enberg
3c6c6041ff simulator: Log query errors with debug level
...it is totally fine for a SQL query to fail as part of the simulation.
For example, if we attempt to create a table that already exists, the
expectation is that the query fails. No need to spam the logs.
2025-01-14 17:41:07 +02:00
alpaylan
fb937eff7b fix non-determinism bug arising from a call to thread_rng while picking
which row to check existence for in the result of the select query
2025-01-13 17:26:23 +03:00
alpaylan
c3ea02783d - add doc comments to generation traits and functions
- remove pick_index from places where it's possible to use pick instead
- allow multiple values to be inserted in the insert-select property
2025-01-13 15:56:10 +03:00
alpaylan
43f6c34408 fix arbitrary_from ergonomics by removing the implicit reference in the trait signature 2025-01-13 14:43:12 +03:00
alpaylan
13442808dd update properties to add extensional interactions between them 2025-01-13 14:35:42 +03:00
alpaylan
82fcc27a58 this commit fixes query generation;
- previous query generation method was faulty, producing wrong assertions
- this commit adds a new arbitrary_from implementation for predicates
- new implementation takes a table and a row, and produces a predicate that would evaluate to true for the row
this commit makes small changes to the main for increasing readability
2025-01-13 02:31:19 +03:00
alpaylan
191b586f05 this commit restructures the interaction generation in order to have
better counterexample minimization.

- it separates interaction plans from their state of execution
- it removes closures from the property definitions, encoding properties as an enum variant, and deriving the closures from the variants.
- it adds some naive counterexample minimization capabilities to the Limbo simulator and reduces the plan sizes considerably.
- it makes small changes to various points of the simulator for better error reporting, enhancing code readability, small fixes to handle previously missed cases
2025-01-11 02:20:22 +03:00
alpaylan
cc56276c3a add execution history to the simulator, the history records
three indexes(connection, interaction pointer, and secondary pointer)
that can uniquely identify the executed interaction at any point.
we will use the history for shrinking purposes.
2025-01-07 13:40:29 +03:00
alpaylan
daa77feea1 add assumptions to the interactions, where a failing assumption stops
the execution of the current property and switches to the next one.
2025-01-06 19:04:29 +03:00
alpaylan
2a4d461627 previously, interactions plans were comprised of a flat sequence of operations that
did not reflect the internal structure, in which they were actually concatenations of
properties, which are a coherent set of interactions that are meaningful by themselves.
this commit introduces this semantic layer into the data model by turning interaction plans
into a sequence of properties, which are a sequence of interactions
2025-01-06 18:16:34 +03:00
alpaylan
d8ce88c057 fix clippy warning 2024-12-30 00:41:21 -05:00
alpaylan
58f23983e1 minor changes, add maximum time bound to the simulator, fix bug in the table create shadowing 2024-12-30 00:36:43 -05:00
alpaylan
c01f2d4ac2 fix formatting 2024-12-29 16:09:49 -05:00
alpaylan
8e2a1e4289 Merge remote-tracking branch 'turso/main' 2024-12-29 16:08:35 -05:00
alpaylan
d3fee3b331 add empty line at the end of cargo.toml, add create counts to the interaction stats, turn the percentages into f64 2024-12-29 14:00:57 -05:00
PThorpe92
f6cd707544 Add clippy CI, fix or ignore warnings where appropriate 2024-12-29 10:25:41 -05:00
adamnemecek
97647ff056 Clean up code to use Self
Closes #556
2024-12-29 10:07:38 +02:00
Pekka Enberg
f2ecebc357 Rename RowResult to StepResult
The name "row result" is confusing because it really *is* a result from
a step() call. The only difference is how a row is represented as we
return from VDBE or from a statement.

Therefore, rename RowResult to StepResult.
2024-12-27 10:20:41 +02:00
alpaylan
ad0288b39c fix formatting 2024-12-26 15:23:10 -05:00
alpaylan
12fee4df37 remove the regex dependency as functionality is possible without it 2024-12-26 15:20:19 -05:00
alpaylan
003ad6cc64 allow failure assertions in the simulator, add creating the same table two times to the list of checked properties as a failure property example 2024-12-26 15:10:03 -05:00
jussisaurio
fa5ca68eec Add multi-row insert to simulator 2024-12-25 21:14:55 +02:00
Pere Diaz Bou
aed14117c9 core: transaction support 2024-12-24 18:04:30 +01:00
Pekka Enberg
13f229020e simulator: Use "mod.rs" for module top-level files
Let's use "mod.rs" for the module top-level file as we do in the rest of
the Limbo codebase for consistency.
2024-12-21 09:50:23 +02:00
alpaylan
8f8b97d54b add the missing rowresult variant 2024-12-20 12:27:54 -05:00
alpaylan
d2723b777b update table create probability, print interactions as info logs 2024-12-20 12:18:03 -05:00
alpaylan
b355568023 use ticks as the main simulator driver, handle disconnects correctly, add multi-connection setup 2024-12-19 23:40:04 -05:00
alpaylan
cb20ca7e40 fix formatting 2024-12-18 17:10:18 -05:00
alpaylan
39b5dbed55 change gen.range based queries into frequency and one_of calls 2024-12-18 17:09:44 -05:00
alpaylan
66e7a4edec fix formatting 2024-12-17 18:30:55 -05:00
alpaylan
7d4d803a13 implement interaction plans 2024-12-17 18:24:39 -05:00
alpaylan
53ecedaceb fix formatting 2024-12-16 10:49:56 -05:00
alpaylan
be18c6e8f0 break simulator into parts, add readme 2024-12-16 10:49:05 -05:00