feat(ground): accept ground_model.json written before the schema number

- A file with no `schema` key is read as schema 1, but every pier must have a
  `ground` object, so a renamed field is refused instead of loading as empty.
- `schema` null or any other number is still refused.
- The project file keeps the normalised model and checks it with its own
  check (checkStoredGroundModel), so a saved model reopens.
- Temporary: remove the no-schema branch once examples/out is regenerated.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
ypshimandClaude Haiku 5.5 committed 2026-10-23 17:41:24 +09:00
1 parent c3606011b5
commit be76425c8f
4 files changed
+453 -6

No files matched your search

+2 -2
View File
@@ -1,5 +1,5 @@
import type { FckByMember, Material } from './rebar/common';
import { checkGroundModel, type GroundModelFile } from './ground-model';
import { checkStoredGroundModel, type GroundModelFile } from './ground-model';
import type { PierInput } from './types';
/** Project file schema (spec §8). Bump only with a migration. */
@@ -71,7 +71,7 @@ export function parseProject(text: string): ProjectFile {
}
}
}
if (obj.groundModel !== undefined) checkGroundModel(obj.groundModel);
if (obj.groundModel !== undefined) checkStoredGroundModel(obj.groundModel);
obj.piers.forEach((p, i) => {
if (!p || typeof p.id !== 'string' || !p.input) throw new Error(`교각 ${i + 1}: id 또는 input이 없습니다.`);
const input = p.input;