Skip to content

Commit cc8ee8d

Browse files
authored
Merge pull request #8 from mdgoldberg/feature/database
feat: add SQLite database persistence for game recording
2 parents fa974f3 + 1c4cb7e commit cc8ee8d

40 files changed

Lines changed: 5980 additions & 255 deletions

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
/target
1+
target/
2+
config.yaml
3+
sqlite*
4+
.sqlx/

AGENTS.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,19 @@ Rust workspace implementing a card game simulation (President/Asshole variant) w
1010
## STRUCTURE
1111
```
1212
roosevelt/
13-
├── Cargo.toml # Workspace with 3 crates
13+
├── Cargo.toml # Workspace with 4 crates
1414
├── Cargo.lock
1515
├── rust-toolchain.toml # Stable + rust-analyzer
1616
├── rustfmt.toml # Import grouping rules
17-
├── notes.txt # Project todo
17+
├── database/ # Database persistence layer
18+
│ ├── src/
19+
│ │ ├── collectors/ # GameEventCollector, GameMetadata
20+
│ │ ├── writers/ # BulkGameWriter, StreamingGameWriter
21+
│ │ ├── config.rs # DatabaseConfig with writer type selection
22+
│ │ ├── error.rs # DatabaseError types
23+
│ │ ├── models.rs # ActionRecord, GameResultRecord
24+
│ │ └── lib.rs
25+
│ └── Cargo.toml
1826
├── types/ # Core data structures
1927
│ ├── src/
2028
│ │ ├── action.rs
@@ -47,13 +55,16 @@ roosevelt/
4755
| CLI entry point | `simulation/src/bin/run_simulation.rs` | YAML config loading, infinite loop |
4856
| Card ordering | `types/src/card.rs` | Two is highest rank |
4957
| Player data | `types/src/player.rs`, `player_state.rs` | Roles, hands, public/private state |
58+
| Database writers | `database/src/writers/` | BulkGameWriter, StreamingGameWriter |
59+
| Game recording | `database/src/collectors/` | GameEventCollector, GameMetadata |
60+
| Database config | `database/src/config.rs` | Writer type selection |
5061

5162
## CONVENTIONS
5263
- **Workspace**: Centralized dependency management in root `Cargo.toml`
5364
- **Strategy pattern**: Dynamic dispatch via `Box<dyn Strategy>`
5465
- **Logging**: Use `log::` facade, initialize with `env_logger::init()`
5566
- **Formatting**: `imports_granularity = "Crate"`, `group_imports = "StdExternalCrate"`
56-
- **No tests**: Zero test infrastructure exists
67+
- **Testing**: Unit and integration tests exist for database, simulation, and types crates
5768
- **CI/CD**: `.github/workflows/ci.yml` enforces fmt, clippy, build, test
5869

5970
## ANTI-PATTERNS (THIS PROJECT)

0 commit comments

Comments
 (0)