.agents/skills/minimizing-ty-ecosystem-changes/references/advanced-minimization.md
Use this reference after the reported difference reproduces against the copied base and PR binaries.
Prefer a single-file reproducer with no third-party imports, few definitions, and the least complex typing or language features that still demonstrate the difference. Keep special modules such as typing, abc, enum, types, and typing_extensions only when removing them changes the behavior.
Work systematically from the reproduced project. Do not skip ahead to an explanation, hand-written reproducer, or a guessed subset of relevant code. Follow the stages below in order and exhaust each stage before advancing. Try one controlled reduction at a time, run both copied ty binaries after every change, and keep the reduction only if the original difference remains. After every successful reduction, restart at step 1 because it may make earlier reductions possible.
crates/ty_vendored, which is ty's source of truth for stdlib types.Repeat the full loop until an exhaustive pass through every stage finds no further reduction that preserves the difference. Do not stop merely because the likely cause is understood or the reproducer is already small.
Attempt to remove every remaining import and inline every remaining third-party definition. Record why any surviving import is essential. Keep these notes as working evidence; the caller decides whether they belong in its final artifact.
Delete transient project and dependency copies after the investigation.