Snapshot Batch Writer
Writes a list of SimulationSnapshot objects produced by InMemorySnapshotCollector into a KSLDatabase in a single sequential pass.
The snapshots arrive with placeholder FK values (exp_id = -1, run_id = -1) set by SimulationLifeCycleBridge. This writer inserts the experiment and simulation-run records first, reads back the auto-increment IDs generated by the database, then fixes all downstream FK fields before inserting the remaining records.
Expected snapshot order (produced by a clean run):
Exactly one SimulationSnapshot.ExperimentStarted
One SimulationSnapshot.ReplicationCompleted per replication
Exactly one SimulationSnapshot.ExperimentCompleted or SimulationSnapshot.ExperimentFailed
Snapshots are mutated in-place during FK remapping; the caller should not reuse the list.
Functions
Writes snapshots to db.