docs release evidence p10 t01 contract harness - AlexandreZanata/Abastevo GitHub Wiki
P10-T01 — Kotlin contract harness and compatibility adapters
Status: LOCAL_DONE on codex/phase-10-functional-integration (phase PR
pending, first push with this commit). Issue: #45 (slice 1 of 8 local;
P10-T09 pilot stays deferred until G18/G09 and is not part of G10-LOCAL).
No package moves, no enum renames, no Room migration, no wire change.
Slice acceptance (frozen before coding)
- T01 (this commit) — consume shared fixtures in the existing
architecture with bounded adapters only:
WireFuelMapperowns the A05 bridge (legacyGASOLINE_PREMIUM↔ wireGASOLINE_ADDITIVED; the legacy name never appears on the wire; unknown enums refused without coercion),BackendCnpjMapperpreserves alphanumeric CNPJ and leading zeroes with the backend check-digit rule (letters never coerced to digits), andP10ContractHarnessTestreplayslegacy-deltas.json/money-portable-v1.json/ ANP manifest compatibility classes. LegacyFuelProduct(keepsGASOLINE_PREMIUM),Cnpj(numeric-only, refuses alphanumeric) andPriceAmount(2-decimal) stay untouched.
What changed
data/.../mapper/WireFuelMapper.kt— 7-value wire map,toWire/fromWire(only wire values accepted),wireValuesfor round-trip.data/.../mapper/BackendCnpjMapper.kt— format-strip + uppercase, 14-char ASCII validation, Receita check digits (A=17…Z=42, mirrorsbackend/internal/modules/kernel/cnpj.go).data/.../mapper/WireFuelMapperTest.kt— 6 suites (premium bridge, round-trip, legacy-name refusal, unknown/case refusal).data/.../mapper/BackendCnpjMapperTest.kt— 6 suites (leading zeroes, alphanumeric, lowercase, no-coercion, checksum/malformed quarantine incl.12ABC345/01DE-30).domain/.../contract/P10ContractHarnessTest.kt— 7 suites replaying the frozen fixtures and documenting the three legacy divergences.
RED → GREEN
- RED proven by the new mapper tests before implementation:
:data:compileDebugUnitTestKotlinfailed on the missingWireFuelMapper/BackendCnpjMapper; GREEN after adding them. - Behavioral RED: the harness first assumed legacy
Cnpjstrips letters;:domain:testfailed (DomainException) because legacyCnpjrefuses alphanumeric input outright — the test now asserts that refusal explicitly, with the backend adapter owning alpha.
Validation (exact commands, this host)
./gradlew :domain:test :data:testDebugUnitTest --no-daemon
./gradlew :domain:test :application:test :data:testDebugUnitTest :app:testDebugUnitTest :app:assembleDebug --no-daemon
bash scripts/check-mobile.sh
git diff --check
bash scripts/scan-secrets.sh
Outcome: :domain:test + :data:testDebugUnitTest green (incl. 7 new
harness + 12 new mapper suites); full Android baseline BUILD
SUCCESSFUL; check-mobile full ok (Android green; Swift SKIP
recorded, never green); diff --check/secrets clean. No backend
change; Go kernel vectors (04218406000104, 12ABC34501DE35)
replayed on the Kotlin side only.