diff --git a/graph/decisions/sba-scout-rust-rewrite-phase-1-complete-foundation-layer-imp-c9add1.md b/graph/decisions/sba-scout-rust-rewrite-phase-1-complete-foundation-layer-imp-c9add1.md new file mode 100644 index 00000000000..c11666a99e1 --- /dev/null +++ b/graph/decisions/sba-scout-rust-rewrite-phase-1-complete-foundation-layer-imp-c9add1.md @@ -0,0 +1,35 @@ +--- +id: c9add129-283a-445a-8dff-4525ec7fa9b6 +type: decision +title: "SBA Scout Rust rewrite Phase 1 complete — foundation layer implemented" +tags: [sba-scout, rust, migration, phase-1, sqlx, sqlite, figment, decision] +importance: 0.8 +confidence: 0.8 +created: "2026-02-27T01:18:18.061642+00:00" +updated: "2026-02-27T01:18:18.061642+00:00" +--- + +# SBA Scout Rust Rewrite — Phase 1 Foundation Complete + +## Status +Phase 1 (Foundation) committed as `2005307` on branch `feat/rust-rewrite`. + +## What Was Implemented + +- **Schema creation** (`schema.rs`): raw `sqlx` queries creating all 9 tables with proper constraints. Reviewer caught a missing `UNIQUE` constraint on `lineups.name` — fixed before commit. +- **Query functions** (`queries.rs`): 20 async query functions covering teams, players, cards, lineups, sync status, matchup cache, and roster aggregates. +- **Config integration** (`main.rs` / `app.rs`): `figment` crate used to load TOML config. +- **Added crates**: `csv`, `sha2`, `regex` for later phases. + +## Key Architectural Decisions + +| Decision | Rationale | +|---|---| +| No ORM — sqlx pool directly | Avoid session pattern complexity; sqlx macros give compile-time query checking | +| Separate queries for player + cards (not JOINs) | Simpler, more composable; avoids N+1 differently | +| `ON CONFLICT` for upserts | SQLite idiomatic upsert pattern | +| TOML config (not YAML) | Python side uses YAML but Rust ecosystem prefers TOML; figment handles both | + +## Repository +- Repo: `sba-scouting`, branch `feat/rust-rewrite`, subdir `rust/` +- Language: Rust, async runtime: Tokio, DB: sqlx + SQLite