duct-tape2/ai-language-partner
View on GitHubbackend: add tests for malformed dialogue pack metadata
Open
#21 opened on Jul 8, 2026
backendclaimedgood first issuetests
Repository metrics
- Stars
- (2 stars)
- PR merge metrics
- (PR metrics pending)
Description
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_packsfromapp.dialogue_match. - Use pytest's
tmp_pathto create a smallpersona/version/manifest.jsontree 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
personaIdandpackVersion, whiletopicsandlevelsfall back to empty lists and the three count fields fall back to0. - 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 #21and 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