Repository navigation
fix(level6): correct project API checker contracts - #66
Merged
Merged
Conversation
- P01 check.py: the happy-path test sent monster_name="Goblin" while the
request schema's Literal is lowercase-only ("goblin", "orc", "dragon"),
matching the README's documented contract. No implementation faithful
to that contract could ever pass this gate. Fixed to send "goblin", and
added an explicit case-sensitivity check confirming "Goblin" still 422s.
- P02 check.py: GET /monsters only checked len(monsters) >= 2, so a
hardcoded two-item fake list passed. Now compares the response against
the real catalog in task/repository.py's _CATALOG by value (name, hp,
atk, def_), as a set since the API contract doesn't guarantee ordering.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Micro-hotfix following the final Level 6 quality gate. Narrow scope: two checker files, no architecture changes.
check.py: the happy-path gate sentmonster_name="Goblin", but the request schema'sLiteral["goblin", "orc", "dragon"]is lowercase-only — matching bothtask.py's scaffold and the README's documented contract. Any implementation faithful to that contract got 422 on the happy path and could never pass the project. Fixed to send"goblin"; added an explicit check that"Goblin"(wrong case) still correctly 422s, so the case-sensitivity of the contract stays enforced rather than silently dropped.check.py:GET /monstersonly checkedlen(monsters) >= 2, so a hardcoded two-item fake list passed. Now compares the response against the real catalog (task/repository.py's_CATALOG) by value — name, hp, atk, def_ — as a set, since the API contract doesn't guarantee ordering. Doesn't require calling any specific repository method.Explicitly not touched
M01–M08, P03, Level 5, Level 7, no new quality gates, no schema/contract changes (lowercase
Literalstays lowercase;_CATALOGstays the single source of truth).Test plan
"goblin"happy path → 200; uppercase"Goblin"→ 422; unknown"Phoenix"→ 422; scaffold → FAILrepo.list_all()direct) → PASS; hardcoded fake 2-item catalog → FAIL; Variant B (different function names/helpers/route order, still backed by the real repo) → PASS; existing lookup → correct data; missing lookup → 404; scaffold → FAILtools/author_check.py→ 727 checks passed, 0 errorstools/course_status.py→ Level 6 fully green__pycache__,.pytest_cache, session files;git status --shortclean except the two intended files🤖 Generated with Claude Code