From 49981f2f3e72d945d8f1a93b09f5c2a59d3347c1 Mon Sep 17 00:00:00 2001 From: boris Date: Sun, 28 Jun 2026 06:50:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=9B=9E=E6=B5=8B=E5=BC=95?= =?UTF-8?q?=E6=93=8E=E6=97=A7=E6=95=B0=E6=8D=AE=E6=BA=90=E5=AE=88=E5=8D=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/verify-no-legacy-data-source.sh | 43 +++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 scripts/verify-no-legacy-data-source.sh diff --git a/scripts/verify-no-legacy-data-source.sh b/scripts/verify-no-legacy-data-source.sh new file mode 100755 index 0000000..a08b68a --- /dev/null +++ b/scripts/verify-no-legacy-data-source.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash +set -euo pipefail + +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +cd "$ROOT_DIR" + +fail() { + local message="$1" + local details="${2:-}" + printf '[FAIL] %s\n' "$message" >&2 + if [[ -n "$details" ]]; then + printf '%s\n' "$details" >&2 + fi + exit 1 +} + +runtime_hits="$( + rg -n \ + --glob '!**/.git/**' \ + --glob '!**/target/**' \ + --glob '!**/docs/**' \ + --glob '!**/*.md' \ + --glob '!**/tests/**' \ + --glob '!**/*test*.rs' \ + --glob '!scripts/verify-no-legacy-data-source.sh' \ + 'fidatacenter|FIDATACENTER|/v1/backtest/data|/v1/xuntou|ClickHouse|clickhouse|CLICKHOUSE' \ + crates Cargo.toml \ + 2>/dev/null || true +)" + +if [[ -n "$runtime_hits" ]]; then + fail "legacy fidatacenter/ClickHouse runtime data source references are not allowed in fidc-backtest-engine" "$runtime_hits" +fi + +manifest_hits="$( + rg -n --glob '!scripts/verify-no-legacy-data-source.sh' '\b(mysql|mariadb|clickhouse|clickhouse-rs|mysql_async|sqlx-mysql)\b' Cargo.toml crates 2>/dev/null || true +)" + +if [[ -n "$manifest_hits" ]]; then + fail "legacy database dependencies are not allowed in fidc-backtest-engine manifests" "$manifest_hits" +fi + +printf '[OK] fidc-backtest-engine has no legacy runtime data-source references\n'