CLI commands for the compiler#37
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4c6503f244
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if referenced_fields.contains(field_id) { | ||
| continue; | ||
| } | ||
| dead_fields.push(field_name); |
There was a problem hiding this comment.
Exclude interface-backed object fields from dead-field output
If a field is only queried through an interface selection or fragment (for example Node.name), referenced_fields contains the interface field ID, not the concrete object field IDs. This loop then checks each object.fields entry against that set, so implementations like User.name/Page.name are reported as dead even though live queries reach them through the interface. In schemas with shared interfaces, the audit will suggest deleting fields that are still in use.
Useful? React with 👍 / 👎.
| match (parent_type, member_type) { | ||
| (Type::Union(union_id), Type::Object(object_id)) => { | ||
| if schema.union(union_id).members.contains(&object_id) { | ||
| referenced_union_members | ||
| .entry(schema.get_type_name(Type::Union(union_id)).to_string()) |
There was a problem hiding this comment.
Account for interface refinements when tracking union members
This helper only records a referenced union member when the refinement is a concrete object. For a union queried through an overlapping interface fragment (for example ... on MaybeNodeInterface { ... }), no member names are inserted here, so the later report marks every matching member as an unselected union member even though the union is actively used through that interface.
Useful? React with 👍 / 👎.
| let start = position_to_offset(&range.start, 0, 0, &source_text) | ||
| .and_then(|offset| usize::try_from(offset).ok()) |
There was a problem hiding this comment.
Convert rename positions to byte offsets before editing
The ranges being converted here come from to_span_range, but relay_lsp::position_to_offset walks chars().enumerate(), so the returned values are character counts rather than byte indices. String::replace_range below expects byte offsets, which means rename-fragment can panic or rewrite the wrong slice whenever a file contains non-ASCII text before the GraphQL literal.
Useful? React with 👍 / 👎.
No description provided.