Fix Pattern#forbidden_rule NameError #1518
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#1518
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
Pattern#forbidden_ruleraisesNameErroron every call that reaches the predicate.Inside the
Data.defineblock, constant lookup uses the lexical scopeOsSdlc::SystemModel, notPattern.The constant
Rulelives atPattern::Rule, soRuledoes not resolve.No test calls the method, and no library code calls it, so nothing caught the error.
Observed
plugins/os-sdlc/lib/os_sdlc/system_model/pattern.rb:12:Callers: none. A grep for
forbidden_ruleoverplugins/*/lib,bin,testsfinds only the definition and two test names (test_every_pattern_has_at_least_one_forbidden_rule,test_every_forbidden_rule_has_an_id,test_every_forbidden_rule_has_a_sentenceinsystem_model_catalog_test.rb:44-52) that do not call it.It appears in
design/generated/facts.jsononly as a generated fact.It came in with commit
f84a4cb3(2026-10-27, #1404).Reproduce
Output:
An empty
forbiddenlist does not raise, becausefindnever calls the block.Approach
Change
RuletoPattern::Ruleonpattern.rb:12, ascatalog/*.rbalready writes it. Add a test that callsforbidden_rule.Required work:
is_a?(Pattern::Rule)inplugins/os-sdlc/lib/os_sdlc/system_model/pattern.rbforbidden_rule("R1")inplugins/os-sdlc/tests/system_model_catalog_test.rbAcceptance criteria
Catalog::Hex, whenforbidden_rule("R1")is called, then it returns the rule whose id isR1.Catalog::Hex, whenforbidden_rule("nope")is called, then it returns nil.Owner sketch
Origin
pattern.rbwhile capturing the leaks_io? ticket; reproduced with the command above.Ruleresolves in lexical scopeSystemModel, notPattern← no caller and no test ← DESIGN (plugins/os-sdlc/lib/os_sdlc/system_model/pattern.rb:12)VERDICT: CREATE
Work started on branch
ticket-1518through /os-sdlc:implement.Resolution
Done: Pattern#forbidden_rule no longer raises NameError: it checks candidate.is_a?(Pattern::Rule). It returns the rule for a known id and nil for an unknown id.
Evidence: Commit on ticket-1518 (implementation 226). Two tests in plugins/os-sdlc/tests/system_model_catalog_test.rb through Catalog::Hex.forbidden_rule. Suite gate green (dispatch 2074); contract audit pass (2075).
Follow-ups: none