Files
Brummel 9e8db7518d Refactor document handling to JSON envelope
The `document.md` file has been replaced by `document.json`. This new
format acts as a JSON envelope, containing the original markdown content
along with metadata such as `covered_mtime`, `written_at`, and
`backend_id`.

This change addresses a bug where new recordings arriving during an LLM
analysis call could be ignored. The `covered_mtime` field in the new
JSON envelope ensures that the document's metadata accurately reflects
the state of recordings at the time of analysis, preventing incorrect
"analysis current" states.

Additionally, the `analysis_input.json` file is now removed upon
successful analysis, and a failure marker is used to indicate analysis
failures. This ensures that a case is re-analyzed if necessary.

The `analysis_idle_threshold_secs` configuration option has been
introduced to control the delay before a case in the `Required` state is
automatically promoted to `Idle` and enqueued for LLM analysis.
2026-05-05 14:01:43 +02:00

48 lines
1.8 KiB
Rust

//! Shared test-support helpers for `server/tests/*.rs`.
//!
//! Every integration test file under `tests/*.rs` is a standalone crate.
//! This module's special filename `mod.rs` prevents Cargo from
//! compiling it as its own test target — it is only loaded by test
//! files that opt in via `mod common;` at the top.
//!
//! `#[allow(dead_code)]` is applied because each test crate uses only
//! a subset of the helpers; without the allow, rustc emits a forest of
//! warnings for the unused ones in each crate.
#![allow(dead_code)]
// Re-exports below are visible to every test crate, but each crate only
// uses a subset — without the allow, rustc emits "unused import"
// warnings per crate. The helpers themselves are exercised; the
// warning is a false positive of the per-crate visibility model.
#![allow(unused_imports)]
pub mod artefacts;
pub mod config;
pub mod http;
pub mod paths;
pub mod seed;
pub mod session;
pub mod users;
// Re-exports for ergonomic `use common::*;` in most test files.
pub use artefacts::{
ANALYSIS_INPUT_FILE, CLOSE_MARKER, DOCUMENT_FILE, Document, ONELINER_FILENAME,
write_document_for_test,
};
pub use config::{TestConfig, unique_tmpdir};
pub use doctate_common::Transcript;
pub use http::{
body_bytes, body_json, body_string, csrf_form_post, form_post, get_with_api_key,
get_with_api_key_if_none_match, get_with_cookie, header_opt, header_str, multipart_upload_body,
};
pub use seed::{
past_rfc3339, seed_case, seed_oneliner_ready, seed_oneliner_state, seed_recording,
seed_recording_meta, seed_recording_with_age, seed_recording_with_sidecars,
write_closed_marker,
};
pub use session::{extract_session_cookie, login, login_request, login_with_csrf};
pub use users::{
TEST_BCRYPT_COST, TEST_PASSWORD, test_admin, test_user, test_user_with_password,
test_user_with_retention, test_user_with_window_hours,
};