Rework history: opened + replaced only, with per-item removal

History was logging every article merely displayed, which made it noise. Split
the two concepts cleanly:
- "displayed" (seenIds) still tracks everything shown, but only to stop Replace
  recycling stories — it no longer feeds history.
- "history" now records only deliberate events: articles the user OPENED (card
  click) or ones they REPLACED away (recoverable accidental swaps).

Also: per-item removal (× in the History panel; DELETE /api/history/{id}), and
when signed in the panel shows the account (cross-device) history. First-sign-in
import now folds the meaningful history (not everything shown). Copy updated.
115 tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
jay
2026-06-03 13:27:39 +00:00
parent 409bb11444
commit 1aa250ca67
4 changed files with 88 additions and 40 deletions
+3
View File
@@ -67,3 +67,6 @@ def test_history_and_import(client):
tc.post("/api/import", json={"seen": [3], "saved": [1, 999]})
assert {a["id"] for a in tc.get("/api/history").json()["items"]} == {1, 2, 3}
assert tc.get("/api/saved/ids").json() == [1]
# granular removal from history
tc.delete("/api/history/2")
assert {a["id"] for a in tc.get("/api/history").json()["items"]} == {1, 3}