Refactor: Simplify case directory structure

The distinction between `open/` and `done/` directories for cases has
been removed.
All cases for a user now reside directly under the user's directory
(e.g., `<data_path>/<slug>/<case_id>/`).

This simplifies path management and eliminates redundant directory
traversals.

Key changes include:
- Removed `open/` and `done/` subdirectories in path resolution.
- Introduced a `paths::case_dir` function as a single source of truth
  for case directory layout.
- Updated various modules (`recovery`, `auth`, `routes`, `transcribe`,
  `tests`) to use the new path structure.
- Adjusted templates to reflect the simplified case status
  representation.
This commit is contained in:
2026-04-15 22:15:13 +02:00
parent 70eed20909
commit 11eb645f3f
17 changed files with 190 additions and 324 deletions
+5 -5
View File
@@ -79,7 +79,7 @@ fn config_without_llm(data_path: PathBuf) -> Arc<Config> {
}
fn seed_case(data_path: &Path, slug: &str, case_id: &str) -> PathBuf {
let dir = data_path.join(slug).join("open").join(case_id);
let dir = data_path.join(slug).join(case_id);
std::fs::create_dir_all(&dir).unwrap();
dir
}
@@ -298,7 +298,7 @@ async fn close_case_skips_blank_transcript_from_recordings() {
#[tokio::test]
async fn analyze_worker_writes_document_via_wiremock() {
let tmp = unique_tmp("w");
let case_dir = tmp.join("dr_a/open/11111111-1111-1111-1111-111111111111");
let case_dir = tmp.join("dr_a/11111111-1111-1111-1111-111111111111");
std::fs::create_dir_all(&case_dir).unwrap();
let input = json!({
@@ -363,7 +363,7 @@ async fn analyze_worker_writes_document_via_wiremock() {
#[tokio::test]
async fn recovery_enqueues_pending_analysis() {
let tmp = unique_tmp("r1");
let case_dir = tmp.join("dr_a/open/11111111-1111-1111-1111-111111111111");
let case_dir = tmp.join("dr_a/11111111-1111-1111-1111-111111111111");
std::fs::create_dir_all(&case_dir).unwrap();
std::fs::write(case_dir.join("analysis_input_v1.json"), "{}").unwrap();
@@ -379,7 +379,7 @@ async fn recovery_enqueues_pending_analysis() {
#[tokio::test]
async fn recovery_skips_completed_analysis() {
let tmp = unique_tmp("r2");
let case_dir = tmp.join("dr_a/open/11111111-1111-1111-1111-111111111111");
let case_dir = tmp.join("dr_a/11111111-1111-1111-1111-111111111111");
std::fs::create_dir_all(&case_dir).unwrap();
std::fs::write(case_dir.join("analysis_input_v1.json"), "{}").unwrap();
std::fs::write(case_dir.join("document_v1.md"), "done").unwrap();
@@ -566,7 +566,7 @@ async fn reanalyze_second_time_returns_409() {
#[tokio::test]
async fn reanalyze_worker_writes_document_v2_via_wiremock() {
let tmp = unique_tmp("rn-w");
let case_dir = tmp.join("dr_a/open/11111111-1111-1111-1111-111111111111");
let case_dir = tmp.join("dr_a/11111111-1111-1111-1111-111111111111");
std::fs::create_dir_all(&case_dir).unwrap();
std::fs::write(case_dir.join("document_v1.md"), "alte Version").unwrap();