File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,7 +7,10 @@ AAB_ROOT="${AIAUDIT_BRIDGE_ROOT:-$(cd "$ROOT/../.." && pwd)}"
77PROJECTS_ROOT=" ${PROJECTS_ROOT:- $HOME / Projects} "
88QUANT_PROJECTS_ROOT=" ${QUANT_PROJECTS_ROOT:- $ROOT / data/ lifecycle-projects} "
99LIFECYCLE_LOCAL_ROOT=" ${LIFECYCLE_LOCAL_ROOT:- $ROOT / data/ lifecycle-store} "
10- QPK_ROOT=" ${QUANT_PLATFORM_KIT_ROOT:- $PROJECTS_ROOT / QuantPlatformKit} "
10+ # Monitoring must never import an editable QuantPlatformKit checkout from a
11+ # developer workspace: the monitor synchronizes and consumes this dedicated
12+ # mirror instead.
13+ QPK_ROOT=" ${QUANT_PLATFORM_KIT_ROOT:- $QUANT_PROJECTS_ROOT / QuantPlatformKit} "
1114VENV=" ${QUANT_MONITOR_VENV:- $ROOT / .venv} "
1215
1316export QUANT_MONITOR_ROOT=" $ROOT "
Original file line number Diff line number Diff line change @@ -7,29 +7,34 @@ REPOS=(
77 UsEquityStrategies
88 CryptoStrategies
99)
10- ROOT=" ${PROJECTS_ROOT:- $HOME / Projects} "
10+ ROOT=" ${QUANT_MONITOR_ROOT:- $(cd " $( dirname " $0 " ) /.." && pwd)} "
11+ MIRROR_ROOT=" ${QUANT_PROJECTS_ROOT:- $ROOT / data/ lifecycle-projects} "
12+ REPOSITORY_BASE_URL=" ${QUANT_MONITOR_REPOSITORY_BASE_URL:- https:// github.com/ QuantStrategyLab} "
1113failed=0
14+
15+ mkdir -p " $MIRROR_ROOT "
16+
1217for repo in " ${REPOS[@]} " ; do
13- dir=" $ROOT /$repo "
18+ dir=" $MIRROR_ROOT /$repo "
1419 if [[ -d " $dir /.git" ]]; then
1520 if ! git -C " $dir " fetch origin main --quiet; then
1621 echo " [sync] $repo fetch failed" >&2
1722 failed=1
1823 continue
1924 fi
20- if ! git -C " $dir " checkout main --quiet; then
25+ if ! git -C " $dir " checkout --detach --quiet origin/main ; then
2126 echo " [sync] $repo checkout failed" >&2
2227 failed=1
2328 continue
2429 fi
25- if ! git -C " $dir " pull --ff-only origin main --quiet; then
26- echo " [sync] $repo pull failed" >&2
30+ echo " [sync] $repo ok"
31+ else
32+ if ! git clone --depth 1 " $REPOSITORY_BASE_URL /$repo .git" " $dir " --quiet; then
33+ echo " [sync] $repo clone failed" >&2
2734 failed=1
2835 continue
2936 fi
30- echo " [sync] $repo ok"
31- else
32- echo " [sync] skip missing $dir " >&2
37+ echo " [sync] $repo cloned"
3338 fi
3439done
3540exit " $failed "
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ Group=ubuntu
1010WorkingDirectory=/home/ubuntu/Projects/AIAuditBridge/ops/quant-monitor
1111Environment=QUANT_MONITOR_ROOT=/home/ubuntu/Projects/AIAuditBridge/ops/quant-monitor
1212Environment=AIAUDIT_BRIDGE_ROOT=/home/ubuntu/Projects/AIAuditBridge
13- Environment=QUANT_PLATFORM_KIT_ROOT=/home/ubuntu/Projects/QuantPlatformKit
13+ Environment=QUANT_PLATFORM_KIT_ROOT=/home/ubuntu/Projects/AIAuditBridge/ops/quant-monitor/data/lifecycle-projects/ QuantPlatformKit
1414Environment=QUANT_SENTINEL_TELEGRAM_SECRET_NAME=quant-sentinel-telegram-bot-token
1515Environment=QUANT_SENTINEL_GCP_PROJECT=firstradequant
1616Environment=GLOBAL_TELEGRAM_CHAT_ID=
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ Group=ubuntu
1010WorkingDirectory=/home/ubuntu/Projects/AIAuditBridge/ops/quant-monitor
1111Environment=QUANT_MONITOR_ROOT=/home/ubuntu/Projects/AIAuditBridge/ops/quant-monitor
1212Environment=AIAUDIT_BRIDGE_ROOT=/home/ubuntu/Projects/AIAuditBridge
13- Environment=QUANT_PLATFORM_KIT_ROOT=/home/ubuntu/Projects/QuantPlatformKit
13+ Environment=QUANT_PLATFORM_KIT_ROOT=/home/ubuntu/Projects/AIAuditBridge/ops/quant-monitor/data/lifecycle-projects/ QuantPlatformKit
1414Environment=QUANT_SENTINEL_TELEGRAM_SECRET_NAME=quant-sentinel-telegram-bot-token
1515Environment=QUANT_SENTINEL_GCP_PROJECT=firstradequant
1616# Set on VPS only — do not commit real chat id to git:
Original file line number Diff line number Diff line change @@ -46,10 +46,18 @@ def test_common_env_separates_code_and_lifecycle_data_roots(self) -> None:
4646 str (Path (home ) / "Projects" ),
4747 str (monitor_root / "data" / "lifecycle-projects" ),
4848 str (monitor_root / "data" / "lifecycle-store" ),
49- str (Path ( home ) / "Projects " / "QuantPlatformKit" ),
49+ str (monitor_root / "data" / "lifecycle-projects " / "QuantPlatformKit" ),
5050 ],
5151 )
5252
53+ def test_strategy_sync_uses_dedicated_mirrors (self ) -> None :
54+ script = (ROOT / "scripts" / "sync_strategy_repos.sh" ).read_text (encoding = "utf-8" )
55+
56+ self .assertIn ('MIRROR_ROOT="${QUANT_PROJECTS_ROOT:-$ROOT/data/lifecycle-projects}"' , script )
57+ self .assertIn ('dir="$MIRROR_ROOT/$repo"' , script )
58+ self .assertIn ("checkout --detach --quiet origin/main" , script )
59+ self .assertNotIn ("pull --ff-only" , script )
60+
5361 def test_health_check_syncs_artifacts_before_monitoring (self ) -> None :
5462 script = (ROOT / "scripts" / "health_check.sh" ).read_text (encoding = "utf-8" )
5563
You can’t perform that action at this time.
0 commit comments