2.0 KiB
Executable File
2.0 KiB
Executable File
reflect-skip Android SAF Debug Log
Root Cause Found (2026-05-28)
Problem: #if SKIP blocks dead in Skip Fuse mode
The project uses SkipFuse (not transpile-mode Skip). In Fuse mode:
#if SKIPis NOT defined — only#if SKIP_BRIDGEis active- All SAF-based code in ProfileManager used
#if SKIPguards - Fallback iOS FileManager code ran instead → empty profile, 0 sessions, agent said "no data"
This affected ALL vault read/write operations:
loadProfile()→ returned ""sessionCount→ returned 0loadRecentSessions()→ returned ""loadSessionDocuments()(BM25 search) → returned []appendSession()/updateProfile()/addInsight()→ wrote nothing
Secondary Bug: HomeViewModel dead regex
HomeViewModel.loadStats() searched for "Сессий проведено: (\d+)" in profile.md.
This string is NEVER written anywhere in the codebase.
Fixed to use ProfileManager.shared.sessionCount (actual file count).
Fix Applied
Sources/ReflectApp/Services/ProfileManager.swift:
- Added private SAF bridge helpers (
saf_read,saf_write,saf_list,saf_exists,saf_mkdirs) usingAnyDynamicObject(forStaticsOfClassName: "reflect.app.AndroidAppMain") - Changed all
#if SKIP→#if SKIP_BRIDGEthroughout the file - Added
#if SKIP_BRIDGEblocks to methods that had no SAF guard:appendToProfile,incrementSessionCount,loadSessionDocuments,updateSessionIndex,getSessionIndex
Sources/ReflectApp/ViewModels/HomeViewModel.swift:
- Replaced dead regex with
ProfileManager.shared.sessionCount
Milestone History
| Date | Version | Milestone |
|---|---|---|
| 2026-05-28 | 0.0.91 | Alert shows files found, buttons appear, HomeView loads |
| 2026-05-28 | 0.0.93 | SAF reads work in Fuse mode → sessions/profile visible |
Pattern for future Skip Fuse code
In Skip Fuse projects, ALWAYS use #if SKIP_BRIDGE (not #if SKIP) for any Android-native calls.
Use AnyDynamicObject(forStaticsOfClassName: "your.package.ClassName") to call Kotlin companion object methods.