geldata / geldata/gel-cli

Cast expression suggestion when changing type of a link property references it as a standard property

Open
#1,188 3 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
175
Forks
32
PR merge metrics
No merged PRs in 30d

Description

When altering the type of a link property as shown in the schema at the bottom:
```
did you alter the type of property 'date' of link 'habit_completed'? [y,n,l,c,b,s,q,?]
> y
Please specify a conversion expression to alter the type of property 'date':
cast_expr> .date
```

Suggestion is to cast a property `.date` which does not exist on the type. The suggestion should be `@date` instead.

- EdgeDB Version: 5.0-dev.8091+e24f7fd
- EdgeDB CLI Version: 4.0.2+500be79
- OS Version: macOS 14.0

### Steps to Reproduce

1. Create a schema with a link property
2. Migrate
3. Change the type of the link property
4. Migrate again

### Schema

Start:
```
module default {
type Habit {
required name: str;
}
type User {
name: str;
multi habit_completed: Habit {
date: datetime;
# Ensures a User can complete a given Habit
# only once per day.
constraint exclusive on ((@target, @date));
}
}
}
```

End:
```
module default {
type Habit {
required name: str;
}
type User {
name: str;
multi habit_completed: Habit {
date: cal::local_date;
# Ensures a User can complete a given Habit
# only once per day.
constraint exclusive on ((@target, @date));
}
}
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the migration prompt with the provided Start and End schemas, then trace the CLI code that generates cast-expression suggestions for link properties. Confirm the completed behavior by checking that the suggested expression uses @date rather than .date.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.