forge
Explore
Log in

Don't you dare go Hollow

Ulid replaces uuid

Browse files at this commit

f18ddfbe50904016bec326e98b9b187421945b91Ahmet Kaan GümüşParent: e619a87
  • refactor
    • ulid replaces uuid
Show full message
♻️ refactor: ulid replaces uuid
Cargo.lockmodified+12 -2
@@ -1745,7 +1745,7 @@ dependencies = [
1745 "tokio",1745 "tokio",
1746 "toml",1746 "toml",
1747 "turso",1747 "turso",
1748- "uuid",1748+ "ulid",
1749 ]1749 ]
1750 1750
1751 [[package]]1751 [[package]]
@@ -1763,7 +1763,7 @@ dependencies = [
1763 "time",1763 "time",
1764 "tokio",1764 "tokio",
1765 "topcoat",1765 "topcoat",
1766- "uuid",1766+ "ulid",
1767 ]1767 ]
1768 1768
1769 [[package]]1769 [[package]]
@@ -4165,6 +4165,16 @@ dependencies = [
4165 "syn 3.0.4",4165 "syn 3.0.4",
4166 ]4166 ]
4167 4167
4168+[[package]]
4169+name = "ulid"
4170+version = "1.2.1"
4171+source = "registry+https://github.com/rust-lang/crates.io-index"
4172+checksum = "470dbf6591da1b39d43c14523b2b469c86879a53e8b758c8e090a470fe7b1fbe"
4173+dependencies = [
4174+ "rand 0.9.5",
4175+ "web-time",
4176+]
4177+
4168 [[package]]4178 [[package]]
4169 name = "uncased"4179 name = "uncased"
4170 version = "0.9.10"4180 version = "0.9.10"
Cargo.tomlmodified+1 -1
@@ -13,7 +13,7 @@ izlek-core = { path = "crates/izlek-core", default-features = false }
13 serde = { version = "1.0.229", features = ["derive"] }13 serde = { version = "1.0.229", features = ["derive"] }
14 serde_json = "1.0.145"14 serde_json = "1.0.145"
15 thiserror = "2.0.20"15 thiserror = "2.0.20"
16-uuid = { version = "1.25.0", features = ["v4", "serde"] }16+ulid = "1"
17 time = { version = "0.3.55", features = ["serde", "formatting", "parsing", "macros"] }17 time = { version = "0.3.55", features = ["serde", "formatting", "parsing", "macros"] }
18 tokio = { version = "1.53.1", features = ["full"] }18 tokio = { version = "1.53.1", features = ["full"] }
19 turso = "=0.8.0-pre.7"19 turso = "=0.8.0-pre.7"
crates/izlek-core/Cargo.tomlmodified+2 -2
@@ -21,7 +21,7 @@ server = [
21 "dep:subtle",21 "dep:subtle",
22 "dep:tokio",22 "dep:tokio",
23 "dep:turso",23 "dep:turso",
24- "dep:uuid",24+ "dep:ulid",
25 ]25 ]
26 26
27 [dependencies]27 [dependencies]
@@ -39,7 +39,7 @@ time.workspace = true
39 toml.workspace = true39 toml.workspace = true
40 tokio = { workspace = true, optional = true }40 tokio = { workspace = true, optional = true }
41 turso = { workspace = true, optional = true }41 turso = { workspace = true, optional = true }
42-uuid = { workspace = true, optional = true }42+ulid = { workspace = true, optional = true }
43 43
44 [dev-dependencies]44 [dev-dependencies]
45 async-trait = "0.1.92"45 async-trait = "0.1.92"
crates/izlek-core/src/config.rsmodified+3 -3
@@ -205,14 +205,14 @@ mod tests {
205 /// A scratch directory, cleaned up when the test ends, so `load_from` can205 /// A scratch directory, cleaned up when the test ends, so `load_from` can
206 /// be exercised without touching the process's own working directory.206 /// be exercised without touching the process's own working directory.
207 fn scratch() -> PathBuf {207 fn scratch() -> PathBuf {
208- let dir = std::env::temp_dir().join(format!("izlek-config-test-{}", uuid_like()));208+ let dir = std::env::temp_dir().join(format!("izlek-config-test-{}", unique_suffix()));
209 std::fs::create_dir_all(&dir).unwrap();209 std::fs::create_dir_all(&dir).unwrap();
210 dir210 dir
211 }211 }
212 212
213 /// Good enough uniqueness for a scratch directory name; no need for a213 /// Good enough uniqueness for a scratch directory name; no need for a
214- /// real UUID dependency just for this.214+ /// real ULID dependency just for this.
215- fn uuid_like() -> u128 {215+ fn unique_suffix() -> u128 {
216 std::time::SystemTime::now()216 std::time::SystemTime::now()
217 .duration_since(std::time::UNIX_EPOCH)217 .duration_since(std::time::UNIX_EPOCH)
218 .unwrap()218 .unwrap()
crates/izlek-core/src/store/secret.rsmodified+3 -3
@@ -172,7 +172,7 @@ mod tests {
172 172
173 #[test]173 #[test]
174 fn load_or_create_key_persists_and_restricts() {174 fn load_or_create_key_persists_and_restricts() {
175- let dir = std::env::temp_dir().join(format!("izlek-key-test-{}", uuid_lite()));175+ let dir = std::env::temp_dir().join(format!("izlek-key-test-{}", unique_suffix()));
176 std::fs::create_dir_all(&dir).unwrap();176 std::fs::create_dir_all(&dir).unwrap();
177 let path = dir.join("izlek.key");177 let path = dir.join("izlek.key");
178 let first = load_or_create_key(&path).unwrap();178 let first = load_or_create_key(&path).unwrap();
@@ -187,9 +187,9 @@ mod tests {
187 let _ = std::fs::remove_dir_all(&dir);187 let _ = std::fs::remove_dir_all(&dir);
188 }188 }
189 189
190- // A tiny stand-in so this module does not reach for the `uuid` crate just190+ // A tiny stand-in so this module does not reach for the `ulid` crate just
191 // to name a scratch directory.191 // to name a scratch directory.
192- fn uuid_lite() -> u64 {192+ fn unique_suffix() -> u64 {
193 use std::time::{SystemTime, UNIX_EPOCH};193 use std::time::{SystemTime, UNIX_EPOCH};
194 SystemTime::now()194 SystemTime::now()
195 .duration_since(UNIX_EPOCH)195 .duration_since(UNIX_EPOCH)
crates/izlek-core/src/store/turso_store.rsmodified+31 -31
@@ -11,7 +11,7 @@ use time::OffsetDateTime;
11 use time::format_description::well_known::Rfc3339;11 use time::format_description::well_known::Rfc3339;
12 use turso::transaction::TransactionBehavior;12 use turso::transaction::TransactionBehavior;
13 use turso::{Builder, Connection, Row, Value, params};13 use turso::{Builder, Connection, Row, Value, params};
14-use uuid::Uuid;14+use ulid::Ulid;
15 15
16 use super::secret;16 use super::secret;
17 use super::{17 use super::{
@@ -609,9 +609,9 @@ impl Store for TursoStore {
609 display_name: &str,609 display_name: &str,
610 password_hash: &str,610 password_hash: &str,
611 ) -> Result<(Workspace, User)> {611 ) -> Result<(Workspace, User)> {
612- let workspace_id = Uuid::new_v4().to_string();612+ let workspace_id = Ulid::new().to_string();
613- let admin_id = Uuid::new_v4().to_string();613+ let admin_id = Ulid::new().to_string();
614- let board_id = Uuid::new_v4().to_string();614+ let board_id = Ulid::new().to_string();
615 let now = now_text()?;615 let now = now_text()?;
616 let email = fold_email(email);616 let email = fold_email(email);
617 617
@@ -668,7 +668,7 @@ impl Store for TursoStore {
668 "INSERT INTO board_column (id, board_id, name, position, is_done) \668 "INSERT INTO board_column (id, board_id, name, position, is_done) \
669 VALUES (?1, ?2, ?3, ?4, ?5)",669 VALUES (?1, ?2, ?3, ?4, ?5)",
670 params![670 params![
671- Uuid::new_v4().to_string(),671+ Ulid::new().to_string(),
672 board_id.clone(),672 board_id.clone(),
673 *name,673 *name,
674 position as i64,674 position as i64,
@@ -832,7 +832,7 @@ impl Store for TursoStore {
832 {832 {
833 return Err(StoreError::Conflict("account"));833 return Err(StoreError::Conflict("account"));
834 }834 }
835- let id = Uuid::new_v4().to_string();835+ let id = Ulid::new().to_string();
836 self.conn836 self.conn
837 .lock()837 .lock()
838 .await838 .await
@@ -982,7 +982,7 @@ impl Store for TursoStore {
982 token_hash: &str,982 token_hash: &str,
983 expires_at: OffsetDateTime,983 expires_at: OffsetDateTime,
984 ) -> Result<SigninLink> {984 ) -> Result<SigninLink> {
985- let id = Uuid::new_v4().to_string();985+ let id = Ulid::new().to_string();
986 self.conn986 self.conn
987 .lock()987 .lock()
988 .await988 .await
@@ -1050,7 +1050,7 @@ impl Store for TursoStore {
1050 token_hash: &str,1050 token_hash: &str,
1051 expires_at: OffsetDateTime,1051 expires_at: OffsetDateTime,
1052 ) -> Result<Session> {1052 ) -> Result<Session> {
1053- let id = Uuid::new_v4().to_string();1053+ let id = Ulid::new().to_string();
1054 self.conn1054 self.conn
1055 .lock()1055 .lock()
1056 .await1056 .await
@@ -1124,7 +1124,7 @@ impl Store for TursoStore {
1124 conn1124 conn
1125 .execute(1125 .execute(
1126 "INSERT INTO auth_attempt (id, bucket, attempted_at) VALUES (?1, ?2, ?3)",1126 "INSERT INTO auth_attempt (id, bucket, attempted_at) VALUES (?1, ?2, ?3)",
1127- params![Uuid::new_v4().to_string(), bucket, stamp(at)?],1127+ params![Ulid::new().to_string(), bucket, stamp(at)?],
1128 )1128 )
1129 .await1129 .await
1130 .map_err(backend)?;1130 .map_err(backend)?;
@@ -1179,7 +1179,7 @@ impl Store for TursoStore {
1179 is_done: bool,1179 is_done: bool,
1180 ) -> Result<Column> {1180 ) -> Result<Column> {
1181 let conn = self.conn.lock().await;1181 let conn = self.conn.lock().await;
1182- let id = Uuid::new_v4().to_string();1182+ let id = Ulid::new().to_string();
1183 conn1183 conn
1184 .execute(1184 .execute(
1185 "INSERT INTO board_column (id, board_id, name, position, is_done) \1185 "INSERT INTO board_column (id, board_id, name, position, is_done) \
@@ -1197,8 +1197,8 @@ impl Store for TursoStore {
1197 }1197 }
1198 1198
1199 async fn create_task(&self, new: NewTask<'_>) -> Result<TaskCreated> {1199 async fn create_task(&self, new: NewTask<'_>) -> Result<TaskCreated> {
1200- let id = Uuid::new_v4().to_string();1200+ let id = Ulid::new().to_string();
1201- let activity_id = Uuid::new_v4().to_string();1201+ let activity_id = Ulid::new().to_string();
1202 let now = now_text()?;1202 let now = now_text()?;
1203 let deadline = new.deadline.map(day_text).transpose()?;1203 let deadline = new.deadline.map(day_text).transpose()?;
1204 1204
@@ -1448,8 +1448,8 @@ impl Store for TursoStore {
1448 body: &str,1448 body: &str,
1449 at: OffsetDateTime,1449 at: OffsetDateTime,
1450 ) -> Result<CommentWritten> {1450 ) -> Result<CommentWritten> {
1451- let comment_id = Uuid::new_v4().to_string();1451+ let comment_id = Ulid::new().to_string();
1452- let activity_id = Uuid::new_v4().to_string();1452+ let activity_id = Ulid::new().to_string();
1453 let when = stamp(at)?;1453 let when = stamp(at)?;
1454 1454
1455 let mut conn = self.tx_conn().await?;1455 let mut conn = self.tx_conn().await?;
@@ -1495,7 +1495,7 @@ impl Store for TursoStore {
1495 1495
1496 async fn add_attachment(&self, new: NewAttachment<'_>) -> Result<String> {1496 async fn add_attachment(&self, new: NewAttachment<'_>) -> Result<String> {
1497 let conn = self.conn.lock().await;1497 let conn = self.conn.lock().await;
1498- let id = Uuid::new_v4().to_string();1498+ let id = Ulid::new().to_string();
1499 let size = new.bytes.len() as i64;1499 let size = new.bytes.len() as i64;
1500 conn1500 conn
1501 .execute(1501 .execute(
@@ -1632,7 +1632,7 @@ impl Store for TursoStore {
1632 }1632 }
1633 let mut ids = Vec::with_capacity(lines.len());1633 let mut ids = Vec::with_capacity(lines.len());
1634 for (kind, detail) in lines {1634 for (kind, detail) in lines {
1635- let id = Uuid::new_v4().to_string();1635+ let id = Ulid::new().to_string();
1636 tx.execute(1636 tx.execute(
1637 "INSERT INTO activity (id, task_id, actor_id, kind, detail, created_at) \1637 "INSERT INTO activity (id, task_id, actor_id, kind, detail, created_at) \
1638 VALUES (?1, ?2, ?3, ?4, ?5, ?6)",1638 VALUES (?1, ?2, ?3, ?4, ?5, ?6)",
@@ -1667,7 +1667,7 @@ impl Store for TursoStore {
1667 at: OffsetDateTime,1667 at: OffsetDateTime,
1668 ) -> Result<Moved> {1668 ) -> Result<Moved> {
1669 let stamp = stamp(at)?;1669 let stamp = stamp(at)?;
1670- let transition_id = Uuid::new_v4().to_string();1670+ let transition_id = Ulid::new().to_string();
1671 1671
1672 // Dropping a card back where it came from is not a move. Answer before1672 // Dropping a card back where it came from is not a move. Answer before
1673 // opening a transaction: there is nothing to serialise.1673 // opening a transaction: there is nothing to serialise.
@@ -1789,7 +1789,7 @@ impl Store for TursoStore {
1789 "INSERT INTO activity (id, task_id, actor_id, kind, detail, created_at) \1789 "INSERT INTO activity (id, task_id, actor_id, kind, detail, created_at) \
1790 VALUES (?1, ?2, ?3, ?4, ?5, ?6)",1790 VALUES (?1, ?2, ?3, ?4, ?5, ?6)",
1791 params![1791 params![
1792- Uuid::new_v4().to_string(),1792+ Ulid::new().to_string(),
1793 task_id,1793 task_id,
1794 actor_id,1794 actor_id,
1795 ActivityKind::Moved.as_str(),1795 ActivityKind::Moved.as_str(),
@@ -1887,7 +1887,7 @@ impl Store for TursoStore {
1887 params![task_id, stamp.clone()],1887 params![task_id, stamp.clone()],
1888 )1888 )
1889 .await?;1889 .await?;
1890- let deleted_activity_id = Uuid::new_v4().to_string();1890+ let deleted_activity_id = Ulid::new().to_string();
1891 tx.execute(1891 tx.execute(
1892 "INSERT INTO activity (id, task_id, actor_id, kind, detail, created_at) \1892 "INSERT INTO activity (id, task_id, actor_id, kind, detail, created_at) \
1893 VALUES (?1, ?2, ?3, ?4, '', ?5)",1893 VALUES (?1, ?2, ?3, ?4, '', ?5)",
@@ -1925,7 +1925,7 @@ impl Store for TursoStore {
1925 "INSERT INTO activity (id, task_id, actor_id, kind, detail, created_at) \1925 "INSERT INTO activity (id, task_id, actor_id, kind, detail, created_at) \
1926 VALUES (?1, ?2, NULL, ?3, ?4, ?5)",1926 VALUES (?1, ?2, NULL, ?3, ?4, ?5)",
1927 params![1927 params![
1928- Uuid::new_v4().to_string(),1928+ Ulid::new().to_string(),
1929 blocked.clone(),1929 blocked.clone(),
1930 ActivityKind::Unblocked.as_str(),1930 ActivityKind::Unblocked.as_str(),
1931 format!("{task_key} was deleted"),1931 format!("{task_key} was deleted"),
@@ -1944,7 +1944,7 @@ impl Store for TursoStore {
1944 None1944 None
1945 } else {1945 } else {
1946 let event = Freeing {1946 let event = Freeing {
1947- id: Uuid::new_v4().to_string(),1947+ id: Ulid::new().to_string(),
1948 board_id,1948 board_id,
1949 cause_key: task_key.clone(),1949 cause_key: task_key.clone(),
1950 cause_title: title,1950 cause_title: title,
@@ -2069,7 +2069,7 @@ impl Store for TursoStore {
2069 at: OffsetDateTime,2069 at: OffsetDateTime,
2070 ) -> Result<String> {2070 ) -> Result<String> {
2071 let conn = self.conn.lock().await;2071 let conn = self.conn.lock().await;
2072- let id = Uuid::new_v4().to_string();2072+ let id = Ulid::new().to_string();
2073 conn2073 conn
2074 .execute(2074 .execute(
2075 "INSERT INTO activity (id, task_id, actor_id, kind, detail, created_at) \2075 "INSERT INTO activity (id, task_id, actor_id, kind, detail, created_at) \
@@ -2098,7 +2098,7 @@ impl Store for TursoStore {
2098 audience: Audience,2098 audience: Audience,
2099 at: OffsetDateTime,2099 at: OffsetDateTime,
2100 ) -> Result<MailRule> {2100 ) -> Result<MailRule> {
2101- let id = Uuid::new_v4().to_string();2101+ let id = Ulid::new().to_string();
2102 let (kind, column) = trigger_parts(trigger);2102 let (kind, column) = trigger_parts(trigger);
2103 self.conn2103 self.conn
2104 .lock()2104 .lock()
@@ -2303,7 +2303,7 @@ impl Store for TursoStore {
2303 recipient: &str,2303 recipient: &str,
2304 at: OffsetDateTime,2304 at: OffsetDateTime,
2305 ) -> Result<Option<MailSend>> {2305 ) -> Result<Option<MailSend>> {
2306- let id = Uuid::new_v4().to_string();2306+ let id = Ulid::new().to_string();
2307 // The index is the decision. `DO NOTHING` turns the second engine run2307 // The index is the decision. `DO NOTHING` turns the second engine run
2308 // into zero rows affected rather than an error to interpret, and the2308 // into zero rows affected rather than an error to interpret, and the
2309 // caller that gets `None` sends nothing.2309 // caller that gets `None` sends nothing.
@@ -2345,7 +2345,7 @@ impl Store for TursoStore {
2345 body: &str,2345 body: &str,
2346 at: OffsetDateTime,2346 at: OffsetDateTime,
2347 ) -> Result<MailSend> {2347 ) -> Result<MailSend> {
2348- let id = Uuid::new_v4().to_string();2348+ let id = Ulid::new().to_string();
2349 self.conn2349 self.conn
2350 .lock()2350 .lock()
2351 .await2351 .await
@@ -2491,7 +2491,7 @@ impl Store for TursoStore {
2491 at: OffsetDateTime,2491 at: OffsetDateTime,
2492 ) -> Result<()> {2492 ) -> Result<()> {
2493 let conn = self.conn.lock().await;2493 let conn = self.conn.lock().await;
2494- let id = Uuid::new_v4().to_string();2494+ let id = Ulid::new().to_string();
2495 conn2495 conn
2496 .execute(2496 .execute(
2497 "INSERT INTO mail_decision (id, rule_id, event_id, task_id, outcome, detail, \2497 "INSERT INTO mail_decision (id, rule_id, event_id, task_id, outcome, detail, \
@@ -3003,7 +3003,7 @@ mod probe {
3003 3003
3004 #[tokio::test]3004 #[tokio::test]
3005 async fn durability_defaults_are_recorded() {3005 async fn durability_defaults_are_recorded() {
3006- let dir = std::env::temp_dir().join(format!("izlek-probe-{}", Uuid::new_v4()));3006+ let dir = std::env::temp_dir().join(format!("izlek-probe-{}", Ulid::new()));
3007 std::fs::create_dir_all(&dir).unwrap();3007 std::fs::create_dir_all(&dir).unwrap();
3008 let path = dir.join("probe.db");3008 let path = dir.join("probe.db");
3009 let db = Builder::new_local(path.to_str().unwrap())3009 let db = Builder::new_local(path.to_str().unwrap())
@@ -3021,7 +3021,7 @@ mod probe {
3021 3021
3022 #[tokio::test]3022 #[tokio::test]
3023 async fn concurrent_writers_on_one_database() {3023 async fn concurrent_writers_on_one_database() {
3024- let dir = std::env::temp_dir().join(format!("izlek-probe-{}", Uuid::new_v4()));3024+ let dir = std::env::temp_dir().join(format!("izlek-probe-{}", Ulid::new()));
3025 std::fs::create_dir_all(&dir).unwrap();3025 std::fs::create_dir_all(&dir).unwrap();
3026 let path = dir.join("probe.db");3026 let path = dir.join("probe.db");
3027 let db = Builder::new_local(path.to_str().unwrap())3027 let db = Builder::new_local(path.to_str().unwrap())
@@ -3064,7 +3064,7 @@ mod probe {
3064 #[tokio::test(flavor = "multi_thread", worker_threads = 4)]3064 #[tokio::test(flavor = "multi_thread", worker_threads = 4)]
3065 async fn two_database_handles_on_one_file() {3065 async fn two_database_handles_on_one_file() {
3066 // Two handles on the same file is the shape a second process takes.3066 // Two handles on the same file is the shape a second process takes.
3067- let dir = std::env::temp_dir().join(format!("izlek-probe-{}", Uuid::new_v4()));3067+ let dir = std::env::temp_dir().join(format!("izlek-probe-{}", Ulid::new()));
3068 std::fs::create_dir_all(&dir).unwrap();3068 std::fs::create_dir_all(&dir).unwrap();
3069 let path = dir.join("probe.db");3069 let path = dir.join("probe.db");
3070 let p = path.to_str().unwrap().to_string();3070 let p = path.to_str().unwrap().to_string();
@@ -3137,7 +3137,7 @@ mod probe {
3137 /// is asserted against the real query rather than against a comment.3137 /// is asserted against the real query rather than against a comment.
3138 #[tokio::test]3138 #[tokio::test]
3139 async fn the_workspace_read_path_cannot_carry_the_password() {3139 async fn the_workspace_read_path_cannot_carry_the_password() {
3140- let dir = std::env::temp_dir().join(format!("izlek-sender-{}", Uuid::new_v4()));3140+ let dir = std::env::temp_dir().join(format!("izlek-sender-{}", Ulid::new()));
3141 std::fs::create_dir_all(&dir).unwrap();3141 std::fs::create_dir_all(&dir).unwrap();
3142 let store = TursoStore::open(dir.join("izlek.db").to_str().unwrap())3142 let store = TursoStore::open(dir.join("izlek.db").to_str().unwrap())
3143 .await3143 .await
@@ -3193,7 +3193,7 @@ mod migration {
3193 /// only half-apply is a migration that can lose the mail ledger.3193 /// only half-apply is a migration that can lose the mail ledger.
3194 #[tokio::test]3194 #[tokio::test]
3195 async fn a_migration_that_fails_partway_leaves_nothing_behind() {3195 async fn a_migration_that_fails_partway_leaves_nothing_behind() {
3196- let dir = std::env::temp_dir().join(format!("izlek-migration-{}", Uuid::new_v4()));3196+ let dir = std::env::temp_dir().join(format!("izlek-migration-{}", Ulid::new()));
3197 std::fs::create_dir_all(&dir).unwrap();3197 std::fs::create_dir_all(&dir).unwrap();
3198 let store = TursoStore::open(dir.join("izlek.db").to_str().unwrap())3198 let store = TursoStore::open(dir.join("izlek.db").to_str().unwrap())
3199 .await3199 .await
crates/izlek-core/tests/store.rsmodified+19 -19
@@ -13,7 +13,7 @@ use izlek_core::store::{
13 SendState, Store, StoreError, Trigger, TursoStore, User,13 SendState, Store, StoreError, Trigger, TursoStore, User,
14 };14 };
15 use time::{Duration, OffsetDateTime};15 use time::{Duration, OffsetDateTime};
16-use uuid::Uuid;16+use ulid::Ulid;
17 17
18 /// A throwaway database on disk. Turso's in-memory mode is not what production18 /// A throwaway database on disk. Turso's in-memory mode is not what production
19 /// runs, so the tests exercise a real file.19 /// runs, so the tests exercise a real file.
@@ -24,7 +24,7 @@ struct Scratch {
24 24
25 impl Scratch {25 impl Scratch {
26 async fn open() -> Self {26 async fn open() -> Self {
27- let dir = std::env::temp_dir().join(format!("izlek-test-{}", Uuid::new_v4()));27+ let dir = std::env::temp_dir().join(format!("izlek-test-{}", Ulid::new()));
28 std::fs::create_dir_all(&dir).unwrap();28 std::fs::create_dir_all(&dir).unwrap();
29 let store = TursoStore::open(dir.join("izlek.db").to_str().unwrap())29 let store = TursoStore::open(dir.join("izlek.db").to_str().unwrap())
30 .await30 .await
@@ -102,7 +102,7 @@ async fn member(store: &TursoStore, workspace_id: &str, email: &str, name: &str)
102 /// empty table.102 /// empty table.
103 async fn a_pre_0013_store_with_a_rule_send_and_decision()103 async fn a_pre_0013_store_with_a_rule_send_and_decision()
104 -> (PathBuf, String, String, String, String) {104 -> (PathBuf, String, String, String, String) {
105- let dir = std::env::temp_dir().join(format!("izlek-test-{}", Uuid::new_v4()));105+ let dir = std::env::temp_dir().join(format!("izlek-test-{}", Ulid::new()));
106 std::fs::create_dir_all(&dir).unwrap();106 std::fs::create_dir_all(&dir).unwrap();
107 let path = dir.join("izlek.db").to_string_lossy().into_owned();107 let path = dir.join("izlek.db").to_string_lossy().into_owned();
108 108
@@ -140,14 +140,14 @@ async fn a_pre_0013_store_with_a_rule_send_and_decision()
140 .unwrap();140 .unwrap();
141 }141 }
142 142
143- let workspace = Uuid::new_v4().to_string();143+ let workspace = Ulid::new().to_string();
144- let admin = Uuid::new_v4().to_string();144+ let admin = Ulid::new().to_string();
145- let board = Uuid::new_v4().to_string();145+ let board = Ulid::new().to_string();
146- let backlog = Uuid::new_v4().to_string();146+ let backlog = Ulid::new().to_string();
147- let done = Uuid::new_v4().to_string();147+ let done = Ulid::new().to_string();
148- let task = Uuid::new_v4().to_string();148+ let task = Ulid::new().to_string();
149- let rule = Uuid::new_v4().to_string();149+ let rule = Ulid::new().to_string();
150- let transition = Uuid::new_v4().to_string();150+ let transition = Ulid::new().to_string();
151 conn.execute(151 conn.execute(
152 "INSERT INTO workspace (id, name, created_at) VALUES (?1, 'Izlek', '2026-08-26T00:00:00Z')",152 "INSERT INTO workspace (id, name, created_at) VALUES (?1, 'Izlek', '2026-08-26T00:00:00Z')",
153 turso::params![workspace.clone()],153 turso::params![workspace.clone()],
@@ -231,7 +231,7 @@ async fn a_pre_0013_store_with_a_rule_send_and_decision()
231 231
232 #[tokio::test]232 #[tokio::test]
233 async fn migrations_apply_once_and_survive_reopen() {233 async fn migrations_apply_once_and_survive_reopen() {
234- let dir = std::env::temp_dir().join(format!("izlek-test-{}", Uuid::new_v4()));234+ let dir = std::env::temp_dir().join(format!("izlek-test-{}", Ulid::new()));
235 std::fs::create_dir_all(&dir).unwrap();235 std::fs::create_dir_all(&dir).unwrap();
236 let path = dir.join("izlek.db").to_string_lossy().into_owned();236 let path = dir.join("izlek.db").to_string_lossy().into_owned();
237 237
@@ -333,7 +333,7 @@ async fn a_second_claim_loses_and_changes_nothing() {
333 333
334 #[tokio::test(flavor = "multi_thread", worker_threads = 4)]334 #[tokio::test(flavor = "multi_thread", worker_threads = 4)]
335 async fn concurrent_claims_produce_exactly_one_admin() {335 async fn concurrent_claims_produce_exactly_one_admin() {
336- let dir = std::env::temp_dir().join(format!("izlek-test-{}", Uuid::new_v4()));336+ let dir = std::env::temp_dir().join(format!("izlek-test-{}", Ulid::new()));
337 std::fs::create_dir_all(&dir).unwrap();337 std::fs::create_dir_all(&dir).unwrap();
338 let path = dir.join("izlek.db").to_string_lossy().into_owned();338 let path = dir.join("izlek.db").to_string_lossy().into_owned();
339 let store = std::sync::Arc::new(TursoStore::open(&path).await.unwrap());339 let store = std::sync::Arc::new(TursoStore::open(&path).await.unwrap());
@@ -386,7 +386,7 @@ async fn concurrent_claims_produce_exactly_one_admin() {
386 /// come back `Ok`, never that error.386 /// come back `Ok`, never that error.
387 #[tokio::test(flavor = "multi_thread", worker_threads = 8)]387 #[tokio::test(flavor = "multi_thread", worker_threads = 8)]
388 async fn many_concurrent_callers_never_see_concurrent_use_forbidden() {388 async fn many_concurrent_callers_never_see_concurrent_use_forbidden() {
389- let dir = std::env::temp_dir().join(format!("izlek-test-{}", Uuid::new_v4()));389+ let dir = std::env::temp_dir().join(format!("izlek-test-{}", Ulid::new()));
390 std::fs::create_dir_all(&dir).unwrap();390 std::fs::create_dir_all(&dir).unwrap();
391 let path = dir.join("izlek.db").to_string_lossy().into_owned();391 let path = dir.join("izlek.db").to_string_lossy().into_owned();
392 let store = std::sync::Arc::new(TursoStore::open(&path).await.unwrap());392 let store = std::sync::Arc::new(TursoStore::open(&path).await.unwrap());
@@ -822,7 +822,7 @@ async fn profile_and_role_updates_stick() {
822 #[tokio::test]822 #[tokio::test]
823 async fn updates_to_a_missing_user_are_not_found() {823 async fn updates_to_a_missing_user_are_not_found() {
824 let scratch = Scratch::open().await;824 let scratch = Scratch::open().await;
825- let missing = Uuid::new_v4().to_string();825+ let missing = Ulid::new().to_string();
826 assert!(matches!(826 assert!(matches!(
827 scratch.store.set_password_hash(&missing, "x").await,827 scratch.store.set_password_hash(&missing, "x").await,
828 Err(StoreError::NotFound)828 Err(StoreError::NotFound)
@@ -945,7 +945,7 @@ async fn the_store_is_usable_behind_a_trait_object() {
945 945
946 #[tokio::test(flavor = "multi_thread", worker_threads = 4)]946 #[tokio::test(flavor = "multi_thread", worker_threads = 4)]
947 async fn a_prefetched_link_is_consumed_exactly_once() {947 async fn a_prefetched_link_is_consumed_exactly_once() {
948- let dir = std::env::temp_dir().join(format!("izlek-test-{}", Uuid::new_v4()));948+ let dir = std::env::temp_dir().join(format!("izlek-test-{}", Ulid::new()));
949 std::fs::create_dir_all(&dir).unwrap();949 std::fs::create_dir_all(&dir).unwrap();
950 let path = dir.join("izlek.db").to_string_lossy().into_owned();950 let path = dir.join("izlek.db").to_string_lossy().into_owned();
951 let store = std::sync::Arc::new(TursoStore::open(&path).await.unwrap());951 let store = std::sync::Arc::new(TursoStore::open(&path).await.unwrap());
@@ -2899,7 +2899,7 @@ async fn an_orphan_row_is_refused() {
2899 .len();2899 .len();
2900 assert_eq!(existing, 1, "only the admin");2900 assert_eq!(existing, 1, "only the admin");
2901 2901
2902- let dir = std::env::temp_dir().join(format!("izlek-fk-{}", Uuid::new_v4()));2902+ let dir = std::env::temp_dir().join(format!("izlek-fk-{}", Ulid::new()));
2903 std::fs::create_dir_all(&dir).unwrap();2903 std::fs::create_dir_all(&dir).unwrap();
2904 let path = dir.join("izlek.db").to_str().unwrap().to_owned();2904 let path = dir.join("izlek.db").to_str().unwrap().to_owned();
2905 {2905 {
@@ -2976,7 +2976,7 @@ async fn a_rule_that_fires_on_nothing_is_refused_by_the_schema() {
2976 // past it: a status rule with no column, straight at the table. The check2976 // past it: a status rule with no column, straight at the table. The check
2977 // constraint is the guard, and if it were ever dropped this insert would2977 // constraint is the guard, and if it were ever dropped this insert would
2978 // quietly succeed and the engine would carry a rule that matches nothing.2978 // quietly succeed and the engine would carry a rule that matches nothing.
2979- let dir = std::env::temp_dir().join(format!("izlek-test-{}", Uuid::new_v4()));2979+ let dir = std::env::temp_dir().join(format!("izlek-test-{}", Ulid::new()));
2980 std::fs::create_dir_all(&dir).unwrap();2980 std::fs::create_dir_all(&dir).unwrap();
2981 let path = dir.join("izlek.db").to_string_lossy().into_owned();2981 let path = dir.join("izlek.db").to_string_lossy().into_owned();
2982 let store = TursoStore::open(&path).await.unwrap();2982 let store = TursoStore::open(&path).await.unwrap();
@@ -3436,7 +3436,7 @@ impl Mailer for Remembering {
3436 3436
3437 /// A store shared between the tests and an engine.3437 /// A store shared between the tests and an engine.
3438 async fn shared() -> (PathBuf, Arc<TursoStore>, String, String) {3438 async fn shared() -> (PathBuf, Arc<TursoStore>, String, String) {
3439- let dir = std::env::temp_dir().join(format!("izlek-test-{}", Uuid::new_v4()));3439+ let dir = std::env::temp_dir().join(format!("izlek-test-{}", Ulid::new()));
3440 std::fs::create_dir_all(&dir).unwrap();3440 std::fs::create_dir_all(&dir).unwrap();
3441 let store = Arc::new(3441 let store = Arc::new(
3442 TursoStore::open(dir.join("izlek.db").to_str().unwrap())3442 TursoStore::open(dir.join("izlek.db").to_str().unwrap())
crates/izlek-web/Cargo.tomlmodified+1 -1
@@ -41,4 +41,4 @@ grass = "0.13"
41 41
42 [dev-dependencies]42 [dev-dependencies]
43 http = "1.5"43 http = "1.5"
44-uuid = { workspace = true }44+ulid = { workspace = true }
crates/izlek-web/tests/http.rsmodified+5 -5
@@ -29,7 +29,7 @@ use izlek_web::server::{Mail, SESSION_COOKIE};
29 use topcoat::asset::{AssetBundle, RouterBuilderAssetExt};29 use topcoat::asset::{AssetBundle, RouterBuilderAssetExt};
30 use topcoat::cookie::RouterBuilderCookieExt;30 use topcoat::cookie::RouterBuilderCookieExt;
31 use topcoat::router::{Body, BodyLimit, Router, RouterBuilderDiscoverExt, to_bytes};31 use topcoat::router::{Body, BodyLimit, Router, RouterBuilderDiscoverExt, to_bytes};
32-use uuid::Uuid;32+use ulid::Ulid;
33 33
34 /// The bundle `cargo build -p izlek-web` + `topcoat asset bundle --bin34 /// The bundle `cargo build -p izlek-web` + `topcoat asset bundle --bin
35 /// izlek-web` write next to the crate's own `target/debug`, not next to the35 /// izlek-web` write next to the crate's own `target/debug`, not next to the
@@ -49,7 +49,7 @@ struct App {
49 49
50 impl App {50 impl App {
51 async fn build(base_url: &str, mail: Mail) -> Self {51 async fn build(base_url: &str, mail: Mail) -> Self {
52- let dir = std::env::temp_dir().join(format!("izlek-http-{}", Uuid::new_v4()));52+ let dir = std::env::temp_dir().join(format!("izlek-http-{}", Ulid::new()));
53 std::fs::create_dir_all(&dir).unwrap();53 std::fs::create_dir_all(&dir).unwrap();
54 let store: Arc<dyn Store> = Arc::new(54 let store: Arc<dyn Store> = Arc::new(
55 TursoStore::open(dir.join("izlek.db").to_str().unwrap())55 TursoStore::open(dir.join("izlek.db").to_str().unwrap())
@@ -76,7 +76,7 @@ impl App {
76 /// settings, so a transition actually reaches the ledger instead of the76 /// settings, so a transition actually reaches the ledger instead of the
77 /// silent no-op `open`'s router hands every crossing.77 /// silent no-op `open`'s router hands every crossing.
78 async fn open_with_mail() -> Self {78 async fn open_with_mail() -> Self {
79- let dir = std::env::temp_dir().join(format!("izlek-http-{}", Uuid::new_v4()));79+ let dir = std::env::temp_dir().join(format!("izlek-http-{}", Ulid::new()));
80 std::fs::create_dir_all(&dir).unwrap();80 std::fs::create_dir_all(&dir).unwrap();
81 let store: Arc<dyn Store> = Arc::new(81 let store: Arc<dyn Store> = Arc::new(
82 TursoStore::open(dir.join("izlek.db").to_str().unwrap())82 TursoStore::open(dir.join("izlek.db").to_str().unwrap())
@@ -1657,7 +1657,7 @@ async fn a_rule_may_not_be_hung_off_a_column_that_is_not_on_this_board() {
1657 Some(&admin_cookie),1657 Some(&admin_cookie),
1658 &[1658 &[
1659 ("trigger", "status"),1659 ("trigger", "status"),
1660- ("column_id", &Uuid::new_v4().to_string()),1660+ ("column_id", &Ulid::new().to_string()),
1661 ("subject", "Task completed"),1661 ("subject", "Task completed"),
1662 ("audience", "assignees"),1662 ("audience", "assignees"),
1663 ],1663 ],
@@ -1706,7 +1706,7 @@ async fn switching_a_rule_off_leaves_it_listed_and_switched_off() {
1706 async fn a_rule_id_this_workspace_does_not_own_is_refused() {1706 async fn a_rule_id_this_workspace_does_not_own_is_refused() {
1707 let app = App::open().await;1707 let app = App::open().await;
1708 let admin_cookie = admin(&app).await;1708 let admin_cookie = admin(&app).await;
1709- let stranger = Uuid::new_v4().to_string();1709+ let stranger = Ulid::new().to_string();
1710 1710
1711 for path in ["/api/set_rule_enabled", "/api/delete_rule"] {1711 for path in ["/api/set_rule_enabled", "/api/delete_rule"] {
1712 let answer = app.post(path, Some(&admin_cookie), &[("rule_id", &stranger), ("enabled", "false")]).await;1712 let answer = app.post(path, Some(&admin_cookie), &[("rule_id", &stranger), ("enabled", "false")]).await;