Skip to content

newtype pattern to protect against sloppy path normalization #3923

@d-v-b

Description

@d-v-b

#3922 revealed that we don't normalize the path parameter when creating an instance of FSSpecStore. So Store(path="foo/") and Store(path="foo") end up with different .path attributes. One way to guard against this type of bug would be to introduce a new type that models "strings that have undergone path normalization", define functions that returns instances of this type (the path normalization function) and annotate the path attribute with this type. That should reduce the rate of these "trailing path separator or not" bugs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew features or improvements

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions