Skip to content

Health v2: Snapshot v2 (v2 signal in the snapshot format) - #80

Merged
belarusian merged 2 commits into
mainfrom
build18/snapshot-v2
Aug 20, 2026
Merged

Health v2: Snapshot v2 (v2 signal in the snapshot format)#80
belarusian merged 2 commits into
mainfrom
build18/snapshot-v2

Conversation

@belarusian

Copy link
Copy Markdown
Owner

The snapshot format gains a v2 shape; old v1 snapshots still load.

  • fleet/health.py: ProjectHealth gains a defaulted health_v2: str | None = None field (last position, so existing keyword constructions stay valid).
  • fleet/snapshot.py: save_snapshot(healths, path, git_states=None) computes each row's health_v2 via classify_health_v2(days, last_outcome, git_state) when git_states is provided; _health_to_dict/_health_from_dict round-trip health_v2 (an old v1 snapshot without the key loads with health_v2=None); _field_changes surfaces a health_v2 -> fragment (- for None) via _fmt_v2, appended after the v1 health fragment.
  • fleet/cli.py: _cmd_snapshot passes git_states=_git_states(root) so a saved snapshot carries the v2 class.
  • tests/test_snapshot.py: +7 v2 tests (round-trip, none-without-git, old-v1-loads, diff v2 change/unchanged/none-to-set, canary classes).
  • tests/test_cli.py: snapshot-then-diff now surfaces health_v2 ->- transitions.

Gate: pytest 153 passed, ruff clean, mypy clean.

Closes #75 #76 #77 #78 #79

…es, v2 diff fragment

The snapshot format gains a v2 shape (old v1 snapshots still load).

- fleet/health.py: ProjectHealth gains a defaulted health_v2: str | None = None
  field (last position, so existing keyword constructions stay valid).
- fleet/snapshot.py: save_snapshot(healths, path, git_states=None) computes each
  row's health_v2 via classify_health_v2(days, last_outcome, git_state) when
  git_states is provided; _health_to_dict/_health_from_dict round-trip health_v2
  (an old v1 snapshot without the key loads with health_v2=None); _field_changes
  surfaces a health_v2 <a>-><b> fragment (- for None) via _fmt_v2, appended after
  the v1 health fragment.
- fleet/cli.py: _cmd_snapshot passes git_states=_git_states(root) so a saved
  snapshot carries the v2 class.
- tests/test_snapshot.py: +7 v2 tests (round-trip, none-without-git, old-v1-loads,
  diff v2 change/unchanged/none-to-set, canary classes).
- tests/test_cli.py: snapshot-then-diff now surfaces health_v2 <class>->- transitions.

Tickets: TICKET-068..072. Closes #75 #76 #77 #78 #79.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TICKET-068: ProjectHealth lacks a health_v2 field

1 participant