Repository navigation
fix(ruby): calls without parentheses, ?/! names, and methods owned by their class (#3377) - #3637
Conversation
…d by their class (#3377) calls_out used CALLS_OUT_C_STYLE (`name(`), which found a third of Ruby's calls: idiomatic Ruby writes `obj.to_s`, `xs.each do`, `puts x`, and method names end in `?`/`!`. The new CALLS_OUT_RUBY takes a name when it follows a receiver dot (`obj.name`, `obj&.name`, a leading-dot chain, `Mod::name`), is followed by `(`, ends in `?`/`!` (a local variable never does), or opens a statement as a command with an argument (`puts x`, `command! "brew"`) -- never a bare word, which Ruby cannot tell from a local variable without a symbol table. Keywords, modifiers (`value if cond`), ternaries, `!=`/`=~` and `name?:` hash labels are excluded; ReDoS-tested. detector.py runs it like the C-style family (qualifiers, #3360 header check) via QUALIFIED_CALLS_OUT_PATTERNS. call_graph_accuracy ruby (vs tree-sitter): recall 34.4% -> 92.9%, precision 91.5% -> 92.7%. 41 of the 71 misses left are `class`/`require`/`raise`, which the contract ignores. Baseline regenerated (it also ratchets javascript, php and typescript gains already on main). Paren-less capture exposed a resolver false edge: brew.rb's bare `puts` resolved `unique` to AbstractDownloadStrategy's private `def puts`. Root cause: no Ruby method was ever attached to its class. The class-scope search looked for a `{`, found the first hash literal or block, and ended the class there (208 of 283 crucible methods classless, 38 agreeing with tree-sitter's enclosing class). Ruby now uses the indentation scoping Python uses -- a class ends at its `end` -- and 245 agree, 0 classless; the rest are naming (`ActiveStorage::Blob` vs `Blob`, `class << self`). The false `puts` edges and an old false `fetch` edge (brew.rb's `options.fetch`) are gone. Golden masters: shell/brew/download_strategy.rb Popularity Rank / Direct Downstream 1 -> 0, plus the network_macro and systemic_bottlenecks ripple and Composition Fit. Closes #3377. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01YAtpBfGGyBGGovitSVaM5Q
|
What failed: 2 failed and 4 collection errors in Cause: Fix: eb24f0e adds Generated by Claude Code |
…nnotations `def main(argv: list[str] | None = None)` is evaluated at import on Python 3.9, raising TypeError in tests/cobol_mainframe/test_completeness.py and test_tool_regex_redos.py on every 3.9 matrix cell (since #3505; the matrix only runs on labelled PRs, so main never exercised it). tests/cobol_mainframe on Python 3.9.23: 481 passed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01YAtpBfGGyBGGovitSVaM5Q
…nal-contract render
Two Windows-only failures in the Full Suite Gate matrix, present on main
since each landed (the matrix only runs on labelled PRs):
- tests/tools/cross_verify.py `_rel` stripped a `/`-joined root, but on
Windows `str(Path("/repo"))` is `\repo` and answer paths are `\repo\B.cbl`,
so no task-B/C/D/E answer ever matched its key (3 test_cross_verify tests).
Both sides are now compared with `/`.
- tests/signal_contract_audit.py rendered doc links with `Path('..') / doc`,
i.e. `..\docs\x.md` on Windows, so the committed render always read stale.
PurePosixPath keeps the link `/` on every OS; the Linux render is unchanged.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01YAtpBfGGyBGGovitSVaM5Q
|
Locally: both test files pass (23 passed), Generated by Claude Code |
…alaxy#3377) (#156) gitgalaxy#3377 gives ruby its own calls_out family (CALLS_OUT_RUBY): a receiver-dot call needs no parentheses. a.rb probe_safety [] -> [freeze], b.rb probe_telemetry gains `logger` (`Rails.logger.info`), probe_state gains `pop`. `freeze` and `pop` are already in docs/calls_out_truth.json's hand-derived periphery -- the old engine missed them; `logger` is a real method call and not forbidden. Nothing planted moves. verify_language.py ruby: PASS (88 assertions); check_calls_out_truth ruby, na_check, ledger_orphan_check, ledger_issue_check: clean. Cross-repo: companion of squid-protocol/gitgalaxy#3637 (merges first, labelled rosetta:rebless-owed); this PR verifies against engine main after it. Claude-Session: https://claude.ai/code/session_01YAtpBfGGyBGGovitSVaM5Q Co-authored-by: Claude <[email protected]>
Closes #3377.
1. Paren-less calls and
?/!names (CALLS_OUT_RUBY)Ruby used
CALLS_OUT_C_STYLE(name(), which finds only a third of Ruby's calls. Idiomatic Ruby writesobj.to_s,xs.each doandputs x, and method names end in?/!.The new pattern in
_shared_patterns.pytakes a name when it:obj.name,obj&.name,"".name, a leading-dot chain line, orMod::name;(;?or!(a local variable never does, so it is always a call);puts x,command! "brew".It never matches a bare word: Ruby can't tell
foothe variable fromfoothe call without a symbol table. It also excludes keywords, modifiers (value if cond), ternaries (ready ? a : b),!=and=~, andname?:hash labels. ReDoS tests are included.detector.pyruns it like the C-style family (qualifier capture, and the #3360 nested-declaration check) throughQUALIFIED_CALLS_OUT_PATTERNS, instead of an identity check against two patterns.call_graph_accuracyruby, against tree-sitter: recall 34.4% → 92.9%, precision 91.5% → 92.7%. Of the 71 remaining misses, 41 areclass,requireandraise, which the calls_out contract ignores.2. Ruby methods now belong to their class
Paren-less capture exposed a false resolver edge: brew.rb's bare
putsresolveduniquetoAbstractDownloadStrategy's privatedef puts.The root cause is older: no Ruby method was ever attached to its class. The class-scope search looked for a
{, found the first hash literal or block, and ended the class there.Ruby now uses the indentation scoping Python uses, so a class ends at its own
end. Crucible ruby methods, compared with tree-sitter's enclosing class:The "name differs" rows are naming only:
ActiveStorage::BlobvsBlob, andclass << self.Golden masters
shell/brew/download_strategy.rb: Popularity Rank / Direct Downstream 1 → 0. The two falseputsedges are gone, and so is an older falsefetchedge (brew.rb'soptions.fetch(...)isHash#fetch).network_macro,systemic_bottlenecksand Composition Fit.Other gates
call_graph_accuracybaseline regenerated. It also ratchets javascript, php and typescript gains that were already on main but never recorded.tests/extraction/languages/test_calls_out_ruby_3377.pyhas 47 tests: call and non-call shapes, splice-level qualifiers, ReDoS, and class ownership. The ownership test fails without the detector change.tree_sitter_accuracy_audit --all --ci: OK (30 languages).docs/calls_out_rule_contract.mdlists Ruby as its own family.Cross-repo
This PR moves the keyword-rosetta ruby manifest (
rosetta-audit: 3 mismatches). All three are real calls the oldname(pattern could not see:a.rbprobe_safety:value.freezeb.rbprobe_telemetry:Rails.logger.info(msg)(loggeris a method call)b.rbprobe_state:items.popThis PR carries
rosetta:rebless-owed, so it merges first. The companion keyword-rosetta re-bless PR then goes against engine main, updatingdata/ruby/expected_signals.jsonper itsdocs/GATING.md. After it merges, the corpus'sbias-history.ymlregenerates the bias chart.🤖 Generated with Claude Code
https://claude.ai/code/session_01YAtpBfGGyBGGovitSVaM5Q