Skip to content

Commit 14e570a

Browse files
Pigbibicodex
andcommitted
fix: keep dependency drift reports hermetic
Co-Authored-By: Codex <noreply@openai.com>
1 parent 12bc523 commit 14e570a

3 files changed

Lines changed: 25 additions & 3 deletions

File tree

.github/workflows/validate.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,23 @@ jobs:
5555
GH_TOKEN: ${{ github.token }}
5656
run: bash python/shell/checkout_internal_dependency_consumers.sh --output-root ..
5757
- name: Report internal dependency matrix
58-
run: python3 python/scripts/check_internal_dependency_matrix.py --projects-root .. --json --strict --require-consumer-files
58+
run: python3 python/scripts/check_internal_dependency_matrix.py --projects-root .. --json --require-consumer-files
59+
- name: Enforce internal dependency matrix when its ledger changes
60+
run: |
61+
set -euo pipefail
62+
if [ "${{ github.event_name }}" = "pull_request" ]; then
63+
comparison_range="origin/${{ github.base_ref }}...HEAD"
64+
elif git rev-parse --verify HEAD^ >/dev/null 2>&1; then
65+
comparison_range="HEAD^...HEAD"
66+
else
67+
echo "No parent commit is available; reporting dependency drift without a strict ledger gate."
68+
exit 0
69+
fi
70+
if git diff --quiet "$comparison_range" -- internal_dependency_matrix.json; then
71+
echo "Internal dependency ledger did not change; retaining the report without making this unrelated PR non-hermetic."
72+
exit 0
73+
fi
74+
python3 python/scripts/check_internal_dependency_matrix.py --projects-root .. --json --strict --require-consumer-files
5975
6076
js:
6177
runs-on: ubuntu-latest

docs/internal_dependency_pin_policy.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ QuantStrategyLab shares Python packages across platforms, strategies, and pipeli
77
## Source of truth
88

99
- **Tracked pins** live in [`internal_dependency_matrix.json`](../internal_dependency_matrix.json).
10-
- **Validation** runs in QuantRuntimeSettings CI via:
10+
- **Validation** runs in QuantRuntimeSettings CI: every PR publishes a drift report, while
11+
strict enforcement blocks only changes to `internal_dependency_matrix.json`. This prevents
12+
an unrelated console or documentation PR from failing non-hermetically merely because a
13+
separately checked-out consumer advanced; a ledger change must still match every consumer.
1114

1215
```bash
1316
python3 scripts/check_internal_dependency_matrix.py --projects-root .. --strict

docs/internal_dependency_pin_policy.zh-CN.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ QuantStrategyLab 通过 git URL pin 在平台、策略与 pipeline 之间共享
77
## 权威来源
88

99
- **已追踪的 pin** 记录在 [`internal_dependency_matrix.json`](../internal_dependency_matrix.json)
10-
- **校验** 在 QuantRuntimeSettings CI 中执行:
10+
- **校验** 在 QuantRuntimeSettings CI 中执行:每个 PR 都生成漂移报告;只有修改
11+
`internal_dependency_matrix.json` 的变更才会以严格模式阻塞合并。这样一个无关的
12+
控制台或文档 PR 不会因为 checkout 时其他仓库恰好前进而变成不可复现的失败;台账
13+
本身仍必须在提交时与所有 consumer 一致。
1114

1215
```bash
1316
python3 scripts/check_internal_dependency_matrix.py --projects-root .. --strict

0 commit comments

Comments
 (0)