refactor(config): consumer들이 &Config 대신 타입 슬라이스 수령 (god-struct 결합 해소)
This commit is contained in:
@@ -33,7 +33,7 @@ fn b3_full_hex(bytes: &[u8]) -> String {
|
||||
#[test]
|
||||
fn copy_mode_writes_file_with_0o644_and_correct_bytes() {
|
||||
let env = common::TestEnv::with_threshold(100);
|
||||
let store = SqliteStore::open(&env.config()).unwrap();
|
||||
let store = SqliteStore::open(&env.config().storage).unwrap();
|
||||
store.run_migrations().unwrap();
|
||||
|
||||
let bytes = b"hello, sqlite";
|
||||
@@ -80,7 +80,7 @@ fn copy_mode_writes_file_with_0o644_and_correct_bytes() {
|
||||
fn reference_mode_does_not_write_file_but_records_path() {
|
||||
// copy_threshold_mb=0 → every byte lands on the reference branch.
|
||||
let env = common::TestEnv::with_threshold(0);
|
||||
let store = SqliteStore::open(&env.config()).unwrap();
|
||||
let store = SqliteStore::open(&env.config().storage).unwrap();
|
||||
store.run_migrations().unwrap();
|
||||
|
||||
let bytes = b"big-pretend-bytes";
|
||||
@@ -126,7 +126,7 @@ fn put_asset_with_bytes_sweeps_workspace_path_orphan() {
|
||||
// is exercised end-to-end in `kebab-app::tests::pdf_pipeline::
|
||||
// re_ingest_edited_pdf_produces_new_doc_id`.
|
||||
let env = common::TestEnv::with_threshold(100);
|
||||
let store = SqliteStore::open(&env.config()).unwrap();
|
||||
let store = SqliteStore::open(&env.config().storage).unwrap();
|
||||
store.run_migrations().unwrap();
|
||||
|
||||
// Pre-populate a row that owns `notes/foo.md` under a *different*
|
||||
@@ -200,7 +200,7 @@ fn put_asset_with_bytes_rejects_invalid_asset_id() {
|
||||
// 32-hex `FromStr` invariant. The store boundary must reject any ID
|
||||
// whose shape would let path construction escape `data_dir/assets/`.
|
||||
let env = common::TestEnv::with_threshold(100);
|
||||
let store = SqliteStore::open(&env.config()).unwrap();
|
||||
let store = SqliteStore::open(&env.config().storage).unwrap();
|
||||
store.run_migrations().unwrap();
|
||||
|
||||
// 32 chars but contains a `/` — would let `assets_path_for` stitch
|
||||
@@ -242,7 +242,7 @@ fn put_asset_with_bytes_rejects_invalid_asset_id() {
|
||||
#[test]
|
||||
fn checksum_mismatch_returns_conflict() {
|
||||
let env = common::TestEnv::new();
|
||||
let store = SqliteStore::open(&env.config()).unwrap();
|
||||
let store = SqliteStore::open(&env.config().storage).unwrap();
|
||||
store.run_migrations().unwrap();
|
||||
|
||||
let bytes = b"the real bytes";
|
||||
|
||||
@@ -30,7 +30,7 @@ fn fixtures_dir() -> PathBuf {
|
||||
#[test]
|
||||
fn document_and_chunks_round_trip_through_sqlite() {
|
||||
let env = common::TestEnv::new();
|
||||
let store = SqliteStore::open(&env.config()).unwrap();
|
||||
let store = SqliteStore::open(&env.config().storage).unwrap();
|
||||
store.run_migrations().unwrap();
|
||||
|
||||
// ── Build inputs from the fixture ───────────────────────────────
|
||||
|
||||
@@ -15,7 +15,7 @@ fn config_for(tmp: &TempDir) -> Config {
|
||||
|
||||
fn open_store(tmp: &TempDir) -> SqliteStore {
|
||||
let cfg = config_for(tmp);
|
||||
let store = SqliteStore::open(&cfg).unwrap();
|
||||
let store = SqliteStore::open(&cfg.storage).unwrap();
|
||||
store.run_migrations().unwrap();
|
||||
store
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ use time::OffsetDateTime;
|
||||
fn open_store(tmp: &TempDir) -> SqliteStore {
|
||||
let mut c = Config::defaults();
|
||||
c.storage.data_dir = tmp.path().to_string_lossy().into_owned();
|
||||
let store = SqliteStore::open(&c).unwrap();
|
||||
let store = SqliteStore::open(&c.storage).unwrap();
|
||||
store.run_migrations().unwrap();
|
||||
store
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ fn fts_v002_backfills_existing_chunks() {
|
||||
#[test]
|
||||
fn fts_v002_backfill_select_matches_chunks_count() {
|
||||
let env = common::TestEnv::new();
|
||||
let store = SqliteStore::open(&env.config()).unwrap();
|
||||
let store = SqliteStore::open(&env.config().storage).unwrap();
|
||||
store.run_migrations().unwrap();
|
||||
|
||||
let conn = raw_conn_no_fk(&env);
|
||||
@@ -158,7 +158,7 @@ fn fts_v002_backfill_select_matches_chunks_count() {
|
||||
#[test]
|
||||
fn fts_chunks_ai_trigger_propagates_insert() {
|
||||
let env = common::TestEnv::new();
|
||||
let store = SqliteStore::open(&env.config()).unwrap();
|
||||
let store = SqliteStore::open(&env.config().storage).unwrap();
|
||||
store.run_migrations().unwrap();
|
||||
|
||||
let conn = raw_conn_no_fk(&env);
|
||||
@@ -185,7 +185,7 @@ fn fts_chunks_ai_trigger_propagates_insert() {
|
||||
#[test]
|
||||
fn fts_chunks_ad_trigger_propagates_delete() {
|
||||
let env = common::TestEnv::new();
|
||||
let store = SqliteStore::open(&env.config()).unwrap();
|
||||
let store = SqliteStore::open(&env.config().storage).unwrap();
|
||||
store.run_migrations().unwrap();
|
||||
|
||||
let conn = raw_conn_no_fk(&env);
|
||||
@@ -205,7 +205,7 @@ fn fts_chunks_ad_trigger_propagates_delete() {
|
||||
#[test]
|
||||
fn fts_chunks_au_trigger_propagates_update() {
|
||||
let env = common::TestEnv::new();
|
||||
let store = SqliteStore::open(&env.config()).unwrap();
|
||||
let store = SqliteStore::open(&env.config().storage).unwrap();
|
||||
store.run_migrations().unwrap();
|
||||
|
||||
let conn = raw_conn_no_fk(&env);
|
||||
@@ -246,7 +246,7 @@ fn count_match(conn: &Connection, term: &str) -> i64 {
|
||||
#[test]
|
||||
fn fts_rebuild_chunks_fts_is_idempotent() {
|
||||
let env = common::TestEnv::new();
|
||||
let store = SqliteStore::open(&env.config()).unwrap();
|
||||
let store = SqliteStore::open(&env.config().storage).unwrap();
|
||||
store.run_migrations().unwrap();
|
||||
|
||||
let conn = raw_conn_no_fk(&env);
|
||||
@@ -274,7 +274,7 @@ fn fts_rebuild_chunks_fts_is_idempotent() {
|
||||
#[test]
|
||||
fn fts_rebuild_chunks_fts_recovers_from_drift() {
|
||||
let env = common::TestEnv::new();
|
||||
let store = SqliteStore::open(&env.config()).unwrap();
|
||||
let store = SqliteStore::open(&env.config().storage).unwrap();
|
||||
store.run_migrations().unwrap();
|
||||
|
||||
let conn = raw_conn_no_fk(&env);
|
||||
@@ -297,7 +297,7 @@ fn fts_rebuild_chunks_fts_recovers_from_drift() {
|
||||
#[test]
|
||||
fn fts_double_run_migrations_is_noop() {
|
||||
let env = common::TestEnv::new();
|
||||
let store = SqliteStore::open(&env.config()).unwrap();
|
||||
let store = SqliteStore::open(&env.config().storage).unwrap();
|
||||
store.run_migrations().expect("run 1");
|
||||
// Second invocation must be a no-op (refinery's bookkeeping table
|
||||
// tracks applied versions). The chunks_fts virtual table is still
|
||||
@@ -444,7 +444,7 @@ fn fts_v009_matches_design_section_5_5_verbatim() {
|
||||
#[test]
|
||||
fn v009_bumps_corpus_revision() {
|
||||
let env = common::TestEnv::new();
|
||||
let store = SqliteStore::open(&env.config()).unwrap();
|
||||
let store = SqliteStore::open(&env.config().storage).unwrap();
|
||||
store.run_migrations().unwrap();
|
||||
let rev = store.corpus_revision();
|
||||
assert!(
|
||||
@@ -459,7 +459,7 @@ fn v009_bumps_corpus_revision() {
|
||||
#[test]
|
||||
fn backfill_tokenized_korean_text_populates_nullable_rows() {
|
||||
let env = common::TestEnv::new();
|
||||
let store = SqliteStore::open(&env.config()).unwrap();
|
||||
let store = SqliteStore::open(&env.config().storage).unwrap();
|
||||
store.run_migrations().unwrap();
|
||||
|
||||
// chunks 에 한국어 row 두 개 INSERT (tokenized_korean_text 는 chunks_ai trigger
|
||||
@@ -527,7 +527,7 @@ fn fts_store_drop_releases_wal_files() {
|
||||
let env = common::TestEnv::new();
|
||||
let db_path = env.db_path();
|
||||
{
|
||||
let store = SqliteStore::open(&env.config()).unwrap();
|
||||
let store = SqliteStore::open(&env.config().storage).unwrap();
|
||||
store.run_migrations().unwrap();
|
||||
// Force at least one trigger fire so WAL has content to flush.
|
||||
let conn = raw_conn_no_fk(&env);
|
||||
@@ -575,7 +575,7 @@ fn fts_store_drop_releases_wal_files() {
|
||||
#[test]
|
||||
fn fts_v009_unicode61_space_separated_korean_token_hits() {
|
||||
let env = common::TestEnv::new();
|
||||
let store = SqliteStore::open(&env.config()).unwrap();
|
||||
let store = SqliteStore::open(&env.config().storage).unwrap();
|
||||
store.run_migrations().unwrap();
|
||||
|
||||
let conn = raw_conn_no_fk(&env);
|
||||
@@ -605,7 +605,7 @@ fn fts_v009_unicode61_space_separated_korean_token_hits() {
|
||||
#[test]
|
||||
fn fts_v009_korean_morphological_2char_query_hits() {
|
||||
let env = common::TestEnv::new();
|
||||
let store = SqliteStore::open(&env.config()).unwrap();
|
||||
let store = SqliteStore::open(&env.config().storage).unwrap();
|
||||
store.run_migrations().unwrap();
|
||||
|
||||
let conn = raw_conn_no_fk(&env);
|
||||
@@ -633,7 +633,7 @@ fn fts_v009_korean_morphological_2char_query_hits() {
|
||||
#[test]
|
||||
fn fts_v009_english_whole_token_only() {
|
||||
let env = common::TestEnv::new();
|
||||
let store = SqliteStore::open(&env.config()).unwrap();
|
||||
let store = SqliteStore::open(&env.config().storage).unwrap();
|
||||
store.run_migrations().unwrap();
|
||||
|
||||
let conn = raw_conn_no_fk(&env);
|
||||
|
||||
@@ -105,7 +105,7 @@ fn make_chunks(doc_id: &DocumentId) -> Vec<Chunk> {
|
||||
#[test]
|
||||
fn put_document_idempotent_bumps_doc_version() {
|
||||
let env = common::TestEnv::new();
|
||||
let store = SqliteStore::open(&env.config()).unwrap();
|
||||
let store = SqliteStore::open(&env.config().storage).unwrap();
|
||||
store.run_migrations().unwrap();
|
||||
|
||||
let asset = make_asset();
|
||||
@@ -149,7 +149,7 @@ fn put_document_idempotent_bumps_doc_version() {
|
||||
#[test]
|
||||
fn put_blocks_and_put_chunks_replace_not_duplicate() {
|
||||
let env = common::TestEnv::new();
|
||||
let store = SqliteStore::open(&env.config()).unwrap();
|
||||
let store = SqliteStore::open(&env.config().storage).unwrap();
|
||||
store.run_migrations().unwrap();
|
||||
|
||||
let asset = make_asset();
|
||||
@@ -209,7 +209,7 @@ fn put_blocks_and_put_chunks_replace_not_duplicate() {
|
||||
#[test]
|
||||
fn put_blocks_transactional_rollback_on_fk_violation() {
|
||||
let env = common::TestEnv::new();
|
||||
let store = SqliteStore::open(&env.config()).unwrap();
|
||||
let store = SqliteStore::open(&env.config().storage).unwrap();
|
||||
store.run_migrations().unwrap();
|
||||
|
||||
let asset = make_asset();
|
||||
|
||||
@@ -77,7 +77,7 @@ fn make_doc() -> CanonicalDocument {
|
||||
#[test]
|
||||
fn put_then_get_document_roundtrips_version_stamps() {
|
||||
let env = common::TestEnv::new();
|
||||
let store = SqliteStore::open(&env.config()).unwrap();
|
||||
let store = SqliteStore::open(&env.config().storage).unwrap();
|
||||
store.run_migrations().unwrap();
|
||||
|
||||
let asset = make_asset();
|
||||
@@ -100,7 +100,7 @@ fn put_then_get_document_roundtrips_version_stamps() {
|
||||
#[test]
|
||||
fn put_then_get_document_roundtrips_none_stamps() {
|
||||
let env = common::TestEnv::new();
|
||||
let store = SqliteStore::open(&env.config()).unwrap();
|
||||
let store = SqliteStore::open(&env.config().storage).unwrap();
|
||||
store.run_migrations().unwrap();
|
||||
|
||||
let asset = make_asset();
|
||||
@@ -126,7 +126,7 @@ fn put_then_get_document_roundtrips_none_stamps() {
|
||||
#[test]
|
||||
fn get_asset_by_workspace_path_roundtrips() {
|
||||
let env = common::TestEnv::new();
|
||||
let store = SqliteStore::open(&env.config()).unwrap();
|
||||
let store = SqliteStore::open(&env.config().storage).unwrap();
|
||||
store.run_migrations().unwrap();
|
||||
|
||||
let asset = make_asset();
|
||||
@@ -145,7 +145,7 @@ fn get_asset_by_workspace_path_roundtrips() {
|
||||
#[test]
|
||||
fn get_asset_by_workspace_path_returns_none_for_unknown() {
|
||||
let env = common::TestEnv::new();
|
||||
let store = SqliteStore::open(&env.config()).unwrap();
|
||||
let store = SqliteStore::open(&env.config().storage).unwrap();
|
||||
store.run_migrations().unwrap();
|
||||
|
||||
let path = WorkspacePath::new("notes/missing.md".into()).unwrap();
|
||||
|
||||
@@ -9,7 +9,7 @@ mod common;
|
||||
#[test]
|
||||
fn create_then_progress_then_finish() {
|
||||
let env = common::TestEnv::new();
|
||||
let store = SqliteStore::open(&env.config()).unwrap();
|
||||
let store = SqliteStore::open(&env.config().storage).unwrap();
|
||||
store.run_migrations().unwrap();
|
||||
|
||||
let id = store
|
||||
@@ -39,7 +39,7 @@ fn create_then_progress_then_finish() {
|
||||
#[test]
|
||||
fn finish_with_error_message_is_round_trippable() {
|
||||
let env = common::TestEnv::new();
|
||||
let store = SqliteStore::open(&env.config()).unwrap();
|
||||
let store = SqliteStore::open(&env.config().storage).unwrap();
|
||||
store.run_migrations().unwrap();
|
||||
|
||||
let id = store.create(JobKind::Embed, json!({})).unwrap();
|
||||
@@ -59,7 +59,7 @@ fn finish_with_error_message_is_round_trippable() {
|
||||
#[test]
|
||||
fn list_filters_status_and_kind() {
|
||||
let env = common::TestEnv::new();
|
||||
let store = SqliteStore::open(&env.config()).unwrap();
|
||||
let store = SqliteStore::open(&env.config().storage).unwrap();
|
||||
store.run_migrations().unwrap();
|
||||
|
||||
// Two ingest jobs (one finished succeeded, one pending) + one embed.
|
||||
|
||||
@@ -81,7 +81,7 @@ fn make_doc(
|
||||
#[test]
|
||||
fn list_documents_filters_lang_and_tags() {
|
||||
let env = common::TestEnv::new();
|
||||
let store = SqliteStore::open(&env.config()).unwrap();
|
||||
let store = SqliteStore::open(&env.config().storage).unwrap();
|
||||
store.run_migrations().unwrap();
|
||||
|
||||
for (asset, doc) in [
|
||||
|
||||
@@ -8,7 +8,7 @@ mod common;
|
||||
#[test]
|
||||
fn fresh_db_has_all_p1_tables_and_indexes() {
|
||||
let env = common::TestEnv::new();
|
||||
let store = SqliteStore::open(&env.config()).expect("open");
|
||||
let store = SqliteStore::open(&env.config().storage).expect("open");
|
||||
store.run_migrations().expect("run migrations");
|
||||
|
||||
// Pull the list of user tables from sqlite_master.
|
||||
|
||||
@@ -8,7 +8,7 @@ use rusqlite::OptionalExtension;
|
||||
|
||||
fn open_migrated() -> (common::TestEnv, SqliteStore) {
|
||||
let env = common::TestEnv::new();
|
||||
let store = SqliteStore::open(&env.config()).expect("open");
|
||||
let store = SqliteStore::open(&env.config().storage).expect("open");
|
||||
store.run_migrations().expect("run migrations");
|
||||
(env, store)
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ fn config_for(tmp: &TempDir) -> Config {
|
||||
|
||||
fn open_store(tmp: &TempDir) -> SqliteStore {
|
||||
let cfg = config_for(tmp);
|
||||
let store = SqliteStore::open(&cfg).unwrap();
|
||||
let store = SqliteStore::open(&cfg.storage).unwrap();
|
||||
store.run_migrations().unwrap();
|
||||
store
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user