# Everything Is a Source -- Part 1

DevFeed: [Everything Is a Source -- Part 1](<https://devfeed.tech/articles/everything-is-a-source-part-1-88050.md>)

Original publisher: [Read original article](<https://proandroiddev.com/everything-is-a-source-part-1-0155cfd84c4d?source=rss----c72404660798---4>)

Author: Damian Petla | Tilt

Published: 2026-10-15T16:42:03Z

Content type: article

Language: en

Sources: [ProAndroidDev](<https://devfeed.tech/sources/proandroiddev-medium.md>)

Topics: [coroutines-flow](<https://devfeed.tech/topics/coroutines-flow.md>), [business logic](<https://devfeed.tech/topics/business-logic.md>), [Functional programming](<https://devfeed.tech/topics/functional-programming.md>), [Grafana](<https://devfeed.tech/topics/grafana.md>), [OpenTelemetry](<https://devfeed.tech/topics/opentelemetry.md>)

Tags: [ai-coding-agents](<https://devfeed.tech/tags/ai-coding-agents.md>), [android](<https://devfeed.tech/tags/android.md>), [android-development](<https://devfeed.tech/tags/android-development.md>), [business-logic](<https://devfeed.tech/tags/business-logic.md>), [caching](<https://devfeed.tech/tags/caching.md>), [coroutines](<https://devfeed.tech/tags/coroutines.md>), [error-handling](<https://devfeed.tech/tags/error-handling.md>), [flow](<https://devfeed.tech/tags/flow.md>), [framework](<https://devfeed.tech/tags/framework.md>), [ios](<https://devfeed.tech/tags/ios.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-coroutines](<https://devfeed.tech/tags/kotlin-coroutines.md>), [kotlin-multiplatform](<https://devfeed.tech/tags/kotlin-multiplatform.md>), [networking](<https://devfeed.tech/tags/networking.md>), [pipeline](<https://devfeed.tech/tags/pipeline.md>), [repository](<https://devfeed.tech/tags/repository.md>), [software-architecture](<https://devfeed.tech/tags/software-architecture.md>)

## AI overview

Tilt replaced hand-written coroutine plumbing and 11 Apollo-specific combine overloads with a roughly 1,600-line Kotlin pipeline built around `PipelineSource<T>`, which wraps `Flow<TiltResult<T>>`. A single `source(...)` factory accepts Apollo calls, flows, values, or existing results; typed combine functions short-circuit on failure, and `build()` and `buildOnce()` distinguish long-lived streams from one-shot reads. Failures propagate by default, while explicit fallbacks make deliberate degradation visible; the home-feed example logs, times out, and falls back for optional settings while allowing feed failures through. The framework also exposed a migration tradeoff: replacing an auction product cache with a stream suppressed unrelated auction updates and refetched all products when IDs changed, so the author restored a plain cache that hands out sources. The excerpt says the shared module has over 50 files using the pattern and that older code is migrating function by function. Its closing section describes tracing as planned for Part 2, not covered here.

## Source excerpt

Part 1 of 2: how a small, home-grown data pipeline became the backbone of Tilt's Kotlin Multiplatform data layer. Part 2 covers what it unlocked: OpenTelemetry tracing with Grafana. At Tilt, the Android and iOS apps share one Kotlin Multiplatform module that owns networking, caching and business logic. A year ago, every repository function in it was a small, hand-rolled piece of coroutine plumbing. Today almost every new one is a single expression that reads like a sentence: source(apolloClient.query(ProductQuery(id))) .transform { converter.toDomain(it) } .buildOnce() This article is about the roughly 1,600 lines of Kotlin behind that expression: why I built them instead of adopting a library, the first design I threw away, and the one idea that survived every refactor: everything is a source. There is also a twist I did not plan for. I built the framework as guardrails for developers who did not know Flows well. It turned out to be exactly the guardrails AI coding agents needed too. The problem: more contributors, less Flow experience In late 2025, iOS developers started contributing to the shared module. That was the point of Kotlin Multiplatform, and it was great. But coroutines and Flows have plenty of sharp edges: when a flow completes, what flatMapLatest cancels, where an exception ends up, why you must never swallow a CancellationException. These are not obvious if Swift is your daily language. The bigger issue was not knowledge of Flows. It was error handling that was quietly skipped. A typical repository function looked like this: return flow { emit(executeDataCatching(apolloClient.query(BundlesConfigQuery(roomId))) { /* map */ }) }.flatMapLatest { configResult -> if (configResult.isSuccess) { val config = configResult.getOrThrow() if (config.sellerId != null && config.enabled) { combineTiltResult( apolloClient.subscription(BundlesSubscription(config.sellerId)), apolloClient.subscription(AddressSubscription(roomId)), ) { bundles, address -> converter.toDom