fix: enforce storage and tooling invariants

This commit is contained in:
Rijad Zuzo
2026-07-30 13:00:59 +02:00
parent e3aa3440a2
commit e284d3774d
9 changed files with 283 additions and 30 deletions
+10 -1
View File
@@ -78,7 +78,16 @@ NPCStateRecord v3 adds carried inventory. SimulationStateRecord v2 adds
StorageStateRecord entries; world-schema v1 migrates legacy village food and
wood into the stable `village_pantry` and `village_woodpile` records. Parsed
storage values are canonicalized so save/restore continuation retains
byte-stable checksums.
byte-stable checksums. Current parsing rejects empty item IDs, negative or
non-finite amounts, negative or non-finite capacity, and contents above
capacity. Runtime deposit and withdrawal requests also reject empty item IDs
and non-finite amounts without mutating authoritative stock. When the authored
pantry or woodpile is present, current world parsing also requires its
authoritative food or wood amount to match the duplicated village summary;
contradictory saves are rejected instead of silently changing checksum during
restore. World-v1 migration expands a storage's inferred capacity when needed
so valid legacy stock above the current default is preserved rather than
discarded.
SimulationStateRecord v3 adds ordered `EconomicEventRecord` entries and
`next_event_id`. World schemas v1 and v2 migrate explicitly to an empty event
+13 -6
View File
@@ -14,7 +14,8 @@ parser errors, and LLM-generated garbage before committing.
```
On Windows, use `.venv/Scripts/python.exe` for the `--python` value.
- **Godot 4** binary on `PATH`, or set the `GODOT_BIN` environment variable
- **Godot 4.7.x** binary on `PATH`, or set the `GODOT_BIN` environment
variable. The gate rejects other engine series before importing or testing.
- **GUT 9.7.1** is vendored under `addons/gut` for Godot 4.7. No separate
package-manager install is needed.
@@ -24,7 +25,8 @@ The downloaded release archive SHA-256 is
`14969aa46adc84aa08cdd21b9f6d1a64addd92ae60b36f02d0521ed305aa4086`.
The quality and format scripts discover `.venv` automatically; activating it
is optional.
is optional. Missing `gdformat` or `gdlint` is a gate failure rather than a
silent skip.
## Usage
@@ -71,6 +73,7 @@ If everything passes:
```
QUALITY RESULT: PASS
Godot: 4.7.stable.official.5b4e0cb0f
godot-import PASS
gdformat PASS
@@ -87,6 +90,7 @@ On failure, only relevant errors and fix suggestions are shown:
```
QUALITY RESULT: FAIL
Godot: 4.7.stable.official.5b4e0cb0f
godot-import PASS
gdformat FAIL
@@ -113,18 +117,20 @@ to the terminal.
| Variable | Description |
|---|---|
| `GODOT_BIN` | Path to the Godot executable (auto-detected from PATH if unset) |
| `GODOT_BIN` | Path to the Godot 4.7.x executable (auto-detected if unset) |
## CI setup
To add this to CI, install the dependencies and run:
To add this to CI, provide a Godot 4.7.x executable, install the dependencies,
and run:
```bash
python -m pip install -r requirements-dev.txt
./tools/quality.sh
```
The script exits non-zero on any failure, so it will fail the CI step.
The script exits non-zero on any failure, including a wrong Godot series or
missing pinned formatter/linter, so it will fail the CI step.
The shell gate isolates Godot's cross-platform user-data paths under
`logs/quality/godot_profile`. Before running scenarios it imports project and
@@ -134,4 +140,5 @@ parse or load markers are failures because headless Godot can report those
errors while returning a zero process exit code. Every Godot subprocess has a
portable watchdog on stock macOS as well as Linux/Windows, and nonzero
`gdformat`/`gdlint` exits fail the gate even when their output is not a familiar
diagnostic string.
diagnostic string. Import receives a 60-second timeout on both shell and
PowerShell; the focused checks retain their 30-second timeout.