Sdlc/Sequel/InlineDatasetQuery flags a test file: scope the Sequel cops or correct the hit #917

Open
opened 2026-10-02 18:18:28 +00:00 by jared · 0 comments
Owner

Problem

The cop Sdlc/Sequel/InlineDatasetQuery reports an offense in a test file. The three new Sequel dataset cops have no path scope, so they run on tests/ and on lib/. The older cop Sdlc/Sequel/RowIndexOnModel exempts tests.

Observed

Full lint of plugins/os-sdlc on main reports 21 offenses. One offense is new today.

plugins/os-sdlc/tests/model/dispatch_test.rb:202:16 Sdlc/Sequel/InlineDatasetQuery

Line 202, with context:

      create_dispatch(implementation, verdict: "fail2")

      recent = implementation.dispatches_dataset.newest.limit(1).all

      assert_equal 1, recent.size

The lint of commit 1360ffba (the HEAD before today's work) reports 20 offenses. The other 20 offenses on main are the same 20 offenses. This is the only offense that today's commits introduced.

Scope facts:

  1. plugins/os-sdlc/.rubocop.yml enables Sdlc/Sequel/DatasetResultCompared, Sdlc/Sequel/RubyFilterAfterAll, and Sdlc/Sequel/InlineDatasetQuery with Exclude: [] and no Include. They run on every path, tests included.
  2. Sdlc/Sequel/RowIndexOnModel sets DEFAULT_ALLOWED_PATHS = %w[**/model/**/* **/*_test.rb **/tests/**/*] in lib/os_sdlc/cops/row_index_on_model.rb. It uses the AllowedPaths mixin in lib/os_sdlc/cops/sequel_allowed_paths.rb. It returns early for those paths.
  3. The three new cop files (dataset_result_compared.rb, ruby_filter_after_all.rb, inline_dataset_query.rb) do not use AllowedPaths.

The cop came from ticket #911 (commit 8087fdfc).

Reproduce

cd plugins/os-sdlc && bundle exec rubocop tests/model/dispatch_test.rb

Approach

Two options. This ticket does not choose between them.

Option A: exclude tests/ from the three Sequel dataset cops (for example with AllowedPaths like RowIndexOnModel, or Exclude in .rubocop.yml).

Option B: keep tests in scope and correct the hit at tests/model/dispatch_test.rb:202.

The lint gate blocks the next change that touches tests/model/dispatch_test.rb until the offense is gone or the scope changes.

Required work: none beyond the acceptance criteria.

Acceptance criteria

  1. Given the chosen option is applied, when the full rubocop run for plugins/os-sdlc runs, then it reports no Sdlc/Sequel/InlineDatasetQuery offense at tests/model/dispatch_test.rb.

Origin

  • Trigger: full rubocop run for plugins/os-sdlc on main after #911.
  • Improvised this session: none
  • Chain: offense in test file ← new cop has no path scope ← DESIGN (ticket #911, commit 8087fdfc, plugins/os-sdlc/.rubocop.yml)
  • Root candidate: none
  • Where: plugins/os-sdlc/.rubocop.yml, plugins/os-sdlc/tests/model/dispatch_test.rb
  • Session: 9ee7805f-a4e4-470e-af50-5020e5c524a4
  • Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/9ee7805f-a4e4-470e-af50-5020e5c524a4.jsonl
## Problem The cop `Sdlc/Sequel/InlineDatasetQuery` reports an offense in a test file. The three new Sequel dataset cops have no path scope, so they run on `tests/` and on `lib/`. The older cop `Sdlc/Sequel/RowIndexOnModel` exempts tests. ## Observed Full lint of `plugins/os-sdlc` on main reports 21 offenses. One offense is new today. ``` plugins/os-sdlc/tests/model/dispatch_test.rb:202:16 Sdlc/Sequel/InlineDatasetQuery ``` Line 202, with context: ``` create_dispatch(implementation, verdict: "fail2") recent = implementation.dispatches_dataset.newest.limit(1).all assert_equal 1, recent.size ``` The lint of commit 1360ffba (the HEAD before today's work) reports 20 offenses. The other 20 offenses on main are the same 20 offenses. This is the only offense that today's commits introduced. Scope facts: 1. `plugins/os-sdlc/.rubocop.yml` enables `Sdlc/Sequel/DatasetResultCompared`, `Sdlc/Sequel/RubyFilterAfterAll`, and `Sdlc/Sequel/InlineDatasetQuery` with `Exclude: []` and no `Include`. They run on every path, tests included. 2. `Sdlc/Sequel/RowIndexOnModel` sets `DEFAULT_ALLOWED_PATHS = %w[**/model/**/* **/*_test.rb **/tests/**/*]` in `lib/os_sdlc/cops/row_index_on_model.rb`. It uses the `AllowedPaths` mixin in `lib/os_sdlc/cops/sequel_allowed_paths.rb`. It returns early for those paths. 3. The three new cop files (`dataset_result_compared.rb`, `ruby_filter_after_all.rb`, `inline_dataset_query.rb`) do not use `AllowedPaths`. The cop came from ticket #911 (commit 8087fdfc). ## Reproduce ``` cd plugins/os-sdlc && bundle exec rubocop tests/model/dispatch_test.rb ``` ## Approach Two options. This ticket does not choose between them. Option A: exclude `tests/` from the three Sequel dataset cops (for example with `AllowedPaths` like `RowIndexOnModel`, or `Exclude` in `.rubocop.yml`). Option B: keep tests in scope and correct the hit at `tests/model/dispatch_test.rb:202`. The lint gate blocks the next change that touches `tests/model/dispatch_test.rb` until the offense is gone or the scope changes. Required work: none beyond the acceptance criteria. ## Acceptance criteria 1. Given the chosen option is applied, when the full rubocop run for `plugins/os-sdlc` runs, then it reports no `Sdlc/Sequel/InlineDatasetQuery` offense at `tests/model/dispatch_test.rb`. ## Origin - Trigger: full rubocop run for `plugins/os-sdlc` on main after #911. - Improvised this session: none - Chain: offense in test file ← new cop has no path scope ← DESIGN (ticket #911, commit 8087fdfc, `plugins/os-sdlc/.rubocop.yml`) - Root candidate: none - Where: plugins/os-sdlc/.rubocop.yml, plugins/os-sdlc/tests/model/dispatch_test.rb - Session: 9ee7805f-a4e4-470e-af50-5020e5c524a4 - Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/9ee7805f-a4e4-470e-af50-5020e5c524a4.jsonl
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jared/cc-os#917
No description provided.