Skip to content

RBS runtime probe drops qualified class identities before seeding method bodies #435

Description

@dchuk

At main 2b2deff, the hand-authored-RBS probe does not apply existing signatures to namespaced runtime methods. Its registry builder stores ActiveRecord::Connection under Connection, but build_method_ctx looks up the ingested ActiveRecord::Connection ID. A declared String parameter is consequently counted as unresolved.

This is a defect in tests/inference_on_spinel_blog_runtime_with_rbs.rs, not a claim that the production analyzer loses these signatures.

The existing connection.rbs already contains:

module ActiveRecord
  class Connection
    def quote_string: (String str) -> String
  end
end

To expose the mismatch, add this assertion to that integration-test file and run cargo test --locked --test inference_on_spinel_blog_runtime_with_rbs qualified_probe_seed_expected -- --exact:

#[test]
fn qualified_probe_seed_expected() {
    let (_, sigs) = build_class_registry();
    let classes = ingest_runtime_classes();
    let (_, class) = classes.iter()
        .find(|(_, c)| c.name.0.as_str() == "ActiveRecord::Connection")
        .unwrap();
    let method = class.methods.iter()
        .find(|m| m.name.as_str() == "quote_string")
        .unwrap();
    let ctx = build_method_ctx(&class.name, method, &sigs, &HashMap::new());
    assert_eq!(ctx.local_bindings.get(&Symbol::from("str")), Some(&Ty::Str));
}

The current lookup yields None instead of Some(Str). The same identity mismatch affects self-sends and declared return types: a receiver typed ActiveRecord::Result cannot find its rows reader in a registry keyed only by Result.

Preserve canonical IDs for signatures and method dispatch. The probe has no constant resolver, so its bare constants still need short-name aliases; aliases must be unambiguous and must not merge unrelated classes with the same final name.

A controlled run using the unchanged main runtime inputs measured 1,273 unresolved nodes with the existing probe and 45 with the corrected probe. Both runs used the same candidate analyzer and isolated runtime inputs; this is not a pristine full Cargo gate. The standalone correction in PR #437 passes three focused probe tests, four runtime source integration tests, and the required full cargo test --locked gate (3,530 passed, zero failed, 130 ignored) on supported Ruby 3.4.11 / Rails 8.1.4. Production sources and the validated source hashes were unchanged. The proposed correction keeps the same node traversal and lowers the ceiling to the measured 45; it does not exclude methods or raise the allowance.

Activity

  1. added a commit that references this issue on Oct 5, 2026
    5a583fb
  2. thomasklemm commented on Oct 5, 2026

    @thomasklemm
    Collaborator

    Fix stacked on the Hill climb meta-PR #451 (5a583fbc): canonical class IDs + unambiguous short aliases in the RBS runtime probe. Measured residual on that head: 1412 → 57. Standalone #437 covers the same change and can close when #451 lands.

  3. thomasklemm commented on Oct 5, 2026

    @thomasklemm
    Collaborator

    Follow-up on #451 tip 712677b8: after canonical ClassIds (#435, ~1412→57), the remaining 57 are now 0 — missing dep RBS / frozen ivars / cross-stem Base harvest, not further ClassId work. Soft ceiling ratcheted to 0 on inference_on_spinel_blog_runtime_with_rbs.

  4. added 5 commits that reference this issue on Oct 5, 2026
    a76ad9e
    59716d8
    bf4f9f1
    7037a0f
    2369bd0
  5. added a commit that references this issue on Oct 6, 2026
    269c220
  6. added a commit that references this issue on Oct 7, 2026
    4e72a52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions