Skip to content

Release v0.6.1: bug fixes, functional tests, GLiNER ONNX fallback#44

Merged
rhnfzl merged 4 commits intomainfrom
develop
Feb 28, 2026
Merged

Release v0.6.1: bug fixes, functional tests, GLiNER ONNX fallback#44
rhnfzl merged 4 commits intomainfrom
develop

Conversation

@rhnfzl
Copy link
Copy Markdown
Owner

@rhnfzl rhnfzl commented Feb 28, 2026

Summary

  • GLiClass API fix: candidate_labels=labels=, updated return format parsing (list[list[dict]])
  • Presidio GLiNER fix: model_path=model_name=, added threshold= passthrough
  • GLiNER ONNX fallback: graceful PyTorch fallback when model.onnx missing (GLiNER #314) — no more user-facing crash
  • 69 end-to-end functional tests (tests/test_functional.py) covering 100% of feature surface with real model inference
  • Code simplification: hoisted invariants, flattened branches, consolidated regex constants, removed dead code
  • Test infrastructure: shared conftest.py, derived entity tags from production map, side-effect-free package detection

Bugs fixed (3)

  1. Document classification (check_classify_document=True) was completely broken — GLiClass API mismatch
  2. Presidio GLiNER backend was completely broken — parameter rename in upstream
  3. GLiNER ONNX mode crashed with FileNotFoundError for most models — now falls back gracefully

Test results

Suite Passed Failed
test_sct.py (unit) 194 0
test_functional.py (e2e) 69 0
Total 263 0

Test plan

  • All 194 unit tests pass
  • All 69 functional tests pass (real model inference)
  • Verified against main branch via git worktree — 0 regressions
  • Ruff lint clean

- config.py: inline single-use variable in __post_init__
- sct.py: remove redundant list() conversion, simplify else branch
- gliclass_adapter.py: flatten nested conditionals, remove dead code
- ner.py: hoist GLiNER-only tag set out of chunk loop
- resources.py: simplify resolve_language with early returns
- special.py: pre-compile punctuation regex at module level
- test_sct.py: deduplicate config construction in test helpers
- Add tests/test_functional.py: 69 end-to-end tests across 13 categories
  covering all backends (ONNX, Torch, GLiNER, ensemble, Presidio),
  replacement modes (placeholder, reversible, synthetic), PII detection,
  document classification, and config edge cases
- Fix gliclass_adapter.py: use `labels=` parameter (not `candidate_labels`)
  and handle list[list[dict]] return format from ZeroShotClassificationPipeline
- Fix ner.py: use `model_name=` parameter (not `model_path`) for
  GLiNERRecognizer to match current presidio-analyzer API
- Update test_sct.py mock to match corrected GLiClass return format
- GLiNER ONNX graceful fallback: catch FileNotFoundError when model.onnx
  missing (GLiNER #314), fall back to PyTorch with warning instead of crash
- Wrap Presidio anonymize return in AnonymizeResult for uniform typing
- Extract TEST_NER_MODELS to tests/conftest.py (DRY)
- Derive ENTITY_TAGS from ENTITY_TYPE_MAP (auto-sync)
- Use importlib.util.find_spec for side-effect-free package detection
- Remove dead else:pass branch, redundant decorators
- Bump version to 0.6.1
@rhnfzl rhnfzl merged commit e23b104 into main Feb 28, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant