обновленная синхронизация клиента

This commit is contained in:
2026-10-04 21:15:18 +04:00
parent d3d19bfaeb
commit 18c8e07744
8 changed files with 749 additions and 249 deletions
+34 -7
View File
@@ -137,7 +137,8 @@ Path safety rules:
## Ignored Directories
The launcher excludes these top-level directories from verification:
Unmanaged files in these directories outside `Data/` and `WoW/Data/` are
preserved and excluded from verification:
- `Cache`
- `Errors`
@@ -145,6 +146,8 @@ The launcher excludes these top-level directories from verification:
- `Screenshots`
- `WTF`
- `benilla-config`
- `.moonwell_launcher`
- `Interface/AddOns`
Files under these directories:
@@ -152,15 +155,35 @@ Files under these directories:
- do not participate in local `buildHash`
- are not compared against server manifest
Inside `Data/` and `WoW/Data/`, the manifest is authoritative for every file,
including nested files whose names contain `wtf`, `cache`, or `addons`.
The exclusions above do not exempt files inside Data from cleanup.
## Local Scan
For every non-ignored file in the installation directory, the launcher computes:
For every existing manifest file in the installation directory, the launcher computes:
- normalized relative path
- file size in bytes
- file `sha256`
The result is stored as a `ClientInstallationSnapshot`.
The result is stored as a `ClientInstallationSnapshot`. Paths are always relative
to the selected installation root, including files in nested directories.
The scan separately collects stale paths without hashing their contents:
- every file absent from the manifest in `Data/` and `WoW/Data/`
- `WoW.exe` and `*.dll` absent from the manifest directly in the installation
root or `WoW/` (binary names are matched without case sensitivity)
- unused Data subdirectories, ordered after their children; the Data roots and
directories needed by manifest files are retained
These paths do not contribute to `buildHash`, but prevent sync from completing
until cleanup and final verification succeed. Other unmanaged files are preserved.
On Windows, manifest membership checks for cleanup ignore path letter case.
Directory links are not traversed during cleanup. Links absent from the manifest
inside Data are removed as links, and deletion through a parent pointing outside
the installation is rejected. Directory deletion is never recursive.
## Hash Cache
@@ -224,15 +247,15 @@ The current sync flow is:
2. Scan local installation.
3. Compute local `buildHash`.
4. Compare local files to manifest files by `path`, `size`, and `sha256`.
5. Identify stale local files that are not present in the manifest.
5. Identify stale paths in the cleanup areas described above.
6. If local `buildHash` matches server `buildHash` and there are no stale files
and no mismatches, finish successfully.
7. Delete stale local files outside ignored directories.
7. Delete stale paths, including unused Data subdirectories after their children.
8. Download changed and missing files.
9. Verify every downloaded file by `sha256`.
10. Re-scan the installation.
11. Recompute local `buildHash`.
12. Fail if final snapshot still differs from manifest.
12. Fail if final snapshot still differs from manifest or stale paths remain.
## Pause and Resume Semantics
@@ -295,8 +318,12 @@ The automated tests cover:
- deterministic `buildHash`
- path normalization used by `buildHash`
- exclusion of ignored directories during local scan
- preservation of user state and unrelated unmanaged files during cleanup
- removal of unmanaged Data files, unused subdirectories, WoW.exe, and DLLs
- preservation of manifest-listed DLLs and WoW.exe
- cache cleanup behavior
- safe path resolution
- sync flow with fully up-to-date client
- sync flow with stale files and changed files
- cleanup when all manifest files are already up to date
- rejection of stale paths remaining after final verification