Check a single-if initialize body in FormatValidationRaisingInInitialize #1709
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#1709
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
Sdlc/Structural/FormatValidationRaisingInInitializedoes not check aninitializewhose whole body is oneifstatement.validated_if_nodecallsbody.each_descendant(:if), andeach_descendantdoes not yield the receiver node. When the body is a singleif, the body node is thatif, so the cop never sees it. The cop then misses a raising format check in the simplest form of the smell.Observed
ifin its test inputs.plugins/os-sdlc/lib/os_sdlc/cops/structural/format_validation_raising_in_initialize.rb:27,body.each_descendant(:if) do |if_node|.Reproduce
Run the cop on this source. It reports no offense. Add a statement
@value = valueafter theraiseline and run it again. The cop now reports the offense.Approach
Required work: none beyond the acceptance criteria.
Acceptance criteria
initializewhose only statement is a raising format check on a parameter, when the cop runs, then it reports the same offense it reports when a second statement follows the check.Owner sketch
Origin
ififinitialize is not checked ←each_descendant(:if)skips the body node itself ← DESIGN (lib/os_sdlc/cops/structural/format_validation_raising_in_initialize.rb:27)VERDICT: CREATE (ticket-skeptic, 2026-11-12): real false negative in a shipped cop; the two open tickets on this cop cover other faults.
Work started: os-sdlc pipeline on branch ticket-1709 (session 01fe836c).
Resolution
Done: FormatValidationRaisingInInitialize now checks an initialize whose whole body is one raising if: validated_if_node uses body.each_node(:if), which visits the body node itself.
Evidence: Implementation 284 (9 dispatches, all pass, 4 min 54 s):
d28458004(lib) andc9691f64a(test + History row) on branch ticket-1709. Cop test file 18 runs, 0 failures; suite gate and survivor gate green.Follow-ups: none