fix(M01): 기대값 시험표가 LB 바로 계산(lbCalcNow)을 씀 — 화면 예시값 계산과 안 부딪힘(PLAN 35-2a)

- 멈춤 까닭은 Api 쉬운 말로
- 시험 test_m01_lb_check.py 9 통과 · LogicBuilder 전부 검사 초록
- ORCA GF000219 시험표 세 줄: 계 79,279.668 통과 · 틀린 기대값 실패 · 해당 없음 조합 계 0 실패

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ly2oHAaTDYRjcniAmHR81z
This commit is contained in:
2026-10-01 11:59:33 +09:00
co-authored by Claude Opus 5.5
parent 3eb66e5aa9
commit f93ce9f676
+9 -9
View File
@@ -12,7 +12,7 @@
* ========================================================================== */
import type { CalcAnswer, LogicRow } from "../M01_MasterData_UI_Logic_Api";
import { lbCalcLater, type LbTables } from "./M01_LB_Api";
import { lbCalcNow, type LbTables } from "./M01_LB_Api";
import { writeLogic, type LbLogic, type LbLookup } from "./M01_LB_Blocks";
type Cell = string | number | boolean | null | [number | null, number | null];
@@ -212,20 +212,20 @@ type CalcFn = (
tables: LbTables,
) => Promise<CalcAnswer>;
/** LB Api 계산을 한 번 기다림 — 차례로 부르므로 「최신만」 에 안 걸림 */
const calcOnce: CalcFn = (row, inputs, tables) =>
new Promise((resolve, reject) =>
lbCalcLater(row, inputs, tables, (ans, plain) =>
ans ? resolve(ans) : reject(new Error(plain ?? "")),
),
);
/** LB Api 바로 계산 — 화면 예시값 계산(0.3초 · 최신만)과 안 부딪힘 · 멈춤 까닭은 쉬운 말로 */
const calcNow: CalcFn = async (row, inputs, tables) => {
let plain = "";
const ans = await lbCalcNow(row, inputs, tables, (p) => (plain = p));
if (!ans) throw new Error(plain);
return ans.ok ? ans : { ok: false, reason: plain || ans.reason };
};
/** 줄마다 시험 계산(차례로 · 하나씩) — 로직은 블록을 글로 되돌린 줄 · `calc` 는 시험에서 바꿔 끼움 */
export async function runExpect(
lb: LbLogic,
tables: LbTables,
rows: ExpectRow[],
calc: CalcFn = calcOnce,
calc: CalcFn = calcNow,
): Promise<ExpectResult[]> {
const row = writeLogic(lb);
const out: ExpectResult[] = [];