Repository navigation
docs store ugc safety
Date: 2026-11-15. Task: Google Play readiness item 2.5
(PLAY_STORE_READINESS). Rules:
community safety contract
(B-BR-SAFE-01…09, BUC-SAFE-01…05). Base: origin/dev db43e949
(tree of main 7ab0b477 after PR #224). Status: LOCAL_DONE /
INTEGRATION_PENDING. This record deploys nothing.
The block list is stored server-side per account (community_user_blocks),
not on the device:
- It follows the blocker to every signed-in device and survives reinstall.
- Public reads stay anonymous and cacheable and never carry an author id. No new public link between forum and station content is created (B-BR-FOR-04).
- The app asks a private signed endpoint which items on screen to hide. It skips the question while the account has no blocks. If the answer fails or takes longer than 5 s, the content shows (fail open), and the next load or refresh asks again.
Blocking needs an account, like every other community write. A block is not a moderation signal; reporting is the moderation path.
| Item | Where |
|---|---|
| Module | backend/internal/modules/safety |
| Migration |
000239_community_user_safety.sql. The number was reserved with the F4 batch, which allocates from 000240. |
| Routes | under /v1/community/, wired in backend/cmd/api/safety.go
|
| Erasure step | backend/cmd/worker/main.go |
| Check | Result |
|---|---|
Domain rules (safety/domain): content kinds, reasons, detail bounds, self target, caps, quota error, hidden subset, labels, fixed case detail |
PASS |
HTTP (safety/adapters/http): the 5 routes require a signed session; strict JSON; a client-named account is refused; validation runs before the store; error codes and Retry-After; no account id or internal text in responses; the signature verifier reads the exact body |
PASS |
cmd/api: routes mounted; a guard refusal answers 401 |
PASS |
Real PostGIS (-race -tags=integration, disposable postgis/postgis:18-3.6): 9 tests, see the detail below |
PASS |
Mutation probe: removing the self-target check fails TestSafetyTargetRefusals
|
caught |
Affected suites with -race -tags=integration: safety, forum, feedback, moderation, platform/migrate, cmd/api |
PASS |
staticcheck (GOTOOLCHAIN=go1.27.1, as in CI), toolchain gofmt, go vet, vacuum on OpenAPI, git diff --check, gitleaks
|
PASS |
The 9 real-PostGIS tests cover:
- Blocks: block lifecycle and replay; hidden subset across all content kinds; unblocking a foreign or unknown block answers 404.
- Refused targets: pending topics, editorial posts, hidden comments, replies under a hidden parent, deleted station comments, wrong content kind, and the user's own content (self target).
- Reports: a repeated report replays the first one; one open case per reported account, with PII-free detail; the report quota is rolling.
- Limits: the active-block cap (409) is checked before the 24-hour window quota.
- Rollback and concurrency: a window-quota refusal stores nothing; a guard refusal stores nothing; 8 concurrent blocks produce 1 row.
- Erasure and schema: erasure runs in bounded batches; schema constraints hold.
Implemented in the app, application, data and domain modules, with
strings in all 8 locales.
- Forum topic: a ⋮ menu with Report topic, Report user and Block user.
- Comments and replies: a ⋮ menu with Report comment, Report user and Block user. The viewer's own content shows no such menu.
- Station comments: Report user and Block user were added to the existing menu.
- Profile → Manage account → Blocked users: lists blocks and unblocks them.
- Hidden-content filter: applied to the feed, conversations, best-answer previews, the live stream and station comment lists. An opened topic from a blocked author shows a neutral notice instead.
-
Terms version:
PublishedLegalDocumentsmoves to2026-11together with the updated Terms page (B-BR-TA03), so the in-app terms screen asks every user to accept the new version.
| Check | Result |
|---|---|
| New unit tests: domain 8, application 17, data 15, app view models 41, string parity 2 (same keys and placeholders in all 8 locales) | PASS |
Full ./gradlew :domain:test :application:test :data:testDebugUnitTest :app:testDebugUnitTest (subagent run, before the Terms version bump) |
all green except PublishedLegalDocumentsTest, fixed by the version bump |
scripts/check-mobile.sh --static-only, git diff --check
|
PASS |
:domain:jacocoTestCoverageVerification |
Fails at 0.86 against a 0.90 minimum, as before this change. The new safety package is at 95.8%. CI runs ./gradlew test, not this rule. |
Set-up:
- Disposable PostGIS with the full migration chain, ending at 000239.
- The local API on
127.0.0.1:18080in development mode, forum enabled. -
app-mapProbe.apk(-PmapApiLocalProof=true) installed as the separate packagecom.anpfuel.app.mapprobeon emulatoremulator-5588(API 36), usingadb reverse. - Fixtures created through SQL:
- two other accounts (author B, reader C);
- a published topic by each;
- B's comment and B's reply under C's topic;
- a directory station with one comment by B and one by C.
- The viewer created a username-only account in the app and accepted the Terms, version
2026-11.
| Step | Observed | Server state |
|---|---|---|
| Topic menu on B's topic | Report topic, Report user, Block user | — |
| Report topic (Defamation) | "Report received…" card; the topic stays visible |
forum_reports row and an OPEN FORUM_POST case |
| Report user from the topic (Harassment + detail) | "Report received. The moderation team will review it." | one community_user_reports row with the private detail; an OPEN COMMUNITY_ACCOUNT case on B with fixed detail community user report via FORUM_POST <id>, without the reporter's text |
| Report user again from B's reply, then from B's station comment | "You already reported this user. The report is under review." | still 1 report and 1 case |
| Block user from B's comment (confirmation dialog) | "User blocked…"; B's comment, B's reply and its preview disappear; C's comment stays; expanding C's replies shows nothing from B | block row with label '', source FORUM_COMMENT
|
| Forum feed | B's topic is gone at once and after refresh |
/blocks/hidden 200 |
| Station page | B's station comment is hidden; C's shows | — |
| Profile → Manage account → Blocked users | "Forum participant · Blocked on Nov 15, 2026" → Unblock (confirmation) → "User unblocked." and the empty state | 0 blocks |
| After unblock | B's topic is back in the feed; both station comments show | — |
| Block user from B's station comment | B's comment is hidden; C's stays | block with label e2e-autor-b, source STATION_COMMENT
|
| Own comment (posted, then approved in the DB) | only Edit and Delete; no report or block menu | — |
Findings fixed during the run:
-
Every signed safety call answered 401. The handler decoded the body
before signature verification and did not restore it, so the verifier
hashed an empty body. Regression test
TestSafetySignedOwnerSeesExactBodyfailed (RED), then passed (GREEN) once the body was restored. -
Top-level station comments never showed on devices. This bug predates
the change. Android's
org.jsonreads"parent_id": nullthroughoptStringas the text"null", so the list filter dropped every top-level comment. The JVMorg.jsonused in unit tests does not, so the client now checksisNull; a contract test documents the shape. The fix was confirmed on the emulator.
Observations, not fixed here:
-
Station comments are off in production. Station comments and ratings
sit behind the local
feedback_enabledflag. Its default is off and nothing turns it on, so production users currently see no station UGC. The E2E turned the flag on in the test package only. - Under heavy host load the filter can let content through. With load average about 46 (other sessions' builds), a hidden-content question overlapped a slow session refresh and passed the 5 s budget. The feed showed B's topic once, and the next refresh hid it. Under the same load, one ANR came from a dropdown popup window waiting for a focus event. The app's main thread was idle (stack captured), and the ANR did not happen again when retried.
-
Forum detail showed the text
null. This happened only for the SQL fixtures, whoseexcerptwas NULL. Topics created through the API store an empty excerpt.
Clean-up: the test package was uninstalled, the adb reverse was removed
and the local API was stopped. The user's com.anpfuel.app.debug app on the
shared emulator was not touched.
- Home
- Roadmap
- docs-README
- docs-android-build
- docs-android-design-system
- docs-android-forum
- docs-android-games
- docs-android-map-engine
- docs-android-navigation
- docs-android-ocr-image
- docs-android-ocr-live-framing
- docs-android-premium-area
- docs-android-premium-integration
- docs-android-release
- docs-android-ui-containers
- docs-architecture-android-stack
- docs-architecture-android
- docs-architecture-backend
- docs-architecture-data-sources
- docs-architecture-overview
- docs-architecture-sources-ev-research
- docs-architecture-sources-national-limits
- docs-architecture-sources-national-stations
- docs-architecture-sources-register
- docs-assets-app-tutorial-CAPTURE_CONTRACT
- docs-assets-app-tutorial-FABLE_LANDING_POLISH_PROMPT
- docs-assets-app-tutorial-README
- docs-assets-attribution
- docs-assets-brand-README
- docs-assets-flags-ATTRIBUTION
- docs-assets-fuel-icons-README
- docs-assets-games-fuel-v1-README
- docs-assets-home-icons-README
- docs-assets-landing-fleet-android-20261012-BRIEF
- docs-assets-landing-hero-20261011-BRIEF
- docs-assets-landing-illustrated-20261012-BRIEF
- docs-assets-landing-illustrated-20261012-README
- docs-assets-landing-minimal-20261012-BRIEF
- docs-assets-landing-open-data-20261026-BRIEF
- docs-assets-landing-redesign-20261011-PREPARATION_EVIDENCE
- docs-assets-landing-redesign-20261011-README
- docs-assets-landing-redesign-20261011-REFERENCE_BRIEF
- docs-assets-landing-sync-20261012-BRIEF
- docs-assets-map-icons-README
- docs-backend-anp-ingestion
- docs-backend-api
- docs-backend-community-pricing
- docs-backend-data-model
- docs-backend-domain-model
- docs-backend-driver-private-data
- docs-backend-forum-architecture
- docs-backend-forum-bulletins
- docs-backend-forum-sources
- docs-backend-payments-provider-admission
- docs-backend-payments-provider-register
- docs-backend-photos-capture
- docs-backend-photos-subset-submission
- docs-backend-premium-api
- docs-backend-premium-cloud-protocol
- docs-backend-testing
- docs-backend-toolchain
- docs-brand-app-icons
- docs-brand-identity
- docs-decisions-001-kotlin-compose-stack
- docs-decisions-002-price-import-immutability
- docs-decisions-003-nominatim-reverse-geocode
- docs-decisions-005-modular-monolith-and-postgresql
- docs-decisions-006-official-catalog-and-exact-contracts
- docs-decisions-007-anonymous-proof-of-possession
- docs-decisions-008-privacy-and-retention
- docs-decisions-009-community-consensus-and-projections
- docs-decisions-010-private-object-evidence
- docs-decisions-012-licensing-and-hosted-business
- docs-decisions-015-kotlin-multiplatform-shared-domain
- docs-decisions-016-android-commercial-community-ios-deferred
- docs-decisions-017-station-profile-and-verified-representation
- docs-decisions-021-community-first-contribution
- docs-decisions-022-comaps-derived-native-map-engine
- docs-decisions-023-admin-suite-granted-tiers-contributors
- docs-decisions-025-private-abastevo-empresas-organization-boundary
- docs-decisions-026-multilingual-public-site
- docs-decisions-README
- docs-enterprise-README
- docs-enterprise-architecture
- docs-enterprise-backlog-INDEX
- docs-enterprise-backlog-ep00-governance
- docs-enterprise-backlog-ep01-platform
- docs-enterprise-backlog-ep02-organizations
- docs-enterprise-backlog-ep03-identity-access
- docs-enterprise-backlog-ep04-sync
- docs-enterprise-backlog-ep05-fleet-meters
- docs-enterprise-backlog-ep06-trips
- docs-enterprise-backlog-ep07-gps-navigation
- docs-enterprise-backlog-ep08-fuelings
- docs-enterprise-backlog-ep09-documents
- docs-enterprise-backlog-ep10-expenses-finance
- docs-enterprise-backlog-ep11-maintenance
- docs-enterprise-backlog-ep12-fuel-stock
- docs-enterprise-backlog-ep13-intelligence
- docs-enterprise-backlog-ep14-station-claims
- docs-enterprise-backlog-ep15-station-commerce
- docs-enterprise-backlog-ep16-subscriptions
- docs-enterprise-backlog-ep17-data
- docs-enterprise-backlog-ep18-imports-notifications-integrations
- docs-enterprise-backlog-ep19-back-office
- docs-enterprise-backlog-ep20-release
- docs-enterprise-business-rules
- docs-enterprise-contract
- docs-enterprise-conventions
- docs-enterprise-data-offering
- docs-enterprise-decisions
- docs-enterprise-domain-model
- docs-enterprise-glossary
- docs-enterprise-journeys
- docs-enterprise-modules-back-office
- docs-enterprise-modules-data
- docs-enterprise-modules-documents
- docs-enterprise-modules-expenses-finance
- docs-enterprise-modules-fleet
- docs-enterprise-modules-fuel-stock
- docs-enterprise-modules-fuelings
- docs-enterprise-modules-gps-navigation
- docs-enterprise-modules-identity
- docs-enterprise-modules-imports-notifications-integrations
- docs-enterprise-modules-intelligence
- docs-enterprise-modules-maintenance
- docs-enterprise-modules-organizations
- docs-enterprise-modules-station-claims
- docs-enterprise-modules-station-commerce
- docs-enterprise-modules-subscriptions
- docs-enterprise-modules-trips
- docs-enterprise-offline-sync
- docs-enterprise-permissions
- docs-enterprise-portal-routes
- docs-enterprise-privacy-security
- docs-enterprise-product-vision
- docs-enterprise-source-admission
- docs-enterprise-state-model
- docs-enterprise-testing
- docs-enterprise-ux-app
- docs-enterprise-ux-web
- docs-operations-README
- docs-operations-backup
- docs-operations-deploy-agent
- docs-operations-dou-editions
- docs-operations-edge-cache
- docs-operations-enterprise-activation
- docs-operations-map-static-overlay
- docs-operations-moderation-feedback
- docs-operations-moderation-profiles
- docs-operations-monitoring
- docs-operations-operator-access
- docs-operations-payments
- docs-operations-premium-billing
- docs-operations-recovery
- docs-operations-registry-daily-sync
- docs-operations-registry-runs
- docs-product-README
- docs-product-admin-tiers
- docs-product-community-community-first
- docs-product-community-experience
- docs-product-community-metrics
- docs-product-community-moderation
- docs-product-community-safety
- docs-product-community-terms-pt-br
- docs-product-driver-suite-README
- docs-product-driver-suite-android-state
- docs-product-driver-suite-cloud-sync
- docs-product-driver-suite-cost-profiles-and-maintenance
- docs-product-driver-suite-driver-model-and-earnings
- docs-product-driver-suite-foundation-decisions
- docs-product-driver-suite-gps-lifecycle
- docs-product-driver-suite-mobile-hub
- docs-product-driver-suite-odometer-review
- docs-product-driver-suite-outbox-wire
- docs-product-driver-suite-quick-refuel
- docs-product-driver-suite-reports
- docs-product-driver-suite-shifts-and-distance
- docs-product-driver-suite-signed-commands
- docs-product-ev-README
- docs-product-ev-charging-stop-planner
- docs-product-ev-energy-model
- docs-product-ev-financial-method
- docs-product-ev-journey-ui
- docs-product-ev-preparation
- docs-product-ev-typed-data
- docs-product-exploration
- docs-product-forum-contract
- docs-product-forum-policies
- docs-product-glossary
- docs-product-landing-content
- docs-product-landing-guides
- docs-product-landing-organic-growth-i18n-plan
- docs-product-licensing
- docs-product-map-discovery
- docs-product-map-favorites-and-trips
- docs-product-map-reports-routing-guidance
- docs-product-notification-content
- docs-product-official-prices
- docs-product-open-source-business
- docs-product-overview
- docs-product-payments-README
- docs-product-payments-offer-policy
- docs-product-premium-README
- docs-product-premium-financial-method
- docs-product-premium-source-policy
- docs-product-stations-catalog
- docs-product-stations-fuel-feedback
- docs-product-stations-fuel-quality
- docs-product-stations-identity-and-ev-catalog
- docs-product-stations-profile-contract
- docs-product-stations-profile-representation
- docs-product-stations-registry-sources
- docs-product-vehicle-registration
- docs-product-vehicles-and-occurrences
- docs-security-android-terms-acceptance
- docs-security-free-account-access
- docs-security-identity-profile
- docs-security-media-location-policy
- docs-security-privacy-notice
- docs-security-privacy-policy
- docs-security-retention
- docs-security-risks
- docs-security-security-privacy
- docs-store-README
- docs-store-play-readiness
- docs-store-play-store-listing
- docs-store-ugc-safety
Source: AlexandreZanata/Abastevo @ e4a67580fc368a59bc1c0f1e0466fc011313f330