Skip to content

fix(bare-git): preserve UTF-8 paths via NUL-delimited Git output - #76

Merged
vreshch merged 2 commits into
agentage:masterfrom
fagnerfaria:fix/unicode-git-paths-nul
Nov 18, 2026
Merged

vreshch merged 2 commits into
agentage:masterfrom
fagnerfaria:fix/unicode-git-paths-nul

Conversation

@fagnerfaria

Copy link
Copy Markdown
Contributor

Fix C-quoted UTF-8 paths in bare Git memory snapshots and search

Problem

The bare-Git store parses newline-delimited Git path output. Git's default core.quotePath=true quotes non-ASCII names with octal escapes; the MCP can then expose incorrect literal paths instead of the UTF-8 names.

Changes

  • Use Git -z output and NUL record parsers for ls-tree, git log, git diff and git grep.
  • Preserve existing number of Git commands, storage format and memory tool schema.
  • Add 3 regression tests using completely synthetic accented filenames.

Validation and limits

  • Before patch: 2 of 3 new tests fail. After patch: all 3 pass.
  • TypeScript type checking, ESLint, Prettier and TypeScript build pass.
  • Full npm run verify has NOT passed in the Windows environment: existing permission and performance assumptions fail, one property test timed out at 240 seconds, and the suite was stopped. Linux CI is a required gate before merge.
  • Windows smoke:dist fails because an existing assertion expects POSIX /data paths; all other independently tested export checks passed.

Privacy

No private filenames, personal notes, secret material, credentials or account metadata are present in the patch.

Base: agentage/memory-core commit 05197b1. Draft PR for maintainer review; full Linux CI required before merge.

@fagnerfaria

Copy link
Copy Markdown
Contributor Author

Linux CI verification for this exact PR commit (dd61dde) is now complete on the public contributor fork, using the unchanged upstream ci.yml workflow.

  • 29 test files passed; 304 tests passed on ubuntu-latest / Node.js 22.
  • npm ci, npm run verify (type-check, ESLint, Prettier, coverage, TypeScript build and smoke:dist) all succeeded.
  • Successful run: https://github.com/fagnerfaria/memory-core/actions/runs/42751789496
  • The temporary fork-only draft PR used to trigger this run was closed without merge.

Upstream CI remains action_required, awaiting maintainer approval: https://github.com/agentage/memory-core/actions/runs/42750254535. This PR remains draft pending its own CI and maintainer review. No merge or deployment is requested before those gates.

@vreshch
vreshch force-pushed the fix/unicode-git-paths-nul branch from dd61dde to d648e58 Compare November 18, 2026 07:03
@vreshch

vreshch commented Nov 18, 2026

Copy link
Copy Markdown
Member

Thank you @fagnerfaria for this fix and the regression tests. I rebased it onto current master (your commit and authorship are kept) and added one test for a mixed-script path (notes/café ü 日本.md). I checked that your tests fail on master and pass with your change, and npm run verify is green. I am marking the PR ready for review.

https://claude.ai/code/session_01XQkodgygL4W8UcLQDwC212

@vreshch
vreshch marked this pull request as ready for review November 18, 2026 07:03
@vreshch

vreshch commented Nov 18, 2026

Copy link
Copy Markdown
Member

Review of head d648e58: MERGE

Thank you @fagnerfaria, this is a clean and well-scoped fix.

  • Verified: grep -z record (rev:path\0text\n), log -z (date, \0, \n, then NUL-separated paths), diff -z (status/path pairs), ls-tree -z and ls-tree -l -z parse correctly. I checked real git output on an accented path.
  • No non-z path parsing remains in src/stores/bare-git. authors-view and cat-file --batch carry no paths.
  • Tests: 3 of 4 new tests fail on master and all pass here. Full suite 305/305, tsc and prettier green.
  • Nit: the validate-tree test passes on master too, so it guards against regression only.
  • Nit: three comments are 2 lines, standards say max 1 line (bare-git-store.ts grep loop, snapshot.ts log). Move the rationale to the PR body.
  • Nit: the inline grep loop adds about 10 lines to search(), which was already over the 20-line and 200-line limits. A small parseGrepCounts helper would help. Not a blocker.
  • Nit: no test for a newline or quote in a filename, which is the main benefit of -z.

https://claude.ai/code/session_01XQkodgygL4W8UcLQDwC212

@vreshch
vreshch merged commit 1d63576 into agentage:master Nov 18, 2026
1 check passed
@fagnerfaria

Copy link
Copy Markdown
Contributor Author

Linux validation completed successfully for the exact SHA in this PR (dd61dde161e5630d6c79feb814c438b5851386bb) using the unchanged ci.yml on the public contributor fork:

The temporary fork-only PR used for Linux verification was closed without merge. Upstream CI is still awaiting maintainer approval: https://github.com/agentage/memory-core/actions/runs/42750254535

This remains a draft PR pending upstream CI and maintainer review. No merge or deployment is requested before those gates.

@fagnerfaria

Copy link
Copy Markdown
Contributor Author

Thank you @vreshch for the thoughtful review and for preserving my authorship. I really appreciate the careful verification and the specific suggestions, especially regarding edge-case testing, distinguishing regression tests from tests that reproduce the original failure, and keeping parsing logic well-scoped.

I'll carry these lessons into my future contributions. Glad to see the fix merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants