Skip to content

follow-up: service-analytics' consumer-local executeAggregate config mirrors still declare aggregations[].method: string after the #12776 contract narrowing #12940

Description

@os-trump

Blocked-by: #12776 (PR #12937 — meaningful only once the contract narrowing lands).

Found while executing #12776. Filed unassigned; measured on the #12776 branch at 7ed016475.

The observation

The spec's StrategyContext.executeAggregate now declares aggregations[].method: AggregationFunction (the six-value enum), but the two consumer-local CONFIG mirrors in @objectstack/service-analytics still declare the slot as string:

  • packages/services/service-analytics/src/plugin.ts ~line 125 — AnalyticsServicePlugin's executeAggregate config option (the custom-bridge type an app author implements)
  • packages/services/service-analytics/src/analytics-service.ts ~line 401 — the AnalyticsService config twin, whose own comment says it is "kept in lockstep with StrategyContext.executeAggregate" — no longer true for this member

This is NOT a compile error and NOT unsound: the mirrors type the function an implementor SUPPLIES, and a handler accepting method: string accepts a superset, so assigning it into the narrowed StrategyContext slot stays legal (parameter contravariance). The #12776 PR deliberately did not touch them — consumer config surfaces are that package's own call, outside the ruled file surface.

Why it may deserve a card

Also plugin.ts carries a comment (~line 292) explaining the auto-bridge's runtime parse by pointing at the spec's method: string declaration — that justification text is now historical and should say the parse is defence in depth behind the narrowed type (the #12776 changeset already words it that way).

Refs: #12776 / PR #12937 (the narrowing) - #11833 (the runtime parse the mirrors sit beside).

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions