Compare commits

..

1 Commits

Author SHA1 Message Date
Ilia Denisov 9814d78ae3 Stage 9: Telegram integration (connector side-service, Mini App, out-of-app push)
Tests · UI / test (push) Successful in 19s
Tests · Go / test (pull_request) Successful in 6s
Tests · Integration / integration (pull_request) Failing after 11s
Tests · UI / test (pull_request) Successful in 18s
New platform/telegram connector (own container, bot token only there):
- go-telegram/bot long-poll loop: /start deep-links + Mini App launch button.
- gRPC API pkg/proto/telegram/v1 (Telegram service): ValidateInitData, Notify
  (renders a localized message + deep-link button), SendToUser/SendToGameChannel
  (admin, wired in Stage 10). Generic methods are platform-agnostic (external_id).
- Bot API base override for Telegram's test environment; Dockerfile + compose
  (VPN sidecar, no public ingress); README.

Gateway:
- initData validation relocated from the gateway into the connector; the gateway
  calls ValidateInitData over gRPC (GATEWAY_CONNECTOR_ADDR), drops the bot token,
  and deletes internal/auth.
- Out-of-app push: runPushPump routes events whose recipient has no live in-app
  stream to connector.Notify, gated by /internal/push-target + the in-app-only
  flag (race-free de-dup); HasSubscribers added to the push hub.

Backend:
- Migration 00007 accounts.notifications_in_app_only (default true) + jetgen.
- ProvisionTelegram seeds a new account's language/display name from the launch
  fields; IdentityExternalID reverse lookup; /internal/push-target handler.

UI:
- Telegram Mini App launch: detect initData, apply themeParams, authTelegram,
  route the deep-link start_param (g/i/f); /telegram/ guard redirects outside
  Telegram. Vite relative base + telegram-web-app.js. In-app-only profile toggle;
  share-to-Telegram link for a friend code. Vitest + Playwright coverage.

Wire/docs/CI: fbs Profile/UpdateProfileRequest gain notifications_in_app_only
(Go + TS); go.work uses ./platform/telegram; go-unit.yaml covers it; PLAN,
ARCHITECTURE, FUNCTIONAL (+ru), UI_DESIGN, READMEs updated.
2026-06-04 07:05:00 +02:00
6 changed files with 25 additions and 12 deletions
+18
View File
@@ -0,0 +1,18 @@
import { test as base } from '@playwright/test';
// All e2e specs run hermetically against the mock transport. Neutralise the real
// telegram-web-app.js (loaded from the CDN in index.html) so the suite never blocks
// on telegram.org — it is unreachable from the CI runner, and a render-blocking
// <script> to it would hang every page load. Specs that exercise the Telegram launch
// inject their own window.Telegram via addInitScript before navigating.
export const test = base.extend({
page: async ({ page }, use) => {
await page.route('**/telegram-web-app.js', (route) =>
route.fulfill({ status: 200, contentType: 'application/javascript', body: '' }),
);
await use(page);
},
});
export { expect } from '@playwright/test';
export type { Page } from '@playwright/test';
+1 -1
View File
@@ -1,4 +1,4 @@
import { expect, test, type Page } from '@playwright/test'; import { expect, test, type Page } from './fixtures';
// Behaviour/display coverage for the polished game screen, driven entirely by the mock // Behaviour/display coverage for the polished game screen, driven entirely by the mock
// transport (no backend). These lock the round-1..4 interactions so future UI edits // transport (no backend). These lock the round-1..4 interactions so future UI edits
+1 -1
View File
@@ -1,4 +1,4 @@
import { expect, test } from '@playwright/test'; import { expect, test } from './fixtures';
// The playable-slice smoke against the mock transport: guest login -> lobby shows the // The playable-slice smoke against the mock transport: guest login -> lobby shows the
// seeded active game -> open it -> the board renders committed tiles -> place a rack // seeded active game -> open it -> the board renders committed tiles -> place a rack
+1 -1
View File
@@ -1,4 +1,4 @@
import { expect, test, type Page } from '@playwright/test'; import { expect, test, type Page } from './fixtures';
// Stage 8 social / account / history surfaces against the mock transport (no backend). // Stage 8 social / account / history surfaces against the mock transport (no backend).
// The mock profile is a durable account, so friends, invitations, stats and the GCG // The mock profile is a durable account, so friends, invitations, stats and the GCG
+3 -8
View File
@@ -1,12 +1,7 @@
import { expect, test } from '@playwright/test'; import { expect, test } from './fixtures';
// Neutralise the real telegram-web-app.js (loaded from the CDN in index.html) so the // The shared fixture already neutralises the real telegram-web-app.js, so these
// test controls window.Telegram deterministically and needs no network. // specs control window.Telegram deterministically (injected below) with no network.
test.beforeEach(async ({ page }) => {
await page.route('**/telegram-web-app.js', (r) =>
r.fulfill({ status: 200, contentType: 'application/javascript', body: '' }),
);
});
// A minimal valid-looking Telegram WebApp stub: non-empty initData triggers the Mini // A minimal valid-looking Telegram WebApp stub: non-empty initData triggers the Mini
// App launch path (the mock gateway accepts any initData and returns a durable // App launch path (the mock gateway accepts any initData and returns a durable
+1 -1
View File
@@ -1,4 +1,4 @@
import { expect, test } from '@playwright/test'; import { expect, test } from './fixtures';
// Item 5: zooming the board must enlarge the labels too (a magnifying-glass zoom). // Item 5: zooming the board must enlarge the labels too (a magnifying-glass zoom).
// cqw is sized against the zoom-scaled board, so the font grows with the cells. // cqw is sized against the zoom-scaled board, so the font grows with the cells.