Skip to content

Component/resource name clash always throws - #213

Merged
krisnye merged 1 commit into
mainfrom
krisnye/name-clash-throws
Oct 7, 2026
Merged

krisnye merged 1 commit into
mainfrom
krisnye/name-clash-throws

Conversation

@krisnye

@krisnye krisnye commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #212, which merged before this commit landed: a component/resource name clash now always throws.

A resource is stored as a same-named component column on its own entity, so components and resources share one name space. A resource reusing a component's name used to replace the component's schema silently (#211 made that a warning, #212 added a nameClashes acknowledgement). Replacing it changes the column's type and flags, for example making every entity's value non-persistent, and every query on the component also returns the resource's entity.

  • Runtime. Store.create throws "<name>" is both a component and a resource… in both directions, even when the schemas are identical.
  • Compile time. Database.Plugin.create rejects a clash within one plugin and against its extends / imports. A clash formed through Plugin.combine is caught at runtime.
  • Removed. The nameClashes option from Name clashes throw, optional struct fields, toTypeScript fixes #212 is gone. It is unpublished, so nothing depends on it.
  • The data-ai rule now says the store throws on a clash.
  • No version bump: main is already at the unpublished 0.10.25.

Testing

  • pnpm run lint and pnpm run typecheck (with build caches cleared) pass, as do pnpm run check:workspace and pnpm run build.
  • pnpm run test passes in every package, including 3,611 tests in data.
  • New tests:
    • A clash throws in both directions and within one schema, including when the schemas are identical, through extends and through Plugin.combine.
    • The type tests reject a clash in one plugin and across extends, and keep inference for distinct names. Type instantiations in packages/data go up by about 1.3%.
  • Checked against a large downstream app by building every plugin store in a browser probe. It found three clashes, which have since been renamed there. With this build that app has 0 type errors and its suites pass.

🤖 Generated with Claude Code

A resource is stored as a same-named component column on its own entity, so
a name that is both collides: the resource schema replaced the component's,
and component queries returned the resource entity. Store.create now throws
in either direction (even for identical schemas), Database.Plugin.create
rejects a clash at compile time within a plugin and across extends/imports,
and the nameClashes option is removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@krisnye
krisnye merged commit d709778 into main Oct 7, 2026
3 checks passed
@krisnye
krisnye deleted the krisnye/name-clash-throws branch October 7, 2026 03:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant