Files
back_end_oudelaa/docs/MOBILE-V1-REMAINING-ACTIONS-2026-11-15.md

51 lines
8.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Flutter V1 backend follow-up — 2026-11-15
Status: local implementation; production migration remains blocked pending deployment and device evidence. No production configuration, secrets, database, user accounts or installed-app sessions were modified.
## Implemented contracts
- `GET /api/v1/reports/options` requires Bearer authentication. Reasons are now target-specific: `{id:"spam",value:"spam",label:"Spam",targetType:"post",target:"post"}`. Every supported target gets the same allowed reason values. `targetTypes` remains unchanged. `value` is the submitted reason. Flutter source is outside this workspace: verify its exact target aliases against this response before declaring its parser certified.
- `POST /api/v1/posts/drafts` requires authenticated Multipart. The accepted schema is `src/modules/posts/dto/save-post-draft.dto.ts`, extending the included `create-post.dto.ts`. Additional optional fields: `type` = text/image/video/audio; `hashtags` = at most 30 strings of length 1–80, repeated or JSON array; `isDraft` = true only (Multipart `"true"`). Explicit false is rejected. Unknown properties including authorId are rejected. This endpoint always saves separately in `postdrafts`; it cannot publish.
- Create-derived fields include content/contentTop/contentBottom, media URLs, thumbnailUrl, durationSeconds (1–7200), waveformPeaks (max 512 numbers), imageCaptions/imageAltTexts, taggedUserIds, collaboratorIds, mentionUsernames, mentionedUserIds, location/coordinates, visibility and comment settings. `videoStorageKey` is deliberately rejected for drafts. All fields are optional. Direct file fields: imageFiles (max 10), videoFile/audioFile/coverImageFile (max 1 each). Mutually exclusive sources/media and cleanup rules are retained. Response retains plain `id` and `draftId`, ownership, status and draft metadata.
- M4V now accepts `video/x-m4v` or `video/mp4`, with MP4-family file signature checking. Existing MP4/MOV/WebM remain supported. Post images: 10 MiB each; audio: 20 MiB; video: 100 MiB; profile images: 5 MiB. The supplied nginx configuration allows a 128 MiB aggregate request. Actual hosted proxy/storage limits remain unverified.
- Audio accepts MP3/M4A/WAV/AAC/OGG/WebM and now OPUS/FLAC with matching MIME and file signature. OPUS supports audio/opus or audio/ogg; FLAC supports audio/flac or audio/x-flac. AAC/OGG/OPUS/FLAC labelled `audio/m4a` is rejected for mismatched extension. Flutter must use correct MIME. No acceptance of misleading MIME was added.
- `GET /api/v1/health/deployment` exposes only build revision/image and nonsecret contract configuration. CI passes commit SHA into the gateway Docker image. Builds outside CI must pass `--build-arg BUILD_REVISION=<sha> --build-arg BUILD_IMAGE=<image-tag>`; absent values are reported as `unknown`, never inferred from local HEAD. This is declared build metadata, not independent image attestation.
## FCM implementation and activation
`FcmPushService` is now provided by gateway A and notification worker C. Notifications created while `FCM_ENABLED=true` are stored as pending outbox entries before delivery. Atomic five-minute leases coordinate replicas. The worker checks every five seconds, claims one notification, sends to current active registrations in batches of five, and retries transient/auth/project failures with exponential backoff up to five failed attempts. Crashed leases are reclaimable. Historic notifications without pending state are not replayed. Inspect failed entries operationally before any deliberate retry.
FCM uses the existing google-auth-library dependency, Application Default Credentials and HTTP v1. Supply `FCM_PROJECT_ID` matching the installed app and mounted `GOOGLE_APPLICATION_CREDENTIALS` or workload identity with permission to send to that project. Never place service-account JSON in the repository. `FCM_ENABLED=false` is the default. Gateway configuration validates the payload mode; C also requires a valid explicit project when enabled. Enable the same settings on the service creating notifications and at least one delivery worker.
`FCM_PAYLOAD_MODE=notification` sends notification+data; `data_only` sends data with Android high priority and APNs background headers. Payload fields are strings: id/notificationId (persisted inbox identity), type, recipientId, actorId, resourceType, resourceId/referenceId, deepLink, title/body, and messageId/conversationId where recorded for chat. `resourceId` and `referenceId` carry the same value, so the documented Flutter alias gap does not require a speculative parser change. This is a proposed implemented payload contract, not a captured real-device payload.
UNREGISTERED responses deactivate only the matching token. Other failures never deactivate devices or log tokens/upstream bodies. Account registration deactivates the same token on other users; ambiguous legacy active registrations are skipped by delivery. Delivery is at least once: partial successes or crashes may repeat an event with the same persisted notificationId; Flutter must deduplicate. Account-switch races still require device testing. Poll throughput and failed/pending counts require operational monitoring before enabling push for a large audience.
The team operating A/C must assign a named push owner. Firebase project identity, APNs setup, installed-token compatibility and foreground/background/terminated receipt/tap/navigation are NOT verified. Keep push disabled until those are established. FCM API acceptance never proves device receipt.
## Session continuity and configuration
No signing, refresh hashing, Google audience or user ID changes were made. Existing sessions can continue only if the deployment preserves access/refresh signing configuration, tokenType compatibility, user IDs/database, refresh records and the configured refresh hashing secret (including fallback), plus Google audiences. Existing secrets/records must be compared privately by deployment operations. Do not rotate them or force re-login as part of this handoff. No old tokens were available for continuity tests.
Plain responses remain the code default (`RESPONSE_ENVELOPE_ENABLED=false`); the effective deployment value must be checked. The new manifest reports the effective gateway flag. No blanket response wrapper change was made.
The supplied gateway proxy already forwards Upgrade/Connection, supports polling affinity and uses Redis room fan-out when configured. A is public REST/socket gateway; RabbitMQ B and worker C stay internal. Declared `/socket.io`, `/chat`, `/notifications`, `auth:{token}` contracts do not prove deployed behavior. Existing gateway tests cover local event behavior; authenticated proxy connections, cross-instance fan-out, reconnect/token rotation and REST/socket identity need staging integration.
## Deployment and controlled verification
No staging environment, approved accounts, Firebase project or deployment administration connection was identified. The owner confirmed they do not know those details. This workspace includes image-building CI but no callable deployment administration tool for A/B/C. No release or deployment occurred.
Run the included bounded read-only checker after deployment:
```powershell
node scripts/verify-mobile-deployment.js https://<approved-host>/api/v1 docs/mobile-v1-staging-check.json
```
The checker reads no credentials and performs four anonymous reads, writes a sanitized local report, and does not create accounts or drafts. Authenticated options/draft testing is a separate staging task. It does not certify WebSocket namespace authentication or fan-out. HTTP 401 proves only rejection of an anonymous request.
Before mobile migration, record the deployed image digest and manifest, authenticated options and draft creation on approved test accounts, old-session continuity, signup/OTP/Google/recovery and V1 social/media/chat/inbox regression, socket lifecycle, FCM device receipt, and rollback image/config. Keep the existing mobile base URL until these gates pass. Marketplace and future features remain out of scope.
## Local verification evidence
See the accompanying validation log for commands and final results. HTTP contract tests use stand-in authentication and mocked persistence/storage; FCM tests mock Google requests. They verify local boundaries, not deployed workflows or device delivery.