feat(health): add pure classify_health_v2 (four classes, most-severe-wins) - #66
Merged
Conversation
…wins) Add classify_health_v2(days, last_outcome, git_state) -> str to fleet/health.py: a PURE function returning one of stranded/active/paused/dead (most-severe-wins: stranded > active > paused > dead). Add module constant DEAD_MIN_DAYS = 30 (reuse ACTIVE_MAX_DAYS = 7) and import GitState from fleet.gittest. Semantics: - stranded = unmerged build* branch OR unpushed commits (any recency) - active = recent (<=7d) AND work in flight (last outcome max_steps_reached) - paused = recently touched but done, or 8-29d idle, nothing in flight - dead = 30+ days untouched AND nothing in flight, or no activity signal Only max_steps_reached counts as work in flight. NOT wired into assess this cycle. Update the module docstring to document the v2 scheme and note the deliberate v1/v2 30-day boundary divergence (v1 dead > 30, v2 dead >= 30). Add 16 hermetic unit tests (tests/test_health.py) covering all acceptance cases including the 7d/30d boundaries and the alloc-pipeline / deepseek-deharness canaries. No other fleet/ source file changed. Tickets: TICKET-055 (core), TICKET-056 (tests), TICKET-058 (docstring), TICKET-059 (30-day boundary note). TICKET-057 (export gittest in __init__.py) is recorded but deferred (out of scope: no other fleet/ source file changed). Closes #64, #65
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cycle 15 — Health v2: Outcome + Classify
Adds the v2 health classifier to
fleet/health.pyas a PURE function (module + tests only; NOT wired intoassess— that is Cycle 17).What
classify_health_v2(days: int | None, last_outcome: str | None, git_state: GitState) -> str— returns exactly one ofstranded/active/paused/dead(most-severe-wins: stranded > active > paused > dead).DEAD_MIN_DAYS = 30(reuses existingACTIVE_MAX_DAYS = 7).from fleet.gittest import GitState(the git-side input from Cycle 14).Semantics (pinned by tests)
build*branch OR unpushed commits on main, regardless of recencymax_steps_reached)Only
max_steps_reachedcounts as work in flight. The v2 dead boundary is>= 30while v1's is> 30— intentionally different, documented, not unified.Tests
16 hermetic unit tests in
tests/test_health.py(constructGitState(...)directly — no git subprocess, notmp_path, nofourseer), covering all 16 acceptance cases including the 7d/30d boundaries and the alloc-pipeline / deepseek-deharness canaries. No existing v1 test modified or removed.Gate
pytest tests/— 133 passed (was 117)ruff check fleet/— cleanmypy fleet/ --ignore-missing-imports— clean (8 source files)Out of scope (deferred)
TICKET-057 (export
gittestinfleet/__init__.py) is recorded but deferred — the briefing forbids changing any otherfleet/source file this cycle.Closes #64, #65