withoutFolders guesses where a path starts and ends, and five review
passes each found a line it let a folder through: blanks, soft stops, a
kept stop in a folder name, the fallback after a cut, a path glued to a
character that starts nothing. The new src/services/logFolders.ts knows
the two folders that hold the OS user name instead: the home folder
(homeDir) becomes "~" and the folder of the profile databases
(appConfigDir) "<profile folder>", the latter first.
- replaceKnownFolders: either separator and any run of them between
segments (JSON.stringify doubles each backslash), case ignored with a
drive letter, trailing separator of the folder dropped, and a
boundary after it, so /home/max leaves /home/maxime alone. Never
throws.
- setKnownFolders builds the patterns once, every segment escaped
(CWE-185: a raw "(" would make every captured console call throw),
and ignores an empty or root folder.
- initKnownFolders resolves both folders once, independently
(Promise.allSettled), never rejected; knownFoldersReady resolves when
they are known or 2 s after initKnownFolders, and at once when it was
never called.
logService replaces them in every entry, whatever its channel, and
replayLogEntries rewrites the entries written before they arrived,
sessionStorage included; main.tsx wires it right after initLogCapture.
db.ts waits for knownFoldersReady inside the exclusive section of
connectToProfile, before repair_migrations, and its four sites clean a
line with cleanLogLine: the exact folders, then withoutFolders, which
does not change. "Migration checksums repaired for" goes through
logWarn, and startupConnection writes through a logError that App.tsx
passes: neither file writes to the Journal through console.* any more.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>