From eb48b7eb0770fad05740622933833a8bb399e518 Mon Sep 17 00:00:00 2001 From: kjh2064 Date: Sun, 12 Jul 2026 12:01:09 +0900 Subject: [PATCH] feat: add dotnet postgres json cutover gate --- package.json | 1 + spec/61_dotnet_postgresql_json_cutover.yaml | 19 ++++++++++ ...idate_dotnet_postgresql_json_cutover_v1.py | 35 +++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 spec/61_dotnet_postgresql_json_cutover.yaml create mode 100644 tools/validate_dotnet_postgresql_json_cutover_v1.py diff --git a/package.json b/package.json index 64b0ac48..620b94c4 100644 --- a/package.json +++ b/package.json @@ -57,6 +57,7 @@ "collect:remote-evidence": "python tools/collect_remote_wbs_evidence_v1.py", "verify:wbs": "python tools/validate_quant_engine_wbs_v1.py", "validate:normalized-learning-store": "python tools/validate_normalized_learning_store_v1.py", + "validate:dotnet-cutover": "python tools/validate_dotnet_postgresql_json_cutover_v1.py", "test:e2e": "playwright test --project=chromium", "test:evidence": "playwright test --project=evidence" }, diff --git a/spec/61_dotnet_postgresql_json_cutover.yaml b/spec/61_dotnet_postgresql_json_cutover.yaml new file mode 100644 index 00000000..b8dfa881 --- /dev/null +++ b/spec/61_dotnet_postgresql_json_cutover.yaml @@ -0,0 +1,19 @@ +formula_id: DOTNET_POSTGRESQL_JSON_CUTOVER_V1 +version: 1 +authority: spec/02_data_contract.yaml +canonical_runtime: + collector: src/dotnet/QuantEngine.Application/Services/KisDataCollectionOrchestrator.cs + seed_ingestion: src/dotnet/QuantEngine.Application/Services/JsonSeedIngestionService.cs + storage: src/dotnet/QuantEngine.Infrastructure/Repositories/CollectionRepository.cs + migration: src/dotnet/QuantEngine.Infrastructure/Migrations/V5__Add_Normalized_Learning_History.sql + output: Temp/kis_dotnet_collection_v1.json +legacy_policy: + python_collector: migration_only + sqlite_store: migration_only + xlsx_runtime_input: forbidden +gates: + - dotnet_collector_registered + - postgresql_collection_repository_registered + - json_seed_ingestion_registered + - dbup_v5_embedded + - xlsx_not_runtime_dependency diff --git a/tools/validate_dotnet_postgresql_json_cutover_v1.py b/tools/validate_dotnet_postgresql_json_cutover_v1.py new file mode 100644 index 00000000..0ccc60f1 --- /dev/null +++ b/tools/validate_dotnet_postgresql_json_cutover_v1.py @@ -0,0 +1,35 @@ +from __future__ import annotations + +import json +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] + + +def main() -> int: + program = (ROOT / "src/dotnet/QuantEngine.Web/Program.cs").read_text(encoding="utf-8") + csproj = (ROOT / "src/dotnet/QuantEngine.Infrastructure/QuantEngine.Infrastructure.csproj").read_text(encoding="utf-8") + migration = ROOT / "src/dotnet/QuantEngine.Infrastructure/Migrations/V5__Add_Normalized_Learning_History.sql" + orchestrator = ROOT / "src/dotnet/QuantEngine.Application/Services/KisDataCollectionOrchestrator.cs" + seed_service = ROOT / "src/dotnet/QuantEngine.Application/Services/JsonSeedIngestionService.cs" + checks = { + "dotnet_collector_registered": "ICollectionOrchestrator, KisDataCollectionOrchestrator" in program, + "postgres_repository_registered": "ICollectionRepository" in program, + "json_seed_registered": "JsonSeedIngestionService" in program, + "dbup_v5_embedded": "Migrations/**/*.sql" in csproj and migration.exists(), + "orchestrator_present": orchestrator.exists(), + "json_seed_ingestion_present": seed_service.exists(), + "json_artifact_contract": "KIS_DOTNET_COLLECTION_V1" in orchestrator.read_text(encoding="utf-8"), + "no_xlsx_in_seed_service": ".xlsx" not in seed_service.read_text(encoding="utf-8"), + } + gate = "PASS" if all(checks.values()) else "FAIL" + payload = {"formula_id": "DOTNET_POSTGRESQL_JSON_CUTOVER_V1", "gate": gate, "checks": checks} + output = ROOT / "Temp/dotnet_postgresql_json_cutover_v1.json" + output.parent.mkdir(parents=True, exist_ok=True) + output.write_text(json.dumps(payload, indent=2), encoding="utf-8") + print(json.dumps(payload, indent=2)) + return 0 if gate == "PASS" else 1 + + +if __name__ == "__main__": + raise SystemExit(main())