Skip to content

card_markup accepts a figure with misplaced commas, such as 32,06 #264

Description

@realmarcin

From the verification round on #212, after its Codex review.

Where: scripts/fleet/card_markup.py FIGURE, whose comment says "digits with thousands commas".

The pattern \d[\d,]* accepts a comma anywhere after the first digit and strips commas before comparing. A card typed <b>32,06</b> is read as 3206: it equals figure_at_pin, the MECHS records: and card_records. Every gate passes, and /mechs/ renders "32,06 habitat records". This predates #212 (main's regex was [\d,]+), but #212 rewrote the regex and its comment claims a format it doesn't enforce.

Fix: require thousands grouping, \d{1,3}(?:,\d{3})+|\d+, so a malformed figure is MARKUP. Add a test case.

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