Skip to content

Commit bf01852

Browse files
authored
Merge pull request #14 from PyAutoLabs/feature/build-pulse-agent-separation
readiness: workspace validation is advisory (YELLOW), not a hard block
2 parents c0eebca + 6701db6 commit bf01852

2 files changed

Lines changed: 28 additions & 18 deletions

File tree

pulse/readiness.py

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,17 @@
1111
The verdict uses STRICT release gates:
1212
1313
- **RED** (a real blocker) if any of the 5 libraries has failing CI, is off
14-
``main``, has uncommitted source changes, or is behind origin; or the latest
15-
Build test run is ``ready == false``; or any workspace is pinned AHEAD of its
16-
installed library, has a ``general.yaml`` ↔ ``version.txt`` MISMATCH, or an
17-
unparseable (BAD) version; or the deep install verification last reported
18-
``ready == false``.
19-
- **YELLOW** (caution) for soft signals: script-timing regressions, stale open
20-
PRs, stale parked scripts, a workspace pinned BEHIND, a stale or never-run
21-
install verification, and — crucially — any *unknown* (missing test-run
22-
report, a library absent from the snapshot). An unknown is never silently
23-
treated as green and never escalated to red.
14+
``main``, has uncommitted source changes, or is behind origin; or any workspace
15+
is pinned AHEAD of its installed library, has a ``general.yaml`` ↔
16+
``version.txt`` MISMATCH, or an unparseable (BAD) version; or the deep install
17+
verification last reported ``ready == false``.
18+
- **YELLOW** (caution) for soft signals: workspace-validation not passing (the
19+
workspace scripts/notebooks carry standing debt, so this is advisory — never a
20+
hard block), script-timing regressions, stale open PRs, stale parked scripts, a
21+
workspace pinned BEHIND, a stale or never-run install verification, and —
22+
crucially — any *unknown* (missing test-run report, a library absent from the
23+
snapshot). An unknown is never silently treated as green and never escalated to
24+
red.
2425
- **GREEN** otherwise.
2526
2627
Red dominates yellow structurally: reasons are collected into separate lists
@@ -61,7 +62,7 @@
6162
"lib_branch": (15, 30),
6263
"lib_dirty": (15, 30),
6364
"lib_behind": (20, 40),
64-
"test_not_ready": (40, 40),
65+
"test_failing": (15, 15),
6566
"skew_ahead": (25, 50),
6667
"lib_unknown": (10, 30),
6768
"test_unknown": (10, 10),
@@ -164,8 +165,14 @@ def hit(key: str, n: int = 1) -> None:
164165
if isinstance(test_run, dict) and "ready" in test_run:
165166
ready = test_run.get("ready")
166167
if ready is False:
167-
red.append(f"test run not ready ({test_run.get('run_label', '?')})")
168-
hit("test_not_ready")
168+
# Workspace scripts/notebooks carry standing debt; failing validation
169+
# is advisory (YELLOW), not a release blocker. Real blockers are the
170+
# library CI / install / version-skew gates above.
171+
yellow.append(
172+
f"workspace validation not passing "
173+
f"({_as_int(test_run.get('failed', 0))} failed, {test_run.get('run_label', '?')})"
174+
)
175+
hit("test_failing")
169176
elif ready is True:
170177
age = _age_days(test_run.get("ts"), ref)
171178
if age is not None and age > TEST_STALE_DAYS:

tests/test_readiness.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,14 @@ def test_test_run_fresh_ready_is_green():
7171
assert v["verdict"] == "green"
7272

7373

74-
def test_test_run_not_ready_is_red():
75-
v = compute(make_snapshot(test_run={"ready": False, "run_label": "x"}))
76-
assert v["verdict"] == "red"
77-
assert any("test run not ready" in r for r in v["red_reasons"])
78-
assert v["score"] == 60
74+
def test_test_run_failing_is_yellow_not_red():
75+
# Workspace scripts carry standing debt — failing validation is advisory.
76+
v = compute(make_snapshot(test_run={"ready": False, "failed": 9, "run_label": "x"}))
77+
assert v["verdict"] == "yellow"
78+
assert not v["red_reasons"]
79+
assert any("workspace validation not passing" in r and "9 failed" in r
80+
for r in v["yellow_reasons"])
81+
assert v["score"] == 85
7982

8083

8184
def test_version_skew_ahead_is_red():

0 commit comments

Comments
 (0)