Skip to content

Commit 8e37fdd

Browse files
fix(ci): fetch-depth 2 for graph staleness, use python -m graphstack on Windows
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 717fa60 commit 8e37fdd

3 files changed

Lines changed: 24 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ jobs:
3737
runs-on: ${{ matrix.os }}
3838

3939
steps:
40+
# depth 2+ required: validate --fail-stale-graph matches graph commit to HEAD~1
41+
# when graph artifacts land in a follow-up commit (v4.1 release pattern).
4042
- uses: actions/checkout@v4
43+
with:
44+
fetch-depth: 2
4145

4246
- name: Set up Python
4347
uses: actions/setup-python@v5
@@ -120,10 +124,10 @@ jobs:
120124
run: python -m pytest scripts/graphstack/tests -v
121125

122126
- name: Validate project layout (graphstack validate)
123-
run: graphstack validate
127+
run: python -m graphstack validate
124128

125129
- name: Fail if knowledge graph is stale vs HEAD
126-
run: graphstack validate --fail-stale-graph
130+
run: python -m graphstack validate --fail-stale-graph
127131

128132
- name: Board smoke test (Python module — cross-platform)
129133
shell: python

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ All notable changes to GraphStack are documented here.
2121

2222
### Fixed
2323
- **Graph staleness check**`validate --fail-stale-graph` accepts `HEAD~1` when the graph was built before a dedicated graph-artifacts commit (common release workflow).
24+
- **CI validate job**`actions/checkout` uses `fetch-depth: 2` (shallow clones hid `HEAD~1` and failed stale-graph checks); validate steps use `python -m graphstack` for Windows PATH reliability.
2425

2526
---
2627

scripts/graphstack/validate.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,27 @@ def _commit_matches_graph(graph_commit: str, ref: str) -> bool:
191191

192192

193193
def _refs_for_staleness_check() -> list[str]:
194-
"""HEAD and HEAD~1 — graph is often committed one commit after graphify runs."""
194+
"""HEAD, HEAD~1, and last commit that touched the graph report.
195+
196+
Graph is often built on HEAD~1 then committed on HEAD (release workflow).
197+
GitHub Actions uses fetch-depth: 1 by default — without HEAD~1, fall back to
198+
the commit that last modified GRAPH_REPORT.md (needs at least that commit).
199+
"""
195200
refs: list[str] = []
201+
seen: set[str] = set()
196202
for arg in ("HEAD", "HEAD~1"):
197203
proc = run_git("rev-parse", arg)
198204
if proc.returncode == 0 and proc.stdout:
199-
refs.append(proc.stdout.strip().lower())
205+
ref = proc.stdout.strip().lower()
206+
if ref not in seen:
207+
seen.add(ref)
208+
refs.append(ref)
209+
proc = run_git("log", "-1", "--format=%H", "--", str(GRAPH_REPORT))
210+
if proc.returncode == 0 and proc.stdout:
211+
ref = proc.stdout.strip().lower()
212+
if ref not in seen:
213+
seen.add(ref)
214+
refs.append(ref)
200215
return refs
201216

202217

0 commit comments

Comments
 (0)