Skip to content

Commit c70b52c

Browse files
committed
fix(release): scope docs drift to site content
Code/machinery paths (scripts/, .githooks/, .github/, support/ excl. support/docs/, env files, Dockerfile) never appear in the site build, so code-only pushes on dev no longer invalidate a docs flag. Content = README/CONTRIBUTING/doc/**/support/docs/**/.pi/**.
1 parent d7f91d5 commit c70b52c

2 files changed

Lines changed: 35 additions & 5 deletions

File tree

‎scripts/localpibox/stack/release.py‎

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,26 @@
3737
DOCS_ONLY_FILES = frozenset({
3838
"mkdocs.yml", "scripts/generate.py", "DOCS.md", DOCS_READY_FILE,
3939
})
40+
# Paths on dev that are code/machinery, not site content — a change there
41+
# does not invalidate a docs flag (the site never builds them). Anything
42+
# else counts as content. support/docs/ is content even though support/
43+
# holds runtime tools.
44+
_NON_CONTENT_FILES = frozenset({
45+
".dockerignore", ".env.example", ".gitignore", "Dockerfile", "VERSION",
46+
"lpb.conf.env", "lpb.stack.env", "lpb.stack.dev.env", "lpb.stack.main.env",
47+
})
48+
_NON_CONTENT_DIRS = ("scripts/", ".githooks/", ".github/")
49+
50+
51+
def _is_content(path: str) -> bool:
52+
"""True when a dev↔docs tree difference is site content (drift-worthy)."""
53+
if path in DOCS_ONLY_FILES or path in _NON_CONTENT_FILES:
54+
return False
55+
if path.startswith(_NON_CONTENT_DIRS):
56+
return False
57+
if path.startswith("support/") and not path.startswith("support/docs/"):
58+
return False
59+
return True
4060

4161

4262
def _docs_preview_dir() -> Path:
@@ -53,17 +73,17 @@ def _stable_version(dev_version: str) -> str:
5373

5474

5575
def _docs_drift_files(path: Path) -> list[str]:
56-
"""Content files differing between origin/dev and origin/docs.
76+
"""Site-content files differing between origin/dev and origin/docs.
5777
58-
Machinery files (DOCS_ONLY_FILES) are expected to differ and are
59-
filtered out; anything else means dev's doc content is not in docs.
78+
Machinery (DOCS_ONLY_FILES) and code paths (_NON_CONTENT_*) never appear
79+
in the site build, so they are not drift; anything else means dev's
80+
doc content is not in docs.
6081
"""
6182
out, _err, code = git(path, "diff", "--name-only",
6283
"origin/dev", f"origin/{DOCS_BRANCH}")
6384
if code != 0:
6485
return []
65-
return sorted(f for f in out.splitlines()
66-
if f and f not in DOCS_ONLY_FILES)
86+
return sorted(f for f in out.splitlines() if f and _is_content(f))
6787

6888

6989
def _docs_verdict(flag: str | None, target: str, drift: list[str]) -> str:

‎scripts/test_localpibox_release.py‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,16 @@ def test_docs_state_ready_then_stale(tmpdir):
136136
_g(clone, "commit", "-qm", "flag")
137137
_g(clone, "push", "-q", "origin", "docs")
138138
p1, p2 = _patch_release(clone, tmpdir)
139+
with p1, p2:
140+
assert rel._docs_release_state()["verdict"] == "ready"
141+
# code-only changes on dev do NOT invalidate the flag (the site
142+
# doesn't build them)
143+
_g(clone, "checkout", "dev")
144+
(clone / "scripts").mkdir(exist_ok=True)
145+
(clone / "scripts" / "tool.py").write_text("x = 1\n")
146+
_g(clone, "add", ".")
147+
_g(clone, "commit", "-qm", "code")
148+
_g(clone, "push", "-q", "origin", "dev")
139149
with p1, p2:
140150
assert rel._docs_release_state()["verdict"] == "ready"
141151
# doc content changes on dev after flagging → stale

0 commit comments

Comments
 (0)