find a minor bug, fix it, you don't have to build and run, just find ...#2
Closed
ningcui-compass wants to merge 1 commit into
Closed
find a minor bug, fix it, you don't have to build and run, just find ...#2ningcui-compass wants to merge 1 commit into
ningcui-compass wants to merge 1 commit into
Conversation
… and add a regression test
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.
Summary
Goal
Fix a minor, self-contained bug in
tildeifyPathin the gemini-cli monorepo. This function replaces a user's home directory prefix in a path with~for friendlier display (used inpackages/cli/src/ui/components/Footer.tsxandpackages/core/src/tools/memoryTool.ts).The bug
packages/core/src/utils/paths.tslines 49-55:The
startsWith(homeDir)check has no path-separator boundary. IfhomeDir = '/home/user'and the input is/home/userfoo/bar,startsWithis true and the function returns~foo/barinstead of leaving the unrelated path untouched. A sibling directory whose name merely starts with the home-dir name gets corrupted in display.Two extra wrinkles to respect when fixing:
path, which shadows the module-levelimport path from 'node:path'. So inside the functionpath.sepcurrently refers to the string argument, not the module. Rename the parameter (e.g. tofilePath) to safely reference the realpathmodule.homeDirwith no trailing content) must still tildeify to~.Constraints / conventions
packages/core/src/utils/paths.test.ts, which usesdescribe/it/expectblocks per exported function and imports functions from./paths.js.tildeifyPathis currently NOT imported or tested there.String.replacewith a string first-arg only replaces the first occurrence, which is correct here since we are anchored at the start.Chunks
Advisories
Metrics
Generated by temporal-harness