Skip to content

feat: layered database structure and AI guidance skills#150

Open
krisnye wants to merge 5 commits into
mainfrom
knye/ai-layered-structure
Open

feat: layered database structure and AI guidance skills#150
krisnye wants to merge 5 commits into
mainfrom
knye/ai-layered-structure

Conversation

@krisnye

@krisnye krisnye commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Move samples (todo, tictactoe, p2p) from flat state/*-plugin files to namespaced database layers (data/resources, database/*, transactions, services) so apps compose typed database stacks instead of ad-hoc plugins.
  • Expand data-ai skills (structure, namespace, types, services, resources, and related helpers) so agents are guided toward that same layout and conventions.
  • Supporting core tweaks: clearer schema builders (fromObjectProperties / fromStructProperties), UI-service transaction overload preservation, and split typecheck scripts.

Direction

We are pushing toward a consistent, agent-friendly project shape: databases built in layers, folders that map to concepts (types / resources / services / structure), and skills that teach that pattern rather than one-off plugin files.

Test plan

  • pnpm typecheck (foundation → libraries → samples)
  • Spot-check data-lit-todo, data-lit-tictactoe, and data-p2p-tictactoe still run
  • Confirm data-ai skills install/resolve as expected

Made with Cursor

krisnye and others added 5 commits July 16, 2026 14:46
Move samples toward namespaced database layers and expand data-ai skills so agents can follow the same structure.

Co-authored-by: Cursor <cursoragent@cursor.com>
…ture

# Conflicts:
#	packages/data-lit-todo/package.json
#	packages/data-p2p-tictactoe/src/state/negotiation-plugin.ts
…tore

Restructure both samples into the four-layer feature model and fix the
supporting core types at the source.

Core @adobe/data
- Remove the separate transaction-context type. `Store` now carries `userId`
  and its index handles (`IX`); `ToStore<P>` includes indexes + partition
  keys. Transaction functions operate on `Store` directly — a store *is* the
  transaction context. Deletes `TransactionContext` / `ToTransactionContext`.
- Fix `UIService.FromService` misclassifying a plain async fire-and-forget
  action (`() => Promise<void>`) as a transaction overload and wrongly
  requiring an argument; a genuine transaction has a synchronous commit
  signature (never a Promise), which is the correct discriminator.

Samples (tic-tac-toe, todo)
- `data/` is the specification: one immutable `State` with pure, unit-tested
  transforms/derivations. `ecs/` is the materialised view; computeds and
  transactions are verified against the `data/` precedent by conformance
  tests. Add `services/` (async ports) and `ui/`.
- Facet-named database layers, no feature/app names in the ladder:
  Core -> Index -> Transaction -> Computed -> Service -> Action.
- todo: async name-generator service, todo-analytics service, and an
  `actions/` layer where the UI dispatches actions that record analytics and
  call one transaction (async action brackets the slow call for timing).

Rules & tooling
- Path-mapped `structure/` rules mirroring the feature folders (adds
  data/state, ecs/actions); README + skill bundle updated.
- Require Node >=22 (engines + .nvmrc) so live-reactivity paths are testable.

Full-monorepo typecheck clean; test suite green on Node 22.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ests

Builds on the layered feature architecture with lazily-loaded features, a
many-to-many index demo, and a presentation-testing utility — plus fixes to
analytics, computed sharing, and flaky tests.

Multi-feature app (data-lit-todo)
- Restructure the sample into src/features/{main,assign}/. `main` imports each
  peer feature's *schema* plugin (Database.Plugin `imports`, not `extends`) so
  the shared store knows every schema without type-coupling or bundling the
  feature's behavior.
- Feature elements lazily extend the live database on first connect
  (DatabaseElement), so a feature's indexes/transactions/UI load only when used.
- New `assign` feature: a User archetype, a unique `usersByName` index and a
  multi-value `todosByAssignee` index — the todo<->user many-to-many navigable
  both ways; assignee dropdown + Users tab load lazily.

Services / actions
- todo-analytics is now named, strongly-typed methods (event vocabulary and
  formatting owned by the service), with a stateless opaque timing token from
  randomTodoRequested handed back to randomTodoAdded; named-object args.

Core @adobe/data
- Wrap db.derive computeds in Observe.withCache so N subscribers share one
  computation (red/green test).
- Convert flaky wall-clock perf assertions to non-fatal warnings; the suite is
  now deterministic and exits 0.

Presentation testing (@adobe/data-lit)
- Add Template — a DOM-free query over a Lit TemplateResult
  (text/values/children/has/find) for asserting what a pure render(props)
  declares. Pure and tree-shakeable.
- Make todo-row-presentation pure (move the drag hook into the element).
- Unit-test every Lit presentation in the repo (tictactoe, todo, p2p) via
  Template; jsdom only where module-load side effects require it.

Rules updated for multi-feature composition, indexes/m2m, and the presentation
testing pattern. Full-monorepo typecheck clean; test suite green on Node 22.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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