Skip to content

fix(purchase): tighten the stored-note reason slot and pin two slot limits #1827

Open

Description

@cristim

Follow-up from the review of #1820 (#1721). None of these block, and all are small.

  1. Invalid byte in the reason slot. quotedTextPattern (internal/purchase/errnotes.go) accepts a raw invalid byte in the operator's resolve reason. Go's regexp reads the byte as U+FFFD, which the class doesn't exclude, so reason="a\xffb" passes unchanged. The %q writer never produces this, and JSON output turns it into U+FFFD, so the effect is cosmetic. Fix: exclude \x{FFFD} from the class, with a test.
  2. Allowlist comment overstates the rule. The comment (errnotes.go, around lines 15-17) says no slot matches whitespace. The reason slot accepts an ASCII space on purpose, so reword the comment.
  3. Two probes survive. Add one assertion each:
    • Removing the {1,256} length limit on commitmentIDPattern breaks no test. Assert that a 257-character commitment ID falls back to the category message.
    • Widening the reason escape from \\[ -~] to \\. breaks no test. Assert that a backslash followed by a raw U+202E in the reason falls back.

Also noted, and older than #1820: skipped-rec notes whose Cost Explorer platform value contains spaces (for example "Red Hat Enterprise Linux") fall back to the category message, because the identity slot excludes spaces. The pattern before #1820 failed on these too. Widen it only if the fallback hides something users need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions