duct-tape2/ai-language-partner

backend: add tests for malformed dialogue pack metadata

Open

#21 geöffnet am 8. Juli 2026

Auf GitHub ansehen
 (4 Kommentare) (0 Reaktionen) (1 zugewiesene Person)TypeScript (2 Forks)auto 404
backendclaimedgood first issuetests

Repository-Metriken

Stars
 (2 Stars)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

Goal

Add regression coverage proving that malformed manifest.json content never crashes dialogue-pack listing.

Scope

  • Work in apps/api/tests/test_api_contract.py.
  • Import list_dialogue_packs from app.dialogue_match.
  • Use pytest's tmp_path to create a small persona/version/manifest.json tree containing invalid JSON.
  • Call list_dialogue_packs(tmp_path) and assert that listing completes without an exception.
  • Assert that the returned pack keeps the directory-derived personaId and packVersion, while topics and levels fall back to empty lists and the three count fields fall back to 0.
  • Keep the PR focused on this regression test. Change production code only if the new test exposes a real failure.

Acceptance Criteria

  • Invalid manifest JSON does not crash pack listing.
  • Safe default metadata is asserted explicitly.
  • Existing valid dialogue-pack behavior remains covered and passing.
  • The PR body includes Closes #21 and names the checks run.

Suggested Verification

cd apps/api
.venv/bin/python -m pytest tests/test_api_contract.py -k dialogue_pack
cd ../..
python3 scripts/check_public_tree.py

Codespaces is available if you do not have the backend environment locally: https://duct-tape2.github.io/ai-language-partner/community/CODESPACES_FIRST_PR.html

Contributor Guide