Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/rspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: RSpec

on:
pull_request:

jobs:
rspec:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
Copy link

Choose a reason for hiding this comment

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

Missing Ruby version causes workflow to fail

High Severity

The new rspec.yml workflow uses ruby/setup-ruby@v1 without specifying a ruby-version parameter, and the repository has no .ruby-version file. The existing pr-dashboard.yml workflow in this repo correctly specifies ruby-version: '3.2'. Without either a version file or explicit parameter, the ruby/setup-ruby action will fail, causing all PR CI checks to fail.

Fix in Cursor Fix in Web

- name: Run specs
run: bundle exec rspec
19 changes: 18 additions & 1 deletion lib/diffdash/cli/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module CLI
# Thin CLI glue. Orchestrates engine + output adapters.
class Runner
VALID_OPTIONS = %w[--dry-run --verbose -v --help -h].freeze
VALID_SUBCOMMANDS = %w[folders].freeze
VALID_SUBCOMMANDS = %w[folders rspec].freeze

def self.run(args)
new(args).execute
Expand Down Expand Up @@ -42,6 +42,8 @@ def execute
case @subcommand
when "folders"
return list_grafana_folders
when "rspec"
return run_rspec
end

warn "[diffdash] v#{VERSION}"
Expand Down Expand Up @@ -105,6 +107,13 @@ def find_invalid_arguments
end
end

def rspec_args
Copy link

Choose a reason for hiding this comment

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

Rspec passthrough arguments rejected as invalid CLI arguments

High Severity

The rspec subcommand is documented to pass arguments through to rspec (e.g., rspec [args]), but find_invalid_arguments rejects any arguments that aren't in VALID_OPTIONS or VALID_SUBCOMMANDS. When running diffdash rspec --format documentation spec/file_spec.rb, the validation fails before the subcommand handler is reached, making the rspec passthrough feature completely non-functional.

Fix in Cursor Fix in Web

idx = @args.index("rspec")
return [] unless idx

@args[(idx + 1)..] || []
end

def build_outputs(change_set)
title = Formatters::DashboardTitle.sanitize(change_set.branch_name)

Expand Down Expand Up @@ -200,6 +209,13 @@ def list_grafana_folders
1
end

def run_rspec
cmd = ["bundle", "exec", "rspec", *rspec_args]
warn "[diffdash] Running: #{cmd.join(" ")}"
system(*cmd)
$?.success? ? 0 : 1
end

def print_signal_summary(bundle, url: nil)
log_count = bundle.logs.size
counter_count = bundle.metrics.count { |s| s.metadata[:metric_type] == :counter }
Expand Down Expand Up @@ -275,6 +291,7 @@ def print_help

Commands:
folders List available Grafana folders
rspec [args] Run the RSpec suite (passes args through)
(none) Run analysis and generate/upload dashboard

Options:
Expand Down
Loading