Your question is Build and Test State-Driven Screen. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Implement a small state-driven screen model for a native mobile project. Given a data source that fetches a list of items and a screen controller/view-model that exposes UI state, write a functionally complete implementation that supports idle, loading, success, and error states. The screen should also support retrying after a failed load. Return the final state object after each action so it can be rendered by the native UI layer.
def process_screen_actions(actions, responses):