Add cop Sdlc/Sequel/DatasetResultCompared #909
Labels
No labels
P0
P1
P2
P3
bug
category/code-change
category/cross-repo
category/eval-run
category/investigation
category/no-test-target
category/owner-ruling
category/prose-artifact
category/recurring-chore
category/structure
category/umbrella
crc-refactor
create
delete
enhancement
filed-by/agent
filed-by/user
frozen
lint-rule
needs-info
needs-triage
next
plugin/cc-architect
plugin/os
plugin/os-adr
plugin/os-aidd-lint
plugin/os-backlog
plugin/os-context
plugin/os-doc-hygiene
plugin/os-sdlc
plugin/os-vault
project/cc-os
ready-for-agent
ready-for-human
recurring
review
rule-proposal
update
waiting
wayfinder:grilling
wayfinder:map
wayfinder:map
wayfinder:research
wayfinder:task
wayfinder:task
wontfix
worklist/deviations
worklist/lint-rule
worklist/new-implement-build
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
jared/cc-os#909
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
A decision about one model's rows is made outside that model, by comparing or testing the result of a dataset chain.
Signal: a decision about one model's rows is made outside that model.
Approach
Add the cop
Sdlc/Sequel/DatasetResultComparedunderplugins/os-sdlc/lib/os_sdlc/cops/.Templates:
registry_outside_entry_point.rb,row_index_on_model.rb, and the sharedsequel_allowed_paths.rb.Authoring guide:
plugins/os-sdlc/skills/mine-lints/references/implement-cop.md.RuboCop runs with
DisabledByDefault: true, so every enabled cop blocks at the gate and every hit must always need a correction.Do not widen the match lists below.
Receiver test: the chain starts from a
*_datasetcall.Direct model queries (
Model.where) are out of scope.Flagged:
*_datasetchain used as an operand of>= > < <= == !=, or as the receiver ofzero? positive? empty? any? none?.Not flagged:
between? eql? <=> equal?,case/===, a bare chain as anifcondition.Known hits:
plugins/os-sdlc/lib/os_sdlc/model/implementation.rb:74-75(reroutes_dataset.applied.count >= Reroute::CAP).Correct the existing hits in
plugins/os-sdlc/lib/in the same change.Intended correction: move the query or decision into a named
dataset_modulemethod on the model that owns the rows, and delegate from the caller.Lesson (ADR-0265): the lesson file is a required part of the cop.
Path:
plugins/os-sdlc/lint-lessons/<kebab-cop-name>.mdin the plugin (ADR-0266).Sections in order: The signal; What it is a sign of; Why it matters; Your decision; Correction; Example.
Lesson text uses generic names (for example
orders_dataset,Order), never names from this codebase.Lesson example: before
orders_dataset.shipped.count >= Order::LIMIT, afterorders_dataset.limit_reached?.Depends on #908 (Lesson concept move;
Lesson::Libraryreads the plugin lesson directory).Required work:
DatasetResultComparedinplugins/os-sdlc/lib/os_sdlc/cops/*.rbThe signalinplugins/os-sdlc/lint-lessons/sdlc-sequel-dataset-result-compared.mdAcceptance criteria
*_datasetchain, when the cop runs, then it flags it.plugins/os-sdlc/lib, when the gate runs, then none remain.Owner sketch
Origin
Work started on branch ticket-909 through the os-sdlc pipeline.
Resolution
Done: Cop Sdlc/Sequel/DatasetResultCompared added and enabled in plugins/os-sdlc/.rubocop.yml, with its lesson file plugins/os-sdlc/lint-lessons/sdlc-sequel-dataset-result-compared.md (ADR-0265 sections, generic names). The existing hit is corrected: the cap decision moved to a Reroute dataset_module method and Implementation delegates.
Evidence: Branch ticket-909, commit
39cfda08; os-sdlc implementation 13: 8 dispatches, 0 retries, required-work gate and full suite green, contract-auditor pass.Follow-ups: none; History row for the os-sdlc leaf added after merge.