A later vendored sync reverted the test typing fixes from 23bd5b2 and the
line-length formatting from 50461c0, which fails the ty check in consumers
that run `ty check --error-on-warning`. Restore them:
- assert the narrowed upgraded/found values before use
- suppress the intentional _FakeDatabase argument mismatches with
`# ty: ignore[invalid-argument-type]`
- reformat the long lines to the package's line-length of 100
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>