Skip to content

fix: correct ap-southeast-3 usagetype prefix; drop duplicate registry/seed rows - #221

Merged
elecnix merged 1 commit into
mainfrom
fix/preexisting-cleanup
Jul 3, 2026
Merged

fix: correct ap-southeast-3 usagetype prefix; drop duplicate registry/seed rows#221
elecnix merged 1 commit into
mainfrom
fix/preexisting-cleanup

Conversation

@elecnix

@elecnix elecnix commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes three pre-existing issues surfaced during the #208#211 handler work and #217 pricing work (each flagged in review as pre-existing / out-of-scope at the time).

1. _REGION_PREFIX collision (correctness)

Both ap-southeast-3 and ap-south-1 mapped to "APS3". AWS assigns usage-type region codes by launch order, not name: ap-south-1 (Mumbai) = APS3, ap-southeast-3 (Jakarta) = APS4. The collision meant a sync for ap-southeast-3 built ap-south-1's usagetype prefix and priced the wrong region — and it now feeds the data-transfer region filters (#219/#220), so it has live impact. Fixed ap-southeast-3APS4.

2. Duplicate known_providers keys (cleanup)

registry.py listed "rds": "aws" three times (silently collapsed by the dict literal). Deduplicated — behavior unchanged.

3. Duplicate seed row (correctness)

The seed price list carried a duplicate CloudWatch-Log-Storage row. SQLite treats seed rows (purchase_option=NULL) as distinct under the UNIQUE constraint, so a dup loads twice and a single logical price can surface as a spurious multi-tier TieredPrice. Removed the duplicate.

Test plan

  • New: _REGION_PREFIX values are all unique (+ explicit AP-region code assertions).
  • New: the seed list has no duplicate (vendor, service, region, usage_metric, start_usage_amount) rows.
  • Full suite: 899 passed locally.

Note: ap-southeast-3 → APS4 is per AWS's documented usage-type region codes; the live API session had expired at fix time, but the codes are canonical (launch-order assignment: APS1 Singapore, APS2 Sydney, APS3 Mumbai, APS4 Jakarta, APS5 Hyderabad).

…/seed rows

Three pre-existing issues surfaced during the #208-#211 / #217 handler and
pricing work:

1. `_REGION_PREFIX` mapped BOTH ap-southeast-3 and ap-south-1 to "APS3". AWS
   assigns usage-type region codes by launch order, not name: ap-south-1
   (Mumbai) is APS3, ap-southeast-3 (Jakarta) is APS4. The collision meant a
   sync for ap-southeast-3 would build ap-south-1's usagetype prefix and price
   the wrong region (and vice-versa) — now feeds the data-transfer region
   filters, so it matters. Fixed ap-southeast-3 -> APS4.

2. `known_providers` in registry.py listed "rds": "aws" three times (silently
   collapsed by the dict literal). Deduplicated; keys unchanged in effect.

3. The seed price list carried a duplicate CloudWatch-Log-Storage row. SQLite
   treats seed rows (purchase_option=NULL) as distinct under the UNIQUE
   constraint, so a dup loads twice and a single logical price can surface as a
   spurious multi-tier TieredPrice. Removed the duplicate.

Regression tests: region prefixes are all unique (+ explicit AP codes), and the
seed list has no duplicate (vendor, service, region, usage_metric, start) rows.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@elecnix
elecnix marked this pull request as ready for review July 3, 2026 15:52
@elecnix
elecnix merged commit 22bce3e into main Jul 3, 2026
3 checks passed
@elecnix
elecnix deleted the fix/preexisting-cleanup branch July 3, 2026 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant