refactor(js): extract sync module from app.js monofile (§3.1)

Second slice of the app.js split (after crypto). Moves the WebDAV sync
section to js/app.sync.js: transport (_webdavCall), buildSyncSnapshot,
applyRemoteSnapshot (merge + tombstone arbitration), runSyncNow, and the
sync settings UI.

- Byte-for-byte identical to the extracted block (verified before removal);
  no duplicate const; no top-level sync reference left in app.js.
- Load order: AFTER app.js (unlike crypto, which loads before) because this
  module has a top-level side effect — `Bridge.onWebdavResult = …` — that
  needs Bridge/state/api already declared. Rule documented in CLAUDE.md.
- index.html + BuildAssets whitelist + harness APP_PARTS updated; assets
  rebuilt to embed the new file.
- Safety net: the existing merge tests exercise applyRemoteSnapshot /
  buildSyncSnapshot from the extracted file and stay green (42/42).

app.js: 11936 → 11256 lines (crypto + sync now separate).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
r-zakarya
2026-07-05 16:09:02 +01:00
parent 4ffbd63893
commit 2d309f8988
10 changed files with 631 additions and 600 deletions
+8 -5
View File
@@ -224,11 +224,14 @@ seulement au runtime).
chargés dans l'ordre via `<script>` séparés — **pas de bundler ES/esbuild**
(les classic scripts partagent l'environnement lexical global, donc zéro
réécriture des call-sites, risque quasi nul vs conversion en modules ES).
-`js/app.crypto.js` extrait (KDF, verifier, AES-GCM) — vérifié
byte-for-byte identique à l'original, 42 tests verts, pas de `const`
dupliqué. Pattern + règles documentés dans CLAUDE.md « Découpage frontend ».
- Reste à extraire (grosses sections cohésives) : sync, slideover,
settings, quicksearch, autofill…
-`js/app.crypto.js` extrait (KDF, verifier, AES-GCM) — byte-for-byte
identique, 42 tests verts, pas de `const` dupliqué. Chargé AVANT app.js.
-`js/app.sync.js` extrait (WebDAV, snapshot, merge `applyRemoteSnapshot`)
— byte-for-byte identique, couvert par les tests merge, chargé APRÈS app.js
(effet de bord top-level `Bridge.onWebdavResult`). Pattern + règles d'ordre
documentés dans CLAUDE.md « Découpage frontend ».
- Reste à extraire (grosses sections cohésives) : slideover, settings,
quicksearch, autofill, auto-backup…
-`node --check` en pré-étape de `BuildAssets.ps1` : **déjà fait** (cf. §3.2).
### 3.2 🟡 Aucun test automatisé — **partiellement adressé (2026-07-04)**