fix: walls r1 review — server (ref #52)

This commit is contained in:
2026-11-20 08:42:50 +01:00
parent f9f26a4a01
commit e1a5b297e4
11 changed files with 198 additions and 167 deletions
+26
View File
@@ -346,3 +346,29 @@ suite "step 8 wall CHECKs (DESIGN 4.4)":
check db.getValue(sql"SELECT count(*) FROM pragma_table_info('wall') WHERE name = 'kind'") == "1"
check db.getValue(sql"SELECT count(*) FROM pragma_table_info('wall') WHERE name = 'thickness'") == "0"
check db.getValue(sql"SELECT count(*) FROM sqlite_master WHERE name = 'wall_v1'") == "0"
test "a malformed props_gm refuses step 8 and leaves the schema-7 DB untouched":
let d = tmpDir()
let db = openFresh(d)
defer:
close(db)
removeDir(d)
applySteps(db, 7)
# The height backfill cannot decide for this row: the step fails rather than silently skipping
# it (DESIGN 4.4: a failing step rolls back completely).
db.exec(sql"""INSERT INTO entity (id, scene_id, kind, descriptive_name, actual_name, x, y,
created_at, props_gm)
VALUES ('tok000000009', 1, 'pc', 'x', 'x', 0, 0, 'x', 'not json')""")
var raised = false
try:
discard migrate(db)
except MigrationError:
raised = true
check raised
check schemaVersion(db) == 7
check appliedMigrations(db).len == 7
check db.getValue(sql"SELECT count(*) FROM pragma_table_info('wall') WHERE name = 'kind'") == "1"
check db.getValue(sql"SELECT count(*) FROM pragma_table_info('wall') WHERE name = 'thickness'") == "0"
check db.getValue(sql"SELECT count(*) FROM sqlite_master WHERE name = 'wall_v1'") == "0"
check db.getValue(sql"SELECT count(*) FROM sqlite_master WHERE name = 'marker_seen'") == "0"
check db.getValue(sql"SELECT props_gm FROM entity WHERE id = 'tok000000009'") == "not json"