inward_dependency_test counts constants inside comments and string literals #744
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#744
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
plugins/os-sdlc/tests/inward_dependency_test.rb finds referenced constants with a regex scan of
File.readraw text. Commitc78dd226fixed qualified-constant resolution through the Zeitwerk cpath map, but the regex still matches constant-shaped text inside comments and string literals, so the baseline it records can count references that are not real code dependencies.Approach
Replace the regex scan with a tokenizer (Ripper or Prism) that yields only constant-path tokens, and drop any token whose source position falls inside a comment or a string literal. Re-run the scanner and re-record KNOWN_VIOLATIONS, which stands at 75 today.
Required work:
referenced_constantswith a Ripper- or Prism-based tokenizer that walks constant-path nodes.bin/rake test TEST=plugins/os-sdlc/tests/inward_dependency_test.rb(or the project's equivalent runner).Rejected: patching the regex with more exclusion patterns — a tokenizer is the direct fix for "is this token code," a regex is an approximation of it.
Acceptance criteria
referenced_constantsscans it, then that occurrence is not counted.referenced_constantsscans it, then that occurrence is not counted.referenced_constantsscans it, then that occurrence is still counted.Owner sketch
Origin
c78dd226(#741), 2026-09-26.Started on branch crc-pass-os-sdlc.
Resolution
Done: Tokenized inward-dependency scanner with Prism so constants inside comments and string literals no longer count as references; baseline dropped 75 -> 73.
Evidence: commit
fd59331c; suite 1430 runs, 3252 assertions, 0 failures, 0 errors, 10 skipsFollow-ups: none