Skip to content

[drivers] driver-mongodb's local AggregationInput still declares distinct?: boolean after the spec key was retired (#6815) #7052

Description

@os-zhuang

Filed unassigned from the #6815 lane (PR #7051). Observation-class: nothing a user hits today.

The finding

packages/drivers/driver-mongodb/src/mongodb-aggregation.ts declares its own hand-mirrored copy of the spec's aggregation-node shape:

export interface AggregationInput {
  function: string;
  field?: string;
  alias: string;
  distinct?: boolean;
  filter?: unknown;
}

distinct has no reader in that file. buildAccumulator(agg) (same file, lines 120-154) switches on agg.function and reads agg.field; nothing consults agg.distinct. It was already inert before #6815 — that is exactly why driver-mongodb appeared in that issue's table as a face that ignored the flag.

As of #6815 the spec key it mirrors is retired: AggregationNodeSchema.distinct is a retiredKey() tombstone, and data/AggregationNode:distinct is registered in RETIRED_KEYS_BY_MAJOR[17]. So this line is now a local declaration of a key the protocol has withdrawn — an orphaned surface in the #3950 sense: a reader who finds it has every reason to think the driver accepts the flag.

Why it was not fixed in PR #7051

Two reasons, both deliberate:

  1. [裁决] driver-memory / driver-mongodb 投入冻结 —— 维护者 2026-08-05 口径(跨单锚点) #5499 freezes this driver's investment. The retirement PR made zero changes to driver-mongodb precisely because zero changes were already compliance on the runtime axis.
  2. The maintainer ruling of 2026-08-09 scoped the removal: "removal costs the in-memory fallback's collectValues flag and nothing else." That sentence was written from the card's notes, which did not know about this local mirror — so this is new information for the ruling rather than a contradiction of it, and it belongs in triage rather than smuggled into the retirement PR.

Suggested disposition

Delete the distinct?: boolean line (and, at whoever's discretion, filter?: unknown, which mirrors a key still marked [EXPERIMENTAL — not enforced] and is likewise unread here). It is a one-line deletion with no runtime effect and no dependents — AggregationInput is exported but nothing outside the file constructs one with distinct.

Worth deciding as a class rather than a line: whether a frozen driver's hand-mirrored input interfaces should track spec retirements at all, or whether the honest fix is for this interface to be derived from AggregationNode instead of restated. The second is the contract-first answer and is the reason this is filed rather than patched.

Refs: #6815, PR #7051, #5499, #3950, ADR-0049.

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