Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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 internal/frontend/grpc/convert_check_diagnostics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func TestConvertCheckDiagnosticsWithRefusedConversion(t *testing.T) {
if err != nil || resp.Error == "" || resp.Content != "" {
t.Fatalf("check %v: two declarations of P converted: %v, error %q", check, err, resp.GetError())
}
if warned := severitiesByCode(resp.Diagnostics)["name-conflict"] == "warning"; warned != check {
if (severitiesByCode(resp.Diagnostics)["name-conflict"] == "warning") != check {
t.Fatalf("check %v: diagnostics %v", check, resp.Diagnostics)
}
}
Expand Down
2 changes: 1 addition & 1 deletion internal/frontend/grpc/run_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (o runOptions) startAction(rt *runtime.Context, name string, action *symbol
}
release := exec.Release
if reused {
release = func() {}
release = func() { /* a reused performance is the run's own; nothing was started for the call */ }
}
if _, err := rt.Advance(*o.advance); err != nil {
release()
Expand Down
2 changes: 1 addition & 1 deletion internal/frontend/grpc/run_options_performer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func TestExecuteActionAdvanceRunsThePerformersPerformance(t *testing.T) {
if got := resp.PerformerAttributes["this.steps"].GetIntValue(); got != 1 {
t.Errorf("%s %s: this.steps = %d, want 1: the robot's own performance ran, once", action, label, got)
}
if got := resp.Outputs["run.n"].GetIntValue(); got != 1 {
if resp.Outputs["run.n"].GetIntValue() != 1 {
t.Errorf("%s %s: outputs = %v, want the performed usage's run.n = 1", action, label, resp.Outputs)
}
}
Expand Down
22 changes: 11 additions & 11 deletions internal/frontend/mcp/toolkit/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ func NewRoot(dir string) (Root, error) {
if err != nil {
return Root{}, fmt.Errorf("resolving the workspace root %s: %w", dir, err)
}
real, err := filepath.EvalSymlinks(abs)
resolved, err := filepath.EvalSymlinks(abs)
if err != nil {
return Root{}, fmt.Errorf("resolving the workspace root %s: %w", dir, err)
}
return Root{Dir: abs, Real: real}, nil
return Root{Dir: abs, Real: resolved}, nil
}

// Resolved is a path Root.Resolve accepted.
Expand Down Expand Up @@ -103,24 +103,24 @@ func (r Root) Resolve(path string, opts ...Option) (Resolved, error) {
path = filepath.Join(r.Dir, path)
}
path = filepath.Clean(path)
real, err := realPath(path)
resolved, err := realPath(path)
if err != nil {
return Resolved{}, fmt.Errorf("resolving %s: %w", path, err)
}
if o.role != NameIgnored && !sameFormat(path, real, o.role) {
return Resolved{}, fmt.Errorf("%s is a link to %s, whose extension names another format; name the file itself or a link with its extension", path, real)
if o.role != NameIgnored && !sameFormat(path, resolved, o.role) {
return Resolved{}, fmt.Errorf("%s is a link to %s, whose extension names another format; name the file itself or a link with its extension", path, resolved)
}
res := Resolved{Path: path, Real: real}
res := Resolved{Path: path, Real: resolved}
for _, dir := range o.exempt {
if realDir, err := filepath.EvalSymlinks(dir); err == nil && Under(realDir, real) {
if realDir, err := filepath.EvalSymlinks(dir); err == nil && Under(realDir, resolved) {
return res, nil
}
}
if !Under(r.Dir, path) {
return Resolved{}, fmt.Errorf("%s is outside the workspace root %s", path, r.Dir)
}
if !Under(r.Real, real) {
return Resolved{}, fmt.Errorf("%s leads through a symlink to %s, outside the workspace root %s", path, real, r.Dir)
if !Under(r.Real, resolved) {
return Resolved{}, fmt.Errorf("%s leads through a symlink to %s, outside the workspace root %s", path, resolved, r.Dir)
}
return res, nil
}
Expand All @@ -147,9 +147,9 @@ func realPath(path string) (string, error) {
func realPathHops(path string, hops int) (string, error) {
rest := ""
for p := path; ; {
real, err := filepath.EvalSymlinks(p)
resolved, err := filepath.EvalSymlinks(p)
if err == nil {
return filepath.Join(real, rest), nil
return filepath.Join(resolved, rest), nil
}
parent := filepath.Dir(p)
if !(errors.Is(err, fs.ErrNotExist) || errors.Is(err, syscall.ENOTDIR)) || parent == p {
Expand Down
Loading