165 lines
5.8 KiB
Bash
Executable File
165 lines
5.8 KiB
Bash
Executable File
#!/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 '!**/*_test.rs' \
|
|
--glob '!crates/fidc-core/src/strategy_ai.rs' \
|
|
--glob '!scripts/verify-no-legacy-data-source.sh' \
|
|
'fidatacenter|FIDATACENTER|/v1/backtest/data|/v1/xuntou|ClickHouse|clickhouse|CLICKHOUSE|FIDC_BT_INSTRUMENT_METADATA_CSV|FIDC_BT_WRITE_SNAPSHOTS|FIDC_BT_WRITE_CSV_SNAPSHOTS|FIDC_BT_WRITE_COMBINED_SOURCE_ROW_CACHE|write_csv_snapshot_files|write_csv\(|FIDC_RISK_RUNTIME_FILE|FIDC_RISK_RUNTIME_URL|FIDC_FIRISK_RUNTIME_FILE|FiRisk runtime snapshot' \
|
|
crates Cargo.toml \
|
|
2>/dev/null || true
|
|
)"
|
|
|
|
if [[ -n "$runtime_hits" ]]; then
|
|
fail "legacy fidatacenter/ClickHouse/CSV snapshot/FiRisk 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
|
|
|
|
local_only_hits="$(
|
|
rg -n \
|
|
--glob '!**/.git/**' \
|
|
--glob '!**/target/**' \
|
|
--glob '!**/docs/**' \
|
|
--glob '!**/*.md' \
|
|
--glob '!**/tests/**' \
|
|
--glob '!**/*.test.rs' \
|
|
--glob '!**/*_test.rs' \
|
|
--glob '!crates/fidc-core/src/strategy_ai.rs' \
|
|
--glob '!scripts/verify-no-legacy-data-source.sh' \
|
|
'FICLAW_DATA_AGENT_URL|ficlaw_data\.source_rows_v1|strategy-factory-source-lake://local|FIDC_BT_WRITE_COMBINED_SOURCE_ROW_CACHE' \
|
|
crates Cargo.toml \
|
|
2>/dev/null || true
|
|
)"
|
|
|
|
if [[ -n "$local_only_hits" ]]; then
|
|
fail "legacy or local-only data source references are not allowed in fidc-backtest-engine runtime" "$local_only_hits"
|
|
fi
|
|
|
|
json_query_hits="$(
|
|
rg -n \
|
|
--glob '!**/.git/**' \
|
|
--glob '!**/target/**' \
|
|
--glob '!**/docs/**' \
|
|
--glob '!**/*.md' \
|
|
--glob '!**/tests/**' \
|
|
--glob '!**/*.test.rs' \
|
|
--glob '!**/*_test.rs' \
|
|
--glob '!crates/fidc-core/src/strategy_ai.rs' \
|
|
--glob '!scripts/verify-no-legacy-data-source.sh' \
|
|
'/v1/query/(source-rows|daily-execution-prices|minute-execution-prices|instruments|corporate-actions)\.json' \
|
|
crates Cargo.toml \
|
|
2>/dev/null || true
|
|
)"
|
|
|
|
if [[ -n "$json_query_hits" ]]; then
|
|
fail "JSON Source Lake high-throughput endpoints are not allowed in fidc-backtest-engine runtime; use Arrow endpoints" "$json_query_hits"
|
|
fi
|
|
|
|
fused_hits="$(
|
|
rg -n \
|
|
--glob '!**/.git/**' \
|
|
--glob '!**/target/**' \
|
|
--glob '!**/docs/**' \
|
|
--glob '!**/*.md' \
|
|
--glob '!**/tests/**' \
|
|
--glob '!**/*.test.rs' \
|
|
--glob '!**/*_test.rs' \
|
|
--glob '!crates/fidc-core/src/strategy_ai.rs' \
|
|
--glob '!scripts/verify-no-legacy-data-source.sh' \
|
|
'exported_fused|fidc_fused|fusion|fused|wide_table|wide table|source_rows_export|exported_daily|merged_daily|daily_merged|merged_source|materialized[_ -]source|materialized_source_rows|source_rows_materialized|融合表|融合宽表' \
|
|
crates Cargo.toml \
|
|
2>/dev/null || true
|
|
)"
|
|
|
|
if [[ -n "$fused_hits" ]]; then
|
|
fail "exported fused tables are not allowed in fidc-backtest-engine runtime; use Strategy Factory Source Lake source rows directly" "$fused_hits"
|
|
fi
|
|
|
|
feature_store_hits="$(
|
|
rg -n \
|
|
--glob '!**/.git/**' \
|
|
--glob '!**/target/**' \
|
|
--glob '!**/docs/**' \
|
|
--glob '!**/*.md' \
|
|
--glob '!**/tests/**' \
|
|
--glob '!**/*.test.rs' \
|
|
--glob '!**/*_test.rs' \
|
|
--glob '!crates/fidc-core/src/strategy_ai.rs' \
|
|
--glob '!scripts/verify-no-legacy-data-source.sh' \
|
|
'research_feature_store|feature_store|FEATURE_STORE|daily_minute_current|FIDC_STRATEGY_FACTORY_ENABLE_FEATURE_STORE_CACHE|ALPHA_FACTORY_ENABLE_FEATURE_STORE_CACHE|ENABLE_FEATURE_STORE_CACHE' \
|
|
crates Cargo.toml \
|
|
2>/dev/null || true
|
|
)"
|
|
|
|
if [[ -n "$feature_store_hits" ]]; then
|
|
fail "historical feature-store paths are not allowed in fidc-backtest-engine runtime; use Strategy Factory Source Lake raw/indicator/artifact partitions and discardable caches" "$feature_store_hits"
|
|
fi
|
|
|
|
truth_csv_hits="$(
|
|
rg -n \
|
|
--glob '!**/.git/**' \
|
|
--glob '!**/target/**' \
|
|
--glob '!**/docs/**' \
|
|
--glob '!**/*.md' \
|
|
--glob '!**/tests/**' \
|
|
--glob '!**/*.test.rs' \
|
|
--glob '!**/*_test.rs' \
|
|
--glob '!crates/fidc-core/src/strategy_ai.rs' \
|
|
--glob '!scripts/verify-no-legacy-data-source.sh' \
|
|
'FIDC_BT_TRUTH_STOCK_LIST_CSV|OMNI_BT_TRUTH_STOCK_LIST_CSV|OMNI_BACKTEST_TRUTH_STOCK_LIST_CSV|selection_source=truth_csv|truth_stock_list|truth_csv' \
|
|
crates Cargo.toml \
|
|
2>/dev/null || true
|
|
)"
|
|
|
|
if [[ -n "$truth_csv_hits" ]]; then
|
|
fail "CSV truth stock-list overrides are not allowed in fidc-backtest-engine runtime; use Source Lake runtime spec selection only" "$truth_csv_hits"
|
|
fi
|
|
|
|
csv_snapshot_loader_hits="$(
|
|
rg -n \
|
|
--glob '!**/.git/**' \
|
|
--glob '!**/target/**' \
|
|
--glob '!**/docs/**' \
|
|
--glob '!**/*.md' \
|
|
--glob '!**/tests/**' \
|
|
--glob '!**/*.test.rs' \
|
|
--glob '!**/*_test.rs' \
|
|
--glob '!scripts/verify-no-legacy-data-source.sh' \
|
|
'from_csv_dir|from_partitioned_dir|instruments\.csv|candidate_flags\.csv|market\.csv|benchmark\.csv' \
|
|
crates Cargo.toml \
|
|
2>/dev/null || true
|
|
)"
|
|
|
|
if [[ -n "$csv_snapshot_loader_hits" ]]; then
|
|
fail "CSV snapshot loaders are not allowed in fidc-backtest-engine runtime; construct DataSet from Source Lake components" "$csv_snapshot_loader_hits"
|
|
fi
|
|
|
|
printf '[OK] fidc-backtest-engine has no legacy runtime data-source references\n'
|