Commit Graph

2 Commits

Author SHA1 Message Date
Alpamys 06d8ea7cc5 chore: migrate to src-layout
Move soup_cli/ -> src/soup_cli/ (history preserved via git mv). src-layout
forces the test suite to import the installed package instead of the
repo-root source tree, surfacing packaging bugs that flat-layout masks —
e.g. the v0.53.8 double-shipped-fixtures regression, invisible because
`pytest tests/` imports ./soup_cli directly and never from the wheel.

- pyproject: packages = ["src/soup_cli"]; artifacts globs -> src/soup_cli/...
  The import name is unchanged, so the `soup` entry point, --cov=soup_cli,
  and report_to/module-path strings stay `soup_cli`.
- CI / ownership: ruff lint path (ci.yml), recipe-validation `paths:` filters,
  CODEOWNERS patterns, and the PR-template checklist all repointed to
  src/soup_cli/.
- tests: source-grep regression tests that read package files by repo-relative
  path repointed to src/soup_cli/ (64 files; 170 path literals). Lines pushed
  over 100 chars by the prefix were wrapped to keep ruff E501 clean. Module
  references (`import soup_cli`, `-m soup_cli`, mock.patch("soup_cli.x")) and
  the `--cov=soup_cli` coverage target are deliberately unchanged.
- docs: AGENTS.md + CONTRIBUTING.md structure tree and lint commands.

Verified locally: ruff clean (src/soup_cli + tests); `import soup_cli`
resolves to src/soup_cli/__init__.py; built wheel ships
soup_cli/data/_fixtures/*.jsonl (10 files, no duplicates, no src/ prefix);
3174 tests across every touched test file pass. Packaging-only — no version bump.
2026-05-31 12:40:06 +05:00
Alpamys 95f9a7116d fix(diagnose): multilingual refusal patterns — en/es/fr/de/ru (#166)
Extends soup_cli/utils/diagnose/refusal.py from English-only to
en/es/fr/de/ru via a MappingProxyType-wrapped _REFUSAL_PATTERNS_BY_LANG
registry + public SUPPORTED_REFUSAL_LANGS frozenset. Adds a
`lang: str = "en"` keyword on `looks_like_refusal` and `score_refusal`
with strict validator (bool / null-byte / oversize / unknown /
case-insensitive normalisation), resolved ONCE per `score_refusal`
invocation via a new `_apply_pattern` hot-path helper so the per-prompt
path skips redundant dict lookups (~8k saved on a 2k-prompt run).

Closes #166 — v0.56.0 Known Limitations bullet #3 (English-only
refusal heuristic).

Review fixes applied (12 total):
- python-reviewer (4): frozenset[str] subscript, hot-path refactor,
  intentional-internal-access comment on _MAX_REFUSAL_SCAN, dropped
  redundant forward-reference quotes.
- tdd-guide (8): TestApplyPattern direct coverage, generator-type
  guard with default lang, cross-language dispatch matrix, evidence
  string lang assertion, renamed misleading test, empty-prompts
  matrix, whitespace-in-lang, source-grep regression guards.

112 new tests in tests/test_refusal_multilingual.py. Pre-existing
v0.56.0 test_v0560.py::TestRefusal block unchanged (back-compat
verified end-to-end).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 16:00:41 +05:00