Repository navigation
fix: compare .gitmem roots by real path, not string (GIT-107) - #45
Merged
2 commits merged intoSep 22, 2026
Merged
2 commits merged into
2 commits merged into
Conversation
findStrandedProjectRoots compared candidate and home as strings. On macOS /var is a symlink to /private/var: process.cwd() reports /private/var/... and a home or GITMEM_DIR under $TMPDIR is spelled /var/..., so session_start showed "Memory store found but NOT being read" about the store it was reading. Any symlink in either path did the same. - canonicalPath() resolves with fs.realpathSync.native; a path that does not exist yet resolves through its nearest existing ancestor. - A candidate is not stranded if it is the same directory as the home root or an explicit GITMEM_DIR (the root actually being read). - migrate-root's "source and destination are the same" check uses it too. +5 tests (symlinked home, a different store still reported, GITMEM_DIR, sameDirectory spellings, and the macOS /var case); 4 fail on origin/main. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The driver's store lives under $TMPDIR, so 1.10.0 shows the notice on every macOS run (exit 1); exits 0 with the fix. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Sep 22, 2026
neoneye
pushed a commit
to agent-memory-atlas-archive/gitmem-dev--gitmem
that referenced
this pull request
Sep 22, 2026
Conflicts (blank-supabase.mjs): all result fields and all checks kept. migrate-root.ts auto-merged (gitmem-dev#43's merge + gitmem-dev#45's sameDirectory). tsc clean.
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.
What
.gitmemroots are compared by real path, not by string (GIT-107).canonicalPath()resolves a path withfs.realpathSync.native. A path that doesn't exist yet (e.g. a destination before its first write) resolves through its nearest existing ancestor, so/var/x/.gitmemand/private/var/x/.gitmemagree even before.gitmemexists.sameDirectory(a, b)compares two paths that way.findStrandedProjectRoots()uses it. A candidate is also excluded when it's the same directory as an explicitGITMEM_DIR, since that's the root actually being read; before, only the home root was checked.migrate-root's "source and destination are the same" check uses it too.Why
On macOS
/varis a symlink to/private/var.process.cwd()reports/private/var/…, while a home orGITMEM_DIRunder$TMPDIRis spelled/var/…. The string comparison saw two stores, andsession_starttold the user their live store wasn't being read. Reproduced on everymainvenue run, where the driver's store lives under$TMPDIR:How to test
Venue (v1.8.0
setup.sql,vujndhcumgroztfkkdus; production not touched):flownow fails ifsession_startshows the notice, since the driver creates no stranded store.main: exit 1 ("reported the store it reads as 'NOT being read'"). This branch: exit 0.Unit tests: 1279/1279 pass (+5,
gitmem-root-symlink.test.ts):GITMEM_DIRnaming the project store → not stranded;sameDirectorywith a symlink, a trailing slash,.segments and not-yet-existing leaves;/varvs/private/var(skipped where$TMPDIRhas no symlink, e.g. Linux).4 of 5 fail on
origin/main; "a different store is still reported" passes on both, as it should. No existing test encoded the old behaviour.Checklist
npm run test:unitpasses (1279)Breaking changes
None.
🤖 Generated with Claude Code