Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ jobs:
- name: Test native-separator store path comparisons
run: >
go test -timeout=10m -count=1
-run 'NativeSeparator|MixedSeparator|ImportAdjacency|ParseDiffGitPaths|ParseDiffLinesNewSide|FeedbackDir'
-run 'NativeSeparator|MixedSeparator|ImportAdjacency|ParseDiffGitPaths|ParseDiffLinesNewSide|FeedbackDir|ReviewRulepack|PrefixedGraphReportsRulepack'
./internal/analysis ./internal/graph/store_sqlite
./internal/mcp ./internal/resolver ./internal/persistence

Expand Down
19 changes: 17 additions & 2 deletions internal/mcp/tools_review.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/zzet/gortex/internal/config"
"github.com/zzet/gortex/internal/gitcmd"
"github.com/zzet/gortex/internal/graph"
"github.com/zzet/gortex/internal/graphpath"
"github.com/zzet/gortex/internal/llm"
"github.com/zzet/gortex/internal/query"
"github.com/zzet/gortex/internal/review"
Expand Down Expand Up @@ -633,7 +634,12 @@ func (s *Server) reviewRulepackMatches(ctx context.Context, changedFiles []strin
}
targets := make([]astquery.Target, 0, len(allTargets))
for _, t := range allTargets {
if changed[filepath.Clean(t.GraphPath)] {
// Normalize, do not Clean. A graph path is "<prefix>/" + the rest in
// native separators, so filepath.Clean rewrites the prefix slash on
// Windows ("repo-a/pkg\widget.go" -> "repo-a\pkg\widget.go") and the
// key the changeset built no longer matches. graphpath.Norm is the
// canonical comparison form and is the identity on POSIX.
if changed[graphpath.Norm(t.GraphPath)] {
targets = append(targets, t)
}
}
Expand Down Expand Up @@ -682,7 +688,11 @@ func (s *Server) reviewRulepackMatches(ctx context.Context, changedFiles []strin
func reviewChangedGraphPaths(changedFiles []string, repoPrefix string) map[string]bool {
changed := make(map[string]bool, len(changedFiles))
for _, f := range changedFiles {
f = filepath.Clean(strings.TrimSpace(f))
// Clean collapses "./" and "..", then Norm puts both vocabularies in
// the one comparison spelling — git already speaks '/', and a caller
// handing in a graph-keyed path carries native separators after the
// prefix. Identity on POSIX.
f = graphpath.Norm(filepath.Clean(strings.TrimSpace(f)))
if f == "" || f == "." {
continue
}
Expand All @@ -698,7 +708,12 @@ func reviewChangedGraphPaths(changedFiles []string, repoPrefix string) map[strin
// repo-relative spelling the rest of the review pipeline speaks: the rule
// resolver matches `.gortex.yaml` globs against it, rankFileRisk keys its rows
// on it, and post_review hands it to the forge's comment API.
// Every one of those consumers speaks '/', so the result is normalized: a
// graph path carries native separators after the prefix, and handing
// `pkg\widget.go` to a `.gortex.yaml` glob or the forge comment API would
// match nothing and anchor a comment nowhere. Identity on POSIX.
func reviewRepoRelPath(path, repoPrefix string) string {
path = graphpath.Norm(path)
if repoPrefix == "" {
return path
}
Expand Down
Loading