Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor all *.from_db() routines to use from_db_json() #821

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Commits on Jun 13, 2024

  1. Refactor all *.from_db() routines to use from_db_json()

    This wrapper calls json.loads() but also handles None (returning None),
    which enables the code at many call sites to be simplified.
    
    Removed some callers' `if isinstance(field, str): ...` code, which has
    the effect of newly disallowing field values that are already dicts.
    However we've verified that all *.from_db() calls have raw database
    outputs as their arguments, so such fields will be always be strings
    and IMHO giving a dict to from_db_json() is really a logic error that
    should be detected.
    
    In SequencingGroupInternal.from_db() added `pop(..., None)` so that
    a missing meta field is now accepted. The previous code suggests that
    having pop() produce KeyError here was unintended.
    
    The expected argument types for from_db_json() are listed in the
    definition, but we don't list its return type. The best we could
    say in general is `object` but most call sites expect `dict[str, str]`
    (or occasionally `list[str]`) due to the shape of their expected JSON.
    Specifying `object` would lead to mypy errors at these call sites.
    jmarshall committed Jun 13, 2024
    Configuration menu
    Copy the full SHA
    9eecc05 View commit details
    Browse the repository at this point in the history

Commits on Jun 17, 2024

  1. Also exercise AuditLogLayer.get_for_ids() in test case

    Expands test coverage to include audit_log.py from_db_json change.
    jmarshall committed Jun 17, 2024
    Configuration menu
    Copy the full SHA
    38e7f1a View commit details
    Browse the repository at this point in the history

Commits on Jun 19, 2024

  1. Configuration menu
    Copy the full SHA
    b3c5e28 View commit details
    Browse the repository at this point in the history