DEV Community

Source Tapestry Review
Source Tapestry Review

Posted on

Invalidating an Edge Approval When the Rug Shape Changes

An approval on a drawing revision should identify the part of the design the reviewer approved. A rug drawing gives a good test case. Its outline and edge pattern can change separately, but the edge pattern’s approval still depends on the outline that was in effect.

Consider a synthetic drawing with outline O-2 and edge pattern E-1. A shape change to O-3 moves the place where the motif reaches the edge. The version of the edge file stays E-1 and its approval should return to review.

Store the dependency with the approval

In this example an outline approval stores one value. An edge approval stores a pair: the outline version followed by the edge version present when the reviewer signed off. An approval without a recorded dependency needs a fresh review before it can be reused.

def approved_scopes(current, approved):
    outline_ok = approved.get("outline") == current["outline"]
    edge_ok = approved.get("edge") == (
        current["outline"], current["edge"]
    )
    return outline_ok, edge_ok

signed = {"outline": "O-2", "edge": ("O-2", "E-1")}
assert approved_scopes(
    {"outline": "O-2", "edge": "E-1"}, signed
) == (True, True)
assert approved_scopes(
    {"outline": "O-3", "edge": "E-1"}, signed
) == (False, False)
assert approved_scopes(
    {"outline": "O-2", "edge": "E-2"}, signed
) == (True, False)
assert approved_scopes(
    {"outline": "O-2", "edge": "E-1"}, {"outline": "O-2"}
) == (True, False)
Enter fullscreen mode Exit fullscreen mode

The two flags are useful separately because an edge revision can leave the outline decision valid. For a production release, the system can require both flags under the applicable approval policy. If a project also collects approval of a physical edge sample, keep that as its own record with the applicable sample reference. A matching version pair merely keeps the drawing approval tied to the conditions reviewed.

Top comments (0)