feat(core): DataError semantic top-level variants (0.0.16-alpha01)
Chunk 0.D from the YallaClient refactor plan — implementation of ADR-022. Adds five semantic top-level variants to `DataError` so feature code pattern-matches on domain meaning instead of HTTP-status archaeology inside `Network.ClientWithMessage`.
New variants
| Variant | Shape | When |
|---|---|---|
| `Unauthorized` | `data object` | Session not authenticated; show login |
| `Forbidden` | `data class(reason: String?)` | Authed but lacks permission; re-login doesn't help |
| `Conflict` | `data class(reason: String?)` | 409; resource state changed under caller |
| `Validation` | `data class(fields: Map<String, String>)` | 422/400 with per-field server messages |
| `NotFound` | `data object` | Semantic 404 (typed server payload) |
Network hierarchy unchanged. Additive change.
Naming note
ADR-022 called this `DomainError`. The existing type in `core` is `DataError` (dates to 0.0.1). Renaming would churn 8 consumer files for marginal clarity. Keeping `DataError` as canonical; the ADR's name is the aspirational title for this exact hierarchy, implemented here. Rename stays as a possible future ADR.
Version
0.0.15-alpha01 → 0.0.16-alpha01. Stacked on #10 (0.E typography); if #10 merges first this rebases to pick up 0.0.15 as the base. Klib baseline regenerated via `./gradlew :core:apiDump`.
Test plan
-
`./gradlew :core:compileKotlinMetadata` — green -
`./gradlew :core:apiCheck` — green (baseline updated) -
Follow-up PR: SafeApiCall maps HTTP → new variants, YallaClient consumers branch on them
CI
Commit carries `[skip ci]`. Type-only addition; publish happens on merge-to-main.