Skip to content

CoreServiceName's file-storage member is the only slot whose name diverges from its accessor, and no source anywhere states why #9683

Description

@os-steve

Found during #9630 (H2: does the storage / file-storage naming difference have a recorded reason?). Filed rather than guessed — #9630's PR documents that the slot is file-storage, but could not document why, because nothing in the tree says.

What was measured

'file-storage' is canonical and consistent — that is not in question:

  • packages/spec/src/system/core-services.zod.ts:27 lists it in the CoreServiceName enum
  • CORE_SERVICE_PROVIDER maps it to @objectstack/service-storage
  • registered at packages/services/service-storage/src/storage-service-plugin.ts:237
  • resolved by packages/cli/src/commands/migrate/files-to-references.ts:197, packages/plugins/plugin-email/src/email-plugin.ts:223, packages/runtime/src/http-dispatcher.ts:1135

It is also the only member of that enum whose name is a compound where every sibling is a bare noun (metadata, data, auth, search, cache, queue, automation, analytics, realtime, job, notification, ai, i18n, ui).

What is missing

Searched for a stated reason and found none:

  • The registration site (storage-service-plugin.ts:237) carries no comment on the name.
  • The enum entry carries only // Storage Driver (Local/S3) — a description of the capability, not of the spelling.
  • ADRs: file-storage appears in docs/adr/0076 and docs/adr/0115, both using it as an established fact; neither discusses the name.
  • Changesets: no .changeset/*.md mentions it.
  • The contract file (packages/spec/src/contracts/storage-service.ts:13) says "Aligned with CoreServiceName 'file-storage'" — which records the alignment, not the reason for it.

There are plausible reasons (a bare storage collides with the /api/v1/storage route namespace and with ObjectStackClient.storage, both of which are real and differently shaped — see #9630). But that is inference, and this issue exists precisely so nobody has to infer it again.

Why it is worth a line

CoreServiceName is a published enum and the divergence has already cost one documentation defect (#9630), where a reader following the docs wrote ctx.getService('storage') and got a throw. A one-clause comment at the enum member converts a recurring "is this a typo?" into a settled fact. The next person to notice the asymmetry will otherwise re-run the same search.

Suggested resolution

Add one clause to the CoreServiceName entry stating why the slot is file-storage rather than storageif a maintainer knows the reason. If there is no reason beyond history, saying that is equally useful and equally cheap.

⚠️ Explicitly not proposed: renaming the slot. It is a published CoreServiceName member with three internal consumers; #9630's dispatch ruled that route out, and nothing here reopens it.

Refs: #9630

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions