Files

39 lines
3.5 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Task G1 — Versioned Save/Load and ASCII Migration
## Scope
Implemented G1 persistence without changing unrelated gameplay behavior:
- Added a versioned JSON `SaveRepository` under `user://saves` with exactly five one-based named slots (`slot1.json` through `slot5.json`), atomic temporary-file replacement, slot metadata, and explicit empty/invalid-slot failures.
- Round-tripped authoritative `RunState` and runtime `GameState`: visited floors/maps, chests/ground items, inventory/equipment/identification, deadlines, quests, journal events, player/companion/party, dialogue player, and achievement/audience/recap/faction/moderation state.
- Added schema migration. Current Godot saves require schema 1; representative ASCII saves are recognized by `levels`, converted to schema 1, and return a deterministic `migration_report` containing every unsupported top-level key rather than silently dropping it.
- Added the five-slot save/load panel, load-slot/continue menu behavior, and loaded-run initialization that rebuilds presentation/domain services around deserialized state.
- Added the process-restart E2E seam: save a live menu-created run, remove the live Game node, instantiate/load again, and compare restored player/floor/meta state.
- Added a representative ASCII fixture and integration contract proving supported fields migrate and both unsupported fixture keys are reported.
## Root-cause fixes found during final verification
The initial full verification exposed two incomplete wiring/serialization paths:
1. `MainMenu` referenced `_show_unavailable` after that helper had been removed, causing a parse error. The new `SaveLoadPanel` was also not instanced in `MainMenu.tscn`, so the menu’s `@onready` reference was null after the parse error was fixed. Restoring the helper and wiring the packed panel into the scene fixes the actual menu construction path; this also preserves the existing display-layout contract.
2. The restart E2E initially failed because JSON serializes dialogue-player `cell` as an array, while `PlayerState` requires `Vector2i`. Repository deserialization now converts that boundary field before constructing `PlayerState`. Save-panel button callbacks also now bind their fixed slot index rather than reading metadata before `present()` assigns it.
No compatibility workaround was added: serialized JSON stays portable, and the typed conversion occurs at the repository/domain boundary.
## Verification and capture
Final `./scripts/verify.sh` completed successfully with Godot 4.5.0:
- Unit: **181 / 181** tests passed, **1,371** assertions.
- Integration: **11 / 11** tests passed, **59,470** assertions.
- E2E: **55 / 55** tests passed, **545** assertions, including the save → restart seam → load contract.
- Visual capture: passed.
- `artifacts/visual-check.png`: `dungeon_non_black_pixels=489308`, `visible_pixels=17524`, `explored_pixels=10438`, `explored_luminance=0.012`, `unknown_pixels=365325`, `unknown_luminance=0.001`.
- `artifacts/visual-check-exit.png`: `dungeon_non_black_pixels=489252`, `visible_pixels=17404`, `explored_pixels=17146`, `explored_luminance=0.012`, `unknown_pixels=439497`, `unknown_luminance=0.001`.
The runners reported existing GUT invalid-UID and cleanup/resource warnings only. There were no application parse errors, script errors, failing tests, or visual-capture failures.
## Git
All G1 sources, scenes, tests, fixture, UIDs, and this root report are committed locally in one commit. No push and no pull request were created.