Skip to content

Conversation

@Tonguechaude
Copy link

Summary

Ruby 3.4 compatibility: TypeError in puppet_strings_helper.rb

The puppet-languageserver-sidecar crashes on Ruby 3.4.7 when attempting to index Puppet types, preventing the LSP from providing information about native Puppet resources (package, user, file, etc.).

Additional Context

Add any additional context about the problem here.

  • OS: Arch Linux (kernel 6.17.9)
  • Ruby version: 3.4.7 (2025-10-08)
  • Puppet version: 8.10.0 (gem)
  • puppet-editor-services version: 2.0.4
  • Installation method: Mason.nvim

Steps to Reproduce

  1. Install Ruby 3.4.7 (default on recent Arch Linux)
  2. Install puppet-editor-services 2.0.4
  3. Run the sidecar:
puppet-languageserver-sidecar --action=default_types

Expected Behavior

The sidecar should return a JSON array of all Puppet native types with their documentation.

Actual Behavior

The sidecar crashes with:

/usr/lib/ruby/3.4.0/json/common.rb:305:in `JSON::Ext::Generator::State.generate': 
wrong argument type Array (expected Hash) (TypeError)

      State.generate(obj, opts, nil)
                     ^^^^^^^^^^^^^^
	from /usr/lib/ruby/3.4.0/json/common.rb:305:in `JSON.generate'
	from lib/puppet-languageserver-sidecar/puppet_strings_helper.rb:373:in `to_json'

Root Cause

In lib/puppet-languageserver-sidecar/puppet_strings_helper.rb, line 373:

def to_json(*options)
  JSON.generate(to_h, options)  # Passes Array instead of unpacking
end

Related Issues (if any)

N/A

Checklist

  • 🟢 Spec tests.
  • 🟢 Acceptance tests.
  • Manually verified.

@Tonguechaude Tonguechaude requested a review from a team as a code owner December 9, 2025 11:23
@CLAassistant
Copy link

CLAassistant commented Dec 9, 2025

CLA assistant check
All committers have signed the CLA.

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.

2 participants