Use ULID instead of UUID for run IDs

ULIDs are lexicographically sortable by creation time, making log
directories and run lists naturally ordered without extra metadata.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Bryan Helmkamp 2026-02-28 14:16:52 -05:00
parent 53ae30dfd4
commit 4572012bc3
4 changed files with 5 additions and 3 deletions

View file

@ -14,6 +14,7 @@ serde = { version = "1", features = ["derive"] }
serde_json = "1"
tokio = { version = "1", features = ["full"] }
reqwest = { version = "0.12", default-features = false, features = ["json", "stream", "rustls-tls"] }
ulid = "1"
uuid = { version = "1", features = ["v4"] }
rand = "0.8"
dotenvy = "0.15"

View file

@ -32,6 +32,7 @@ thiserror.workspace = true
serde.workspace = true
serde_json.workspace = true
tokio.workspace = true
ulid.workspace = true
uuid.workspace = true
rand.workspace = true
async-trait.workspace = true

View file

@ -480,7 +480,7 @@ pub async fn run_command(args: RunArgs, styles: &'static Styles) -> anyhow::Resu
let engine = PipelineEngine::with_interviewer(registry, Arc::clone(&emitter), interviewer, Arc::clone(&execution_env));
// 7. Execute
let run_id = worktree_run_id.unwrap_or_else(|| uuid::Uuid::new_v4().to_string());
let run_id = worktree_run_id.unwrap_or_else(|| ulid::Ulid::new().to_string());
let config = RunConfig {
logs_root: logs_dir.clone(),
cancel_token: None,
@ -602,7 +602,7 @@ fn setup_worktree(
) -> anyhow::Result<(String, PathBuf, PathBuf, String, String)> {
let base_sha = crate::git::head_sha(original_cwd)
.map_err(|e| anyhow::anyhow!("{e}"))?;
let run_id = uuid::Uuid::new_v4().to_string();
let run_id = ulid::Ulid::new().to_string();
let branch_name = format!("arc/run/{run_id}");
crate::git::create_branch(original_cwd, &branch_name)
.map_err(|e| anyhow::anyhow!("{e}"))?;

View file

@ -170,7 +170,7 @@ async fn start_pipeline(
}
};
let run_id = uuid::Uuid::new_v4().to_string();
let run_id = ulid::Ulid::new().to_string();
let interviewer = Arc::new(WebInterviewer::new());
let (event_tx, _) = broadcast::channel(256);
let (cancel_tx, cancel_rx) = tokio::sync::oneshot::channel::<()>();