Skip to content

check_cards.published() crashes on a bare-list JSON body instead of reporting it unreadable #110

Description

@realmarcin

From the review of #109.

published("json", ...) calls document.get(selector) before checking the shape. A body that is a bare JSON list raises AttributeError: 'list' object has no attribute 'get', which is not in the except (ValueError, json.JSONDecodeError) clause, so the nightly run dies with a traceback rather than printing an unread line for that Mech. The fallback two lines down — return len(document) if isinstance(document, list) else None — is unreachable for exactly the case its comment describes.

Reproduced on the branch:

>>> check_cards.published("json", "[1,2,3]", "ingredients")
AttributeError: 'list' object has no attribute 'get'

Fix belongs in #109: test the list shape first, and treat any other non-object body as a shape change.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions