Skip to content

CLI commands for the compiler#37

Merged
zth merged 7 commits into
rescriptrelay-2.0from
rescript-relay-cli
Mar 18, 2026
Merged

CLI commands for the compiler#37
zth merged 7 commits into
rescriptrelay-2.0from
rescript-relay-cli

Conversation

@zth
Copy link
Copy Markdown
Owner

@zth zth commented Mar 16, 2026

No description provided.

@zth zth marked this pull request as ready for review March 18, 2026 09:29
@zth zth merged commit 9ad1ac6 into rescriptrelay-2.0 Mar 18, 2026
22 of 34 checks passed
@zth zth deleted the rescript-relay-cli branch March 18, 2026 09:30
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +323 to +326
if referenced_fields.contains(field_id) {
continue;
}
dead_fields.push(field_name);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Comment on lines +263 to +267
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())
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Comment on lines +212 to +213
let start = position_to_offset(&range.start, 0, 0, &source_text)
.and_then(|offset| usize::try_from(offset).ok())
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant