Skip to content

fix(extraction): reduce A::B.new callee to the constant - #1710

Open
benrfairless wants to merge 2 commits into
DeusData:mainfrom
benrfairless:fix/ruby-namespaced-constructor-callee
Open

fix(extraction): reduce A::B.new callee to the constant#1710
benrfairless wants to merge 2 commits into
DeusData:mainfrom
benrfairless:fix/ruby-namespaced-constructor-callee

Conversation

@benrfairless

Copy link
Copy Markdown

What does this PR do?

Slice 2 of 5 splitting #1706. Stands alone; depends on nothing else in the series.

A Ruby Const.new call is rewritten to name the constant rather than the method, so the call links the class the way every other language's new T() does — the constructor body lives in initialize, so naming new links nothing.

That rewrite only fired for bare constant receivers. A scope-resolved receiver fell through it and kept the whole call expression as its callee: Admin::User.new. That resolves to nothing, and it cannot join the Ruby LSP's constructor rows, whose callee is the class QN.

Correction to the original description. While writing the reproduce-first test I found the claim I made in #1706 — that the callee stayed "new" — is wrong. The actual pre-fix callee is the full Admin::User.new expression. The commit message and test here state the real behaviour; the fix itself is unchanged and still needed.

Reproduce-first. Without the change, the new row prints exactly that:

ruby callees (2):
  'Admin::User.new'
  'Widget'

The test pins both spellings — scope-resolved reduces to Admin::User, bare stays Widget as a regression guard — and rejects any callee that is new or retains a .new suffix. There was previously no test anywhere for this rewrite in either form.

Where this sits in the series

# PR Depends on
1 #1709
2 this PR
3 feat/ruby-lsp-per-file
4 feat/ruby-lsp-cross-file 3
5 docs/ruby-hybrid-lsp 4

CI baseline

main at 4d7d9f1 is red for reasons unrelated to this change: #1181 gave list_projects pagination parameters, retiring the last empty-properties schema that #1359's guards used as their zero-argument example. #1704 already fixes it. Until that merges, ci-ok will be red here for that reason.

Refs #1701

Checklist

  • Every commit is signed off (git commit -s)
  • Tests pass locally (scripts/test.sh) — see fix(extraction): keep Ruby superclass names bare #1709 for the full-leg numbers; all failures are pre-existing on unmodified origin/main.
  • Lint passes (make -f Makefile.cbm lint-ci)
  • New behavior is covered by a test (reproduce-first for bug fixes)

Assisted by OpenCode using anthropic/claude-opus-5.

A Ruby `Const.new` call is rewritten to name the constant rather than
the method, so the call links the class the way every other language's
`new T()` does — the constructor body lives in `initialize`, so naming
`new` links nothing.

That rewrite only fired for bare `constant` receivers. A scope-resolved
receiver fell through it and kept the whole call expression as its
callee: `Admin::User.new`. That resolves to nothing, and it cannot join
the Ruby LSP's constructor rows, whose callee is the class QN.

Treat `scope_resolution` receivers the same way. The new extraction row
pins both spellings and fails without this change, printing the
'Admin::User.new' callee that is the bug's signature.

Refs DeusData#1701

Assisted-by: OpenCode:anthropic/claude-opus-5
Signed-off-by: Ben Fairless <ben@oaf.org.au>
@benrfairless
benrfairless requested a review from DeusData as a code owner August 18, 2026 09:02
@github-actions

Copy link
Copy Markdown

Thanks for opening this — it has been seen, and it is queued.

This note is automated, but it is not a brush-off: it exists so you know where your PR stands instead of having to guess from silence.

Current review status: working through a backlog. 0.9.1-rc.1 is out, so the release freeze that held reviews is over — but it left a large queue of open pull requests behind it, and we are reading through them oldest-first. The background is in discussion #1144.

What that means for this PR, concretely:

  • It will not be closed for inactivity. No stale bot touches pull requests here.
  • It may still sit a while before a human reads it. That is on us, not on you.
  • Older PRs are read first, so a recent one is not being skipped — it is behind a queue.

Things that will genuinely speed it up whenever review does happen:

  • Keep it rebased on main — the tree is moving quickly right now, and a conflicting branch cannot be reviewed as the diff you intended.
  • Get CI green, or say which failures you believe are pre-existing.
  • Keep the change to one claim. Bundled features and refactors get split before they get merged, which costs you a round trip.
  • Every commit needs a sign-off (git commit -s) — CI enforces DCO.

If this fixes a bug, a reproduction we can run is worth more than a description of the symptom.

Thanks for contributing, and sorry in advance for the wait.

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