Files
lyskov-ai d8b0be6015 fix: make weighted_rigid_align dtype-agnostic (accept float64) (#286)
* test: bootstrap mypy + pytest + coverage CI gates

Wire up the tooling the upcoming test/annotation/refactor work depends on:

- Add mypy>=1.13 to [dev] and a lenient [tool.mypy] config scoped to
  src/foundry + src/foundry_cli (ignore_missing_imports, no
  disallow_untyped_defs). The 14 modules with pre-existing type errors
  are pinned via [[tool.mypy.overrides]] ignore_errors=true and listed
  as the ratchet target — fix and remove, never add.
- Add [tool.pytest.ini_options] (testpaths=["tests"], --strict-markers
  --strict-config) and [tool.coverage.*] (source = src/foundry +
  src/foundry_cli, branch = true) for opt-in gap finding.
- Add .github/workflows/test.yaml with mypy and pytest jobs running on
  the same triggers as lint_production.yaml. Top-level tests/ only;
  per-model tests under models/*/tests/ may require GPU and checkpoints
  and stay out of CI for now.

Co-authored-by: Sergey Lyskov <sergey.lyskov@jhu.edu>

* test(mypy): extend ignore list with 4 modules CI surfaced

Local sanity-check ran mypy without foundry installed, so torch /
lightning resolved to `Any` and errors that depend on knowing those
types stayed invisible. First CI run installed the full deps and
surfaced 6 errors in 4 additional modules:

  foundry.model.layers.blocks
  foundry.training.schedulers
  foundry.utils.logging
  foundry.utils.xpu.xpu_accelerator

Same ratchet contract as the original 14: do not add, only remove
(after fixing the errors and removing `ignore_errors = true`).

Co-authored-by: Sergey Lyskov <sergey.lyskov@jhu.edu>

* style: ruff format 2 pre-existing files unrelated to bootstrap

These files have been failing `ruff format --check` on production HEAD
(merged via #275 and #281 without a pre-commit run). They block the
existing `lint_production` workflow on every PR, including this
bootstrap. Strictly out of scope for 0001 — kept in a separate commit
so it can be cherry-picked or reverted cleanly.

  models/rfd3/src/rfd3/inference/input_parsing.py
  models/rfd3/tests/test_partial_diffusion.py

No semantic changes — `ruff format` output only.

Co-authored-by: Sergey Lyskov <sergey.lyskov@jhu.edu>

* ci: run test workflow on all pull requests

Drop the base-branch filter on the pull_request trigger so PRs targeting
stacked task branches are gated too, not only PRs into the mainline branches.

Co-authored-by: Sergey Lyskov <sergey.lyskov@jhu.edu>

* test: unit tests for foundry geometry utils (alignment, rotation augmentation)

Pin the numeric behaviour of weighted_rigid_align/get_rmsd and the
rotation/centre/augment helpers used across the diffusion models:
exact recovery of known rigid transforms, mask/weight exclusion from
the fit, proper-rotation invariants, global-centroid centring, and
distance-preserving augmentation. CPU-only, float32, 18 tests.

Co-authored-by: Sergey Lyskov <sergey.lyskov@jhu.edu>

* fix: make weighted_rigid_align dtype-agnostic (accept float64)

The determinant-correction matrix F was built with torch.eye's default
dtype (float32), so float64 coordinate inputs raised at U @ F @ V. Pass
dtype=X_L.dtype so F follows the input. Add a float64 regression test.

Co-authored-by: Sergey Lyskov <sergey.lyskov@jhu.edu>

* Add test for float64 coords with float32 weights

Add test for float64 coordinates with float32 weights to ensure correct output dtype and alignment.

* Add additional blank line before functions

Fix formatting by adding blank line before functions in test_alignment

---------

Co-authored-by: Sergey Lyskov <sergey.lyskov@jhu.edu>
Co-authored-by: Hope Woods <hope.woods@omsf.io>
2026-06-02 16:45:33 -05:00
..