mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-11-29 23:37:41 +00:00
* fix(ruby): a block parameter stops the receiver type walk — it no longer takes a same-named outer local's type (RUBY-03)
The shared receiver walk stops at the nearest scope that owns the
receiver's name, and a scope owns a name it holds no type for only through
Scope.lexicalNames. Ruby published none, so an untyped parameter was
invisible to the walk, which climbed past it to a same-named outer binding:
`user = User.new; items.each { |user| user.save }` resolved the block's
`user.save` to User#save.
- emitRubyScopeCaptures attaches @scope.lexical-names to every scope that
declares parameters: a do/end or brace block (its |...| names, block
locals included; this covers lambda { |x| }, proc { |x| } and
Proc.new { |x| }), the body block of a stabby lambda (its parameter list
is a sibling of the body), and a method or singleton method. Blocks
already had scopes; none is added. Numbered and `it` parameters are not
declared names and are not listed.
- The YARD @param decline (RUBY-01) no longer fires for a block, lambda or
nested-def parameter of the tagged name: the shadow now stops the walk on
its own scope, so the tagged use beside it keeps its type. A stabby lambda
whose parameter default reads the name still declines, because the
parameter list sits outside the lambda body.
Fixed shapes, each pinned against exact owner IDs with a decoy: block and
lambda/proc parameters shadowing a typed local or a YARD-typed parameter,
nested blocks, every block-parameter form, an untyped method parameter named
like a typed reader, an attr_reader @return type or a top-level local, a
nested def parameter under a tagged method, and a bare read of a parameter
(a read, not a call). Recall cost: an explicit target() / target(1) /
target 1 beside a same-named block parameter now resolves to nothing, as it
already did beside a same-named method parameter.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* test(bench): gate Ruby block-parameter stop correctness and scaling (RUBY-03)
Block, lambda and method parameters are published as lexical names on the
scope that declares them, so the receiver walk stops at a block parameter
instead of taking a same-named outer local's type.
bench/ruby-block-param-stop pins what that produces and checks how its
cost grows, in the format of bench/ruby-gem-resolution.
Each file holds class Svc<i> with m(items): `user = User.new`, K blocks
rotating `|x| user.run` (the nearest `user`), `|user| user.save` and
`|user, i| user.save` (no edge), side by side or nested, then `user.save`.
Each method's CALLS must equal the expected multiset; main gives the
rebinding blocks wrong User#save edges. One class per file, because Ruby
resolution on main is already super-linear in the classes of ONE file
(measured with `--shape crowded`, not gated).
--check runs a CI profile (about 15 s locally); --full keeps min of 15
after 2 warmups and a fresh process per shape. Every budget is 1.5.
Re-running the scope query over the method for every block scope fails
the nested block gate (2.242 > 1.5).
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* test(bench): ruby-block-param-stop — fixed-width indent, input bytes per cell, 16x side-by-side blocks
Three defects the scaling-bench review found in the other benches apply
here too:
- the nested generator indented each level two spaces deeper, so the
input grew 6.1x for 4x depth; every line now has a fixed-width indent
and each shape pins its input_bytes beside its groups and edges;
- the gate could not see a known O(blocks^2) edit: walking the enclosing
method once per block scope measured 1.410 on the 4x side-by-side
range and passed. Side-by-side blocks now grow 16x (6 -> 96), where
the same edit fails sibling_capture_block_scaling_ratio 3.596 > 1.5
(nested 1.778) with unchanged fingerprints;
- the ratio divides by each shape's own growth factor.
Nesting depth stays 4x: over 6 -> 96 it measures 2.57 (capture) and 2.46
(resolution) from two terms that predate #3905 (the shared callable-flow
fallback that searches a block-taking call's subtree for an argument
list, and the shared lexical lookup climbing from each reference to its
binder); baseline.json `_nested_depth_note` records both. Three CI-profile
runs and one --full run pass, every ratio at most 1.202.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* fix(ruby): resolve PR #3905 feedback
Preserve outer YARD types across lambda defaults and explicit self calls beside parameters. Add parameter-order regressions and a four-size scaling sweep.
Note: pre-existing failure in scenario-map/consolidation.test.ts (jscpd 5.4.2 installed; 5.4.3 expected) not addressed by this PR.
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
188 lines
12 KiB
JSON
188 lines
12 KiB
JSON
{
|
|
"_what": "Synthetic Ruby block-parameter gate for #3905 (RUBY-03), following bench/ruby-gem-resolution: exact accuracy cells and fingerprints, with ratios as the only timing gates. Real capture emitter, real parse worker (dist/), real Ruby ScopeResolver and manifest loader; analyze, persistence and full-pipeline memory are outside this benchmark.",
|
|
"_triage": "Shape and fingerprint failures are deterministic: inspect the corpus and the resolved edges, never rebaseline just to make CI green. The runner also fails, before any baseline comparison, when a method misses an expected CALLS edge or gains one the source never makes. For a timing failure, rerun on an idle machine and verify the report shows its profile (ci: 5 interleaved samples after 1 warmup; full: 15 after 2) before investigating a regression. Millisecond observations are context, not gates.",
|
|
"shapes": {
|
|
"sibling_small": {
|
|
"methods": 64,
|
|
"blocks_per_method": 6,
|
|
"input_bytes": 25047,
|
|
"capture_groups": 2001,
|
|
"relationships": 390,
|
|
"calls": 192,
|
|
"declines": {
|
|
"member-lookup-ambiguous": 64,
|
|
"receiver-type-unresolved/untyped-binder": 640
|
|
},
|
|
"expected_missing": 0,
|
|
"unexpected_edges": 0,
|
|
"fingerprint": "aa773f2b3162324e7427e530a3acb9aefe9238a0f072da831fc257edc44a3bb1"
|
|
},
|
|
"sibling_large": {
|
|
"methods": 256,
|
|
"blocks_per_method": 6,
|
|
"input_bytes": 100083,
|
|
"capture_groups": 7953,
|
|
"relationships": 1542,
|
|
"calls": 768,
|
|
"declines": {
|
|
"member-lookup-ambiguous": 256,
|
|
"receiver-type-unresolved/untyped-binder": 2560
|
|
},
|
|
"expected_missing": 0,
|
|
"unexpected_edges": 0,
|
|
"fingerprint": "5e6a8bb5074c1af40b74932a2a1b7404c0fdc2bd6962044edcfd610b746ea279"
|
|
},
|
|
"sibling_dense": {
|
|
"methods": 64,
|
|
"blocks_per_method": 96,
|
|
"input_bytes": 305367,
|
|
"capture_groups": 19281,
|
|
"relationships": 2310,
|
|
"calls": 2112,
|
|
"declines": {
|
|
"member-lookup-ambiguous": 64,
|
|
"receiver-type-unresolved/untyped-binder": 10240
|
|
},
|
|
"expected_missing": 0,
|
|
"unexpected_edges": 0,
|
|
"fingerprint": "d70d4bba2a6517a9b0307c795b9c43ec30e4de5e692695cbdb80da3f0785b8f8"
|
|
},
|
|
"nested_small": {
|
|
"methods": 64,
|
|
"blocks_per_method": 6,
|
|
"input_bytes": 25047,
|
|
"capture_groups": 2001,
|
|
"relationships": 326,
|
|
"calls": 128,
|
|
"declines": {
|
|
"member-lookup-ambiguous": 64,
|
|
"receiver-type-unresolved/untyped-binder": 704
|
|
},
|
|
"expected_missing": 0,
|
|
"unexpected_edges": 0,
|
|
"fingerprint": "bf3ced2896bcb454e5e26e4bf42b9f583966ce0edfab625a76ec1cf552f8c918"
|
|
},
|
|
"nested_large": {
|
|
"methods": 256,
|
|
"blocks_per_method": 6,
|
|
"input_bytes": 100083,
|
|
"capture_groups": 7953,
|
|
"relationships": 1286,
|
|
"calls": 512,
|
|
"declines": {
|
|
"member-lookup-ambiguous": 256,
|
|
"receiver-type-unresolved/untyped-binder": 2816
|
|
},
|
|
"expected_missing": 0,
|
|
"unexpected_edges": 0,
|
|
"fingerprint": "23a9aa638768212f103378f5b700de54800859e98a3e53c02d94b50a0e6766ff"
|
|
},
|
|
"nested_dense": {
|
|
"methods": 64,
|
|
"blocks_per_method": 24,
|
|
"input_bytes": 81111,
|
|
"capture_groups": 5457,
|
|
"relationships": 326,
|
|
"calls": 128,
|
|
"declines": {
|
|
"member-lookup-ambiguous": 64,
|
|
"receiver-type-unresolved/untyped-binder": 3008
|
|
},
|
|
"expected_missing": 0,
|
|
"unexpected_edges": 0,
|
|
"fingerprint": "cdbd041fdb50e983938598b22982bda15ae579c4a552ec5e77b7bb72c530eef1"
|
|
}
|
|
},
|
|
"_shape_note": "Exact counts are the workload FLOOR. small = 64 methods x 6 blocks, large = 256 x 6 (methods 4x); dense = 64 x 96 side by side (blocks per method 16x) and 64 x 24 nested (depth 4x; see _nested_depth_note). Every line has a fixed-width indent, so input_bytes (pinned per shape) grows linearly in methods and in blocks: 25047 -> 100083 (large, 4.0x), 305367 (sibling dense, 12.2x for 16x blocks) and 81111 (nested dense, 3.2x for 4x depth); with the earlier two-spaces-per-level indent nested input grew 6.1x for 4x depth. One class with one method per file. Expected edges per method are computed from the binder rule, not read back from the graph: a block that rebinds `user` (`|user|`, `|user, i|`) gets no edge, `|x|` reaches the nearest `user` (the local `User` unless an enclosing block rebinds it), and the closing `user.save` reaches User#save. main misses that rule (128 wrong edges at 32 x 6 side by side), so this gate fails without #3905. The one `member-lookup-ambiguous` decline per method is identical on main.",
|
|
"_fingerprint_note": "Hashes pin every relationship (endpoints, type, confidence, reason) and every decline (reason, file, name, position).",
|
|
"budgets": {
|
|
"sibling_capture_method_scaling_ratio": 1.5,
|
|
"sibling_capture_block_scaling_ratio": 1.5,
|
|
"sibling_resolve_method_scaling_ratio": 1.5,
|
|
"sibling_resolve_block_scaling_ratio": 1.5,
|
|
"nested_capture_method_scaling_ratio": 1.5,
|
|
"nested_capture_block_scaling_ratio": 1.5,
|
|
"nested_resolve_method_scaling_ratio": 1.5,
|
|
"nested_resolve_block_scaling_ratio": 1.5
|
|
},
|
|
"_scaling_note": "Scaling ratios are (t_dense / t_small) / growth and (t_large / t_small) / 4, where growth is 16 for sibling blocks and 4 for nesting depth: about 1 is linear, about the growth factor is quadratic. 1.5 (bench/scope-capture) on every ratio.",
|
|
"_one_file_note": "Not gated: on main, Ruby resolution is super-linear in the number of classes or methods in ONE file. With every class in one file (`--shape crowded`), 256 -> 2048 methods, resolution's fitted exponent is 1.60 (1.48-1.72) on main and 1.61 (1.52-1.70) with #3905, per-doubling ratios 2.8 -> 3.5 on both; in a profile at 2048 classes the time is in ruby/merge-bindings.ts and in findClassBindingInScope / lookupMatchingNameClaim (scope-resolution/scope/walkers.ts). #3905 changes neither, and its absolute time there is lower (1180 vs 1641 ms at 2048). The gated shapes therefore use one class per file.",
|
|
"_profiles_note": "Two profiles share the shapes and every accuracy gate. CI (the default, and what --check runs in the benchmarks job): one process, one parse worker, every workload timed, min of 5 after 1 warmup, interleaved. --full: one child times every workload, min of 15 after 2 warmups, and each shape runs in a fresh child for its peak RSS. Wall times are in _measured_ci.",
|
|
"_negative_controls_note": "Walking the enclosing method once per block scope (O(blocks^2) per method, a temporary edit of attachRubyLexicalNames in languages/ruby/captures.ts) fails sibling_capture_block_scaling_ratio 3.596 > 1.5 (nested 1.778) in the CI profile, with unchanged fingerprints. With the earlier 4x side-by-side range the same edit gave 1.410 and passed: per-file overhead hid it, which is why that range is now 16x. These are deliberate regressions, not baseline observations.",
|
|
"_measured_ci": {
|
|
"environment": "macOS arm64 / Node 24.16.0, 2026-11-13, shared host (load average 23-80 on 15 cores)",
|
|
"wall_seconds": [23.77, 83.97, 24.91],
|
|
"reps": 5,
|
|
"warmup": 1,
|
|
"sibling_capture_method_scaling_ratio": 1.046,
|
|
"sibling_capture_method_scaling_ratio_samples": [0.998, 1.046, 0.828],
|
|
"sibling_capture_block_scaling_ratio": 0.753,
|
|
"sibling_capture_block_scaling_ratio_samples": [0.724, 0.753, 0.641],
|
|
"sibling_resolve_method_scaling_ratio": 1.202,
|
|
"sibling_resolve_method_scaling_ratio_samples": [1.202, 1.101, 0.907],
|
|
"sibling_resolve_block_scaling_ratio": 0.785,
|
|
"sibling_resolve_block_scaling_ratio_samples": [0.785, 0.772, 0.685],
|
|
"nested_capture_method_scaling_ratio": 1.061,
|
|
"nested_capture_method_scaling_ratio_samples": [1.061, 0.989, 1.061],
|
|
"nested_capture_block_scaling_ratio": 1.172,
|
|
"nested_capture_block_scaling_ratio_samples": [1.172, 1.112, 0.991],
|
|
"nested_resolve_method_scaling_ratio": 1.138,
|
|
"nested_resolve_method_scaling_ratio_samples": [1.0, 1.138, 1.086],
|
|
"nested_resolve_block_scaling_ratio": 1.088,
|
|
"nested_resolve_block_scaling_ratio_samples": [1.064, 1.067, 1.088],
|
|
"sibling_small_capture_ms": 77.2,
|
|
"sibling_small_resolve_ms": 12.7,
|
|
"sibling_large_capture_ms": 323.0,
|
|
"sibling_large_resolve_ms": 54.5,
|
|
"sibling_dense_capture_ms": 930.3,
|
|
"sibling_dense_resolve_ms": 152.9,
|
|
"nested_small_capture_ms": 89.5,
|
|
"nested_small_resolve_ms": 13.3,
|
|
"nested_large_capture_ms": 359.2,
|
|
"nested_large_resolve_ms": 60.4,
|
|
"nested_dense_capture_ms": 398.0,
|
|
"nested_dense_resolve_ms": 56.8
|
|
},
|
|
"_measured_full": {
|
|
"environment": "macOS arm64 / Node 24.16.0, 2026-11-13, shared host (load average 23-80 on 15 cores)",
|
|
"reps": 15,
|
|
"warmup": 2,
|
|
"sibling_capture_method_scaling_ratio": 0.868,
|
|
"sibling_capture_method_scaling_ratio_samples": [0.868],
|
|
"sibling_capture_block_scaling_ratio": 0.675,
|
|
"sibling_capture_block_scaling_ratio_samples": [0.675],
|
|
"sibling_resolve_method_scaling_ratio": 1.052,
|
|
"sibling_resolve_method_scaling_ratio_samples": [1.052],
|
|
"sibling_resolve_block_scaling_ratio": 0.686,
|
|
"sibling_resolve_block_scaling_ratio_samples": [0.686],
|
|
"nested_capture_method_scaling_ratio": 1.014,
|
|
"nested_capture_method_scaling_ratio_samples": [1.014],
|
|
"nested_capture_block_scaling_ratio": 1.137,
|
|
"nested_capture_block_scaling_ratio_samples": [1.137],
|
|
"nested_resolve_method_scaling_ratio": 1.186,
|
|
"nested_resolve_method_scaling_ratio_samples": [1.186],
|
|
"nested_resolve_block_scaling_ratio": 1.144,
|
|
"nested_resolve_block_scaling_ratio_samples": [1.144],
|
|
"sibling_small_capture_ms": 71.2,
|
|
"sibling_small_resolve_ms": 10.9,
|
|
"sibling_small_peak_rss_mib": 291.6,
|
|
"sibling_large_capture_ms": 247.2,
|
|
"sibling_large_resolve_ms": 46.0,
|
|
"sibling_large_peak_rss_mib": 379.8,
|
|
"sibling_dense_capture_ms": 769.1,
|
|
"sibling_dense_resolve_ms": 120.0,
|
|
"sibling_dense_peak_rss_mib": 541.4,
|
|
"nested_small_capture_ms": 71.4,
|
|
"nested_small_resolve_ms": 11.0,
|
|
"nested_small_peak_rss_mib": 290.0,
|
|
"nested_large_capture_ms": 289.6,
|
|
"nested_large_resolve_ms": 52.2,
|
|
"nested_large_peak_rss_mib": 376.8,
|
|
"nested_dense_capture_ms": 324.7,
|
|
"nested_dense_resolve_ms": 50.3,
|
|
"nested_dense_peak_rss_mib": 330.3
|
|
},
|
|
"_measured_note": "Three CI-profile runs and one --full run on 382d254dc with this runner. Scalar ratios and millisecond values are per-metric maxima across the runs of that profile (rounded); the 84 s wall time is one run under load average ~80, the others took 24-25 s. peak_rss_mib (--full only) is each --shape child's high-water mark after one worker parse and one resolution, worker thread included; context, not gated. Exact shapes and fingerprints were identical in all runs. Shapes changed from the earlier runner: fixed-width indent (nested decline positions, hence nested fingerprints) and 96 blocks per sibling method.",
|
|
"_rebaselined_on_main": "Rebased #3905 onto 14d5405a5 after #3903 and #3880 merged. All six workloads retain their capture groups, CALLS, relationship counts, and zero missing/unexpected edges. DART-11 now records receiver-type-unresolved/untyped-binder declines: sibling small/large/dense 640/2560/2560; nested small/large/dense 704/2816/3008. Only those recorded declines and their fingerprints change; the pre-existing member-lookup-ambiguous counts and all scaling budgets are unchanged. Measured scaling ratios range from 0.692 to 1.056, below 1.5.",
|
|
"_nested_depth_note": "Nesting depth stays 4x (6 -> 24). Over 6 -> 96 on this head (CI profile, one run, fixed-width indent) nested_capture_block_scaling_ratio is 2.57 and nested_resolve_block_scaling_ratio 2.46, from two terms that predate #3905: capture, the shared callable-flow fallback that searches a block-taking call's whole subtree for an argument list (`items.each do ... end` has none; O(depth^2), fixed for Ruby in the bare-read follow-up to #3880); resolution, the shared lexical lookup that climbs from each reference to its binder (`items` at every level climbs to the method; O(depth^2)). Widen the nested range when those land."
|
|
}
|