Skip to content

Update ruff submodule to latest ty-types-2 branch; surface ParamSpec/Concatenate#14

Merged
knutwannheden merged 2 commits intomainfrom
vivid-eagle
Apr 20, 2026
Merged

Update ruff submodule to latest ty-types-2 branch; surface ParamSpec/Concatenate#14
knutwannheden merged 2 commits intomainfrom
vivid-eagle

Conversation

@knutwannheden
Copy link
Copy Markdown
Contributor

Motivation

Upstream ty released 0.0.22 → 0.0.31 while our submodule was pinned to ~0.0.21. This PR catches up by bumping the ruff/ submodule to the latest openrewrite/ruff ty-types-2 tip (1f844143e8), fixing the API shim against breaking changes on ty's side, and exposing two new pieces of structured signature information that ty now makes available: Concatenate prefixes and ParamSpec tails.

Examples

Callable[Concatenate[int, P], R] — the leading int is now tagged, and the synthesized *args / **kwargs carry the ParamSpec name so consumers can collapse them back into P:

{
  "kind": "callable",
  "parameters": [
    { "name": "", "kind": "positionalOnly", "typeId": 7, "hasDefault": false, "concatenatePrefix": true },
    { "name": "args",   "kind": "variadic",        "typeId": 8, "hasDefault": false, "paramSpecName": "P" },
    { "name": "kwargs", "kind": "keywordVariadic", "typeId": 9, "hasDefault": false, "paramSpecName": "P" }
  ],
  "returnType": 10
}

Callable[P, R] — same paramSpecName treatment, no concatenatePrefix:

{
  "kind": "callable",
  "parameters": [
    { "name": "args",   "kind": "variadic",        "typeId": 4, "hasDefault": false, "paramSpecName": "P" },
    { "name": "kwargs", "kind": "keywordVariadic", "typeId": 5, "hasDefault": false, "paramSpecName": "P" }
  ],
  "returnType": 6
}

Plain signatures are unaffected — both fields are omitted when false / absent.

Summary

  • Bump ruff/ submodule from f74e9836 to 1f844143 (openrewrite/ruff ty-types-2).
  • API shim: ProjectDatabase::new(metadata, system)ProjectDatabase::fallible(metadata, system) (upstream split the constructor and added a MisconfigurationStrategy parameter).
  • API shim: collapse the per-variant match in supertypes_from_class_literal to ClassLiteral::explicit_bases, which now uniformly handles the new DynamicTypedDict / DynamicEnum variants.
  • API shim: fold the new Type::Divergent(DivergentType) cycle marker into the Other fallback.
  • Add concatenatePrefix: bool and paramSpecName: Option<String> to ParameterInfo, populated from sig.parameters().kind() in both registry.rs (for function / callable / boundMethod descriptors) and collector.rs (for CallSignatureInfo on ExprCall nodes).
  • Add a TODO in registry.rs for TypedDict.extraItems[ty] Infer the extra_items keyword argument to class-based TypedDicts as an annotation expression astral-sh/ruff#24362 landed the inference side, but the public accessor on TypedDictType is still unavailable.
  • Document the new fields in README.md.

Test plan

  • cargo check — clean.
  • cargo test — 25/25 integration tests pass, including three new tests:
    • test_param_spec_signature (Callable[P, R])
    • test_concatenate_signature (Callable[Concatenate[int, P], R])
    • test_non_paramspec_signature_has_no_flags (regular def add(a: int, b: int) -> int)
  • cargo build --release — clean.
  • Smoke-tested --serve with initialize / shutdown.

All new fields are additive and skip_serializing_if-gated, so existing consumers are unaffected.

…Concatenate

Bumps ruff submodule to pull in astral-sh/ruff main through ty 0.0.31
(openrewrite/ruff ty-types-2 tip 1f844143e8).

API shim changes:
- ProjectDatabase::new → ProjectDatabase::fallible; the constructor now
  takes a MisconfigurationStrategy, and `fallible` matches our prior
  error-propagating behavior.
- ClassLiteral gained DynamicTypedDict / DynamicEnum variants; replace
  the per-variant match in supertypes_from_class_literal with the
  uniform ClassLiteral::explicit_bases(db), which already handles them.
- Type gained a Divergent(DivergentType) cycle marker; folded into the
  Other fallback alongside DataclassDecorator / BoundSuper.

New wire-protocol fields on ParameterInfo:
- concatenatePrefix (bool) — set on leading positional params of a
  Concatenate[T1, ..., Tn, P] / Concatenate[T1, ..., Tn, ...] signature.
- paramSpecName (string) — set on the synthesized *args / **kwargs
  entries that stand in for a ParamSpec tail, carrying that ParamSpec's
  name.

Both fields are omitted when absent, so consumers that ignore unknown
fields see no change.

TypedDict.extraItems is noted as a TODO in registry.rs: ty's
inference-side parsing landed in astral-sh/ruff#24362, but the public
accessor on TypedDictType is still unavailable.
@knutwannheden knutwannheden merged commit 9dc40e7 into main Apr 20, 2026
7 checks passed
@knutwannheden knutwannheden deleted the vivid-eagle branch April 20, 2026 07:22
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OpenRewrite Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant