os-sdlc lint rule: module owning instance state (disguised inheritance) #86
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#86
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?
Context
Sandi Metz review of
plugins/os_sdlc/lib/os_sdlc/issue_source.rbfound a behavioral mixinthat owns instance state — a module doing the job inheritance is for, without saying so.
Problem
plugins/os-sdlc/lib/os_sdlc/issue_source.rb:100-104CommandFetchisincluded intoForgejoandGithub(lines 127, 141). It definesinitializeand bothfetch(line 106-115) andparse_json(119-123) read@runner,@slug. A module that ownsinitializeplus ivars isn't sharing stateless behavior — it'sdisguised inheritance.
Forgejo/Githubonly differ incommand/description, exactly thetemplate-method shape a base class expresses directly.
Detection
module ... endnode in a file (RuboCopon_module).def/def_node).initializeis defined directly in the module body.ivar/ivasgn)."module CommandFetch defines initialize and reads @slug/@runner -- a module that owns instance state is disguised inheritance. Convert it to a base class (Forgejo/Github inherit from it) or extract the shared behavior into a composed collaborator object, instead of a module mixed into classes that need that state."Correction
(mirrored for
Github; each subclass keeps only its owncommand/description.)Pass/fail examples
module CommandFetchas shown — definesinitialize, reads@slug/@runnerinfetch/parse_json.arguments (e.g. a
Comparable-style mixin definingbetween?in terms of<=>resultspassed in, no
initialize, no ivar reference anywhere in the module body).Provenance
Sandi Metz review of
issue_source.rb, cc-os session 2026-07-22 (organic finding — not acouncil/run finding).
Implementation plan
Custom RuboCop cop (this repo's
.rubocop.ymlscaffolding reserves a "batch 2" slot forcustom, non-stock cops — this rule needs one, since no stock cop flags stateful modules).
Implemented directly by a Fable agent, with a Codex review/audit before merge.
Implemented in cc-os commit
82d6d87as Sdlc/ModuleOwnsInstanceState. Verified firing on issue_source.rb (module CommandFetch). Pending validation in a live run per the lint-rule loop.Covered: Sdlc/Structural/ModuleOwnsInstanceState shipped (lib/os_sdlc/cops/module_owns_instance_state.rb), enabled in .rubocop.yml with tests. ADR-0061 finalizes the os-sdlc lint program; closing per commit
8e88bbe.