You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by "orangeCatDeveloper (via GitHub)" <gi...@apache.org> on 2026/08/26 09:08:14 UTC

[PR] fix(desktop): shorten Windows Memory paths [maka]

orangeCatDeveloper opened a new pull request, #3890:
URL: https://github.com/apache/maka/pull/3890

   Fixes #3889
   
   ## Summary
   
   Windows users see the complete local `MEMORY.md` path in Settings while the equivalent POSIX path is shortened, allowing the label to crowd the adjacent saved/dirty status.
   
   Desktop constructs this value with platform-native `node:path.join`, but `displayMemoryPath` split only on `/`. The formatter now recognizes both path separators and preserves the native separator in the compact tail. Opening and copying Memory files continue to use the untouched absolute path.
   
   ## Verification
   
   ```text
   Before
   projected_path=C:\Users\alice\.maka\memory\MEMORY.md
   display=C:\Users\alice\.maka\memory\MEMORY.md
   
   After
   projected_path=C:\Users\alice\.maka\memory\MEMORY.md
   display=…\.maka\memory\MEMORY.md
   ```
   
   ```text
   tests 1522
   pass 1522
   fail 0
   
   Desktop typecheck: passed
   Biome: Checked 2 files. No fixes applied.
   git diff --check: passed
   ```
   
   No Windows screenshot is included; the regression test exercises the exact platform-native path projected by Desktop, along with POSIX, UNC, and short-path controls.
   
   ## AI use
   
   - [ ] No generative tool made a substantive contribution
   - [x] Generative tooling made a substantive contribution
   
   Tool(s) and scope: OpenAI Codex traced the production path, implemented the formatter change, and added regression tests. The human contributor reviewed and directed the submission.
   
   ## Checklist
   
   - [x] Tests cover the change and fail without it
   - [x] Lint, format, typecheck and the affected suites pass locally
   
   Does this PR entail a change in behavior?
   
   - [x] Yes — described under Summary above
   - [ ] No
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [PR] fix(desktop): shorten Windows Memory paths [maka]

Posted by "orangeCatDeveloper (via GitHub)" <gi...@apache.org>.
orangeCatDeveloper commented on PR #3890:
URL: https://github.com/apache/maka/pull/3890#issuecomment-5423738921

   Added before/after Settings → Memory screenshots using the same Windows path fixture. The PR description now shows the full path before the change and the shortened native-separator path after it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [PR] fix(desktop): shorten Windows Memory paths [maka]

Posted by "Astro-Han (via GitHub)" <gi...@apache.org>.
Astro-Han commented on code in PR #3890:
URL: https://github.com/apache/maka/pull/3890#discussion_r3862215955


##########
apps/desktop/src/renderer/settings/memory-settings-labels.ts:
##########
@@ -55,16 +55,11 @@ export function formatLocalMemorySaveSummary(state: LocalMemoryState, copy: Memo
   return copy.saveSummary(state.activeEntryCount, state.archivedEntryCount);
 }
 
-/** Display-only path shortening: the full absolute MEMORY.md path used
- * to render as a full-width mono line that shoved the sibling status
- * words into a cramped stack (and leaked the raw absolute path into
- * the renderer, against the UI quality plan). Show the meaningful
- * trailing segments; the full path stays available via title= and the
- * copy-path action. */
 export function displayMemoryPath(path: string): string {
-  const parts = path.split('/').filter(Boolean);
+  const separator = /^[A-Za-z]:\\/.test(path) || path.startsWith('\\\\') ? '\\' : '/';

Review Comment:
   [P3] The separator is chosen from the prefix but the split accepts both, so the two can disagree. A drive-less rooted Windows path renders with the wrong one:
   
   ```
   "\\Users\\alice\\.maka\\memory\\MEMORY.md"  ->  "…/.maka/memory/MEMORY.md"
   ```
   
   Reading the separator from what the path actually contains removes both the disagreement and the regex:
   
   ```ts
   const separator = path.includes('\\') ? '\\' : '/';
   ```



##########
apps/desktop/src/renderer/settings/memory-settings-labels.ts:
##########
@@ -55,16 +55,11 @@ export function formatLocalMemorySaveSummary(state: LocalMemoryState, copy: Memo
   return copy.saveSummary(state.activeEntryCount, state.archivedEntryCount);
 }
 
-/** Display-only path shortening: the full absolute MEMORY.md path used
- * to render as a full-width mono line that shoved the sibling status
- * words into a cramped stack (and leaked the raw absolute path into
- * the renderer, against the UI quality plan). Show the meaningful
- * trailing segments; the full path stays available via title= and the
- * copy-path action. */
 export function displayMemoryPath(path: string): string {
-  const parts = path.split('/').filter(Boolean);
+  const separator = /^[A-Za-z]:\\/.test(path) || path.startsWith('\\\\') ? '\\' : '/';
+  const parts = path.split(/[/\\]+/).filter(Boolean);
   if (parts.length <= 3) return path;

Review Comment:
   [P3] The drive letter counts as a segment, so the threshold is one level stricter on Windows and a shallow path gets "shortened" into something no shorter that has lost its root:
   
   ```
   "C:\\a\\b\\MEMORY.md"  ->  "…\\a\\b\\MEMORY.md"    (before this PR: unchanged)
   "/a/b/MEMORY.md"       ->  "/a/b/MEMORY.md"
   ```
   
   This one is introduced here — the old `split('/')` yielded a single segment for any Windows path, so it always returned early. Either exclude the drive/UNC prefix from the count, or only shorten when the result is actually shorter.



##########
apps/desktop/src/renderer/settings/memory-settings-labels.ts:
##########
@@ -55,16 +55,11 @@ export function formatLocalMemorySaveSummary(state: LocalMemoryState, copy: Memo
   return copy.saveSummary(state.activeEntryCount, state.archivedEntryCount);
 }
 
-/** Display-only path shortening: the full absolute MEMORY.md path used
- * to render as a full-width mono line that shoved the sibling status
- * words into a cramped stack (and leaked the raw absolute path into
- * the renderer, against the UI quality plan). Show the meaningful
- * trailing segments; the full path stays available via title= and the
- * copy-path action. */
 export function displayMemoryPath(path: string): string {

Review Comment:
   [P2] Please put the doc comment back. It recorded two things this diff does not replace: why the shortening exists at all (the full-width mono line crowded the sibling status words, and the raw absolute path should not reach the renderer under the UI quality plan), and where the full path is still reachable (`title=` and the copy-path action).
   
   A future reader who sees only the new body has no way to recover either, and the natural "simplification" is then to delete a shortener that looks purely decorative. Nothing about supporting backslashes required removing it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [PR] fix(desktop): shorten Windows Memory paths [maka]

Posted by "M4n5ter (via GitHub)" <gi...@apache.org>.
M4n5ter merged PR #3890:
URL: https://github.com/apache/maka/pull/3890


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org