fix(career): hours polish — recency stamp + non-2xx POST is a failure (#947)

CodeRabbit follow-up on #942:

- add_play_seconds() now stamps last_played_at (like touch_position):
  an unscored play that ran to the natural end WAS played — recent /
  Continue ordering must see it. Resume position stays untouched.
- stats-recorder post() treats non-2xx as failure: a 4xx/5xx JSON error
  body parsed as an object read as success, silently dropping the
  accrued seconds instead of re-queuing them.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Byron Gamatos
2026-07-13 15:31:12 +02:00
committed by GitHub
co-authored by Claude Fable 5
parent b85496fe58
commit 3e57ba0345
3 changed files with 19 additions and 4 deletions
+2
View File
@@ -480,6 +480,8 @@ def test_seconds_only_post_accrues_without_touching_position(client):
# overwrite Continue with the end-of-song offset).
assert row["plays"] == 0
assert row["last_position"] == pytest.approx(42.0)
# But the song WAS played — recency ordering must see it.
assert row["last_played_at"]
# Still counts as playing today for the streak.
assert r.json()["progress"]["current_streak"] == 1