Skip to content

XinMatch v1.7.1 — Code review follow-up

Choose a tag to compare

@PolyXRD PolyXRD released this 18 Oct 11:21
· 168 commits to master since this release

v1.7.1 — Code review remediation (maintenance release)

Version 1.7.0 → 1.7.1, no API breakage, no data migration. Full acceptance see docs/ACCEPTANCE-v1.7.1-20261018.md, item-by-item review and implementation plan see docs/CODE_REVIEW-20261018.md.

Defect fixes

  • GUI search connection leak: every SQLite connection opened per search is now closed in finally; when re-entering the busy window is rejected, the caller closes it as well. Long sessions no longer accumulate handles or hold the reference DB, which previously caused "rebuild/replace library" to fail.
  • High-angle peaks crashing search: when d ≤ λ/2 (backscatter limit, e.g. Mo/Ag-target data paired with Cu wavelength) math.asin goes out of range; now the peak is skipped and logged, and both 2θ window bounds are clamped.
  • recall_max_candidates failed in restraints mode: broad constraints (e.g. "must contain O") scored tens of thousands of candidates in full; now it truncates consistently with other recall modes (intersected with d-value recall, then best selected).
  • Package unusable after pip install: the wheel previously lacked schema.sql and the 3D-view resources (3dmol), failing at import; package data is now declared and read via importlib.resources, and CI added a packaging assertion.
  • Import failure with no dist metadata: __version__ gained a fallback constant.
  • Stale curve records after clearing pattern: PatternView.clear() was shadowed by pyqtgraph's same-named instance attribute (a real bug), now fixed — patterns() no longer returns deleted curves.

Performance

  • Candidate fetch N+1 → batched chunks: SQL round-trips for 3000 candidates dropped from 3000 to 7.
  • Hanawalt top-K intensity cache now keyed by library fingerprint (mtime/size + lock + LRU(2)): rebuilding or replacing the reference DB no longer hits stale rankings.
  • Result assembly normalized: added fpfm.to_candidates(), GUI / batch / CLI now share the same raw → CandidateResult mapping.

UX

  • Opening large data files (.raw / .brml / large ASCII) no longer freezes the UI.
  • Long tasks are cancellable: FPFM full-profile fitting and similar operations show a "Cancel" button (cooperative interrupt, threads not force-killed).
  • 5 placeholder toolbar actions are now functional: background subtraction / smoothing / Kα2 stripping / reset raw data / peak detection.

Engineering

  • Added GitHub Actions CI (ubuntu + windows × Python 3.10/3.12: ruff + mypy + default tests + wheel resource assertions), with a local equivalent entry tools/ci.ps1.
  • slow markers completed and excluded by default: pytest now runs directly; full numerical cases via pytest -m slow.
  • Removed the hardcoded D:\Project\... default library path; SQLite URI and LIKE wildcard escaping; GSAS-II gpx backfill exceptions now logged, with GSAS2_HOME override support.
  • Docs index docs/README.md; data-backup cleanup script tools/clean_data_backups.ps1 (dry-run by default).

Acceptance numbers

  • ruff: All checks passed; mypy: 113 source files, 0 errors.
  • Default regression suite: 1297 items / 0 failures / 7 skipped (13.2 min, excluding slow).
  • Frozen binary: XinMatch.exe import --help exit 0; internal variant registration self-check JSON correct.

Install

  1. Download XinMatch-Setup-1.7.1.exe and install (install location selectable).
  2. Download xinmatch-cod-db-1.7.1.zip, extract into the install directory so the reference DB is at data/cod_inorganics.db (the installer does not bundle the database, ~700 MB).
  3. The internal evaluation build (no registration) is XinMatch-Internal-1.7.1.zip, extract-and-use.

Known limitations

  • The slow suite (turn-on least squares, GSAS-II real refinement, L3 acceptance) was not run this time; re-run separately with pytest -m slow.
  • The release variant's GUI self-check is blocked by the startup registration dialog in non-interactive sessions (same environment limitation as the v1.7.0 acceptance record), confirmed covered via variant markers + unit tests.
  • Registration codes remain an HMAC "obfuscation-level" scheme (security boundary in docs/PACKAGING.md); upgrading to asymmetric signing requires re-issuing codes.