Skip to content

fix: exclude unpatchable types from source tracking#6

Merged
6f6d6172 merged 4 commits into
mainfrom
os-exclude-unpatchable-types
Aug 20, 2025
Merged

fix: exclude unpatchable types from source tracking#6
6f6d6172 merged 4 commits into
mainfrom
os-exclude-unpatchable-types

Conversation

@6f6d6172

Copy link
Copy Markdown
Contributor

/task SEC-300

This addresses an issue where k/v pairs where the value is of type Float would cause Claws to abort because it looks for line information there (calling .line on it). However because Float is an immediate/non-heap object, we can't monkey patch it to hold line information, and Claws crashes when trying. This happens super rarely but every time it's happened, it was because we passed a version number e.g. 3.0 to a Github Action parameter, but YAML will turn that into a Float. So if you do 3, you get an integer (can't be monkey patched but already handled), 3.0 you get a float (can't be monkey patched, but handled in this PR), 3.0.1 you get a string (is monkey patched)

Also, I realized the version of Ruby specified in .rubocop.yml doesn't match .ruby-version so I fixed that while I'm here.

@6f6d6172 6f6d6172 requested a review from Copilot August 19, 2025 23:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses a critical bug where Claws would crash when encountering Float values in YAML configurations by excluding Float from monkey patching operations, and aligns Ruby version specifications across configuration files.

  • Adds Float to the list of unpatchable types to prevent crashes when processing YAML values like 3.0
  • Updates Ruby version requirements from 3.0 to 3.2+ across .rubocop.yml and gemspec
  • Refactors code to use modern Ruby shorthand syntax for hash parameters

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
lib/claws/cli/yaml_with_lines.rb Excludes Float type from monkey patching to prevent crashes
spec/claws/workflow_spec.rb Adds test coverage for various YAML value types including Float
lib/claws/workflow.rb Refactors to use Ruby shorthand hash syntax
lib/claws/base_rule.rb Refactors to use Ruby shorthand hash syntax
lib/claws/application.rb Refactors to use Ruby shorthand hash syntax
claws-scan.gemspec Updates required Ruby version to 3.2+
.rubocop.yml Updates target Ruby version to 3.2.3

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@6f6d6172 6f6d6172 changed the title Exclude Unpatchable Types fix: exclude unpatchable types from source tracking Aug 20, 2025
Comment thread lib/claws/cli/yaml_with_lines.rb

@lindan-betterment lindan-betterment left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

domain lgtm

@6f6d6172

Copy link
Copy Markdown
Contributor Author

/no-platform

@6f6d6172 6f6d6172 merged commit f020950 into main Aug 20, 2025
5 checks passed
@6f6d6172

Copy link
Copy Markdown
Contributor Author

a potential hack to track line information for other datatypes is to consider casting everything to a string. I'm not too excited about this but I don't think we would ever need to do integer/float specific operations on anything in a github workflow file...

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.

3 participants