Skip to content

fix(recfilter): dedupe key lacks account, platform, tenancy, scope, AZ and size-flex #323

Open

Description

@cristim

Problem

recfilter duplicate detection keys on resourceType|region|engine|deployment (pkg/recfilter/dedupe.go dedupeKey). Consumers that dedupe search results (the MCP search tool, cloud-commitments-mcp#42) therefore cannot trust it for several services:

  • EC2: GetExistingCommitments (providers/aws/services/ec2/client.go) fills only instance type and region, so a recent Windows, dedicated, AZ-scoped or Convertible reservation appears to cover a Linux regional recommendation.
  • No listing sets Commitment.Account, while AWS recommendations carry the linked account (parser_ri.go), so from a payer account a purchase in one account can appear to cover another account's recommendation.
  • RDS size flexibility is not modelled (a larger covering reservation is not recognised), and ElastiCache reservations with an empty ProductDescription act as a wildcard for every engine.
  • adjustSingleRecommendation lowers Count but leaves cost and savings at the full-count figures.
  • MemoryDB reserved nodes are always listed as engine redis (memorydb/client.go:269).

Proposed

Add account, platform, tenancy, scope, AZ and size-flex dimensions to the commitment listings and to dedupeKey, keep cost and savings consistent when a count is reduced (or report the covered count instead), and add tests per service from the real parsers' recommendation shapes.

Until then the MCP consumer suppresses only RDS, OpenSearch, Redshift and ElastiCache (known engine) for the caller's own account and flags the rest.

Activity

  1. self-assigned this
    on Oct 16, 2026
  2. cristim commented on Oct 16, 2026

    @cristim
    MemberAuthor

    Claiming: working on a first slice here: Commitment.Account and EC2 platform, tenancy and scope in the commitment listing and in dedupeKey, delivered as a Refs #323 PR. RDS size-flex, the ElastiCache empty-description wildcard and the MemoryDB engine stay open for later slices. The count reduction already scales cost and savings since #379 (common.ResizeCount).

  3. cristim commented on Oct 16, 2026

    @cristim
    MemberAuthor

    Design note before the first slice lands. Keying EC2 dedupe on account is unsafe by default, so this slice leaves it out.

    With RI sharing on (the AWS Organizations default), a reservation bought in account A also discounts matching usage in account B. If the dedupe key included the account, a recent purchase in A would no longer suppress B's matching recommendation, and the guard would buy a duplicate. A duplicate-purchase guard has to fail toward suppressing.

    The first slice therefore keys only the dimensions that rule out coverage whatever the sharing setting: platform, tenancy, scope, and AZ for zonal scope. A Windows, dedicated or zonal reservation cannot cover a Linux, default-tenancy or regional recommendation. A commitment in another account still suppresses, and a test pins that.

    Open question for a maintainer: should account keying be added, and only where RI sharing is known to be off for that account? That needs a sharing signal this library doesn't have today.

  4. cristim commented on Oct 16, 2026

    @cristim
    MemberAuthor

    Slice 1 for EC2 is complete with #458 and #460 (merged) plus #465 (open). Dedupe now matches EC2 commitments on platform, tenancy and scope, and the EC2 listing reports them. This issue stays open for:

    • RDS size-flexibility;
    • the ElastiCache empty-description wildcard;
    • the MemoryDB engine (always 'redis');
    • account keying, which needs an RI-sharing signal (see the design note above).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions