Skip to content

Pin the sign contract of build_direction_chart's rows with a test #296

Open

Description

@codingjoe

No test pins the sign contract of build_direction_chart. A sign error can reach the chart unnoticed.

services/email/message/charts.py:build_direction_chart negates every incoming count, so both directions can stack away from zero. abstract/static/abstract/chart_card.js's drawVariation now accumulates its running base per sign to follow that:

f"{incoming_direction}_{key}": -value

No test exercises the negation, and nothing pins the contract that incoming rows are negative and outgoing rows are positive. A Python test can hold that end of the wire without any JS harness. Assert the sign of each incoming_* key against its outgoing_* twin for the same day. Assert also that y_scale.diverging is set.

Found while validating the slimming cut on #289:

side quest: build_direction_chart's negated incoming rows are untested, so the variation chart's negative-value input contract is unpinned. [services/email/message/charts.py]

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

    side questOut-of-scope finding, deferred to its own issuetestCoverage, ghost and delulu branches

    Projects

    • Status
      Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions