mirror of
https://github.com/firstsun-dev/git-files-sync.git
synced 2026-07-22 17:20:30 +00:00
performRemoteDeletion passed the vault-relative path (carrying the vaultFolder prefix) straight to gitService.deleteFile(), but getFullPath() expects a path relative to rootPath only -- vaultFolder is stripped before every other gitService call site (see sync-manager.ts's getNormalizedPath(file.path) pattern). With a non-empty vaultFolder setting this built the wrong repo path, so deleteFile's pre-delete getFile() lookup 404'd -- surfacing as "file was not found on branch main" for a file the UI still listed as remote-only, since status refresh already normalizes the path correctly. Also hardens SyncStatusView against a local directory (or symlink to one) colliding with a stale remote record at the same path: a new isLocalFile() helper (adapter.stat().type === 'file') gates identifyExtraFiles and the hidden-file recursiveScan, and readFileContent's string-path branch falls back to readLocalSymlinkTarget() on read failure.
9 KiB
9 KiB
Session Progress Log
Completed work is archived in archive/, one file per calendar month — this file only tracks what's still open.
Current State
Last Updated: 2026-07-14 09:35 Session ID: current Active Feature: issue #78 (blog repo, misfiled — actually a git-files-sync bug: delete remote-only file fails) — three root causes found and fixed, awaiting user re-test after rebuild
Status
What's Done
- feat-001..009 (project setup, settings UX bundle, folder picker, symlink pull fix, tree-SHA refresh, HTML-response error clarity, what's-new modal, i18n/multi-language support) — see archive/2026-07.md
- All consolidated onto branch
claude/fix-directory-symlink-pull-260713→ PR #51 (open, all CI green as of last check), per user's explicit request to keep the PR count down rather than one PR per issue. - "Root path" folder picker now suggests folders from the remote repo tree instead of the local vault. Added
src/ui/RemoteFolderSuggest.ts(derives folder paths fromgitService.listFiles(branch, false)); wired into the Root path field insrc/settings.ts. Vault folder field untouched (still uses localFolderSuggest). - Issue #78 (filed in
firstsun-dev/blogbut actually a git-files-sync bug — user confirmed to fix it here regardless of repo mismatch): "delete remote only file fail". Three distinct root causes found and fixed across this session (iteratively, as the user re-tested against real console errors each time):- URL encoding + silent empty-sha delete:
github-service.ts/gitea-service.tsgetApiUrl()built the Contents API URL withoutencodeURIComponenton path segments (unlikegitlab-service.ts, which already encodes), so paths with spaces/non-ASCII (e.g. Chinese filenames) 404'd on the pre-delete sha lookup; that 404 silently produced an emptysha, and the resulting DELETE withsha: ''was rejected — silently, since the UI swallowed all delete errors. Fixed: encode path segments in both services;deleteFile()now throws a clear error if the pre-delete lookup's sha is empty;SyncStatusView.tsdelete flow now captures{path, message}per failure and surfaces the real message in the Notice (syncStatus.notice.deleteResult.partialWithMessagei18n key, added to bothen.ts/zh-tw.ts) instead of a bare "N failed". - EISDIR + folder/remote-record collision:
SyncStatusView.tsreadFileContent()/identifyExtraFiles()treated any local path thatadapter.exists()returned true for as a readable file — but a real local directory (or a symlink to one) that happens to share a path with a stale remote record (e.g..claude/skills/polish-blog) is not readable content, andadapter.read()on it throwsEISDIR. Fixed: newisLocalFile()helper (adapter.stat().type === 'file') gatesidentifyExtraFilesand the hidden-filerecursiveScan;readFileContent's string-path branch (extracted toreadStringPathContent()) also falls back toreadLocalSymlinkTarget()on read failure as a last resort. - Wrong path passed to deleteFile (the actual reported bug):
performRemoteDeletioncalledgitService.deleteFile(s.path, ...)withs.path— a vault-relative path (carries thevaultFolderprefix, peridentifyExtraFiles'sgetVaultPath()mapping) — butdeleteFile'sgetFullPath()expects a path relative torootPathonly (vaultFolder is a purely local concept, stripped before every othergitServicecall site, e.g.sync-manager.ts'sgetNormalizedPath(file.path)pattern used everywhere else). With a non-emptyvaultFoldersetting, this built the wrong repo path, causingdeleteFile's pre-deletegetFile()lookup to 404 — surfacing as "file was not found on branch main" for a file the UI still listed as remote-only (since refresh's status computation does normalize correctly). Fixed:performRemoteDeletionnow computesthis.plugin.getNormalizedPath(s.path)before callingdeleteFile, matching every other call site.
- Added 4 new tests (2 in
tests/services/github-service.test.ts, 2 intests/services/gitea-service.test.ts) covering the empty-sha throw and non-ASCII/space path encoding. No new test yet for root cause #3 (vaultFolder/rootPath path mismatch) or #2 (folder collision) —SyncStatusView.tscurrently has no dedicated test file; consider adding one if this recurs. - Evidence:
npx eslint .→ 0 errors;npm run build→ clean;npx vitest run→ 312/312 passed. - Root causes #1+#2 committed as
896d77b, merged with the i18n branch (563a28e), pushed. Root cause #3 fixed after that push, in this same session — not yet committed/pushed as of this note. - Not yet done: comment on/reference issue #78 (in the
blogrepo) noting the fix landed ingit-files-syncinstead — flag to user before doing so since it crosses repos.
- URL encoding + silent empty-sha delete:
What's In Progress
- Nothing else actively in progress.
What's Next
- Get user confirmation that delete now works (or a new detailed error message) after they rebuild/reload with the latest push.
- Issue #37 (Bitbucket provider support, feat-010) — large, was deferred until #38 (i18n) landed. Now unblocked.
- Re-sync against
gh issue list --repo firstsun-dev/git-files-sync --state open. Remaining genuinely-unstarted issues as of this session: #47 (regex ignore lists), #45 (SonarQube findings), #37 (Bitbucket), #28 (non-engineering: community visibility). - PR #51 is large (7+ issues' worth of changes now). If the user wants to review/merge it before more work piles on, flag this rather than continuing to add commits indefinitely.
Blockers / Risks
- None currently.
Decisions Made
- All work goes into one PR (#51): user explicitly said "不要那麼多pr merge" (don't want so many PRs). Any further issue work should commit directly onto
claude/fix-directory-symlink-pull-260713, not a new branch. - feat-009 scope (i18n): settings.ts + all Notice() messages, done in one pass rather than split into infra-first/settings-only phases.
- Flat key-value i18n dict, not nested namespaces: matches this plugin's small scale; simpler
t(key, vars)lookup, no external i18n library dependency. - Locale detection via
window.moment.locale(): per issue #38's suggested approach; unresolvable/unsupported locales fall back to English. A barezhlocale code maps tozh-tw, the only Chinese variant shipped. - Diff-format markers, changelog release-note text, and proper nouns (GitHub/GitLab/Gitea) were left untranslated — out of scope for UI-chrome i18n.
src/changelog.tsis hand-curated, separate from the auto-generatedCHANGELOG.md: semantic-release already maintainsCHANGELOG.mdfrom Conventional Commit messages, but it's commit-log-level detail; the what's-new modal needs a small, hand-written, user-facing "highlights" list instead.- Fixed two duplication regressions mid-session (SonarCloud gate is 3% on new code, learned the hard way on PR #49 earlier): deduped
TextComponent/TextAreaComponenttest mocks, and deduped the GitHub/GiteagetBlob()bodies into a sharedfetchGitHubStyleBlob()base helper.
Files Modified This Session
- Issue #78 fix:
src/services/github-service.ts,src/services/gitea-service.ts,src/ui/SyncStatusView.ts,src/i18n/locales/en.ts,src/i18n/locales/zh-tw.ts,tests/services/github-service.test.ts,tests/services/gitea-service.test.ts. - Root path picker fix:
src/ui/RemoteFolderSuggest.ts(new),src/settings.ts. - feat-009 (i18n, prior parallel session):
src/i18n/index.ts,src/i18n/locales/en.ts,src/i18n/locales/zh-tw.ts,tests/i18n/index.test.ts(all new);src/settings.ts,src/main.ts,src/ui/SyncStatusView.ts,src/ui/SyncConflictModal.ts,src/ui/WhatsNewModal.ts,src/ui/ConfirmModal.ts,src/ui/components/ActionBar.ts,FileListItem.ts,DiffPanel.ts(modified). - See archive/2026-07.md entries feat-003/005/006/007/008 for earlier features' file lists.
Evidence of Completion
- Tests pass:
npx vitest run→ 306/306 passed (post-merge, this session) - Type check clean:
npm run build(tsc + Obsidian 1.11.0 compat typecheck + esbuild) → clean - Lint clean:
npx eslint .→ 0 errors - Manual verification in Obsidian: in progress — user is re-testing the delete fix live; not yet confirmed resolved.
Notes for Next Session
- Working branch for all further commits:
claude/fix-directory-symlink-pull-260713(PR #51). Do not open a new branch/PR for the next issue unless the user says otherwise. feature_list.json's backlog is a snapshot from this session — re-checkgh issue listbefore trusting it.- If the user reports delete still failing after this push, get the exact new error message (should no longer be a bare "N failed") to find the next root cause.