Dejavu¶
Wait... didn't we just compose this?
Guard your Compose UI efficiency. Catch recomposition regressions before your users.
The Problem¶
Compose's recomposition behavior is an implicit contract — composables should recompose when their inputs change and stay stable otherwise. But that contract breaks silently, and today's options for catching it are limited:
- Layout Inspector — manual, requires a running app, can't automate, can't run in CI
- Manual tracking code —
SideEffectcounters,LaunchedEffectlogging, wrapper composables; invasive, doesn't scale, and ships in your production code - Neither gives you a testable, automatable contract you can enforce on every PR
What Dejavu Does¶
Dejavu is a test-only library that turns recomposition behavior into assertions. Tag your composables with standard Modifier.testTag(), write expectations against recomposition counts, and get structured diagnostics when something changes — whether from a teammate, a library upgrade, an AI agent rewriting your UI code, or a refactor that silently destabilizes a lambda.
- Zero production code changes — just
Modifier.testTag() - One-line test setup —
createRecompositionTrackingRule() - Rich diagnostics — source location, recomposition timeline, parameter diffs, causality analysis
- Per-instance tracking — multiple instances of the same composable get independent counters
Dejavu 0.5.x supports Compose 1.11–1.12 (BOM 2026.05.00 through 2026.08.00); the release baseline is
Compose Multiplatform 1.12.0 and Android Compose BOM 2026.08.00. For Compose 1.10, use Dejavu
0.3.1. The 0.5.x test harness uses the Compose testing v2 APIs (which default to
StandardTestDispatcher). Instrumented BOM gates run the supported BOM range, and the
compose-experimental module (a staging area for experimental-API
recomposition coverage) validates Dejavu against Compose 1.11's new composables (Grid, FlexBox,
derivedMediaQuery, the Styles API) and the LinkBuffer runtime path. See How It Works for the full compatibility table and details.
Next Steps¶
- Getting Started — add the dependency and write your first test
- Use Cases — locking in UI efficiency, AI agent guardrails, and CI enforcement
- Examples — test patterns for common scenarios
- API Reference — all assertions and utilities
- How It Works — internals, compatibility, and limitations
- Releases and migration — supported versions, release notes, and validation
- Contributing — development setup, test expectations, and project policies
Using an AI coding agent?¶
Install DejaVu's portable skills for setup, test writing, failure diagnosis and performance optimization:
Choose your agent during installation. See Agent Skills for Codex, Claude Code, Cursor, GitHub Copilot, OpenCode and manual installation.
DejaVu 0.5.0 also covers Compose 1.12 keyed effects, shrinking remember keys, test synchronization,
and nested movable content. The Android Compose 1.11 support floor is retained; see
compatibility and coverage for the tested version matrix.