Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions crates/codestory-bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ path = "src/bin/codestory_proof_availability.rs"
name = "codestory-witness-seam"
path = "src/bin/codestory_witness_seam.rs"

[[bin]]
name = "codestory-etr1"
path = "src/bin/codestory_etr1.rs"

[dev-dependencies]
codestory-retrieval = { workspace = true, features = ["benchmark-support"] }
criterion = { workspace = true }
Expand Down
109 changes: 109 additions & 0 deletions crates/codestory-bench/src/bin/codestory_etr1.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
//! Benchmark-only implementation of the frozen ETR-1 frontier experiment.

use anyhow::{Result, ensure};
use clap::{Parser, Subcommand};
use std::path::PathBuf;

#[path = "codestory_proof_availability/build_provenance.rs"]
mod build_provenance;
#[path = "codestory_etr1/contract.rs"]
mod contract;
#[path = "codestory_etr1/control.rs"]
mod control;
#[path = "codestory_etr1/prepare.rs"]
mod prepare;
#[path = "codestory_etr1/run.rs"]
mod run;

#[derive(Parser)]
#[command(about = "Run the frozen benchmark-only ETR-1 frontier experiment")]
struct Args {
#[command(subcommand)]
command: Command,
}

#[derive(Subcommand)]
enum Command {
/// Prepare the fixed synthetic canary, never a corpus experiment.
PrepareCanary {
#[arg(long)]
project_root: PathBuf,
#[arg(long)]
output_dir: PathBuf,
},
/// Authenticate the frozen corpus, rebuild BM25 memberships, and emit exact
/// fragment documents for the existing embedding diagnostic.
Prepare {
#[arg(long)]
evidence_root: PathBuf,
#[arg(long)]
corpus_root: PathBuf,
#[arg(long)]
output_dir: PathBuf,
},
/// Build paired unconditioned and source-conditioned frontiers from a
/// previously authenticated preparation and exact fragment vectors.
Run {
#[arg(long)]
document_execution: PathBuf,
#[arg(long)]
document_execution_sha256: String,
#[arg(long)]
cancel_file: PathBuf,
#[arg(long)]
prepared: PathBuf,
#[arg(long)]
prepared_sha256: String,
#[arg(long)]
fragment_vectors: PathBuf,
#[arg(long)]
fragment_vectors_sha256: String,
#[arg(long)]
state_root: PathBuf,
#[arg(long)]
output_dir: PathBuf,
},
}

fn main() -> Result<()> {
if std::env::args().nth(1).as_deref() == Some("internal-embedding-server") {
ensure!(
build_provenance::SOURCE_DIRTY.trim() == "false",
"dirty_etr1_binary"
);
return codestory_cli::run_native_embedding_server();
}
let args = Args::parse();
match args.command {
Command::PrepareCanary {
project_root,
output_dir,
} => prepare::execute_canary(&project_root, &output_dir),
Command::Prepare {
evidence_root,
corpus_root,
output_dir,
} => prepare::execute(&evidence_root, &corpus_root, &output_dir),
Command::Run {
document_execution,
document_execution_sha256,
cancel_file,
prepared,
prepared_sha256,
fragment_vectors,
fragment_vectors_sha256,
state_root,
output_dir,
} => run::execute(
&prepared,
&prepared_sha256,
&fragment_vectors,
&fragment_vectors_sha256,
&state_root,
&output_dir,
&cancel_file,
&document_execution,
&document_execution_sha256,
),
}
}
Loading
Loading