crdb_test_utils/
fuzz_simple.rs

1#[macro_export]
2macro_rules! fuzz_simple {
3    ($db_type:tt) => {
4        use super::fuzz_helpers::{self, make_db, make_fuzzer, setup, Database, SetupState};
5
6        use anyhow::Context;
7        use rust_decimal::Decimal;
8        use std::{str::FromStr, sync::Arc};
9        use ulid::Ulid;
10        use $crate::{crdb_core::*, *};
11
12        make_fuzzer_stuffs! {
13            $db_type,
14            (Simple, TestObjectSimple, TestEventSimple),
15        }
16
17        make_fuzzer!("fuzz_simple", fuzz, fuzz_impl);
18
19        fn make_make_updatedness() -> impl FnMut() -> Option<Updatedness> {
20            let mut updatedness = Updatedness::from_u128(1);
21            move || {
22                updatedness = Updatedness(updatedness.0.increment().unwrap());
23                Some(updatedness)
24            }
25        }
26
27        #[fuzz_helpers::test]
28        async fn regression_events_1342_fails_to_notice_conflict_on_3() {
29            use Op::*;
30            let cluster = setup();
31            let mut make_updatedness = make_make_updatedness();
32            fuzz_impl(
33                &cluster,
34                Arc::new(vec![
35                    CreateSimple {
36                        object_id: OBJECT_ID_1,
37                        created_at: EVENT_ID_1,
38                        object: Arc::new(TestObjectSimple(b"123".to_vec())),
39                        updatedness: make_updatedness(),
40                        importance: Importance::LOCK,
41                    },
42                    SubmitSimple {
43                        object_id: 0,
44                        event_id: EVENT_ID_3,
45                        event: Arc::new(TestEventSimple::Clear),
46                        updatedness: make_updatedness(),
47                        additional_importance: Importance::LOCK,
48                    },
49                    SubmitSimple {
50                        object_id: 0,
51                        event_id: EVENT_ID_4,
52                        event: Arc::new(TestEventSimple::Clear),
53                        updatedness: make_updatedness(),
54                        additional_importance: Importance::LOCK,
55                    },
56                    SubmitSimple {
57                        object_id: 0,
58                        event_id: EVENT_ID_2,
59                        event: Arc::new(TestEventSimple::Clear),
60                        updatedness: make_updatedness(),
61                        additional_importance: Importance::LOCK,
62                    },
63                    CreateSimple {
64                        object_id: OBJECT_ID_2,
65                        created_at: EVENT_ID_3,
66                        object: Arc::new(TestObjectSimple(b"456".to_vec())),
67                        updatedness: make_updatedness(),
68                        importance: Importance::LOCK,
69                    },
70                ]),
71            )
72            .await;
73        }
74
75        #[fuzz_helpers::test]
76        async fn regression_proper_error_on_recreate_inexistent() {
77            use Op::*;
78            let cluster = setup();
79            fuzz_impl(
80                &cluster,
81                Arc::new(vec![RecreateSimple {
82                    object_id: 0,
83                    new_created_at: EVENT_ID_NULL,
84                    object: Arc::new(TestObjectSimple::stub_1()),
85                    updatedness: Some(Updatedness::from_u128(1)),
86                    additional_importance: Importance::LOCK,
87                }]),
88            )
89            .await;
90        }
91
92        #[fuzz_helpers::test]
93        async fn regression_wrong_error_on_object_already_exists() {
94            use Op::*;
95            let cluster = setup();
96            let mut make_updatedness = make_make_updatedness();
97            fuzz_impl(
98                &cluster,
99                Arc::new(vec![
100                    CreateSimple {
101                        object_id: OBJECT_ID_1,
102                        created_at: EVENT_ID_1,
103                        object: Arc::new(TestObjectSimple(vec![0, 0, 0, 0, 0, 2, 0, 252])),
104                        updatedness: make_updatedness(),
105                        importance: Importance::LOCK,
106                    },
107                    CreateSimple {
108                        object_id: OBJECT_ID_1,
109                        created_at: EVENT_ID_2,
110                        object: Arc::new(TestObjectSimple(vec![0, 0, 0, 0, 0, 0, 0, 0])),
111                        updatedness: make_updatedness(),
112                        importance: Importance::LOCK,
113                    },
114                ]),
115            )
116            .await;
117        }
118
119        #[fuzz_helpers::test]
120        async fn regression_postgres_did_not_distinguish_between_object_and_event_conflicts() {
121            use Op::*;
122            let cluster = setup();
123            let mut make_updatedness = make_make_updatedness();
124            fuzz_impl(
125                &cluster,
126                Arc::new(vec![
127                    CreateSimple {
128                        object_id: ObjectId(
129                            Ulid::from_string("0001SPAWVKD5QPWQV100000000").unwrap(),
130                        ),
131                        created_at: EventId(
132                            Ulid::from_string("00000000000000000000000000").unwrap(),
133                        ),
134                        object: Arc::new(TestObjectSimple(vec![0, 143, 0, 0, 0, 0, 126, 59])),
135                        updatedness: make_updatedness(),
136                        importance: Importance::LOCK,
137                    },
138                    CreateSimple {
139                        object_id: ObjectId(
140                            Ulid::from_string("0058076SBKEDMPYVJZC4000000").unwrap(),
141                        ),
142                        created_at: EventId(
143                            Ulid::from_string("00000000000000000000000000").unwrap(),
144                        ),
145                        object: Arc::new(TestObjectSimple(vec![0, 0, 244, 0, 105, 111, 110, 0])),
146                        updatedness: make_updatedness(),
147                        importance: Importance::LOCK,
148                    },
149                ]),
150            )
151            .await;
152        }
153
154        #[fuzz_helpers::test]
155        async fn regression_submit_on_other_snapshot_date_fails() {
156            use Op::*;
157            let cluster = setup();
158            let mut make_updatedness = make_make_updatedness();
159            fuzz_impl(
160                &cluster,
161                Arc::new(vec![
162                    CreateSimple {
163                        object_id: ObjectId(
164                            Ulid::from_string("0000000000000004PAVG100000").unwrap(),
165                        ),
166                        created_at: EventId(
167                            Ulid::from_string("00000000000000000000000000").unwrap(),
168                        ),
169                        object: Arc::new(TestObjectSimple(vec![0, 0, 0, 0, 0, 0, 214, 0])),
170                        updatedness: make_updatedness(),
171                        importance: Importance::LOCK,
172                    },
173                    CreateSimple {
174                        object_id: ObjectId(
175                            Ulid::from_string("00000000000000000JS8000000").unwrap(),
176                        ),
177                        created_at: EventId(
178                            Ulid::from_string("0000001ZZZ1BYFZZRVZZZZY000").unwrap(),
179                        ),
180                        object: Arc::new(TestObjectSimple(vec![0, 0, 0, 0, 0, 0, 1, 0])),
181                        updatedness: make_updatedness(),
182                        importance: Importance::LOCK,
183                    },
184                    SubmitSimple {
185                        object_id: 0,
186                        event_id: EventId(Ulid::from_string("0000001ZZZ1BYFZZRVZZZZY000").unwrap()),
187                        event: Arc::new(TestEventSimple::Set(vec![0, 0, 0, 0, 0, 0, 0, 0])),
188                        updatedness: make_updatedness(),
189                        additional_importance: Importance::LOCK,
190                    },
191                ]),
192            )
193            .await;
194        }
195
196        #[fuzz_helpers::test]
197        async fn regression_vacuum_did_not_actually_recreate_objects() {
198            let cluster = setup();
199            let mut make_updatedness = make_make_updatedness();
200            fuzz_impl(
201                &cluster,
202                Arc::new(vec![
203                    Op::CreateSimple {
204                        object_id: ObjectId(
205                            Ulid::from_string("00000A58N21A8JM00000000000").unwrap(),
206                        ),
207                        created_at: EventId(
208                            Ulid::from_string("00000000000000000000000000").unwrap(),
209                        ),
210                        object: Arc::new(TestObjectSimple(vec![55, 0, 0, 0, 0, 0, 0, 0])),
211                        updatedness: make_updatedness(),
212                        importance: Importance::LOCK,
213                    },
214                    Op::SubmitSimple {
215                        object_id: 0,
216                        event_id: EventId(Ulid::from_string("00001000040000000000000000").unwrap()),
217                        event: Arc::new(TestEventSimple::Set(vec![15, 0, 255, 0, 0, 255, 0, 32])),
218                        updatedness: make_updatedness(),
219                        additional_importance: Importance::LOCK,
220                    },
221                    Op::ServerVacuum {
222                        recreate_at: Some(EventId(
223                            Ulid::from_string("00001000040000000000001000").unwrap(),
224                        )),
225                        updatedness: make_updatedness().unwrap(),
226                    },
227                    Op::SubmitSimple {
228                        object_id: 0,
229                        event_id: EventId(Ulid::from_string("00000000000000000000000200").unwrap()),
230                        event: Arc::new(TestEventSimple::Set(vec![6, 0, 0, 0, 0, 0, 0, 0])),
231                        updatedness: make_updatedness(),
232                        additional_importance: Importance::LOCK,
233                    },
234                ]),
235            )
236            .await;
237        }
238
239        #[fuzz_helpers::test]
240        async fn regression_object_with_two_snapshots_was_not_detected_as_object_id_conflict() {
241            use Op::*;
242            let cluster = setup();
243            let mut make_updatedness = make_make_updatedness();
244            fuzz_impl(
245                &cluster,
246                Arc::new(vec![
247                    CreateSimple {
248                        object_id: ObjectId(
249                            Ulid::from_string("00000000000000000000000000").unwrap(),
250                        ),
251                        created_at: EventId(
252                            Ulid::from_string("00000000000000000000000000").unwrap(),
253                        ),
254                        object: Arc::new(TestObjectSimple(vec![0, 0, 0, 0, 0, 0, 75, 0])),
255                        updatedness: make_updatedness(),
256                        importance: Importance::LOCK,
257                    },
258                    SubmitSimple {
259                        object_id: 0,
260                        event_id: EventId(Ulid::from_string("00000000510002P00000000000").unwrap()),
261                        event: Arc::new(TestEventSimple::Append(vec![0, 0, 0, 0, 0, 0, 0, 0])),
262                        updatedness: make_updatedness(),
263                        additional_importance: Importance::LOCK,
264                    },
265                    CreateSimple {
266                        object_id: ObjectId(
267                            Ulid::from_string("00000000000000000000000000").unwrap(),
268                        ),
269                        created_at: EventId(
270                            Ulid::from_string("00000000000000188000NG0000").unwrap(),
271                        ),
272                        object: Arc::new(TestObjectSimple(vec![0, 0, 0, 0, 1, 0, 0, 4])),
273                        updatedness: make_updatedness(),
274                        importance: Importance::LOCK,
275                    },
276                ]),
277            )
278            .await;
279        }
280
281        #[fuzz_helpers::test]
282        async fn regression_any_query_crashed_postgres() {
283            let cluster = setup();
284            fuzz_impl(
285                &cluster,
286                Arc::new(vec![Op::QuerySimple {
287                    user: User(Ulid::from_string("00000020000G10000000006000").unwrap()),
288                    only_updated_since: None,
289                    query: Arc::new(Query::All(vec![])),
290                }]),
291            )
292            .await;
293        }
294
295        #[fuzz_helpers::test]
296        async fn regression_postgres_bignumeric_comparison_with_json_needs_cast() {
297            let cluster = setup();
298            fuzz_impl(
299                &cluster,
300                Arc::new(vec![Op::QuerySimple {
301                    user: User(Ulid::from_string("00000020000G10000000006000").unwrap()),
302                    only_updated_since: None,
303                    query: Arc::new(Query::Lt(vec![], Decimal::from_str("0").unwrap())),
304                }]),
305            )
306            .await;
307        }
308
309        #[fuzz_helpers::test]
310        async fn regression_keyed_comparison_was_still_wrong_syntax() {
311            let cluster = setup();
312            fuzz_impl(
313                &cluster,
314                Arc::new(vec![Op::QuerySimple {
315                    user: User(Ulid::from_string("00000020000G10000000006000").unwrap()),
316                    only_updated_since: None,
317                    query: Arc::new(Query::Ge(
318                        vec![JsonPathItem::Key(String::new())],
319                        Decimal::from_str("0").unwrap(),
320                    )),
321                }]),
322            )
323            .await;
324        }
325
326        #[fuzz_helpers::test]
327        async fn regression_too_big_decimal_failed_postgres() {
328            let cluster = setup();
329            fuzz_impl(
330                &cluster,
331                Arc::new(vec![Op::QuerySimple {
332                    user: User(Ulid::from_string("00000020000G10000000006000").unwrap()),
333                    only_updated_since: None,
334                    query: Arc::new(Query::Ge(
335                        vec![JsonPathItem::Key(String::new())],
336                        Decimal::from_str(&format!("0.{:030000}1", 0)).unwrap(),
337                    )),
338                }]),
339            )
340            .await;
341        }
342
343        #[fuzz_helpers::test]
344        async fn regression_postgresql_syntax_for_equality() {
345            let cluster = setup();
346            fuzz_impl(
347                &cluster,
348                Arc::new(vec![Op::QuerySimple {
349                    user: User(Ulid::from_string("00000020000G10000000006000").unwrap()),
350                    only_updated_since: None,
351                    query: Arc::new(Query::Eq(
352                        vec![JsonPathItem::Key(String::new())],
353                        serde_json::Value::Null,
354                    )),
355                }]),
356            )
357            .await;
358        }
359
360        #[fuzz_helpers::test]
361        async fn regression_checked_add_signed_for_u64_cannot_go_below_zero() {
362            let cluster = setup();
363            fuzz_impl(
364                &cluster,
365                Arc::new(vec![Op::QuerySimple {
366                    user: User(Ulid::from_string("00000020000G10000000006000").unwrap()),
367                    only_updated_since: None,
368                    query: Arc::new(Query::Le(
369                        vec![],
370                        Decimal::from_str(&format!("0.{:0228}1", 0)).unwrap(),
371                    )),
372                }]),
373            )
374            .await;
375        }
376
377        #[fuzz_helpers::test]
378        async fn regression_way_too_big_decimal_caused_problems() {
379            let cluster = setup();
380            fuzz_impl(
381                &cluster,
382                Arc::new(vec![Op::QuerySimple {
383                    user: User(Ulid::from_string("00000020000G10000000006000").unwrap()),
384                    only_updated_since: None,
385                    query: Arc::new(Query::Le(
386                        vec![],
387                        Decimal::from_str(&format!("0.{:057859}1", 0)).unwrap(),
388                    )),
389                }]),
390            )
391            .await;
392        }
393
394        #[fuzz_helpers::test]
395        async fn regression_strings_are_in_keys_too() {
396            let cluster = setup();
397            fuzz_impl(
398                &cluster,
399                Arc::new(vec![Op::QuerySimple {
400                    user: User(Ulid::from_string("00000020000G10000000006000").unwrap()),
401                    only_updated_since: None,
402                    query: Arc::new(Query::Le(
403                        vec![JsonPathItem::Key(String::from("\0"))],
404                        Decimal::from_str("0").unwrap(),
405                    )),
406                }]),
407            )
408            .await;
409        }
410
411        #[fuzz_helpers::test]
412        async fn regression_cast_error() {
413            let cluster = setup();
414            fuzz_impl(
415                &cluster,
416                Arc::new(vec![
417                    Op::CreateSimple {
418                        object_id: ObjectId(
419                            Ulid::from_string("000000000000000000000002G0").unwrap(),
420                        ),
421                        created_at: EventId(
422                            Ulid::from_string("00000000000000000000000000").unwrap(),
423                        ),
424                        object: Arc::new(TestObjectSimple(vec![0, 0, 0, 4, 6, 75, 182, 0])),
425                        updatedness: Some(Updatedness::from_u128(1)),
426                        importance: Importance::LOCK,
427                    },
428                    Op::QuerySimple {
429                        user: User(Ulid::from_string("00000000000000000000000001").unwrap()),
430                        only_updated_since: None,
431                        query: Arc::new(Query::Le(vec![], Decimal::from_str("0").unwrap())),
432                    },
433                ]),
434            )
435            .await;
436        }
437
438        #[fuzz_helpers::test]
439        async fn regression_sql_injection_in_path_key() {
440            let cluster = setup();
441            fuzz_impl(
442                &cluster,
443                Arc::new(vec![Op::QuerySimple {
444                    user: User(Ulid::from_string("030C1G60R30C1G60R30C1G60R3").unwrap()),
445                    only_updated_since: None,
446                    query: Arc::new(Query::Eq(
447                        vec![JsonPathItem::Key(String::from("'a"))],
448                        serde_json::Value::Null,
449                    )),
450                }]),
451            )
452            .await;
453        }
454
455        #[fuzz_helpers::test]
456        async fn regression_sqlx_had_a_bug_with_prepared_queries_of_different_types() {
457            // See https://github.com/launchbadge/sqlx/issues/2981
458            let cluster = setup();
459            fuzz_impl(
460                &cluster,
461                Arc::new(vec![
462                    Op::RecreateSimple {
463                        object_id: 0,
464                        new_created_at: EVENT_ID_NULL,
465                        object: Arc::new(TestObjectSimple::stub_1()),
466                        updatedness: Some(Updatedness::from_u128(1)),
467                        additional_importance: Importance::LOCK,
468                    },
469                    Op::QuerySimple {
470                        user: USER_ID_NULL,
471                        only_updated_since: None,
472                        query: Arc::new(Query::Eq(
473                            vec![
474                                JsonPathItem::Key(String::from("a")),
475                                JsonPathItem::Key(String::from("a")),
476                            ],
477                            serde_json::Value::Null,
478                        )),
479                    },
480                    Op::QuerySimple {
481                        user: USER_ID_NULL,
482                        only_updated_since: None,
483                        query: Arc::new(Query::Eq(vec![], serde_json::Value::Null)),
484                    },
485                    Op::QuerySimple {
486                        user: USER_ID_NULL,
487                        only_updated_since: None,
488                        query: Arc::new(Query::Eq(vec![], serde_json::Value::Null)),
489                    },
490                    Op::QuerySimple {
491                        user: USER_ID_NULL,
492                        only_updated_since: None,
493                        query: Arc::new(Query::Eq(vec![], serde_json::Value::Null)),
494                    },
495                    Op::QuerySimple {
496                        user: USER_ID_NULL,
497                        only_updated_since: None,
498                        query: Arc::new(Query::Eq(
499                            vec![JsonPathItem::Id(1), JsonPathItem::Key(String::from("a"))],
500                            serde_json::Value::Null,
501                        )),
502                    },
503                ]),
504            )
505            .await;
506        }
507
508        #[fuzz_helpers::test]
509        async fn regression_postgres_null_led_to_not_being_wrong() {
510            let cluster = setup();
511            fuzz_impl(
512                &cluster,
513                Arc::new(vec![
514                    Op::CreateSimple {
515                        object_id: ObjectId(
516                            Ulid::from_string("000002C1800G08000000000000").unwrap(),
517                        ),
518                        created_at: EventId(
519                            Ulid::from_string("0000000000200000000002G000").unwrap(),
520                        ),
521                        object: Arc::new(TestObjectSimple(vec![0, 0, 0, 255, 255, 255, 0, 0])),
522                        updatedness: Some(Updatedness::from_u128(1)),
523                        importance: Importance::LOCK,
524                    },
525                    Op::QuerySimple {
526                        user: User(Ulid::from_string("00000000000000000000000000").unwrap()),
527                        only_updated_since: None,
528                        query: Arc::new(Query::Not(Box::new(Query::ContainsStr(
529                            vec![],
530                            String::new(),
531                        )))),
532                    },
533                ]),
534            )
535            .await;
536        }
537
538        #[fuzz_helpers::test]
539        async fn regression_postgres_handled_numbers_as_one_element_arrays() {
540            // See also https://www.postgresql.org/message-id/87h6jbbxma.fsf%40coegni.ekleog.org
541            // tracing_subscriber::FmtSubscriber::builder()
542            //     .with_max_level(tracing::Level::TRACE)
543            //     .init();
544
545            let cluster = setup();
546            fuzz_impl(
547                &cluster,
548                Arc::new(vec![
549                    Op::CreateSimple {
550                        object_id: ObjectId(
551                            Ulid::from_string("0000001YR00020000002G002G0").unwrap(),
552                        ),
553                        created_at: EventId(
554                            Ulid::from_string("0003XA00000G22PB005R1G6000").unwrap(),
555                        ),
556                        object: Arc::new(TestObjectSimple(vec![0, 0, 3, 3, 3, 3, 3, 3])),
557                        updatedness: Some(Updatedness::from_u128(1)),
558                        importance: Importance::LOCK,
559                    },
560                    Op::QuerySimple {
561                        user: User(Ulid::from_string("00000000000000000000000000").unwrap()),
562                        only_updated_since: None,
563                        query: Arc::new(Query::Lt(
564                            vec![JsonPathItem::Id(-1), JsonPathItem::Id(-1)],
565                            Decimal::from(158),
566                        )),
567                    },
568                ]),
569            )
570            .await;
571        }
572
573        #[fuzz_helpers::test]
574        async fn regression_indexeddb_recreation_considered_dates_the_other_way_around() {
575            let cluster = setup();
576            let mut make_updatedness = make_make_updatedness();
577            fuzz_impl(
578                &cluster,
579                Arc::new(vec![
580                    Op::CreateSimple {
581                        object_id: OBJECT_ID_1,
582                        created_at: EVENT_ID_1,
583                        object: Arc::new(TestObjectSimple(vec![221, 218])),
584                        updatedness: make_updatedness(),
585                        importance: Importance::LOCK,
586                    },
587                    Op::RecreateSimple {
588                        object_id: 0,
589                        new_created_at: EVENT_ID_2,
590                        object: Arc::new(TestObjectSimple(vec![])),
591                        updatedness: make_updatedness(),
592                        additional_importance: Importance::LOCK,
593                    },
594                ]),
595            )
596            .await;
597        }
598
599        #[fuzz_helpers::test]
600        async fn regression_indexeddb_recreation_did_not_fail_upon_back_in_time() {
601            let cluster = setup();
602            let mut make_updatedness = make_make_updatedness();
603            fuzz_impl(
604                &cluster,
605                Arc::new(vec![
606                    Op::CreateSimple {
607                        object_id: OBJECT_ID_1,
608                        created_at: EVENT_ID_2,
609                        object: Arc::new(TestObjectSimple(vec![221, 218])),
610                        updatedness: make_updatedness(),
611                        importance: Importance::LOCK,
612                    },
613                    Op::RecreateSimple {
614                        object_id: 0,
615                        new_created_at: EVENT_ID_1,
616                        object: Arc::new(TestObjectSimple(vec![])),
617                        updatedness: make_updatedness(),
618                        additional_importance: Importance::LOCK,
619                    },
620                ]),
621            )
622            .await;
623        }
624
625        #[fuzz_helpers::test]
626        async fn regression_memdb_recreation_of_non_existent_deadlocked() {
627            // tracing_wasm::set_as_global_default();
628            // std::panic::set_hook(Box::new(console_error_panic_hook::hook));
629            let cluster = setup();
630            fuzz_impl(
631                &cluster,
632                Arc::new(vec![Op::RecreateSimple {
633                    object_id: 0,
634                    new_created_at: EVENT_ID_1,
635                    object: Arc::new(TestObjectSimple(vec![])),
636                    updatedness: Some(Updatedness::from_u128(1)),
637                    additional_importance: Importance::LOCK,
638                }]),
639            )
640            .await;
641        }
642
643        #[fuzz_helpers::test]
644        async fn regression_indexeddb_removal_of_nonexistent_object_had_wrong_error_message() {
645            // tracing_wasm::set_as_global_default();
646            // std::panic::set_hook(Box::new(console_error_panic_hook::hook));
647            let cluster = setup();
648            fuzz_impl(&cluster, Arc::new(vec![Op::Remove { object_id: 0 }])).await;
649        }
650
651        #[fuzz_helpers::test]
652        async fn regression_memdb_unlocking_of_nonexistent_object_had_wrong_error_message() {
653            // tracing_wasm::set_as_global_default();
654            // std::panic::set_hook(Box::new(console_error_panic_hook::hook));
655            let cluster = setup();
656            fuzz_impl(
657                &cluster,
658                Arc::new(vec![Op::SetObjectImportance {
659                    object_id: 0,
660                    new_importance: Importance::NONE,
661                }]),
662            )
663            .await;
664        }
665
666        #[fuzz_helpers::test]
667        async fn regression_memdb_did_not_vacuum_unlocked_objects() {
668            let cluster = setup();
669            let mut make_updatedness = make_make_updatedness();
670            fuzz_impl(
671                &cluster,
672                Arc::new(vec![
673                    Op::CreateSimple {
674                        object_id: OBJECT_ID_1,
675                        created_at: EVENT_ID_2,
676                        object: Arc::new(TestObjectSimple(vec![1])),
677                        updatedness: make_updatedness(),
678                        importance: Importance::NONE,
679                    },
680                    Op::ClientVacuum,
681                    Op::RecreateSimple {
682                        object_id: 0,
683                        new_created_at: EVENT_ID_1,
684                        object: Arc::new(TestObjectSimple(vec![2])),
685                        updatedness: make_updatedness(),
686                        additional_importance: Importance::LOCK,
687                    },
688                ]),
689            )
690            .await;
691        }
692
693        #[fuzz_helpers::test]
694        async fn regression_memdb_recreate_did_not_recompute_latest_snapshot_right() {
695            let cluster = setup();
696            let mut make_updatedness = make_make_updatedness();
697            fuzz_impl(
698                &cluster,
699                Arc::new(vec![
700                    Op::CreateSimple {
701                        object_id: OBJECT_ID_1,
702                        created_at: EVENT_ID_1,
703                        object: Arc::new(TestObjectSimple(vec![231])),
704                        updatedness: make_updatedness(),
705                        importance: Importance::LOCK,
706                    },
707                    Op::SubmitSimple {
708                        object_id: 1296584126,
709                        event_id: EVENT_ID_3,
710                        event: Arc::new(TestEventSimple::Append(vec![111])),
711                        updatedness: make_updatedness(),
712                        additional_importance: Importance::LOCK,
713                    },
714                    Op::RecreateSimple {
715                        object_id: 2039216500,
716                        new_created_at: EVENT_ID_2,
717                        object: Arc::new(TestObjectSimple(vec![])),
718                        updatedness: make_updatedness(),
719                        additional_importance: Importance::LOCK,
720                    },
721                ]),
722            )
723            .await;
724        }
725
726        #[fuzz_helpers::test]
727        async fn regression_memdb_vacuum_very_late_gave_error_outside_cmp() {
728            let cluster = setup();
729            fuzz_impl(
730                &cluster,
731                Arc::new(vec![Op::ServerVacuum {
732                    recreate_at: Some(EventId::from_u128(u128::MAX)),
733                    updatedness: UPDATEDNESS_1,
734                }]),
735            )
736            .await;
737        }
738
739        #[fuzz_helpers::test]
740        async fn regression_memdb_had_not_implemented_timestamps() {
741            let cluster = setup();
742            fuzz_impl(
743                &cluster,
744                Arc::new(vec![Op::QuerySimple {
745                    user: User(Ulid::from_string("39DNJNMVVECM3GFZR00278W04E").unwrap()),
746                    only_updated_since: Some(Updatedness(
747                        Ulid::from_string("00000000000000000000000000").unwrap(),
748                    )),
749                    query: Arc::new(Query::Eq(vec![], serde_json::Value::Null)),
750                }]),
751            )
752            .await;
753        }
754
755        #[fuzz_helpers::test]
756        #[cfg(any())] // disabled
757        async fn impl_reproducer() {
758            let cluster = setup();
759            fuzz_impl(
760                &cluster,
761                serde_json::from_str(include_str!("../../repro.json")).unwrap(),
762            )
763            .await;
764        }
765    };
766}