fix(cli): make dungeon writes transactional - #124
Conversation
Review: fix(cli): make dungeon writes transactionalOverviewThis PR closes a real gap: the four dungeon-edit CLI commands (
This directly follows the "ROM writes as atomic disk operations" and Correctness
Style / conventions
Test coverageSolid additions:
SecurityNo new attack surface — filenames come from already-trusted CLI/ROM state, and all filesystem operations use SummaryWell-scoped fix with good test discipline for a real correctness bug (memory/disk divergence on partial failure). Main suggestions: reuse the fsync helpers in |
|
Addressed the durability/documentation points in |
Review: fix(cli): make dungeon writes transactionalSolid change — the Correctness
Potential issue — legacy
|
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
Summary
Rom::SaveSettings::require_backupmode while preserving legacy best-effortbackup=trueScopedRomTransactionMoveFileExW(..., MOVEFILE_REPLACE_EXISTING)so a failed replacement does not first delete the targetRoot cause
The dungeon edit handlers mutated their reusable in-memory
Rombefore calling the atomic disk save. A disk failure preserved the target file but left the caller's bytes and pointers mutated. Separately,backup=truelogged and continued when backup creation failed, even for safety-critical writes.Commands covered
dungeon-place-spritedungeon-remove-spritedungeon-place-objectdungeon-set-collision-tileOther CLI callers that use only
backup=trueintentionally remain best-effort pending their own transaction audit.Verification
cmake --build --preset mac-ai --target yaze_test_unit --parallel 8YAZE_PREPUSH_BUILD_DIR=build/presets/mac-ai scripts/pre-push.shTest note: the broader local filter also selected the pre-existing environment-sensitive
RomTest.LoadFromFile; it found the available 1 MiB local vanilla fixture while that test expects 2 MiB. The task-focused filter excludes only that unrelated fixture check.Fixes #123