Files
Aislo/resources/tester/helper_349_0n_cross_enforce.cjs
T
eomsangdonandClaude Opus 5.5 78c6080853 fix(계산묶음): 349-0p 초안 새 측점 암 경계 = 서버 기본값 — cross 단계가 입력 없는 측점에 기본 오프셋을 받음 · 소수 자리 관 측점 시험
- 검증_브레인232 를 검증_sub2b(abdc72d0 · 노선 330)로 복제해 같은 끌기(25+0 부근 꺾임점 북동 10 m)로 서버 [저장] 체인 실측: 미리보기 1,169.6 대 정본 1,184.0 · 갈린 곳은 960 측점 하나(초안에서 격자 열쇠라 저장 입력 없음 → 암 경계 비어 흙 · 암 나눔이 다름)
- CrossStageInput.rockBoundaryDefaultM — 입력 없는 측점의 암 경계(서버 config 기본값) · 넘기면 미리보기 1,184.7 대 정본 1,184.0
- 넘기는 줄(design_pipeline_cross.ts `readRockBoundaryDefault(projectId)`)은 남의 도움 파일 가짜 모듈을 깨서 브레인 몫으로 남김
- 시험: test_349_0p_fractional_station 2(소수 자리 관 · 물넘이 · 세월교 측점 = 서버 보정 뒤 · 입력 없는 측점 암 경계) · 관련 97 통과 · typecheck 0

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QfHKQs7J3hQELKMWQMUJEy
2026-10-16 17:04:04 +09:00

71 lines
3.0 KiB
JavaScript

/* PLAN 349-0n 헬퍼 — 계산 묶음 cross 단계의 [확정] 보정(포장 구간 · 세월교 노면 하강 · 사토장).
* 진짜 TS(`B06_Section_Cross_Stage` · `B06_Section_Cross_Enforce`)를 트랜스파일해 Node 로 돌림.
* 입력 argv[2] JSON(측점 · 계획고 · 관 · 구조물 · 판정 누가거리) · 결과 = 표준출력 JSON.
* 짝 = `test_349_0n_cross_enforce_mirror.py`. */
const fs = require("fs");
const path = require("path");
const ts = require(path.join(__dirname, "..", "..", "config", "node_modules", "typescript"));
const CATALOG = require("./helper_322_catalog_module.cjs");
const ROOT = path.join(__dirname, "..", "..");
const job = JSON.parse(fs.readFileSync(process.argv[2], "utf8"));
const cache = new Map();
function loadTs(full) {
if (cache.has(full)) return cache.get(full);
const js = ts.transpileModule(fs.readFileSync(full, "utf8"), {
compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020 },
}).outputText;
const box = { exports: {} };
cache.set(full, box.exports);
const localRequire = (request) => {
if (CATALOG.isCatalogRequest(request)) return CATALOG;
if (request.endsWith(".json")) return require(path.join(path.dirname(full), request));
const bare = request.replace(/\.js$/, "");
if (bare.startsWith("@util/"))
return loadTs(path.join(ROOT, "common_util", `${bare.slice(6)}.ts`));
if (bare.startsWith(".")) return loadTs(path.join(path.dirname(full), `${bare}.ts`));
return require(request);
};
new Function("exports", "module", "require", js)(box.exports, box, localRequire);
return box.exports;
}
const load = (...parts) => loadTs(path.join(ROOT, ...parts));
const enforce = load("B06_Section", "logic", "B06_Section_Cross_Enforce.ts");
const crossMod = load("B06_Section", "logic", "B06_Section_Cross_Stage.ts");
const ranges = enforce.facilityRanges(job.pipes, job.structures);
const at = job.probe.map((chainage) => ({ chainage, ...enforce.facilityAt(ranges, chainage) }));
const profile = {
stations: job.stations.map((s) => ({ chainage_m: s.chainageM, plan_elevation_m: s.elevation })),
samples: job.stations.map((s) => ({ chainage_m: s.chainageM, elevation_m: s.elevation })),
};
const ground = { stations: job.stations };
function runStage(facilities) {
const cross = crossMod.createCrossStage();
const started = process.hrtime.bigint();
const out = cross.stage({
generation: 1,
range: null,
inputs: {
cross: {
standard: job.standard,
byKey: job.byKey,
rockBoundaryDefaultM: job.rockBoundaryDefaultM ?? null,
},
pipes: facilities ? job.pipes : null,
structures: facilities ? job.structures : null,
},
out: { profile, ground },
prev: null,
});
const ms = Number(process.hrtime.bigint() - started) / 1e6;
return {
ms,
byKey: Object.fromEntries(Object.entries(out.byKey).map(([k, v]) => [k, v.detail])),
};
}
process.stdout.write(JSON.stringify({ at, stage: runStage(true), carried: runStage(false) }));