spike: @adobe/data adoption evidence (chat-state container port) - #2211
Draft
2witstudios wants to merge 1 commit into
Draft
spike: @adobe/data adoption evidence (chat-state container port)#22112witstudios wants to merge 1 commit into
2witstudios wants to merge 1 commit into
Conversation
Evidence branch for the @adobe/data (ECS + Observe) adoption spike. Not for merge — no production call site imports any of this. What is here: - apps/web/src/state/chat/chat-data-plugin.ts — components/archetypes/indexes: one entity per conversation, one per live stream, with real ECS indexes on conversationId / streamMessageId / streamPageId. - chat-state-plugin.ts — the two stores' applyX transitions as `transactions`, the selectors as `computed` (db.derive), the value-returning glue as `actions`. Only the AI-edit transaction is `undoable`. - facade/ — zustand-shaped facades so existing getState() call sites are unchanged over the new container. - app/spike/adobe-data/ — RSC → DatabaseProvider → useObservableValues harness. - __tests__/ — the two existing store suites re-run against the port with zero assertion changes (49/49), plus AI-undo, computed, interop and React binding/hydration evidence. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This branch exists to answer the
@adobe/dataadoption spike with running code. Nothing here is imported by any production call site;apps/web/src/app/spike/adobe-data/is a throwaway harness route. Do not merge. Close it once the migration epic is scoped, or cherry-picksrc/state/chat/*into that epic's PR A.Full verdict + migration epic proposal: spike page
q9ysdsvdada5c6jp1fq0abpj.Verdict: ADOPT — after E1, at the E1→E2 boundary
No blocker found. Bindings, SSR, hydration, StrictMode, undo and zustand coexistence all work under Next 15 + React 19, with zero
any/as any/@ts-ignoreand a clean monorepo typecheck. Not "adopt now" only because E1 PR5/PR6 are in flight on zustand and the rails forbid a mid-wave platform swap.Versions:
@adobe/data@0.9.83,@adobe/data-react@0.9.83.The decisive proof
apps/web/src/state/chat/__tests__/conversationMessagesFacade.test.tsandpendingStreamsFacade.test.tsare mechanical copies of the two existing store suites with exactly one line changed each — the container construction inbeforeEach. Everyit()title, every arrangement, every assertion is byte-identical.49/49 pass. The 133 pure
applyXtests are untouched and green, because the transactions call those same functions.What is in the port
state/chat/chat-data-plugin.tsstate/chat/chat-state-plugin.tsapplyXtransitions astransactions, selectors ascomputed(db.derive), value-returning glue asactionsstate/chat/conversationEntry.tsapplyX→ write columnsstate/chat/facade/*getState()call sites are unchanged over the new containerapp/spike/adobe-data/*DatabaseProvider→useObservableValuesharnessExtra evidence suites:
aiActionUndo(5),computedObservables(9),zustandInterop(3),reactBinding(7 — SSR, StrictMode, propagation, unmount, hydration).Measurements
bun run typecheck(Turbo, monorepo): clean.eslinton all new files: clean.Friction the migration epic must carry
computedandactionscannot share oneDatabase.Plugin.createcall (0.9.83) — declaring both silently collapses inferred actions to{}. Splitting across anextendsboundary fixes it. Undocumented; dictates plugin layout for every adopter.Database.Plugin.ToStore<P>drops declaredindexes— useToTransactionContext<P>/Database.Read<ToDatabase<P>>.void | Entity, sostartLoad's "return the generation" contract becomes anaction.applyOperationstransaction — runtime throw, nothing in the types says so.null-encoded columns projected back toundefined).mutable: trueorToTypewraps them inDeepReadonly.Verification gaps (stated honestly)
.puworktree — the epic's documented dual-React failure did not reproduce here (@adobe/data-reactresolves React fromapps/web/node_modules, the same copy vitest uses). Re-run on the main checkout before relying on it./spike/adobe-datawas not loaded through a live dev server: it sits behind the auth middleware, and a spike must not modify an auth boundary to make itself reachable.next buildcompiles it (route listed at 21.8 kB) and SSR/hydration is asserted in tests instead. A signed-in manual load remains the one open gap.🤖 Generated with Claude Code
https://claude.ai/code/session_01B1feUaxUzUP3Z6oDLTtFDd