Rust Elite Standards (Edition 2024, Safe & Robust)
0.52.x (ensure patch version compatibility).unwrap() and expect() in business logic.thiserror for library errors and anyhow for application-level errors.tokio for async runtime unless specified otherwise.walkthrough.md documenting test results.camelCase. Use #[serde(rename_all = "camelCase")] on structs.#[tauri::arg(rename = "camelCase")] or #[allow(non_snake_case)] to reconcile Rust's snake_case with Frontend's camelCase without breaking convention.tracing crate. Use #[tracing::instrument] on core logic.WorkerManager.stdin. If parent drops, worker must exit immediately to avoid "ghost processes".Semaphore. Cap based on CPU core count or memory availability.ExtractionProduct JSON protocol.stdin/stdout.camelCase.0.52.x for stability and API consistency.DataFrame::new(Vec<Column>) (not Vec<Series>)Series β Column via .into_column() or Column::from(series).into() for PlSmallStr compatibilitySeries::new((&col_name).into(), &values).unwrap() on DataFrame operations β use Result propagationLATENCY_BUDGET.md)0.45 instead of 0.52.x specified in skill#[tracing::instrument] on core functions0.52 β clean build with no breaking changesVec<Series> β Vec<Column> for DataFrame construction.into() for PlSmallStr column nameschrono for timestamp handlingCargo.toml to avoid API driftUnsafe Policy
unsafe blocks are forbidden by default.Refactor Discipline
unwrap() / expect() (including tests & examples).Result<T, E> and ?.Public API Contract
Result.Refactor Workflow
src/.JanitorReport is non-authoritative. It is an audit trail for the Dashboard, but MUST NEVER be used by the Truth layer to determine validity.EncodingGatekeeper for UTF-8 and Mojibake validation before reaching the Janitor.TableTruth) must remain pure. It only validates data. Any repair logic resides in the Adapter/Engine layer and results must be re-submitted for validation. "The Judge does not write the Law, and the Janitor does not argue with the Truth."TableTruth is the singular source of truth for structural validity.ProjectTruth is the derived authority for cross-source reconciliation.Rejected status by default.std::sync::OnceLock for global, thread-safe singletons (e.g., EncodingNormalizer). Avoid lazy_static unless complex macro execution is required.total_cost) MUST carry a LineageMap._lineage_ prefix for forensic metadata columns in Polars. These columns are for sideboat metadata only and MUST NOT participate in primary business logic (sort/filter/calc).GlobalId for any entity (cell, row, table) must be deterministic and hash-based: hash(v1_id, v2_id...). Never use random UUIDs for forensic data.TableCell), use #[serde(default)] to ensure compatibility with existing serialized mocks and project files.df.get_column_names(), convert to a Vec<String> first or handle PlSmallStr types carefully to avoid &str vs &&str type mismatches in .contains().ForensicState must act as the primary cache for derived truths (like ProjectTruth) to ensure consistency across independent IPC commands (Drill-down, Export)..emit() on an AppHandle in Tauri v2, you MUST import the trait: use tauri::Emitter;. The Manager trait is no longer sufficient for event emission.camelCase for serialized output.snake_case fields (e.g., cell_id) may arrive at Frontend as cellId or cell_id, leading to undefined errors.#[serde(rename = "your_field_name")] if the frontend expects a specific casing.#[serde(rename_all = "camelCase")] for the entire struct.payload?.cell_id?.split(...)) and verify field existence before operations.cargo check warnings (unused imports, dead fields) are unacceptable in Release Candidates._ (e.g., _ctx, _start_time).#[allow(...)] unless it is a temporary bridge.