Skip to content

ci: verify Compose layout claims in the reference docs - #16

Merged
aldefy merged 6 commits into
masterfrom
feat/verify-claims-ci
Jul 8, 2026
Merged

ci: verify Compose layout claims in the reference docs#16
aldefy merged 6 commits into
masterfrom
feat/verify-claims-ci

Conversation

@aldefy

@aldefy aldefy commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Why

Issue #14 (and four follow-ups) were docs asserting Compose layout behavior
that nothing executed — a wrong claim (size(100).padding(16) → "132x132")
shipped green because no test ever composed the code and measured it. This adds
CI that runs and asserts the layout claims, with the docs as the single source
of truth
so a claim and its test cannot drift apart.

How it works

A block in a reference .md is marked executable with a verify fence:

```kotlin verify
// name: size-before-padding-keeps-footprint
// assert: width = 100.dp
// assert: height = 100.dp
@Composable fun Subject() {
    Box(Modifier.size(100.dp).padding(16.dp).background(Color.Red))
}
```

The Gradle task generateClaimTests harvests every verify block, emits one
Robolectric test per block, composes Subject(), and asserts the measured
width/height — headless on the JVM, no emulator. A wrong number fails CI.
Plain ```kotlin blocks are illustrative and are not executed.

What's here

  • verify-claims/ — Android library module (Compose + Robolectric unit tests).
  • buildSrc/ClaimParser (unit-tested) + GenerateClaimTests task.
  • modifiers.md — the modifier invalid size and padding comment #14 size/padding examples annotated as verify blocks.
  • .github/workflows/ci.yml — new verify-claims job (existing validate
    job untouched).
  • CONTRIBUTING.md — how to author a verify block.

Verification (run locally)

  • ./gradlew :verify-claims:testDebugUnitTest — 2 claim tests pass
    (132x132 and 100x100 confirmed by measurement).
  • Harness proven non-trivial: temporarily asserting 132x132 for the
    size-first chain makes the test FAIL — exactly the guard that would have
    caught modifier invalid size and padding comment #14.
  • ./gradlew -p buildSrc test — 4 parser tests pass.
  • Existing CI (versions, description-length, manifest, bats) still green.

Release (version bump + tag) will follow as a separate step after this merges.

@aldefy
aldefy merged commit 00d80d5 into master Jul 8, 2026
2 checks passed
@aldefy
aldefy deleted the feat/verify-claims-ci branch July 8, 2026 06:27
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