docs mobile p22 t02 ratings comments votes - AlexandreZanata/Abastevo GitHub Wiki
P22-T02 — Ratings transport plus agreement-vs-confidence display
Status: LOCAL_DONE on codex/phase-22-social-moderation. Issue: #87. Entry P22-T01 satisfied (account journey LOCAL_DONE); P14/P17 comment/reply/vote contracts integrated and reused unchanged. Binds B-BR-F02, B-BR-C04 and BUC-C03. No migration, no new permission, no iOS work.
What this task adds
- Backend ratings transport (the recorded P14 gap):
POST /v1/feedback/ratings(1–5 stars, one current rating per account/target, idempotent converge, revision bump),POST /v1/feedback/ratings/remove(unknown keys →rating-not-found, no aggregate touch),GET /v1/feedback/ratings/stats(public anonymous read, exact count/sum, null mean when empty — never an invented score). Author derives server-side from the live session; every response isno-storewith no account identifiers. - Application
GetFeedbackPageUseCase.stats(public read, no login; blank targets fail fast, transport fails closed asUnavailable). - Android
FeedbackHttpClient.rate/deleteRating/statsagainst the three routes with stable-kind mapping (rating-out-of-range,rating-not-found); the explicitGATE_REQUIREDrefusal is gone — no fake path remains. FeedbackViewModel.rate/deleteRating/loadStatswith local 1–5 guard (no IO), blank-sessionSignInRequired, stable-op-id retry, and newRated/RatingDeleted/StatsLoadedstates (rating outcomes no longer reuse comment states).FeedbackDisplay.ratingLine(floor one-decimal mean with exact count,No ratingswhen empty) kept apart from price confidence: stars describe personal experience (B-BR-F02), agreement describes comment validity (F06), neither certifies a pump price (B-BR-C04).
Reused and verified (not rebuilt)
Comment/reply/edit/vote/report transport, use cases, outbox retry, 280-scalar portable rules and agreement math — all P14/P17-owned and untouched.
Auth/critical gate (real PostGIS)
- Backend
feedbackunit +-tags=integrationvs local PostGIS (project dev DB): all packages ok — rate/remove/stats handlers, golden vectors, existing rating/vote/comment stores. - OpenAPI
vacuum lintpasses with the pre-existing 27 informs only.
Explicitly deferred (not waived)
- Screen-level discussion section (
StationDetailSheetcommunity card /Comunidadehub wiring with agreement-vs-confidence copy): needs the station-identity mapping (list-row CNPJ → directory UUID target) before any consumer — next slice, not silently dropped. - Real Google/Apple provider proof: P24-owned device evidence (per P22-T01).
- Report/moderation journeys: P22-T03.
Validation
go test ./internal/modules/feedback/...+-tags=integration0-fail;apicontractgolden vectors (4 new rating vectors) PASS;vacuum lintPASS.:domain:test408 +:application:test246 +:data:testDebugUnitTest203 (1 pre-existing live-network skip) +:app:testDebugUnitTest142, 0-fail (--rerun-tasks);:app:assembleDebugPASS.git diff --checkclean;scripts/scan-secrets.shPASS (no secrets/PII/GPS/photo content).