Skip to content

CubeRegistry.inferFromObject has no runtime caller — its built-in default labels (Count, LABEL (Sum), LABEL (Avg)) are unreachable; #14492 ruling site 3 is dead code #15019

Description

@hotlong

Observation found while implementing #14492 (PR #15017); not fixed there because it is outside that card's ruling and the right disposition (delete vs wire) is a maintainer's call.

Measured on origin/main

git grep -n inferFromObject origin/main -- packages apps examples returns exactly two hits:

  • packages/services/service-analytics/src/cube-registry.ts line 73 — the definition (CubeRegistry.inferFromObject(objectName, fields)).
  • packages/services/service-analytics/src/__tests__/analytics-service.test.ts line 89 — a unit test calling it directly.

No runtime path calls it: the AnalyticsService ad-hoc path mints cubes through its own inferCubeFromQuery / inferMeasure, and datasets compile through dataset-compiler.ts. The class docblock still advertises it as the second of two cube sources ("Object schema inference — auto-generated cubes from ObjectQL object schemas"), which is declared-not-delivered.

Why it matters for #14492

The ruling on #14492 listed cube-registry.ts:80 (label: 'Count') as one of five hardcoded English default-label sites. Being unreachable, that site never contributes to any response, so it was left untouched by #15017 — and the same method's composite defaults LABEL (Sum) / LABEL (Avg) (lines ~106 / ~112) are English literals that an aggregate-only discriminator could not localize anyway, because they embed the field label.

Disposition options

  1. Delete inferFromObject and its test, and correct the CubeRegistry docblock (dead code; smallest change; matches the enforce-or-remove precedent).
  2. Wire it as a real cube source (needs a caller, getMeta() exposure, and a decision on how composite default labels are localized — probably a field-plus-aggregate discriminator rather than a string).

Recommendation: option 1 unless a consumer is planned; nothing on the wire reads what it produces today.

Generated by Claude Code

Activity

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