fix: exclude unpatchable types from source tracking#6
Merged
Conversation
Contributor
There was a problem hiding this comment.
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.ymland 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.
Contributor
Author
|
/no-platform |
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... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
/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
.lineon 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.0to a Github Action parameter, but YAML will turn that into a Float. So if you do3, you get an integer (can't be monkey patched but already handled),3.0you get a float (can't be monkey patched, but handled in this PR),3.0.1you get a string (is monkey patched)Also, I realized the version of Ruby specified in
.rubocop.ymldoesn't match.ruby-versionso I fixed that while I'm here.