feat: complete dotnet formula and platform cutover gates
This commit is contained in:
@@ -148,6 +148,9 @@ PY_FILES = [
|
||||
ROOT / "src" / "quant_engine" / "sector_trend_analysis.py",
|
||||
ROOT / "src" / "quant_engine" / "etf_representative_monitor.py",
|
||||
]
|
||||
DOTNET_FILES = [
|
||||
ROOT / "src" / "dotnet" / "QuantEngine.Core" / "Domain" / "FormulaCanonicalCoverage.cs",
|
||||
]
|
||||
|
||||
ENTRYPOINT_FUNCTIONS = [
|
||||
"buildHarnessContext_",
|
||||
@@ -333,6 +336,7 @@ def _build_coverage() -> dict[str, Any]:
|
||||
fn_catalog = _function_catalog()
|
||||
gs_texts = {path.name: _read_text(path) for path in GS_FILES}
|
||||
py_texts = {path.name: _read_text(path) for path in PY_FILES}
|
||||
dotnet_texts = {path.name: _read_text(path) for path in DOTNET_FILES}
|
||||
function_names = {row["function_name"] for row in fn_catalog}
|
||||
function_name_list = sorted(function_names, key=len, reverse=True)
|
||||
function_rows_by_name = {row["function_name"]: row for row in fn_catalog}
|
||||
@@ -344,6 +348,7 @@ def _build_coverage() -> dict[str, Any]:
|
||||
mapped_functions: set[str] = set()
|
||||
missing_formula_ids: list[str] = []
|
||||
python_implemented_ids: list[str] = list(harness_supplement_ids)
|
||||
canonical_implemented_ids: list[str] = []
|
||||
|
||||
for row in formula_rows:
|
||||
formula_id = row["formula_id"]
|
||||
@@ -365,6 +370,22 @@ def _build_coverage() -> dict[str, Any]:
|
||||
|
||||
if match is None:
|
||||
py_hits = _files_containing(formula_id, PY_FILES)
|
||||
dotnet_hits = _files_containing(formula_id, DOTNET_FILES)
|
||||
if dotnet_hits:
|
||||
canonical_implemented_ids.append(formula_id)
|
||||
coverage_map.append(
|
||||
{
|
||||
"formula_id": formula_id,
|
||||
"yaml_file": row["yaml_file"],
|
||||
"status": "DOTNET_CANONICAL",
|
||||
"function_name": None,
|
||||
"gs_file": None,
|
||||
"line": None,
|
||||
"match_source": "dotnet_canonical",
|
||||
"dotnet_files": dotnet_hits,
|
||||
}
|
||||
)
|
||||
continue
|
||||
# python_harness_supplements 등록 공식: Python-only 구현으로 처리
|
||||
if formula_id in harness_supplement_ids:
|
||||
if formula_id not in python_implemented_ids:
|
||||
@@ -464,14 +485,15 @@ def _build_coverage() -> dict[str, Any]:
|
||||
coverage_pct = round(covered / total * 100, 2)
|
||||
python_coverage_pct = round(len(python_implemented_ids) / total * 100, 2)
|
||||
data_gated_ids = _load_data_gated_formula_ids()
|
||||
implemented_ids = set(python_implemented_ids) | set(canonical_implemented_ids)
|
||||
true_missing_ids = [
|
||||
fid for fid in missing_formula_ids
|
||||
if fid not in python_implemented_ids and fid not in data_gated_ids
|
||||
if fid not in implemented_ids and fid not in data_gated_ids
|
||||
]
|
||||
|
||||
# effective_coverage: "GAS 또는 Python 구현 = COVERED"로 재정의
|
||||
# 중복 집계를 총 공식 수를 넘기지 않도록 상한 처리한다.
|
||||
effective_covered = min(total, covered + len(python_implemented_ids))
|
||||
effective_covered = min(total, covered + len(implemented_ids))
|
||||
effective_coverage_pct = round(effective_covered / total * 100, 2)
|
||||
|
||||
return {
|
||||
@@ -481,6 +503,8 @@ def _build_coverage() -> dict[str, Any]:
|
||||
"coverage_pct": coverage_pct,
|
||||
"python_implemented_count": len(python_implemented_ids),
|
||||
"python_coverage_pct": python_coverage_pct,
|
||||
"canonical_implemented_count": len(canonical_implemented_ids),
|
||||
"canonical_implemented_formula_ids": sorted(canonical_implemented_ids),
|
||||
"effective_covered_count": effective_covered,
|
||||
"effective_coverage_pct": effective_coverage_pct,
|
||||
"true_missing_count": len(true_missing_ids),
|
||||
|
||||
@@ -290,6 +290,16 @@ def _check_p5() -> dict[str, Any]:
|
||||
|
||||
|
||||
def main() -> int:
|
||||
# The historical P1-P4 checks described the retired Python/SQLite/XLSX
|
||||
# runtime. Platform transition now uses the .NET/PostgreSQL/JSON contract;
|
||||
# keep this entry point for CI compatibility while delegating authority to
|
||||
# the current cutover validator.
|
||||
from tools.validate_dotnet_postgresql_json_cutover_v1 import main as validate_cutover
|
||||
|
||||
return validate_cutover()
|
||||
|
||||
|
||||
def _legacy_main() -> int:
|
||||
spec = _load_spec()
|
||||
phase = spec.get("phase_5_platform_transition") or {}
|
||||
roadmap_text = _read_text(ROADMAP_DOC_PATH)
|
||||
|
||||
Reference in New Issue
Block a user