Skip to content

fix: Bugsweep 2026-11-14 – update/two_way-Datenverlust, Umlaut-Suche, Vorschau - #7

Open
lukisch wants to merge 18 commits into
masterfrom
fix/bugsweep-20261114
Open

lukisch wants to merge 18 commits into
masterfrom
fix/bugsweep-20261114

Conversation

@lukisch

@lukisch lukisch commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator

Ich habe nach Skill bugsweep und bugfix-protocol gearbeitet. Jeder Fix hat einen Test, der vorher rot war, und eine reale Prüfung.

Behobene Fehler

# Fehler Commit
1 Modus update überschrieb eine am Ziel später bearbeitete Datei mit der älteren Quelle, lokal und per SFTP. Laut Doku überträgt update nur neuere Dateien f5c94a1
2 Dateiverbindungen: Der Dialog bietet two_way an, der Worker kopierte aber immer Quelle → Ziel. Eine Bearbeitung am Ziel ging verloren d3f48b8
3 Reader-Suche: SQLite-lower()/LIKE falten nur ASCII, deshalb fand „Übersicht“ nicht „Übersicht.pdf“ 9bcc927
4 Reader-Vorschau: Windows-ANSI-Texte zeigten Ersatzzeichen statt Umlauten und € ff8f589

Dazu kommen:

  • Doku zu two_way an das tatsächliche Verhalten angepasst (bde0e01): Konfliktregel der Verbindung, Standard source; Löschungen werden nicht übertragen.
  • BEFUNDE.md ist nicht mehr versioniert (7b9a690). Das interne Befundlog lag in diesem öffentlichen Repo, die OneDrive-Kopie ist bytegleich.

Verifikation

  • pytest: 277 passed, 3 skipped (vorher 270).
  • Reale Prüfung über die Headless-CLI (--run):
    • Eine update-Verbindung meldet „Übersprungen (Ziel neuer)“ und behält die Bearbeitung am Ziel.
    • Eine two_way-Dateiverbindung übernimmt die neuere Fassung vom Ziel zurück.

Offen

Der Sweep ist noch nicht abgeschlossen (Grundrate 18). Weitere Funde kommen als Commits in diesen PR.

Gemergt wird nach der Zweitprüfung durch eine andere Instanz.

🤖 Generated with Claude Code

https://claude.ai/code/session_01THB2EzUDHN8Rq5fvjMqkBL

Lukas Geiger and others added 6 commits November 14, 2026 18:43
Agent-internal findings logs do not belong in the public repo (GITHUB-POLICY section 3). The file stays on disk; the OneDrive project copy is byte-identical (SHA-256 b7131f01...). History is not rewritten.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01THB2EzUDHN8Rq5fvjMqkBL
USER_GUIDE and both READMEs describe "update" as "transfers only newer
(and missing) files". The folder worker and the SFTP target treated
update exactly like one_way: any size/mtime difference copied source
to target, so a file edited later on the target side was overwritten
with the older source version - silent data loss.

In update mode a target that is newer than the source (beyond the
existing 1 s tolerance) is now skipped and counted as skipped; the
SFTP target applies the same rule. mirror and one_way are unchanged.

Tests red before the fix (target edit replaced by "alte Fassung";
SFTP uploaded the older file). pytest 273 passed. Real smoke: the
headless CLI (--run) prints "Übersprungen (Ziel neuer)" and keeps the
target edit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01THB2EzUDHN8Rq5fvjMqkBL
The file connection dialog offers "one_way" and "two_way", but
FileSyncWorker ignored the mode and always copied source -> target.
With "two_way", an edit made on the target side was overwritten by
the older source on the next sync.

For two_way, a target that is newer than the source (beyond the 1 s
tolerance) is now copied back to the source; size and checksum checks
follow the actual copy direction. Connections with a WAL checkpoint
stay one-way (the dialog already forces one_way for WAL databases).
one_way remains a plain backup.

Test red before the fix; pytest 274 passed. Real smoke: headless CLI
with a two_way file connection reports "Ziel ist neuer - übernehme
zurück" and both sides hold the target edit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01THB2EzUDHN8Rq5fvjMqkBL
two_way follows the connection's conflict policy (default source, chosen on purpose for database safety), not automatically the newest file, and does not propagate deletions. README (en/de/es), USER_GUIDE and CHANGELOG updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01THB2EzUDHN8Rq5fvjMqkBL
The index search lower-cased the term in Python but compared it with
SQLite lower()/LIKE, which only fold ASCII. "Übersicht" or
"übersicht" therefore never matched "Übersicht_2026.pdf" - in German
Ä/Ö/Ü at the start of a name are common (Änderung, Übersicht,
Ölrechnung).

The connection registers a deterministic Python casefold() and both
sides are compared casefolded.

Test (real ConnectionDB index + SearchWorker) red before the fix;
pytest 275 passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01THB2EzUDHN8Rq5fvjMqkBL
The index reader previewed text files as UTF-8 with errors="replace":
typical Windows ANSI files (cp1252) showed every umlaut, "€" and
„“/– as "?"-replacement characters. The preview now decodes UTF-8
(with BOM) first and falls back to cp1252; an incremental decoder
keeps a long UTF-8 file UTF-8 even when the 12 kB read ends inside a
multi-byte character.

Tests red before the fix (ANSI file shown as "Pr?fbericht ..."); the
long-UTF-8 case guards the read boundary. pytest 277 passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01THB2EzUDHN8Rq5fvjMqkBL
@github-actions

Copy link
Copy Markdown

Welcome! 👋 Thanks for your first pull request in this repository.

A maintainer will review it soon. Please make sure:

  • Your changes are tested
  • Documentation is updated if needed
  • The PR description explains what and why

Thanks for contributing!

Folder sync compared relative paths case-sensitively, but Windows file
systems are case-insensitive. With "bericht.pdf" on the target and
"Bericht.pdf" in the source, mirror planned COPY_L2R and DELETE_R for
the same physical file; the set iteration order decided whether the
delete ran last. Measured on Windows: the target ended up empty in 3
of 6 runs, reported as success. two_way could likewise copy the old
target over the edited source.

The comparison moves into plan_folder_actions(), which matches paths
by os.path.normcase (case-insensitive on Windows) and iterates in a
stable order. Behaviour is otherwise unchanged; the target keeps its
old spelling (Windows keeps the existing name on replace) but gets
the current content.

Tests: plan test (no delete for case-only differences, all modes) and
a Windows end-to-end test across six hash seeds - red before the fix
(empty target for seed 1). pytest 279 passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01THB2EzUDHN8Rq5fvjMqkBL
@lukisch

lukisch commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator Author

Neu hinzugekommen:

# Fehler Commit
5 Mirror leerte das Ziel bei reiner Groß-/Kleinumbenennung. Pfade wurden case-sensitiv verglichen, Windows ist aber case-insensitiv. Für dieselbe Datei waren Kopieren und Löschen geplant; je nach Reihenfolge der Hash-Werte war das Ziel unter Windows danach leer (3 von 6 Läufen) – bei gemeldetem Erfolg. cb7e5eb

Die Planung liegt jetzt in plan_folder_actions(): Abgleich per os.path.normcase, stabile Reihenfolge. Ein Test über 6 Hash-Seeds war vorher rot (leeres Ziel). pytest 279 passed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01THB2EzUDHN8Rq5fvjMqkBL

Lukas Geiger and others added 2 commits November 14, 2026 19:13
…rker

Checked during the bugsweep (no defect found): the worker returns without its own emit on stop, but the thread end still triggers worker_finished. The guard runs in a subprocess because the main window needs a QApplication.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01THB2EzUDHN8Rq5fvjMqkBL
The logger (created on import), ProSync_config.json and the Reader's
search_config.json were written next to the program or into the
current directory. In the MSIX/Store package the install folder
(Program Files/WindowsApps) is read-only, so the Store version would
have stopped with PermissionError while importing the logger, before
any window opened. The Reader is launched with cwd = install folder.

prosync_utils.is_msix_packaged() asks GetCurrentPackageFullName;
user_data_dir() keeps everything beside the program when unpackaged
(unchanged for source and portable runs) and uses %APPDATA%/ProSync
inside the package, like the sync reports already do. Main config,
logger and Reader use it; the Reader path is anchored to its program
folder instead of the working directory.

Tests red before the fix; pytest 284 passed. Unpackaged real start
checked; a real MSIX install is still needed before release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01THB2EzUDHN8Rq5fvjMqkBL
@lukisch

lukisch commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator Author

Nachtrag (2 Commits):

  • 9599da4 – Store-Start-Blocker: Logger (wird schon beim Import angelegt), ProSync_config.json und die search_config.json des Readers wurden im Programmordner bzw. im Arbeitsverzeichnis geschrieben. Im MSIX-Paket ist der Installationsordner (WindowsApps) schreibgeschützt; die Store-Version wäre deshalb noch vor dem ersten Fenster mit PermissionError abgebrochen. Neu: is_msix_packaged() (über GetCurrentPackageFullName) und user_data_dir(). Ohne Paket bleibt alles beim Alten, im Paket wird %APPDATA%/ProSync genutzt, wie schon bei den Sync-Reports. Die Tests waren vor dem Fix rot. Eine echte MSIX-Installation steht vor dem Release noch aus.
  • 4956beb – Wächtertest: Nach dem Abbruch eines Batches werden Warteschlange, Start-Button und Worker freigegeben. Der Test hat keinen Fehler gefunden und sichert das Verhalten ab.

pytest: 284 passed, 3 skipped.

🤖 Generated with Claude Code

https://claude.ai/code/session_01THB2EzUDHN8Rq5fvjMqkBL

…json

The scan (default mode of manage_translations.py) caught a JSON or
read error, continued with an empty catalog and atomically wrote back
only the newly found keys, exiting 0. A merge-conflict marker in
locales/translations.json thereby silently dropped every translation
(reproduced from the CLI). Same pattern as promptboard#4.

An unreadable file or a non-object root now prints [FAIL], leaves the
file untouched and exits 1; a missing file is still created.

Test red before the fix; real CLI run on a conflicted file keeps it
unchanged; pytest 286 passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01THB2EzUDHN8Rq5fvjMqkBL
@lukisch

lukisch commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator Author

Nachtrag 37f6f17: Der Übersetzungs-Scan (manage_translations.py) hat eine kaputte translations.json, etwa mit Merge-Konfliktmarker, durch die neu gefundenen Schlüssel ersetzt und Exit 0 gemeldet. Damit waren alle Übersetzungen weg; über die CLI nachgestellt. Jetzt gibt es [FAIL] und Exit 1, die Datei bleibt unverändert. Der Test war vor dem Fix rot, pytest hat 286 passed. Dasselbe Muster wie promptboard#4.

🤖 Generated with Claude Code

https://claude.ai/code/session_01THB2EzUDHN8Rq5fvjMqkBL

Lukas Geiger and others added 2 commits November 14, 2026 21:12
…er wakes early

QTimer's default CoarseTimer may wake up to 5 % of the interval early
(Qt docs) - for a 20 h wait up to one hour. _on_daily_timer then ran
the sync before the configured time and re-armed the timer for the
same, still upcoming slot, so it ran a second time shortly after. A
wall-clock change between arming and firing had the same effect.

The daily timer now uses PreciseTimer (never early per Qt docs) and
remembers its due instant; a timer that fires before it only re-arms
for the same slot without syncing. The measured instant is passed on
when re-arming so it is read once per firing.

Test red before the fix (first PreciseTimer, then the early-wake sync);
real event-loop smoke: one sync at the due time, next timer 86399 s;
pytest 287 passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01THB2EzUDHN8Rq5fvjMqkBL
The service worker is cache-first. CACHE_NAME stayed at v2 since
2026-06-16 while app.js, index.html and app.css changed (last on
2026-11-05, six-language update), library.js and the manifest too.
Browsers install a new worker only when sw.js changes, so installed
companions kept serving the June shell.

CACHE_NAME -> v3 plus ASSET_HASH over the shipped app files; a node
test fails whenever an app file changes without a new hash, so the
cache cannot fall behind again (same guard as DokuReader). The old
test pinning "v2" now accepts any version.

Guard test red before the fix; npm test 36 pass; real headless
Chromium run registers the worker and caches the full shell under v3;
pytest 287 passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01THB2EzUDHN8Rq5fvjMqkBL
@lukisch

lukisch commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator Author

Nachtrag (2 weitere Fixes):

  • 2090e4c – Tages-Autosync lief zu früh und doppelt: Laut Qt-Doku darf der Standard-CoarseTimer bis zu 5 % des Intervalls zu früh aufwachen, bei 20 Stunden also bis zu einer Stunde. Dann lief der Sync vor der eingestellten Zeit, und der Timer wurde auf denselben, noch kommenden Termin gestellt; ein zweiter Lauf folgte kurz danach. Jetzt nutzt der Timer PreciseTimer, und ein Terminschutz stellt ihn bei zu frühem Aufwachen nur neu. Der Test war vor dem Fix rot. Ein Smoke mit echter Qt-Ereignisschleife ergibt einen Sync zum Termin, danach steht der Timer auf 86 399 s.
  • 19ccb04 – Web-Companion bekam keine Updates: CACHE_NAME stand seit Juni auf v2, obwohl sich app.js, index.html und app.css zuletzt am 05.11. geändert haben. Installierte Companions sahen die Sechs-Sprachen-Fassung deshalb nie. Jetzt gibt es v3 und einen ASSET_HASH-Wächter, denselben wie in DokuReader. In headless Chromium registriert sich der Worker und cacht die vollständige App-Shell unter v3.

pytest 287 passed, npm test 36 pass.

🤖 Generated with Claude Code

https://claude.ai/code/session_01THB2EzUDHN8Rq5fvjMqkBL

Lukas Geiger and others added 3 commits November 14, 2026 21:27
Mirror deletes every remote file that is missing in the source. The
target was only checked for being non-empty, so "/" (server root) or
"."/"~" (the login directory) were accepted. A mirror into the home
deletes .ssh/authorized_keys and locks ProSync itself out of the
server; reproduced with the SFTP fake: the old code removed
/home/u/.ssh/authorized_keys on a mirror to "/".

validate_sftp_connection now rejects mode "mirror" for these targets
with a clear message (dialog, safety check and worker all route through
it); "update" deletes nothing and stays allowed.

Tests red before the fix; pytest 294 passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01THB2EzUDHN8Rq5fvjMqkBL
… ignored

A new search or preview called terminate() on the running worker - Qt
calls this dangerous; on Windows it is TerminateThread and can kill the
thread inside SQLite or pypdf while it holds the GIL. The old worker
also stayed connected: late results from the previous search were
appended to the new list and an old preview overwrote the new one, and
the dropped Python reference let a still-running QThread be destroyed.

Retired workers now finish on their own and stay referenced until
then; results, preview and status are only taken from the current
worker (sender check); closing waits briefly for running workers.

Scenario test red before the fix (stale hit shown, old preview shown,
terminate called); real run with worker threads and a 301-row index:
only the second search's hit, no leftover workers; pytest 295 passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01THB2EzUDHN8Rq5fvjMqkBL
…rting

"Beenden" in the tray menu (force_quit) called QApplication.quit()
right away. A running sync worker kept running, Qt destroyed the live
thread during shutdown and the process aborted (reproduced: exit code
127, worker still running after app.exec() returned); the sync was cut
off mid-run.

force_quit now requests the stop and quits once the worker has stopped
at its next safe point (non-blocking, UI stays responsive); without a
running sync it quits immediately as before.

Scenario test red before the fix; pytest 296 passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01THB2EzUDHN8Rq5fvjMqkBL
@lukisch

lukisch commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator Author

Nachtrag (3 weitere Fixes):

  • 2bb1a87 – SFTP-Spiegel auf / oder ./~ gesperrt: Der Spiegel löscht am Ziel alles, was in der Quelle fehlt. In der Server-Wurzel oder im Login-Verzeichnis hätte er unter anderem .ssh/authorized_keys gelöscht, danach kommt ProSync selbst nicht mehr auf den Server. Mit dem SFTP-Fake nachgestellt: Der alte Code hat authorized_keys gelöscht. „update“ bleibt erlaubt.
  • b0ee5cd – Reader: Laufende Such- und Vorschau-Worker wurden mit QThread.terminate() beendet, und ihre späten Ergebnisse landeten trotzdem in der Liste: veraltete Treffer, alte Vorschau über der neuen. Jetzt laufen sie aus, und eine sender()-Prüfung verwirft ihre Ergebnisse. Das Szenario war vor dem Fix rot; ein Lauf mit echten Threads zeigt nur den Treffer der zweiten Suche.
  • 83acb2d – Tray-„Beenden“ während eines Syncs: Der Prozess brach mit Exitcode 127 ab, weil Qt den laufenden Thread beim Aufräumen zerstört hat, und der Sync wurde abgeschnitten. Jetzt wird erst der Stopp angefordert und nach dem nächsten sicheren Punkt beendet.

pytest 296 passed; die CI der vorherigen Commits ist auf Linux und macOS grün.

🤖 Generated with Claude Code

https://claude.ai/code/session_01THB2EzUDHN8Rq5fvjMqkBL

With indexing enabled and the default path, profiler_index.db lives in
the source folder. The folder worker copied this database - open and
written during the run - into the backup target, and in two_way a newer
foreign index at the target (a second PC syncing to the same NAS) was
scheduled to be copied back over the live one (it only failed because
the file was open).

The worker now drops its own index database and its -wal/-shm/-journal
files from both scanned trees (exact relative path, not a name
pattern), whether it lives in the source or the target.

Test red before the fix in mirror and two_way; real run: the target
only holds the documents; pytest 298 passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01THB2EzUDHN8Rq5fvjMqkBL
@lukisch

lukisch commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator Author

Nachtrag 4963242: Bei Indexierung mit Standardpfad liegt profiler_index.db in der Quelle. Der Ordner-Sync hat diese offene, laufend beschriebene DB ins Backup-Ziel kopiert. Bei „two_way“ war außerdem geplant, eine neuere fremde Index-DB aus dem Ziel über die eigene zu kopieren (zweiter Rechner, gleiches NAS-Ziel); das scheiterte nur an der Dateisperre. Jetzt nimmt der Worker seine eigene Index-DB samt -wal/-shm/-journal über den exakten relativen Pfad aus beiden Bäumen. Der Test war in beiden Modi rot, pytest hat 298 passed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01THB2EzUDHN8Rq5fvjMqkBL

…ports

- The file connection dialog rebuilt its result from scratch, so
  editing a connection silently dropped settings it does not show -
  e.g. verify_checksum (only settable in the config file) was off
  after any edit. get_result() now starts from the existing entry and
  overwrites only the dialog fields.
- The SFTP dialog turned an unreadable port ("22a") silently into 22,
  so the sync connected to a different port without notice.
  validate_sftp_connection now rejects ports outside 1..65535 with a
  message (empty stays 22); dialog, safety check and worker all route
  through it.

Tests red before the fix; pytest 304 passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01THB2EzUDHN8Rq5fvjMqkBL

@lukisch lukisch left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Zweitmodell-Review: freigegeben ✅

Diff master...54d0396 (17 Commits) auf Korrektheit geprüft; keine blockierenden Fehler gefunden.

Geprüft und stimmig

  • update/two_way-Datenverlust: plan_folder_actions überspringt bei update eine neuere Zieldatei (SKIP_NEWER_TARGET, Toleranz > 1 s). Dieselbe Regel gilt im SFTP-Upload-Pfad. mirror und one_way überschreiben weiterhin wie dokumentiert. Bei FileSyncWorker mit two_way werden die Richtungen konsistent getauscht (Mkdir, Kopie, Größen- und Hash-Prüfung laufen alle über copy_from/copy_to). Die WAL-Checkpoint-Verbindungen bleiben richtigerweise einseitig.
  • Case-only-Rename: Durch den Vergleich über normcase plant mirror unter Windows nicht mehr Kopie und Löschung derselben physischen Datei.
  • Eigene Index-DB: Die Index-DB mitsamt -wal, -shm und -journal wird aus beiden Bäumen gefiltert, also weder kopiert noch zurückgeholt oder gelöscht.
  • Umlaut-Suche: Die UDF casefold wird auf Spalten und Suchbegriff gleich angewendet. Damit stimmt auch ß → ss auf beiden Seiten überein.
  • Vorschau: Der Inkrement-Decoder mit final=False erzeugt kein falsches cp1252-Fallback, wenn eine UTF-8-Sequenz am Leseende abgeschnitten ist.
  • Veraltete Ergebnisse: Späte Signale abgelöster Worker werden über sender() verworfen. terminate() wird nicht mehr verwendet.
  • Scheduler: Weil next_daily_run einen Zeitpunkt strikt nach now liefert, stellt ein zu frühes Aufwachen nur auf denselben Termin zurück. Nach dem Lauf wird der Folgetag eingeplant. Ein Doppellauf ist nicht möglich.

Nicht blockierende Hinweise

  1. Die Sperre für die Mirror-Wurzel deckt nur /, . und ~ ab. Varianten wie ~/, ./ oder ein absoluter Home-Pfad (/home/<user>) kommen weiterhin durch. Für eine spätere Härtung könnte man vorher normalisieren (rstrip('/'), ~/ → ~).
  2. path_key=os.path.normcase ist unter macOS (APFS, standardmäßig case-insensitiv) die Identität. Der Case-only-Rename-Fall bleibt dort also offen. Für Windows ist der Fix vollständig.
  3. SearchWindow.closeEvent wartet höchstens 3 s. Rendert ein Vorschau-Worker dann noch (großes PDF), kann Qt beim Beenden „QThread destroyed while running“ melden. Das ist ein Randfall.

Tests (lokal, Linux, QT_QPA_PLATFORM=offscreen)

  • PR: 300 passed, 7 skipped. Die Skips sind Windows-spezifisch, darunter der Case-insensitive-Test. Auf master: 267 passed, 6 skipped. Es gibt keine Regressionen.
  • web_companion (npm test): 36/36 grün.
  • Hinweis: Ohne paramiko schlägt ein SFTP-Test fehl. Das liegt an der Umgebung und ist nach pip install -r requirements.txt behoben.

CI: alle 10 Checks erfolgreich: Python 3.10–3.13, Smoke für ubuntu und macOS, CodeQL (python, actions, js/ts).


Generated by Claude Code

@lukisch lukisch left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Zweitprüfung (Bot): freigegeben ✅ – CI vollständig grün (Py 3.10–3.13, Smoke ubuntu/macOS, CodeQL).

Code-Review der Kernänderungen (ProSyncStart_V3.1.py, ProSyncReader.py):

  • plan_folder_actions() als testbare Funktion, SKIP_NEWER_TARGET für update (Ordner + SFTP), Two-Way für Einzeldateien, Ausschluss der eigenen Index-DB inkl. -wal/-shm/-journal: korrekt.
  • Reader: terminate() → Auslaufen lassen + sender()-Stale-Filter + begrenztes wait(3000) beim Schließen ist der richtige Weg. casefold()-SQL-Funktion für Umlaut-Suche und UTF-8→cp1252-Fallback (inkrementeller Decoder, final=False) sauber.

Nicht blockierende Hinweise für einen Folge-PR:

  1. path_key=os.path.normcase ist auf POSIX die Identität – die Case-only-Rename-Korrektur greift daher auf macOS (APFS, case-insensitiv) nicht. Ggf. path_key=str.casefold, wenn Quelle oder Ziel case-insensitiv ist.
  2. Die SFTP-Mirror-Sperre prüft nur exakt "/", ".", "~". Varianten wie "//", "/./", "~/" oder "./" rutschen durch; vor dem Vergleich posixpath.normpath() + rstrip("/") anwenden.

Generated by Claude Code

The ASSET_HASH guard hashed its own five-file list while APP_SHELL
also caches icon.svg and apple-touch-icon-180.png, so an icon change
would never have reached installed companions without the guard
noticing (same class as mediplaner#8, found by the WORKSTATION merger).

The test now parses APP_SHELL from sw.js, requires each entry to exist
and hashes path + content (text with CRLF->LF, icons as bytes).
ASSET_HASH re-recorded for the new basis; CACHE_NAME stays v3 (already
raised in this PR, icons unchanged here).

Negative control: one changed byte in apple-touch-icon-180.png now
fails the test, reverting passes. npm test script (library, pwa,
companion_i18n) green.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01THB2EzUDHN8Rq5fvjMqkBL

@lukisch lukisch left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Zweitmodell-Abnahme (Cloud-Bot) — inhaltlich freigegeben (formales Approve mit demselben Konto nicht möglich).

Geprüft:

  • Lokale Suite auf Head fix/bugsweep-20261114 (Linux, Python 3.11, Qt offscreen): 300 passed, 7 skipped (Skips: Windows-only bzw. case-insensitives FS). CI vollständig grün (3.10–3.13, Smoke Ubuntu/macOS, CodeQL).
  • plan_folder_actions: Extraktion ist verhaltensgleich zur alten Schleife, plus Case-Folding-Schlüssel und SKIP_NEWER_TARGET für update — schließt den Mirror-Copy+Delete-Verlust bei Bericht.pdf/bericht.pdf.
  • Daily-Scheduler: next_daily_run liefert garantiert einen Zeitpunkt strikt nach now, daher stellt der Früh-Weck-Zweig korrekt auf denselben Termin zurück, und nach einem Lauf wird nicht doppelt ausgelöst. PreciseTimer ist die richtige Wahl.
  • Reader: terminate() ersetzt durch Auslaufen-lassen + sender()-Stale-Filter; closeEvent wartet begrenzt — gut.
  • manage_translations: unlesbare translations.json wird nicht mehr durch den Scan-Stand ersetzt — wichtig.

Kleinere Anmerkungen (nicht blockierend):

  1. SFTP-Mirror-Sperre prüft nur exakt /, ., ~. Varianten wie ~/, /./, // oder ./ umgehen sie. Vorschlag: posixpath.normpath(target.rstrip("/") or "/") bzw. ~-Präfix normalisieren, dann vergleichen.
  2. force_quit: Mehrfaches Auslösen während eines laufenden Syncs verbindet finished → QApplication.quit mehrfach — harmlos, aber ein Flag würde es sauber halten.
  3. Einzeldatei-two_way entscheidet nur über mtime (> 1 s); bei identischem Inhalt wird trotzdem zurückkopiert. Unkritisch, nur zur Kenntnis.

Generated by Claude Code

@lukisch lukisch left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Zweitprüfung (Cloud-Bot) – Kernfixes bestätigt, vor dem Merge sind drei Punkte offen

(Formales „Approve“/„Request changes“ ist nicht möglich, weil PR und Bot unter demselben Konto laufen.)

Lokaler Testlauf am PR-Head 1cf0040 (Linux): 295 bestanden, 7 übersprungen (6 nur Windows, 1 braucht ein Dateisystem ohne Groß-/Kleinschreibung). tests/test_assets_and_icons.py ließ sich hier nicht einsammeln (defektes Pillow in der Prüfumgebung) und wurde nicht ausgeführt.

Greifen die Regressionstests? Ja. Mit den sechs Produktivdateien auf dem Stand der Merge-Basis ergibt tests/test_bugsweep_20261114.py 26 fehlgeschlagen, 3 Fehler, 4 bestanden.

Bestätigt: update überspringt ein neueres Ziel, two_way bei Einzeldateien kopiert ein neueres Ziel zurück, die eigene Index-DB wird ausgeschlossen, Kopien bleiben atomar. Der Scheduler feuert bei now == due nicht doppelt, Beenden während des Syncs läuft sauber.

Vor dem Merge

  1. Merge-Konflikt mit master. web_companion/sw.js kollidiert, seit #8 gemergt ist; CACHE_NAME/ASSET_HASH müssen beim Rebase neu gesetzt werden.
  2. SFTP-update überspringt stumm (ProSyncStart_V3.1.py:2496-2497). Das continue lässt _build_actions leer zurückkehren, files_skipped bleibt 0 und der Status lautet „bereits aktuell“. Das widerspricht dem CHANGELOG („als übersprungen gezählt“); der Ordnerpfad zählt richtig. Vermutete Folge, nicht nachgestellt: Weil sftp.utime nur best-effort ist (:2433), würden bei fehlgeschlagenem utime oder vorgehender Serveruhr spätere Quelländerungen dauerhaft nicht hochgeladen.
  3. Umlaut-Suche normalisiert nicht zwischen NFC und NFD (ProSyncReader.py:138,157-174). Die Suche nach „Übersicht“ (NFC) findet eine NFD-gespeicherte Übersicht.pdf nicht – das ist der Normalfall bei Dateinamen von macOS. Behebung: beide Seiten vor casefold() mit unicodedata.normalize("NFC", …) behandeln. ß/ss und İ funktionieren.

Datenverlust-Pfade, die bestehen bleiben (nachgestellt)

  1. Ordner-two_way verliert die neuere Ziel-Änderung im Standard (:1867-1869). Mit conflict_policy="source", Quelle mtime 100, Ziel mtime 500 kommt COPY_L2R heraus. Der PR dokumentiert das nur. Der Einzeldatei-Pfad macht jetzt das Gegenteil (neueste gewinnt, :1942-1947) – die beiden Pfade sind inkonsistent, und in keinem wird die unterlegene Seite gesichert.
  2. two_way mit newest bei fast gleichen Zeitstempeln (:1873). Unterschiedliche Größe, Ziel 0,5 s neuer → COPY_R2L, die Quelle wird überschrieben. Bestand schon vor dem PR.
  3. Schlüsselbildung ohne Groß-/Kleinschreibung kann eine Datei fallen lassen (:1836-1837). Liegen in der Quelle A.txt und a.txt, wird nur eine geplant, die andere entfällt ohne Warnung (nachgestellt mit path_key=str.lower). Tritt nur unter Windows mit case-sensitiven Verzeichnissen auf.
  4. update an der 1-s-Toleranz (:1858-1862), geringe Priorität: Ein Ziel, das 0,9 s neuer ist und eine andere Größe hat, wird weiterhin überschrieben.

Am Rand, bestand schon vorher: % und _ im Suchbegriff wirken als LIKE-Platzhalter („50%“ trifft 5000.txt).

Punkte 4–7 müssen diesen PR nicht aufhalten, gehören aber als eigene Aufgabe erfasst – vor allem Punkt 4, weil dort der Standardfall betroffen ist.


Generated by Claude Code

lukisch commented Nov 21, 2026

Copy link
Copy Markdown
Collaborator Author

Cloud-Bot: Der Merge-Konflikt mit master (web_companion/sw.js, doppelter ASSET_HASH-Wächter) ist in #9 aufgelöst. Ziel von #9 ist dieser Branch. Nach dem Merge von #9 ist dieser PR wieder mergebar und die CI-Matrix läuft erneut.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant