Developer
Neil Mitchell
ndmitchell@meta.com
Performance
YoY:+245%Key patterns and highlights from this developer's activity.
Breakdown of growth, maintenance, and fixes effort over time.
Bugs introduced vs. fixed over time.
Reclassifies engineering effort based on bug attribution. Commits that introduced bugs are retrospectively counted as poor investments.
Investment Quality reclassifies engineering effort based on bug attribution data. Commits identified as buggy origins (those that introduced bugs later fixed by someone) have their grow and maintenance time moved into the Wasted Time category. Their waste (fix commits) remains counted as productive. All other commits retain their standard classification: grow is productive, maintenance is maintenance, and waste (fixes) is productive.
The standard model classifies commits as Growth, Maintenance, or Fixes. Investment Quality adds a quality lens: a commit that introduced a bug is retrospectively counted as a poor investment — the engineering time spent on it was wasted because it ultimately required additional fix work. Fix commits (Fixes in the standard model) are reframed as productive, because fixing bugs is valuable work.
Currently computed client-side from commit and bug attribution data. Ideal server-side endpoint:
POST /v1/organizations/{orgId}/investment-quality
Content-Type: application/json
Request:
{
"startTime": "2025-01-01T00:00:00Z",
"endTime": "2025-12-31T23:59:59Z",
"bucketSize": "BUCKET_SIZE_MONTH",
"groupBy": ["repository_id" | "deliverer_email"]
}
Response:
{
"productivePct": 74,
"maintenancePct": 18,
"wastedPct": 8,
"buckets": [
{
"bucketStart": "2025-01-01T00:00:00Z",
"productive": 4.2,
"maintenance": 1.8,
"wasted": 0.6
}
]
}Latest analyzed commits from this developer.
| Hash | Message | Date | Files |
|---|
Commit activity distribution by hour and day of week. Shows when this developer is most active.
Developers who frequently work on the same files and symbols. Higher score means stronger code collaboration.
| Effort |
|---|
| 82da5abf | This commit **refactors** the **`LoaderFindCache`** to implement more efficient **origin-agnostic caching** for module resolution. It introduces a mechanism to use `None` as the origin key for modules whose resolution is origin-independent, specifically promoting bundled typeshed and third-party stub modules to this cache state. A new `is_bundled()` method was added to **`ModulePath`** to identify these modules, enabling the cache to serve future lookups from any origin. This optimization significantly **improves performance** for module loading, demonstrating a **19.5% speedup** on large projects by reducing redundant cache lookups. | Mar 24 | 2 | maint |
| 1e6061b1 | This commit introduces a **performance optimization** to the **Python comment parsing logic** within the `pyrefly_python` crate. It adds a **fast path** to the `find_comment_start` function, enabling it to quickly identify comment beginnings on common Python lines that do not contain quotes or backslashes before a hash symbol. This **refactoring** extracts the original, more complex state machine logic into a new `find_comment_start_slow` function, allowing the fast path to use a single `position()` scan for the majority of lines. The change primarily impacts the **`ignore.rs` module**, leading to significantly faster processing of Python source code by `pyrefly_python` by avoiding byte-by-byte iteration for simple cases. | Mar 23 | 1 | maint |
| f948860e | This commit implements a **performance optimization** by adding a fast path to the `get_idx` function within the `pyrefly` **`Answers` solver**. It introduces an early return that checks if a `Calculation` cell already contains a computed value, thereby avoiding the overhead of constructing a `CalcId` or interacting with the `CalcStack`. This **refactoring** significantly **reduces CPU cycles** by preventing redundant operations like `Arc` increments, hash map manipulations, and `RefCell` borrows when re-reading already-solved bindings. The improvement is particularly impactful during the `pre_solve` loop in `Answers::solve`, where frequent access to pre-computed values previously incurred unnecessary `CalcStack` overhead. | Mar 23 | 1 | maint |
| c72e6f90 | This commit introduces a **performance optimization** within the `pyrefly` **module finder**, specifically in the `find_one_part_in_root` function. It **refactors** the module path component lookup logic to first verify the existence of a candidate directory before attempting to locate `__init__.py` or `__init__.pyi` files within it. This change **reduces file system I/O** by avoiding two unnecessary `stat` calls for each non-existent directory, leading to **faster module resolution** in scenarios where module path components do not exist. | Mar 23 | 1 | maint |
| 5b488260 | This commit introduces a **performance optimization** to the `pyrefly` library's **error collection mechanism**. It **refactors** the `collect_unused_ignore_errors_for_display()` function in `pyrefly/lib/state/errors.rs` to replace an inefficient `O(errors * loads)` lookup with a `SmallMap` for `O(1)` path-to-config resolution. This change significantly **improves the speed** of identifying and displaying unused ignore errors, yielding approximately an 18% performance gain on large codebases and enhancing the overall responsiveness of the analysis tool. | Mar 23 | 1 | maint |
| 4f82df4f | This commit introduces a **performance optimization** by **refactoring** the error collection mechanism within the **`pyrefly` check command**. It addresses a redundancy where `collect_unused_ignore_errors()` and `collect_unused_ignore_errors_for_display()` were re-collecting errors that had already been gathered by their callers. The **refactoring** modifies these functions to accept pre-collected errors as a parameter and introduces an `apply_baseline()` method in `pyrefly/lib/state/errors.rs` to centralize baseline filtering. This change primarily affects the **`pyrefly` command-line interface** and **error suppression logic**, streamlining error processing in modules like `buck_check.rs`, `check.rs`, and `playground.rs`. The elimination of double error collection results in a notable **performance improvement** of approximately 10% for large codebases during the `check` command execution. | Mar 23 | 5 | maint |
| ca60ca2e | This commit introduces a **performance optimization** within the **`pyrefly_util` crate** by **refactoring** how type equality is checked in the **`Visit` and `VisitMut` traits**. Previously, the default `visit` and `visit_mut` methods performed expensive runtime string comparisons via `type_eq()`. This change now pre-computes and stores the result of these checks as a `TYPE_EQ` associated constant on the traits, guaranteeing compile-time evaluation. This significantly reduces overhead on every visit/recurse call, leading to a notable **runtime performance improvement** of approximately 8% for large codebases utilizing these visitor patterns. | Mar 20 | 1 | maint |
| 651f4984 | This commit introduces a significant **performance optimization** to the **`pyrefly_python` crate** by **refactoring** the `find_comment_start` function within `crates/pyrefly_python/src/ignore.rs`. The change semantically optimizes **comment parsing** by processing input as **bytes** directly, rather than relying on expensive character iterators. This targeted improvement drastically **reduces CPU overhead** associated with comment detection, which previously accounted for 5% of execution time. The simpler, byte-based approach is expected to result in faster overall processing and potentially allow the function to be inlined for further efficiency gains, improving the performance of operations that rely on ignoring comments. | Mar 17 | 1 | maint |
| fdf7caab | This commit **introduces a new `TypePtr` mechanism** within the `pyrefly_types` crate, designed to provide **lifetime-erased references to `Type` objects**. The `TypeHeap` module now includes `ptr()` and `unptr()` methods, allowing for the creation and safe recovery of these references, with runtime verification to prevent misuse. This **new capability** is a critical **scaffolding step** for the upcoming arena-based type allocation migration, enabling more flexible and efficient memory management for types. | Feb 24 | 1 | grow |
| 5206870e | This commit **refactors** the **`pyrefly_util`** crate by **removing the `'static` lifetime requirement** from the **`Visit` and `VisitMut` traits** and their default implementations. Previously, these traits mandated `Self: 'static` and `To: 'static` due to their reliance on `Any::downcast_ref`. The change replaces `Any::downcast_ref` with a pointer cast, guarded by an existing compile-time type check, thereby eliminating the restrictive `'static` bound. This crucial **refactoring** also updates the generated implementations in **`pyrefly_derive`** and unblocks the upcoming **`Type<'t>` migration**, allowing types with non-static lifetimes to correctly utilize the visitor pattern. | Feb 24 | 2 | maint |
| 162d7bd1 | This commit **adds support for lifetime parameters** to the `Visit` and `VisitMut` **derive macros** within the `pyrefly_derive` crate. Previously rejected, these macros now correctly process and include lifetimes in the generated `impl` blocks by adjusting the `generics` helper and `derive_visit_impl`. Additionally, it **implements `Visit` and `VisitMut` for `std::marker::PhantomData`** in `pyrefly_util`, which is a **new capability**. This **feature enhancement** is a prerequisite for the upcoming `Type<'t>` migration, allowing the visitor pattern to be used with lifetime-generic types. | Feb 24 | 3 | grow |
| bb9c972f | This commit introduces a **new feature** by adding a unique identifier to the `TypeHeap` structure within the **`pyrefly_types` crate**. A global `UniqueFactory` is now responsible for generating these distinct IDs for each `TypeHeap` instance upon creation, accessible via a new `unique` method. This enhancement significantly **improves the ability to track and debug individual type heaps**, laying crucial groundwork for future optimizations such as arena-based memory allocation. | Feb 24 | 1 | grow |
| a9d7d9b0 | This commit performs a **memory optimization refactoring** by replacing `Vec` with `ThinBoxSlice` in key data structures within **Buck2's action execution and analysis storage components**. Specifically, it updates the `remote_execution_dependencies` and `re_gang_workers` fields in `UnregisteredRunAction`, and the `transitive_sets` field in `FrozenAnalysisValueStorage`, to leverage `ThinBoxSlice`'s more compact representation. This change significantly reduces memory overhead, as `ThinBoxSlice` uses a single pointer (8 bytes) compared to `Vec`'s 24 bytes, and allocates zero memory for empty slices, which is common for these fields. The **refactoring** impacts how remote execution dependencies are collected in `analysis_actions_methods_run` and how analysis values are frozen in `freeze`, leading to a more **memory-efficient Buck2 system**. | Feb 23 | 3 | maint |
| 91281066 | This commit introduces a **memory optimization** within the **Buck2 action implementation** by **refactoring** how `metadata_param` is stored in `UnregisteredRunAction`. The `metadata_param` field is now wrapped in an `Option<Box<MetadataParameter>>` in `app/buck2_action_impl/src/actions/impls/run.rs`, preventing the full `MetadataParameter` struct from being inlined when it's typically `None`. This change, supported by an update to `analysis_actions_methods_run` in `app/buck2_action_impl/src/context/run.rs` to box the parameter during creation, results in a measurable **reduction in RSS memory consumption** for Buck2 compilations. This targeted **refactoring** improves the overall resource efficiency of the build system. | Feb 23 | 2 | maint |
| 92e37b53 | This commit **enhances the `TypeEq` derive macro** within the **`pyrefly_derive` crate** to correctly process and include **lifetime generic parameters**. Previously, the macro would reject types with lifetimes, but now it passes them through to the generated `impl` blocks, enabling more robust type equality checks. This **new capability** is a critical preparatory step for an **upcoming `Type<'t>` migration**, allowing types with lifetimes to be properly compared. Additionally, the **`pyrefly_types` crate** gains a `TypeEq` implementation for `PhantomData` and new test cases to validate the macro's expanded support for lifetime-bound types. | Feb 10 | 2 | grow |
| 1389dbe3 | This commit **refactors** the type system by **wiring a `TypeHeap` parameter** through the `unions_with_literals` function and its various callers. This is a **preparatory change** to enable future type construction using `TypeHeap::mk_*` methods, impacting **type simplification**, **typed dictionary processing**, and the **inference command**. The `unions_with_literals` signature in `crates/pyrefly_types/src/simplify.rs` now accepts a `TypeHeap`, and a new `TypeHeap` is instantiated within `pyrefly/lib/commands/infer.rs` to satisfy the new parameter requirement. While the `TypeHeap` parameter is currently unused, this **architectural refactoring** ensures the necessary infrastructure is in place for upcoming changes to type representation and construction. | Feb 10 | 4 | maint |
| 2c6e4956 | This commit **refactors** the **type simplification logic** by modifying the `intersect` function in `crates/pyrefly_types/src/simplify.rs`. It introduces a new `&TypeHeap` parameter to `intersect`'s signature, which is currently unused but **prepares the groundwork** for future changes where type construction will leverage `TypeHeap::mk_*` methods. Consequently, all direct callers of `intersect` within the **type solver** (`solver/solver.rs`) and **alternative narrowing logic** (`alt/narrow.rs`) are updated to pass the `TypeHeap` reference. This change is a **foundational step** towards centralizing type allocation and management within the `TypeHeap` system. | Feb 10 | 3 | maint |
| 8a055043 | This commit performs a significant **refactoring** to propagate the `&TypeHeap` parameter through the `unions()` function in `crates/pyrefly_types/src/simplify.rs` and its extensive call chain. This is a **preparatory step** for an **arena migration** within the **type system**, ensuring that the `TypeHeap` context is available for future type construction methods like `TypeHeap::mk_*`. The change affects core type manipulation functions such as `callable_return_type`, `callable_first_param`, `distribute_type_over_union`, and `Restriction::as_type`, and cascades through numerous modules in `pyrefly/lib/alt/`, `pyrefly/lib/solver/`, and `pyrefly/lib/report/pysa/`. While the `TypeHeap` parameter is currently unused, this **foundational change** establishes the necessary plumbing for improved memory management and performance within the `pyrefly_types` crate. | Feb 10 | 16 | maint |
| dc9c9e6d | This commit performs a **refactoring** of the **PyRefly type system** by introducing a `&TypeHeap` parameter to the `simplify_tuples` function in `crates/pyrefly_types/src/simplify.rs`. All existing call sites, including those in `pyrefly/lib/alt/class/tuple.rs`, `pyrefly/lib/alt/narrow.rs`, and `pyrefly/lib/solver/solver.rs`, have been updated to pass the relevant heap instance. While the `_heap` parameter is currently unused, this change is **preparatory work** to enable future integration of type construction logic with `TypeHeap::mk_*` methods, streamlining type management within the **type simplification process**. This foundational update sets the stage for more efficient and consistent type handling across the project. | Feb 10 | 4 | maint |
| 2a6e00b4 | This commit introduces a significant **refactoring** within the **type simplification logic** in `crates/pyrefly_types/src/simplify.rs`. It **migrates all type construction** from direct `Type` constructors to using `heap.mk_*()` methods provided by a `TypeHeap` instance. This change involves threading the `TypeHeap` parameter through numerous internal functions, including `unions_internal`, `try_collapse`, and `simplify_intersections`, ensuring that all type creation is now centralized and managed by the heap. The primary impact is an improved internal architecture for type management, paving the way for potential memory optimizations and canonicalization of type objects within the type system. | Feb 10 | 1 | maint |
This commit **refactors** the **`LoaderFindCache`** to implement more efficient **origin-agnostic caching** for module resolution. It introduces a mechanism to use `None` as the origin key for modules whose resolution is origin-independent, specifically promoting bundled typeshed and third-party stub modules to this cache state. A new `is_bundled()` method was added to **`ModulePath`** to identify these modules, enabling the cache to serve future lookups from any origin. This optimization significantly **improves performance** for module loading, demonstrating a **19.5% speedup** on large projects by reducing redundant cache lookups.
This commit introduces a **performance optimization** to the **Python comment parsing logic** within the `pyrefly_python` crate. It adds a **fast path** to the `find_comment_start` function, enabling it to quickly identify comment beginnings on common Python lines that do not contain quotes or backslashes before a hash symbol. This **refactoring** extracts the original, more complex state machine logic into a new `find_comment_start_slow` function, allowing the fast path to use a single `position()` scan for the majority of lines. The change primarily impacts the **`ignore.rs` module**, leading to significantly faster processing of Python source code by `pyrefly_python` by avoiding byte-by-byte iteration for simple cases.
This commit implements a **performance optimization** by adding a fast path to the `get_idx` function within the `pyrefly` **`Answers` solver**. It introduces an early return that checks if a `Calculation` cell already contains a computed value, thereby avoiding the overhead of constructing a `CalcId` or interacting with the `CalcStack`. This **refactoring** significantly **reduces CPU cycles** by preventing redundant operations like `Arc` increments, hash map manipulations, and `RefCell` borrows when re-reading already-solved bindings. The improvement is particularly impactful during the `pre_solve` loop in `Answers::solve`, where frequent access to pre-computed values previously incurred unnecessary `CalcStack` overhead.
This commit introduces a **performance optimization** within the `pyrefly` **module finder**, specifically in the `find_one_part_in_root` function. It **refactors** the module path component lookup logic to first verify the existence of a candidate directory before attempting to locate `__init__.py` or `__init__.pyi` files within it. This change **reduces file system I/O** by avoiding two unnecessary `stat` calls for each non-existent directory, leading to **faster module resolution** in scenarios where module path components do not exist.
This commit introduces a **performance optimization** to the `pyrefly` library's **error collection mechanism**. It **refactors** the `collect_unused_ignore_errors_for_display()` function in `pyrefly/lib/state/errors.rs` to replace an inefficient `O(errors * loads)` lookup with a `SmallMap` for `O(1)` path-to-config resolution. This change significantly **improves the speed** of identifying and displaying unused ignore errors, yielding approximately an 18% performance gain on large codebases and enhancing the overall responsiveness of the analysis tool.
This commit introduces a **performance optimization** by **refactoring** the error collection mechanism within the **`pyrefly` check command**. It addresses a redundancy where `collect_unused_ignore_errors()` and `collect_unused_ignore_errors_for_display()` were re-collecting errors that had already been gathered by their callers. The **refactoring** modifies these functions to accept pre-collected errors as a parameter and introduces an `apply_baseline()` method in `pyrefly/lib/state/errors.rs` to centralize baseline filtering. This change primarily affects the **`pyrefly` command-line interface** and **error suppression logic**, streamlining error processing in modules like `buck_check.rs`, `check.rs`, and `playground.rs`. The elimination of double error collection results in a notable **performance improvement** of approximately 10% for large codebases during the `check` command execution.
This commit introduces a **performance optimization** within the **`pyrefly_util` crate** by **refactoring** how type equality is checked in the **`Visit` and `VisitMut` traits**. Previously, the default `visit` and `visit_mut` methods performed expensive runtime string comparisons via `type_eq()`. This change now pre-computes and stores the result of these checks as a `TYPE_EQ` associated constant on the traits, guaranteeing compile-time evaluation. This significantly reduces overhead on every visit/recurse call, leading to a notable **runtime performance improvement** of approximately 8% for large codebases utilizing these visitor patterns.
This commit introduces a significant **performance optimization** to the **`pyrefly_python` crate** by **refactoring** the `find_comment_start` function within `crates/pyrefly_python/src/ignore.rs`. The change semantically optimizes **comment parsing** by processing input as **bytes** directly, rather than relying on expensive character iterators. This targeted improvement drastically **reduces CPU overhead** associated with comment detection, which previously accounted for 5% of execution time. The simpler, byte-based approach is expected to result in faster overall processing and potentially allow the function to be inlined for further efficiency gains, improving the performance of operations that rely on ignoring comments.
This commit **introduces a new `TypePtr` mechanism** within the `pyrefly_types` crate, designed to provide **lifetime-erased references to `Type` objects**. The `TypeHeap` module now includes `ptr()` and `unptr()` methods, allowing for the creation and safe recovery of these references, with runtime verification to prevent misuse. This **new capability** is a critical **scaffolding step** for the upcoming arena-based type allocation migration, enabling more flexible and efficient memory management for types.
This commit **refactors** the **`pyrefly_util`** crate by **removing the `'static` lifetime requirement** from the **`Visit` and `VisitMut` traits** and their default implementations. Previously, these traits mandated `Self: 'static` and `To: 'static` due to their reliance on `Any::downcast_ref`. The change replaces `Any::downcast_ref` with a pointer cast, guarded by an existing compile-time type check, thereby eliminating the restrictive `'static` bound. This crucial **refactoring** also updates the generated implementations in **`pyrefly_derive`** and unblocks the upcoming **`Type<'t>` migration**, allowing types with non-static lifetimes to correctly utilize the visitor pattern.
This commit **adds support for lifetime parameters** to the `Visit` and `VisitMut` **derive macros** within the `pyrefly_derive` crate. Previously rejected, these macros now correctly process and include lifetimes in the generated `impl` blocks by adjusting the `generics` helper and `derive_visit_impl`. Additionally, it **implements `Visit` and `VisitMut` for `std::marker::PhantomData`** in `pyrefly_util`, which is a **new capability**. This **feature enhancement** is a prerequisite for the upcoming `Type<'t>` migration, allowing the visitor pattern to be used with lifetime-generic types.
This commit introduces a **new feature** by adding a unique identifier to the `TypeHeap` structure within the **`pyrefly_types` crate**. A global `UniqueFactory` is now responsible for generating these distinct IDs for each `TypeHeap` instance upon creation, accessible via a new `unique` method. This enhancement significantly **improves the ability to track and debug individual type heaps**, laying crucial groundwork for future optimizations such as arena-based memory allocation.
This commit performs a **memory optimization refactoring** by replacing `Vec` with `ThinBoxSlice` in key data structures within **Buck2's action execution and analysis storage components**. Specifically, it updates the `remote_execution_dependencies` and `re_gang_workers` fields in `UnregisteredRunAction`, and the `transitive_sets` field in `FrozenAnalysisValueStorage`, to leverage `ThinBoxSlice`'s more compact representation. This change significantly reduces memory overhead, as `ThinBoxSlice` uses a single pointer (8 bytes) compared to `Vec`'s 24 bytes, and allocates zero memory for empty slices, which is common for these fields. The **refactoring** impacts how remote execution dependencies are collected in `analysis_actions_methods_run` and how analysis values are frozen in `freeze`, leading to a more **memory-efficient Buck2 system**.
This commit introduces a **memory optimization** within the **Buck2 action implementation** by **refactoring** how `metadata_param` is stored in `UnregisteredRunAction`. The `metadata_param` field is now wrapped in an `Option<Box<MetadataParameter>>` in `app/buck2_action_impl/src/actions/impls/run.rs`, preventing the full `MetadataParameter` struct from being inlined when it's typically `None`. This change, supported by an update to `analysis_actions_methods_run` in `app/buck2_action_impl/src/context/run.rs` to box the parameter during creation, results in a measurable **reduction in RSS memory consumption** for Buck2 compilations. This targeted **refactoring** improves the overall resource efficiency of the build system.
This commit **enhances the `TypeEq` derive macro** within the **`pyrefly_derive` crate** to correctly process and include **lifetime generic parameters**. Previously, the macro would reject types with lifetimes, but now it passes them through to the generated `impl` blocks, enabling more robust type equality checks. This **new capability** is a critical preparatory step for an **upcoming `Type<'t>` migration**, allowing types with lifetimes to be properly compared. Additionally, the **`pyrefly_types` crate** gains a `TypeEq` implementation for `PhantomData` and new test cases to validate the macro's expanded support for lifetime-bound types.
This commit **refactors** the type system by **wiring a `TypeHeap` parameter** through the `unions_with_literals` function and its various callers. This is a **preparatory change** to enable future type construction using `TypeHeap::mk_*` methods, impacting **type simplification**, **typed dictionary processing**, and the **inference command**. The `unions_with_literals` signature in `crates/pyrefly_types/src/simplify.rs` now accepts a `TypeHeap`, and a new `TypeHeap` is instantiated within `pyrefly/lib/commands/infer.rs` to satisfy the new parameter requirement. While the `TypeHeap` parameter is currently unused, this **architectural refactoring** ensures the necessary infrastructure is in place for upcoming changes to type representation and construction.
This commit **refactors** the **type simplification logic** by modifying the `intersect` function in `crates/pyrefly_types/src/simplify.rs`. It introduces a new `&TypeHeap` parameter to `intersect`'s signature, which is currently unused but **prepares the groundwork** for future changes where type construction will leverage `TypeHeap::mk_*` methods. Consequently, all direct callers of `intersect` within the **type solver** (`solver/solver.rs`) and **alternative narrowing logic** (`alt/narrow.rs`) are updated to pass the `TypeHeap` reference. This change is a **foundational step** towards centralizing type allocation and management within the `TypeHeap` system.
This commit performs a significant **refactoring** to propagate the `&TypeHeap` parameter through the `unions()` function in `crates/pyrefly_types/src/simplify.rs` and its extensive call chain. This is a **preparatory step** for an **arena migration** within the **type system**, ensuring that the `TypeHeap` context is available for future type construction methods like `TypeHeap::mk_*`. The change affects core type manipulation functions such as `callable_return_type`, `callable_first_param`, `distribute_type_over_union`, and `Restriction::as_type`, and cascades through numerous modules in `pyrefly/lib/alt/`, `pyrefly/lib/solver/`, and `pyrefly/lib/report/pysa/`. While the `TypeHeap` parameter is currently unused, this **foundational change** establishes the necessary plumbing for improved memory management and performance within the `pyrefly_types` crate.
This commit performs a **refactoring** of the **PyRefly type system** by introducing a `&TypeHeap` parameter to the `simplify_tuples` function in `crates/pyrefly_types/src/simplify.rs`. All existing call sites, including those in `pyrefly/lib/alt/class/tuple.rs`, `pyrefly/lib/alt/narrow.rs`, and `pyrefly/lib/solver/solver.rs`, have been updated to pass the relevant heap instance. While the `_heap` parameter is currently unused, this change is **preparatory work** to enable future integration of type construction logic with `TypeHeap::mk_*` methods, streamlining type management within the **type simplification process**. This foundational update sets the stage for more efficient and consistent type handling across the project.
This commit introduces a significant **refactoring** within the **type simplification logic** in `crates/pyrefly_types/src/simplify.rs`. It **migrates all type construction** from direct `Type` constructors to using `heap.mk_*()` methods provided by a `TypeHeap` instance. This change involves threading the `TypeHeap` parameter through numerous internal functions, including `unions_internal`, `try_collapse`, and `simplify_intersections`, ensuring that all type creation is now centralized and managed by the heap. The primary impact is an improved internal architecture for type management, paving the way for potential memory optimizations and canonicalization of type objects within the type system.