fix(gemini): derive project_path from caller/on-disk identity, not the log's directories#126
Open
akesling wants to merge 1 commit into
Open
fix(gemini): derive project_path from caller/on-disk identity, not the log's directories#126akesling wants to merge 1 commit into
akesling wants to merge 1 commit into
Conversation
…e log's directories read_session_metadata preferred the chat file's internal directories()[0] over the caller-passed project path, so a session projected onto this machine from elsewhere (e.g. path resume of a Pathbase upload) reported the original author's foreign path instead of where it actually lives here. Same class of bug as toolpath-claude #103. New trust order: caller-supplied absolute path wins verbatim (checked via Path::is_absolute so Windows drive paths count too); else fall back to directories()[0], then the caller string, preserving prior behavior. A non-absolute caller string can't actually reach metadata assembly — PathResolver::project_dir never resolves a bare slot name to its own slot directory, so file resolution fails first — hence no slot reverse-lookup is needed and the public API is unchanged.
|
🔍 Preview deployed: https://f8a3115e.toolpath.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
Same latent bug class that #103 fixed for toolpath-claude:
read_session_metadatareportedConversationMetadata.project_pathfrom the chat file's internaldirectories()[0]— a file-internal claim. A session projected in from another machine (or any log whose recorded directory disagrees with where it actually lives) reports a foreign project path.Fix
Both
read_session_metadatasites (main-file Case A and orphan-UUID Case B) now resolve the display path through one helper with the trust order:Path::is_absolute(), so Windows drive paths count too) — the caller/OS identity wins;directories()[0]as fallback;A reverse slot→path lookup (friendly name / SHA-256 hash) was originally drafted for step 2 but review + a reachability trace proved it dead code:
PathResolver::project_dirnever resolvestmp/<arg>verbatim, so a bare-slot caller fails file resolution withConversationNotFoundbefore this helper can run. It was removed —paths.rsis byte-identical to main, no public API change (the analysis is preserved in the helper's doc comment and CHANGELOG).Tests
TDD: new test mirrors the #103 precedent — a chat file whose
directoriesclaims/somewhere/else, caller passes/real/project(hash-slot on-disk layout), metadata must report/real/project. toolpath-gemini 162 unit + 29 integration + 5 doc green; full workspace suite + clippy green.toolpath-geminibumped 0.6.0 → 0.6.1.Notes
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.