Skip to content

Commit 5fb58fc

Browse files
committed
merge upstream astral-sh/ruff (222 commits, jul 9 → jul 22 2026)
merges `upstream/main` at 47d7184 into the fork. 45 conflicts resolved; typeshed regenerated from scratch; full suite green (10355 tests), ci insta gate clean, clippy and prek clean. notable ripples from upstream refactors: - salsa `Update` derive renamed to `SalsaValue`; tracked functions and interned fields now return references unless marked `returns(copy)` - `Type::to_instance` returns an `InstanceProjection`; fork call sites that only need the type use `to_instance_approximation` - the parser collects into `expr_scratch`/`stmt_scratch` buffers, so the fork's subscript and simple-statement hooks push there instead. the `context`-parameter validation had to move after the buffers are drained, or it inspected empty parameter lists and never fired - upstream's two-tier expression cache replaces the fork's `(expression, tcx) -> Type` map; the fluid fields are threaded through `FullExpressionCacheEntry` - `check_file` became a salsa query; `apply_overrides` became `apply_override_options` - `ProtocolMemberWrite` wraps the write capability, so the reified-member lookup goes through `domain()` - pydantic field metadata moved behind `pydantic::field_metadata`, which gains the fork's `frozen` flag fluid specializations needed a real fix: upstream now specializes a generic call's parameter type from the arguments themselves, so every generic call recorded a self-derived "adoption" and locked the specialization. argument contexts built that way are marked `inferred_from_argument` and no longer count as external observers. the typeshed patch pipeline is reproducible from scratch again: `container_overlapping` moved to the post-conversion pass (it matches the converted `Element`/`Key` names and collided with `mapping` in pass 1), and the sync script now runs the patches to a fixed point, since `private type _X` only becomes visible after `TypeAliasStatements` writes the `type _X = …` statement. fork divergences newly exposed by upstream tests are annotated in place: `isinstance(x, (List,))` through the recursive pep 695 `_ClassInfo` alias, covariant `Mapping` keys not widening to the declared key type, `in` on a provably-disjoint container erroring under `Overlapping`, and a `reveal_type` in the arguments of a fluid-receiver call reporting an intermediate pass.
2 parents 3493458 + 47d7184 commit 5fb58fc

565 files changed

Lines changed: 42210 additions & 11480 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.agents/skills/minimizing-ty-ecosystem-changes/SKILL.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ scripts/collect_ty_ecosystem_run_metadata.py \
2525

2626
The manifest contains the analyzed Ruff revisions, Actions `EXCLUDE_NEWER`, ecosystem-analyzer and mypy-primer revisions, and each project's CI Python version. Stop if the helper cannot determine a unique value; never substitute a comment timestamp or local default.
2727

28+
The current workflow splits compilation into `Build ty (base)` and `Build ty (pr)`. The helper reads the base job, which records both the merge base and PR merge revision, and still supports historical runs with a single `Build ty` job.
29+
2830
## Prepare ty
2931

3032
If a primary agent supplied freshly copied base and PR binaries plus the PR ecosystem config, verify the paths exist and reuse them. Do not rebuild, switch Ruff refs, or overwrite the shared artifacts.
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
name: wobbling-ty-constraint-order
3+
description: >
4+
Use when a user asks to wobble ty constraint ordering, check constraint-set or TDD ordering
5+
determinism, test reversed constraint/typevar IDs, or investigate nondeterministic ty inference
6+
and mdtest results.
7+
compatibility: >
8+
Requires Cargo, mktemp, and a POSIX-compatible shell; uses cargo-nextest when available and
9+
otherwise falls back to cargo test.
10+
---
11+
12+
# Wobbling ty constraint order
13+
14+
`TY_CONSTRAINT_SET_ORDER` perturbs both the builder-local TDD-variable order and the local typevar order used to orient typevar-to-typevar constraints. The setting is fixed for the lifetime of each test process.
15+
16+
- unset/`0`: normal ordering;
17+
- `reverse`: reverse both orderings;
18+
- an integer: XOR each local ID with that mask. Small masks immediately perturb dense arena IDs: `1` swaps adjacent IDs, `3` reverses blocks of four, and powers of two exchange neighboring blocks.
19+
20+
This deliberately changes internal TDD shape. Run **mdtests only**: graph-structure unit snapshots are expected to differ. Never enable snapshot updates for a wobble run, since updating would hide the failures being sought.
21+
22+
## Run
23+
24+
From the Ruff root, first establish the normal baseline, then run the reversed and XOR-masked orders sequentially. Set `TY_CONSTRAINT_ORDER_LOG_DIR` to retain logs in a particular writable directory; otherwise `mktemp` chooses an appropriate temporary directory (respecting the environment's temporary-directory configuration).
25+
26+
```bash
27+
set -u
28+
29+
if test -n "${TY_CONSTRAINT_ORDER_LOG_DIR:-}"; then
30+
log_dir="$TY_CONSTRAINT_ORDER_LOG_DIR"
31+
mkdir -p "$log_dir"
32+
else
33+
log_dir="$(mktemp -d -t ty-constraint-order.XXXXXXXX)"
34+
fi
35+
printf '%s\n' "logs: $log_dir"
36+
37+
if cargo nextest --version >/dev/null 2>&1; then
38+
runner=nextest
39+
else
40+
runner=test
41+
fi
42+
printf '%s\n' "runner: cargo $runner"
43+
44+
export CARGO_PROFILE_DEV_OPT_LEVEL=1
45+
export CARGO_PROFILE_DEV_DEBUG=line-tables-only
46+
export INSTA_UPDATE=no
47+
export MDTEST_UPDATE_SNAPSHOTS=0
48+
unset INSTA_FORCE_PASS || true
49+
50+
for order in normal reverse 1 2 3 4 7 8 15; do
51+
if test "$order" = normal; then
52+
unset TY_CONSTRAINT_SET_ORDER || true
53+
else
54+
export TY_CONSTRAINT_SET_ORDER="$order"
55+
fi
56+
57+
log="$log_dir/ty-constraint-order-${order}.log"
58+
if test "$runner" = nextest; then
59+
cargo nextest run -p ty_python_semantic --test mdtest \
60+
--no-fail-fast --status-level fail --failure-output immediate-final \
61+
>"$log" 2>&1
62+
else
63+
cargo test -p ty_python_semantic --test mdtest >"$log" 2>&1
64+
fi
65+
status=$?
66+
67+
printf '%-7s exit=%s\n' "$order" "$status"
68+
grep -E 'Summary \[|test result:' "$log" | tail -1 || true
69+
printf '%s\n' " log: $log"
70+
done
71+
```
72+
73+
Read each failing log and report the mdtest file, section, line, expected result, and actual diagnostic/revealed type. A wobble failure is evidence that inference semantics or displayed solution types still depend on ordering; do not update the mdtest expectations merely to make the wobble run green.
74+
75+
The knob does **not** perturb hashing of Salsa-backed values. The `Solution binding order follows constraint source order` section of `regression/constraint_set_ordering.md` separately varies typevar declaration order to catch binding-order changes caused by draining an `FxHashMap<BoundTypeVarInstance, ...>`.

.github/actionlint.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ self-hosted-runner:
88
- depot-ubuntu-latest-8
99
- depot-ubuntu-22.04-16
1010
- depot-ubuntu-22.04-32
11-
- depot-macos-15
11+
- namespace-profile-macos-15
1212
- depot-windows-2022-16
1313
- depot-ubuntu-22.04-arm-4
1414
- github-windows-2025-x86_64-8

.github/workflows/build-binaries.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666

6767
macos-x86_64:
6868
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-build') }}
69-
runs-on: macos-15
69+
runs-on: ${{ github.repository == 'astral-sh/ruff' && 'namespace-profile-macos-15' || 'macos-15' }}
7070
steps:
7171
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
7272
with:
@@ -96,7 +96,7 @@ jobs:
9696

9797
macos-aarch64:
9898
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-build') }}
99-
runs-on: macos-15
99+
runs-on: ${{ github.repository == 'astral-sh/ruff' && 'namespace-profile-macos-15' || 'macos-15' }}
100100
steps:
101101
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
102102
with:

.github/workflows/build-docker.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ jobs:
5252
submodules: recursive
5353
persist-credentials: false
5454

55-
- uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
55+
- uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
5656

57-
- uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
57+
- uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4.4.0
5858
if: ${{ inputs.plan != '' && !fromJson(inputs.plan).announcement_tag_is_implicit }}
5959
with:
6060
registry: ghcr.io
@@ -78,7 +78,7 @@ jobs:
7878
7979
- name: Extract metadata (tags, labels) for Docker
8080
id: meta
81-
uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # v6.1.0
81+
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
8282
with:
8383
images: ${{ env.RUFF_BASE_IMG }}
8484
# Defining this makes sure the org.opencontainers.image.version OCI label becomes the actual release version and not the branch name
@@ -94,7 +94,7 @@ jobs:
9494
# Adapted from https://docs.docker.com/build/ci/github-actions/multi-platform/
9595
- name: Build and push by digest
9696
id: build
97-
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0
97+
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
9898
with:
9999
context: .
100100
platforms: ${{ matrix.platform }}
@@ -138,19 +138,19 @@ jobs:
138138
pattern: digests-*
139139
merge-multiple: true
140140

141-
- uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
141+
- uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
142142

143143
- name: Extract metadata (tags, labels) for Docker
144144
id: meta
145-
uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # v6.1.0
145+
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
146146
with:
147147
images: ${{ env.RUFF_BASE_IMG }}
148148
# Order is on purpose such that the label org.opencontainers.image.version has the first pattern with the full version
149149
tags: |
150150
type=pep440,pattern={{ version }},value=${{ fromJson(inputs.plan).announcement_tag }}
151151
type=pep440,pattern={{ major }}.{{ minor }},value=${{ fromJson(inputs.plan).announcement_tag }}
152152
153-
- uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
153+
- uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4.4.0
154154
with:
155155
registry: ghcr.io
156156
username: ${{ github.repository_owner }}
@@ -210,9 +210,9 @@ jobs:
210210
- debian:trixie-slim,trixie-slim,debian-slim
211211
- buildpack-deps:trixie,trixie,debian
212212
steps:
213-
- uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
213+
- uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
214214

215-
- uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
215+
- uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4.4.0
216216
with:
217217
registry: ghcr.io
218218
username: ${{ github.repository_owner }}
@@ -262,7 +262,7 @@ jobs:
262262
263263
- name: Extract metadata (tags, labels) for Docker
264264
id: meta
265-
uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # v6.1.0
265+
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
266266
# ghcr.io prefers index level annotations
267267
env:
268268
DOCKER_METADATA_ANNOTATIONS_LEVELS: index
@@ -275,7 +275,7 @@ jobs:
275275
276276
- name: Build and push
277277
id: build-and-push
278-
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0
278+
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
279279
with:
280280
context: .
281281
platforms: linux/amd64,linux/arm64
@@ -316,11 +316,11 @@ jobs:
316316
pattern: digests-*
317317
merge-multiple: true
318318

319-
- uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
319+
- uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
320320

321321
- name: Extract metadata (tags, labels) for Docker
322322
id: meta
323-
uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # v6.1.0
323+
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
324324
env:
325325
DOCKER_METADATA_ANNOTATIONS_LEVELS: index
326326
with:
@@ -330,7 +330,7 @@ jobs:
330330
type=pep440,pattern={{ version }},value=${{ fromJson(inputs.plan).announcement_tag }}
331331
type=pep440,pattern={{ major }}.{{ minor }},value=${{ fromJson(inputs.plan).announcement_tag }}
332332
333-
- uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
333+
- uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4.4.0
334334
with:
335335
registry: ghcr.io
336336
username: ${{ github.repository_owner }}

0 commit comments

Comments
 (0)