Skip to content

fix(purchase): match server-note resource heads to the providers' real type sets #1753

Open

Description

@cristim

Summary

Follow-ups from the final reviews of #1739. The resource-type head allowed in front of a stored server note (resourceTypePattern, internal/purchase/errnotes.go ~:117-128) is still too narrow for some real types and too wide for some made-up tokens. Neither affects what users can see from a provider today, because the only writer of that head is internal/purchase/execution.go ~:763 with rec.ResourceType.

Too narrow: real types that fall back to the generic message

These ResourceType literals from cloud-commitments-go fall back to "the provider returned an error": Premium_P1, 100RU, Cosmos_DB_100_RUs, GeneralPurpose_Gen5_2, db-n1-standard-1, STANDARD, STANDARD_HA, BASIC, u7i-12tb.224xlarge and a3-edgegpu-8g. The impact is small: for non-EC2 types the only allowlisted per-rec note is "purchase was not successful", which the category message roughly matches. For EC2, u7i-* loses the zonal re-fetch hint.

Too wide: short tokens accepted as a head

  • The unprefixed Azure alternative accepts DB1, SQL1 and PG01.
  • The AWS grammar accepts web1.medium, db1.large and db.app1.large.
  • The GCP grammar accepts n2-standard-db-prod and e2-micro-admin.

Expected

The accepted heads come from the providers' own resource-type sets wherever they are enumerable, and from grammars anchored to the real families where they are not (for example Azure sizes as [A-Z]{1,2}[0-9]{1,3}…). There is one test row per example above.

Related

#1739, #1748 (quoted value slots), #1721.

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