Skip to content

Scope in schema, reserved-name guards, conformance context, and 0.10.20 back-compat - #211

Merged
krisnye merged 5 commits into
mainfrom
krisnye/feature-tweaks
Oct 6, 2026
Merged

krisnye merged 5 commits into
mainfrom
krisnye/feature-tweaks

Conversation

@krisnye

@krisnye krisnye commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #210: small fixes and guards found while porting the samples, plus back-compat so a 0.10.20 consumer can take this release as a version bump.

  • Scope moves to @adobe/data/schema. It only annotates a schema with its scope flags, so data/ files no longer import the ECS module to declare a column's scope.
  • presence is documented as not yet synced. @adobe/data-sync deliberately skips nonPersistent data, so a presence value currently stays local.
  • Reserved names are a compile error. Database.Plugin.create rejects id, nonPersistent and nonShared as component or resource names. A type test covers both.
  • A Parameter is not assignable to Schema (Schema.schema?: never), so a named parameter can't be passed where its schema is expected.
  • Conformance.implementation takes concurrency and seedContext. p2p presence (whose action reads the peer userId) now uses plain checkFeature instead of the lower-level runners. There is a new library test for this.
  • New conventions check: no runtime file in a feature package imports spec/, ecs/conformance/, @adobe/data-testing or vitest. TS project references already enforce this for data/, services/ and ecs/; this extends it to ui/ and app/.
  • Rule cleanup:
    • features/ui/binding-element.md is removed. Its unique contract (the presentation exports, callback naming, cleanup via hooks) moved into element.md.
    • service.md now matches the samples (flat create / createFake) and drops the nonexistent singletonFactory.
  • Version bump to 0.10.24.

Back-compat for 0.10.20 consumers

The samples stay on the new spec-based layout; existing code on the 0.10.20 state-based layout keeps working unchanged.

  • Bare-Schema parameters. signature.parameters accepts a named Parameter or (deprecated) a bare Schema. ToType and toTypeScript handle both; a bare entry renders as argN. New Parameter.schemaOf(p) reads either form. Code that reads parameters through the generic Schema type and needs a Schema should call it.
  • Legacy conformance API. Conformance.feature and FeatureSpec are restored (@deprecated). checkSpec / checkFeature accept either shape and run the 0.10.20 runner for the old one: transactions plus actions, schemas from the plugin, and lenient doubles. The new path is unchanged and stays strict.
  • Name clash warns instead of throwing. A resource sharing a component's name keeps the 0.10.20 behaviour (its schema replaces the component's) and logs a one-time console.warn per name. The hopper sample's rename (width → boardWidth / boardHeight) stays. A component redefining a resource's name with a different schema still throws, as in 0.10.20.
  • Legacy rules. data-ai restores features/data/state.md and features/services/main-service/* for features that still have data/state/ or services/main-service/. The shared feature rules and the build/review skills each say in one line to follow the legacy rules for such a feature and not migrate it unless asked.

Not included: the struct-packing crash, where an object schema of optional Vec2 fields with a {} default crashes at Store.create. It needs a decision on how struct detection should treat optional fields.

Testing

  • pnpm run build, pnpm run lint, pnpm run typecheck (with build caches cleared) and pnpm run check:workspace pass.
  • pnpm run test passes in every package: data 3,581 tests, data-testing 56 (2 skipped), plus data-gpu, data-sync, data-persistence, data-lit, data-rpc and all seven feature samples.
  • New coverage: Parameter.schemaOf and mixed/bare parameter type tests, bare-parameter toTypeScript output and IsValidWithCompleteSchema, the once-per-name clash warning, the restored legacy type test, a runtime legacy-conformance fixture (a transaction-only op and an unscheduled fake call), and the lenient-double mode.
  • Validated against a large downstream app on 0.10.20 using packed tarballs of this branch. With only the version bump, plus a 4-line Parameter.schemaOf change in one file, typecheck is clean and its full test suite passes.

🤖 Generated with Claude Code

krisnye and others added 5 commits October 5, 2026 12:42
…s, conformance context

- Scope moves from @adobe/data/ecs to @adobe/data/schema (it annotates a
  schema); presence documented as not yet synced by data-sync
- the store throws when a component and a resource share a name (either
  order) instead of a resource silently replacing the component schema;
  hopper's board width/height resources renamed boardWidth/boardHeight
- Database.Plugin.create rejects reserved component/resource names
  (id, nonPersistent, nonShared) at compile time
- Conformance.implementation takes concurrency + seedContext, so p2p
  presence conforms through checkFeature
- conventions script: no runtime file imports spec/, ecs/conformance,
  @adobe/data-testing or vitest
- rules: element.md absorbs the binding-element contract (file removed);
  service.md matches the samples (no nonexistent singletonFactory)
- bump to 0.10.24

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Schema declares schema?: never, so passing a { name, schema } parameter where
its schema is expected is a compile error instead of a silent runtime
mismatch (found while updating a consumer to named parameters).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cy conformance, clash warning, legacy rules)

- signature.parameters accepts a named Parameter or a bare Schema; Parameter.schemaOf reads either
- Conformance.feature / FeatureSpec restored; checkSpec/checkFeature accept the old shape and run the 0.10.20 runner
- a resource sharing a component's name warns once and keeps the 0.10.20 overwrite instead of throwing
- data-ai keeps the data/state and services/main-service rules for legacy-layout features

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…review skills

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ills

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@krisnye krisnye changed the title Scope in @adobe/data/schema; name-clash, reserved-name and test-tier guards; conformance context Scope in schema, reserved-name guards, conformance context, and 0.10.20 back-compat Oct 6, 2026
@krisnye
krisnye merged commit 3c170b0 into main Oct 6, 2026
3 checks passed
@krisnye
krisnye deleted the krisnye/feature-tweaks branch October 6, 2026 16:55
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