fix: reject malformed JSON feed objects without a listings key - #2
Open
TrueFurina wants to merge 2 commits into
Open
TrueFurina wants to merge 2 commits into
TrueFurina wants to merge 2 commits into
Conversation
quangshuynh
requested changes
Aug 27, 2026
quangshuynh
left a comment
Owner
There was a problem hiding this comment.
Thanks for working on this! The validation behavior and test coverage are headed in the right direction.
There are two things to address before this is ready to merge:
- CI currently fails at
ruff format --check. becausecollectors/json_feed_collector.pywould be reformatted. Please run the repository's formatter and push the result - The PR currently shows much more file churn than this change requires (
+270/-201across two files), with many apparently unchanged lines appearing in the diff. Please avoid unrelated formatting or line-ending changes and keep the patch focused on the feed-shape validation and its tests
Once the diff is focused and CI is green, I’m happy to take another look
This branch has not been deployed
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.
Problem
fetch_listings()silently treated a top-level object without alistingskey as an empty feed (raw.get("listings", [])), making malformed input look like a legitimate empty result.Fix
listingskey now raisesValueErrordescribing the expected shape (including the keys actually present).listingsvalue is not a list is rejected with a clear error.{"listings": []}remains a valid empty feed.Tests
Added 4 cases covering: missing-key, wrong-type, valid-empty-object, top-level-list. Verified locally with the acceptance criteria: