Skip to content

Type live events in the domain; move UiText and SplitPanePreferences out of the wrong layer - #1012

Merged
ivanfenenko merged 6 commits into
mainfrom
chore/typed-events-and-neutral-ui-types
Nov 10, 2026
Merged

ivanfenenko merged 6 commits into
mainfrom
chore/typed-events-and-neutral-ui-types

Conversation

@ivanfenenko

@ivanfenenko ivanfenenko commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

Layering refactor, part 1 of 2. No behaviour change, no UI change.

What moved and why

  • Typed live events (both platforms). Feature code matched server event names ("worktree.updated", "vcs.branch.updated", "session.idle", "session.error", "session.archived"/"unarchived", catalog and reconnect sets) and Android SessionInfo read rawProperties to tell a user abort from a real error. New domain/event/OpencodeEventQueries (.kt / .swift) holds the event names and typed queries on OpencodeEvent: isWorktreeUpdated, isBranchUpdated, isSessionRunEnd, isMessagePartDelta, isStreamReconnect, triggersModelCatalogRefresh, sessionArchiveChange (SessionArchiveChange), triggersArchivedListRefresh, isUserAbortSessionError, sessionErrorMessage, and the title / revert / delete (and on iOS move) updates. Every UI subscriber uses them. SessionInfo and SessionChatViewModel no longer hold an EventDomainAdapter on either platform; the adapter keeps its query methods as one-line delegates so domain callers and adapter tests are unchanged. Emitted events, the v2→v1 projection and the Live Stores are untouched.
  • Android UiText moves from ui.text to domain.text (plain type, UiTextLookup, lookup-based resolve). The Resources lookup and the Compose resolve() stay in ui/text/UiTextResources.kt. TimelineText.kt surrogates have explicit @SerialNames, so navigation keys serialize the same.
  • SplitPanePreferences moves beside the split-pane component on both platforms (Android ui/components/layout, package ui.components; iOS Components/Layout), removing the domain → design-system dependency. Storage names, keys and values are unchanged. The screenshot module already compiles ui/components/layout via srcDir, so its symlink to the old path is removed.

After this PR, grep -rn "^import dev.opencode.mobile.ui" android/app/src/main/java/dev/opencode/mobile/domain lists only the three DisplayMessagePipeline.kt imports that part 2 removes, and no non-playground file under ui/ / UI/ holds a server event-name literal or touches rawProperties.

Checks

  • Android (JDK 17), from android/: ./gradlew :app:assembleDebug :app:compileDebugAndroidTestKotlin :app:testDebugUnitTest --continue → BUILD SUCCESSFUL; 3507 unit tests, 0 failures, 1 skipped.
  • iOS: xcodebuild build-for-testing Debug and xcodebuild build Release for generic/platform=iOS Simulator → succeeded. xcodebuild test -only-testing:"OpenCode MobileTests" on a dedicated simulator → 3474 tests in 334 suites passed.
  • gitleaks git --pre-commit --staged before each commit: no leaks.
  • No UI change.

Risks / Follow-ups

  • android/screenshot (-PincludeScreenshot=true :screenshot:compileDebugKotlin, JDK 26) does not compile on this branch or on origin/main (438 identical errors, mostly unresolved R and ThemeManager's UiText). Pre-existing and not in CI; not fixed here.
  • Platform differences kept as they were: Android sessionErrorMessage() skips blank candidates while iOS skips empty ones; iOS sessionMoved reads the v2 move projected onto session.updated, Android keeps its existing sessionMoved() on session.moved. Kotlin exposes parsed updates as functions (event.sessionTitleUpdate()), Swift as properties, matching each platform's existing style.
  • Android has no Session Chat goal reconnect subscriber, so isStreamReconnect is only used through triggersModelCatalogRefresh there.
  • The intermediate commits were not built one by one; the branch head is what was built and tested.

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

ivanfenenko and others added 3 commits November 9, 2026 23:53
Feature code matched server event-name strings and read raw event
properties itself. Add typed queries on OpencodeEvent in domain/event
(worktree and branch updates, run end, reconnect, model catalog refresh,
archive change, session error and user abort, title / revert / delete /
move updates) and move the event names there. UI subscribers use the
typed form, and SessionInfo / SessionChatViewModel no longer hold an
EventDomainAdapter. The adapter keeps its query methods as delegates.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Five domain files imported UiText from ui.text. The plain type and its
lookup-based resolve move to domain.text; the Android Resources lookup
and the Compose resolve() stay in ui.text (UiTextResources.kt). The
serialization surrogates in TimelineText.kt carry explicit serial names,
so navigation keys serialize exactly as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The store in domain/preferences depended on the design-system types
OpenCodeSplitPaneScreen / State / Layout on both platforms. It now lives
next to the component (Android ui/components/layout, package
ui.components; iOS Components/Layout). Storage names, keys and values
are unchanged. The screenshot module already compiles
ui/components/layout, so its symlink to the old path is removed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ivanfenenko
ivanfenenko marked this pull request as ready for review November 10, 2026 08:16

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review: no finding that 2+ of 2 passes agreed on.

opencode pr-review · passes: muse-spark-1.3-contributor, glm-5.3-flash, deepseek-v4.1-flash · $0.124 · 1 pass(es) failed

ivanfenenko and others added 2 commits November 10, 2026 15:26
…dependencies downward (#1013)

* Read tool input and metadata through typed domain accessors

Timeline UI indexed a tool part's raw input / metadata JSON by wire key
(per-tool chrome, step titles, background work, child session linking,
the tool result sheet). Add ToolPartFields in domain/message on both
platforms: per-meaning accessors (inputPattern, inputTargetPath,
childSessionId, patchFiles, executeCallPreviews, questionAnswers,
summaryCalls, resultFields, withChildSessionId, ...) that keep each
surface's existing read rule. UI consumes them; the raw fields stay on
the model, so the session cache and protocol adapters are untouched.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Point the display pipeline's dependencies down into the domain

Android: DisplayMessagePipeline called the UI block builder to decide
whether a message is one text block. PresentationBlockId and the default
timeline's text-run segmentation (text runs, tool grouping, visibility
and part-id rules) move to domain/message/pipeline as TimelineSegments;
the UI builder maps segments to blocks and the pipeline counts text
runs. A test checks the two agree.

iOS: the Markdown document model (NativeMarkdownDocument and its block,
inline, code-span and diff types), the variant/detector and the parser
move from Components / UI to Domain/Markdown; the SwiftUI rendering
stays in Components. The highlighter reaches DisplayMessagePipeline and
MessageContentPreparer.shared through their initializers from
AppContainer instead of the domain reading Container.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
The sync coordinator invalidated on both the stopped occupancy and the
backgroundStop signal, which arrive on separate tasks. A late signal could
invalidate after a foreground catch-up started and force a second reload,
which made ProjectionReconciliationTests flaky on CI.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@ivanfenenko
ivanfenenko merged commit db258ad into main Nov 10, 2026
@ivanfenenko
ivanfenenko deleted the chore/typed-events-and-neutral-ui-types branch November 10, 2026 14:52
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