# 900 — Decisions

Created: 2026-11-06
Updated: 2026-11-11

All decisions of Standa (S1–S27) and the shared technical decisions (T1–T23) are in WEB
`/Users/chudy/Documents/Projector/Projects/milionar/docs/plan/account-sync/01-decisions.md` — the only place for
them. Never reopen them; if a fact contradicts one, stop and ask Standa.

Most important for the addon side:

| # | In short |
|---|---|
| S2 | account optional; offered first in the onboarding; declined → classic TMDb path |
| S3, S4 | sign-in = clean switch; local data backed up and restored; reload without restarting Kodi |
| S5 | keys delivered hidden; key management in Kodi inactive while signed in |
| S7 | appearance, rows, menu per device — skin settings never synchronised |
| S13, S25 | Pro tebe from the server when signed in; local engine when the server does not answer; signed out unchanged |
| S15 | no migration from old versions at all (incl. `migrate_ai_models`); old files left alone |
| S16, S17 | Kodi mirror removed; old Kodi records left alone |
| S21 | Kráska and StreamCinema removed forever |
| S26 | reset while signed in = account-wide, huge warning |
| S27 | several devices at once, last saved position wins, races handled perfectly |

## Addon-only technical decisions

| # | Topic | Decision | Why |
|---|---|---|---|
| K1 | Where the sync runs | One service thread `milionar-sync`; plugin processes only write the store (+ outbox in the same transaction) | plugin calls stay as fast as today |
| K2 | Store hook | `store.py` stays the only SQL module; ops are recorded inside its transactions | atomicity (T5) |
| K3 | Signed out | `wcs.account` beyond `state.py` is never imported | no cost for users without an account |
| K4 | Outbox order (2026-11-06) | `sync.push_once` sends the outbox strictly in queue order: a newer op waits while an older one is in back-off | found by the simulator (a channel delete overtook its create) |
| K5 | Skipped rows (2026-11-06) | Keys skipped while an own op was queued, and keys of `rejected`/`duplicate` answers, are kept in `sync_state.skipped` and fetched again (`POST sync/rows`) before the next long-poll; `acked` holds the per-op revision and is cleared by every bootstrap | WEB T29 |
| K6 | Cursor after documents (2026-11-06) | `apply.apply_page` stores the cursor after the documents are applied (both applies are idempotent) | a stop in between lost channel changes |
| K7 | Interrupted sign-out (2026-11-06) | a journal in `logout`/`flush` resumes with the server logout and the `restore` | a kill there left a revoked token in a "signed-in" device |
| K8 | Webshare ready (2026-11-06) | `user_data.webshare_ready`: login, or a signed-in account with its session token | WEB T28 |
| K9 | Webshare token of the account comes back (2026-11-07) | A signed-in device without its own Webshare login fetches the account's keys again (`secrets.restore_webshare_token`, at most once a minute) when its token is missing or Webshare refuses it (`WebshareClient.revalidate`, `user_data.webshare_ready`); the legacy `action=settings` keeps a token-only account's token; the onboarding counts the account's token as Webshare | Standa 2026-11-07: signed in, Webshare said to enter the account; `action=settings` wiped the token (reproduced live) |
| K10 | Background progress of the account (2026-11-07) | `wcs/account/progress.py` in the service: after a sign-in (`account_changed`) and for a pulled page or resync of ≥ 50 changes a `DialogProgressBG` "Účet Milionář" shows the phases (changes, then `Připravuji Home: x z y` from `journal._build_pending`) and closes when nothing is held and Home is idle 2 s; never during playback, at most 10 min. Idle (2.1.143, Standa 2026-11-09: Pokračovat of Pro tebe filled silently after the bar): the journal builds nothing, no title's data (`library:`, `svc:` jobs of `wcs/skin/service.py`, `titles_left()`) is queued or fetched, no changed row waits for publication, no Pro tebe build runs in any process (`foryou.lock`, `foryou.service.building()`); while only titles come the bar says `Načítám tituly: zbývá N` (36060). A sign-in inside the first-run guide opens the bar when the guide ends (`onboarding.launch.account_home`) | Standa 2026-11-07: 1B, 2A, 3B; 2026-11-09 |
| K11 | Push limits (2026-11-09) | `sync.push_once` sends ≤ 512 kB per request (`BATCH_BYTES`), halves on 413, drops one op the server can never take; the sync threads back off on unexpected errors (no log every 0.5 s) | WEB T38 |
| K12 | Bar after sign-out (2026-11-09) | a sign-out closes the account's „Připravuji Home“ bar and the bar ends when the guide covers Home | seen in Windows Kodi |
| K13 | History deletions (2026-11-11) | Apply `play_log` tombstones by deleting exactly the named UUID and dirtying `recent_played` once; repeated tombstones are no-ops. Required for complete history editing via the Milionář MCP plugin. | The server emitted deletions but `_play_log` ignored them; focused `test_play_log_delete.py`. Release tracked in WEB `docs/plan/chatgpt-plugin/11-status.md`. |

(A05.6 adds the long-poll decision here.)
