sparkengine-persistence-save-and-migrations

Diagnose and modify SparkEngine save files, async database transactions, and JSON store durability.

31|3|Updated Jul 26, 2025
One-click install
npx skills add https://github.com/Krilliac/SparkEngine --skill sparkengine-persistence-save-and-migrations-krilliac
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sparkengine-persistence-save-and-migrations
Source: https://github.com/Krilliac/SparkEngine/tree/main/.claude/skills/sparkengine-persistence-save-and-migrations
Command: npx skills add https://github.com/Krilliac/SparkEngine --skill sparkengine-persistence-save-and-migrations-krilliac

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Game state persistence bugs in SparkEngine — corrupt save files, failed loads, torn database flushes, and unsafe format migrations — are hard to diagnose without knowing which of the four persistence layers is involved and what durability guarantees each one actually provides. ## Core Features & Use Cases - Save format reference: Documents the .spark_save binary layout (SPRK magic, version 3, reader window 1..3), parser budgets, slot retention, and atomic write semantics. - Durability status matrix: Tracks which persistence claims are implemented, tested, CI-enforced, or still open (e.g., AsyncDatabase torn flush, missing N-1 migration fixtures under SAVE-230/DATA-120). - Failure-mode triage: Maps symptoms like failed loads, stuck futures, and quarantined .corrupt-*.bak files to likely causes and first diagnostic moves. - Use Case: A player reports their save won't load after an update. Use this Skill to check the version gate, identify whether the file hit a parser budget or truncation rejection, and determine whether a migration step is missing. ## Quick Start Ask the AI to diagnose why a SparkEngine save file fails to load or to review the durability of a new persistence store before committing it.

Frequently Asked Questions about sparkengine-persistence-save-and-migrations

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix a SparkEngine save file that won't load?

Check the load failure log, which names the exact reason and offset: version gate rejection, bad SPRK magic, truncation, or trailing bytes. Compare the file version against kCurrentSaveVersion (3) and the reader window starting at version 1.

How do I bump the save format version in SparkEngine?

Increment kCurrentSaveVersion in SaveSystemTypes.h, decide whether kOldestSupportedSaveVersion moves, and add an in-memory migration step to the load loop. Adding component fields needs no bump since property maps degrade to defaults.

Is the SparkEngine AsyncDatabase crash-safe?

No. FlushToDisk truncates the live KV file in place, so a crash mid-flush causes silent partial data loss. Clean close/reopen durability is tested, but crash durability remains an open issue pending a tmp-plus-rename fix.

Why was my TERRAFRONT JSON file renamed to .corrupt-.bak?

The strict parser rejected the file as corrupt or truncated, so the store quarantined it instead of wiping it with an empty database. Inspect the .corrupt-*.bak file and restore manually if salvageable; this behavior is intentional.

Does SparkEngine support N-1 save migration and rollback?

Not yet. No SaveMigration or BackupRestore test fixtures exist, and readiness items SAVE-230 and DATA-120 remain open and release-blocking. Only TF quarantine renames and atomic-write failure safety currently exist.