chore: land in-progress workspace changes before 1.16.2

The tree carried uncommitted work from several areas (web push, mobile
screens, admin charts, test-hygiene cleanup, CI and map docs). It is landed
as one commit so the release pipeline can start from a clean tree; the
desktop transcript-correction behaviour shipped in the previous commit and
is unchanged here.
This commit is contained in:
Yun Chan 2026-11-05 21:58:44 +09:00
parent 9c2b6a9782
commit 7fe49c437e
144 changed files with 3760 additions and 4523 deletions

View file

@ -1,76 +0,0 @@
import { expect, test } from '@playwright/test'
import {
formatBillingPrice,
formatPlanCatalogPrice,
parseBillingCatalog,
} from '../src/lib/billing-catalog'
const catalogPayload = {
schema_version: '1',
plans: [
{
tier: 'pro',
prices: [
{ provider: 'payple', unit_amount: 9900, currency: 'KRW', interval: 'month', interval_count: 1 },
],
},
{
tier: 'pro_plus',
prices: [
{ provider: 'payple', unit_amount: 29900, currency: 'KRW', interval: 'month', interval_count: 1 },
],
},
],
}
test.describe('billing catalog strict client contract', () => {
test('parses provider prices and formats minor currency units', () => {
const catalog = parseBillingCatalog(catalogPayload)
expect(catalog).not.toBeNull()
expect(formatBillingPrice(catalog!.plans.pro[0])).toContain('9,900')
expect(formatPlanCatalogPrice('pro', catalog)).toContain('9,900')
expect(formatPlanCatalogPrice('pro_plus', catalog)).toContain('29,900')
expect(formatPlanCatalogPrice('free', catalog)).toBe('무료')
})
test('rejects duplicate tiers/providers, malformed amounts, and unknown values', () => {
const invalid = [
null,
{},
{ ...catalogPayload, schema_version: '2' },
{ ...catalogPayload, plans: [catalogPayload.plans[0], catalogPayload.plans[0]] },
{
...catalogPayload,
plans: [{
tier: 'pro',
prices: [catalogPayload.plans[0].prices[0], catalogPayload.plans[0].prices[0]],
}, catalogPayload.plans[1]],
},
{
...catalogPayload,
plans: [{ tier: 'pro', prices: [{ ...catalogPayload.plans[0].prices[0], unit_amount: 0 }] }, catalogPayload.plans[1]],
},
{
...catalogPayload,
plans: [{ tier: 'pro', prices: [{ ...catalogPayload.plans[0].prices[0], currency: 'KRW<script>' }] }, catalogPayload.plans[1]],
},
{
...catalogPayload,
plans: [{ tier: 'pro', prices: [{ ...catalogPayload.plans[0].prices[0], provider: 'google_play' }] }, catalogPayload.plans[1]],
},
]
for (const value of invalid) expect(parseBillingCatalog(value)).toBeNull()
})
test('keeps an unavailable provider absent instead of inventing a price', () => {
const catalog = parseBillingCatalog({
schema_version: '1',
plans: [
{ tier: 'pro', prices: [] },
{ tier: 'pro_plus', prices: [] },
],
})
expect(catalog).not.toBeNull()
expect(formatPlanCatalogPrice('pro', catalog)).toBeNull()
})
})

View file

@ -1,70 +0,0 @@
import { test, expect } from '@playwright/test';
import path from 'path';
import fs from 'fs';
import { SITE_URLS } from '@d3ro/core/web-urls';
const SCREENSHOT_DIR = path.resolve('C:/Users/encep/.gemini/antigravity/brain/bbff18a3-721d-4c43-989f-1d6964e15be7/screenshots');
test.describe.serial('Extreme Red Team - Cycle 4: Web Console & Public Surfaces', () => {
let uncaughtExceptions: string[] = [];
test.beforeAll(() => {
if (!fs.existsSync(SCREENSHOT_DIR)) {
fs.mkdirSync(SCREENSHOT_DIR, { recursive: true });
}
});
test.beforeEach(({ page }) => {
uncaughtExceptions = [];
page.on('pageerror', (err) => {
console.error('[WEB PAGEERROR]:', err.message);
uncaughtExceptions.push(err.message);
});
});
test('RT-14: Web Public Hub - /login and the /download redirect to the landing site', async ({ page }) => {
// 1. Test /login
await page.goto('/app/login');
await page.waitForLoadState('domcontentloaded');
await expect(page.getByText(/D3RO[- ]VOICE/i)).toBeVisible({ timeout: 10000 });
await expect(page.getByRole('button', { name: /Google/i })).toBeVisible();
await expect(page.getByRole('button', { name: /GitHub/i })).toBeVisible();
// Screenshot login
await page.screenshot({
path: path.join(SCREENSHOT_DIR, 'rt14_01_web_login.png'),
});
// 2. /download lives only on the landing site; the web app just redirects there.
const downloadRes = await page.request.get('/app/download', { maxRedirects: 0 });
expect([307, 308]).toContain(downloadRes.status());
expect(downloadRes.headers()['location']).toBe(SITE_URLS.download);
expect(uncaughtExceptions).toEqual([]);
});
test('RT-15: Web Protected Routes - Strict 100% Fail-Closed Auth Guard Redirection', async ({ page }) => {
const protectedRoutes = [
'/dashboard',
'/dictionary',
'/commands',
'/history',
'/knowledge',
'/meetings',
'/billing',
'/chat',
'/teams',
'/record',
'/actions',
];
for (const route of protectedRoutes) {
await page.goto(`/app${route}`);
await page.waitForURL(/\/login/, { timeout: 10000 });
expect(page.url()).toContain('/login');
}
expect(uncaughtExceptions).toEqual([]);
});
});

View file

@ -1,40 +1,61 @@
// apps/web/e2e/smoke.spec.ts
// 기본 스모크 테스트 — 인증 없이 접근 가능한 라우트 확인.
// 인증 없이 접근 가능한 표면의 계약 (스모크):
// 1. 보호 라우트는 예외 없이 전부 /login 으로 되돌린다 (fail-closed)
// 2. /login 은 로고와 Google/GitHub OAuth 진입을 보여준다
// 3. /download 는 웹앱이 아니라 랜딩 사이트로 넘긴다
//
// 실행:
// npm install -D @playwright/test --workspace=@d3ro/web
// npx playwright install chromium --with-deps
// npm run test:e2e --workspace=@d3ro/web
//
// 배포 환경별 차이는 E2E_BASE_URL 로 주입한다. 서버를 띄우지 않으려면 E2E_NO_SERVER=1.
import { test, expect } from '@playwright/test'
import { SITE_URLS } from '@d3ro/core/web-urls'
// 보호 라우트 전체. 라우트를 추가하면 여기에도 추가한다 (누락 = 미검증 표면).
const PROTECTED_ROUTES = [
'/dashboard',
'/dictionary',
'/commands',
'/history',
'/knowledge',
'/meetings',
'/billing',
'/chat',
'/teams',
'/record',
'/actions',
] as const
test.describe('Smoke: unauthenticated access', () => {
test('루트(/)는 /login으로 리다이렉트된다 (Supabase 미설정 시)', async ({ page }) => {
test('루트(/)는 /login으로 리다이렉트된다', async ({ page }) => {
await page.goto('/app')
await page.waitForURL(/\/login/, { timeout: 10000 })
expect(page.url()).toContain('/login')
})
test('/login 페이지가 로드되고 D3RO VOICE 로고가 표시된다', async ({ page }) => {
test('/login은 로고와 Google/GitHub OAuth 버튼을 보여준다', async ({ page }) => {
await page.goto('/app/login')
await expect(page.getByText(/D3RO[- ]VOICE/i)).toBeVisible({ timeout: 10000 })
})
test('/login에 Google/GitHub OAuth 버튼이 보인다', async ({ page }) => {
await page.goto('/app/login')
await expect(page.getByText(/D3RO[- ]VOICE/i)).toBeVisible({ timeout: 10000 })
await expect(page.getByRole('button', { name: /Google/i })).toBeVisible()
await expect(page.getByRole('button', { name: /GitHub/i })).toBeVisible()
})
test('/dashboard는 미로그인 시 /login으로 리다이렉트', async ({ page }) => {
await page.goto('/app/dashboard')
await page.waitForURL(/\/login/, { timeout: 10000 })
expect(page.url()).toContain('/login')
test('모든 보호 라우트는 미로그인 시 /login으로 되돌린다', async ({ page }) => {
for (const route of PROTECTED_ROUTES) {
await test.step(route, async () => {
await page.goto(`/app${route}`)
await page.waitForURL(/\/login/, { timeout: 10000 })
expect(page.url()).toContain('/login')
})
}
})
test('/meetings도 미로그인 시 /login으로 리다이렉트', async ({ page }) => {
await page.goto('/app/meetings')
await page.waitForURL(/\/login/, { timeout: 10000 })
expect(page.url()).toContain('/login')
test('/download는 랜딩 사이트 다운로드 페이지로 넘긴다', async ({ page }) => {
const response = await page.request.get('/app/download', { maxRedirects: 0 })
expect([307, 308]).toContain(response.status())
expect(response.headers()['location']).toBe(SITE_URLS.download)
})
})

View file

@ -1,84 +0,0 @@
import { expect, test } from '@playwright/test'
import { transcribeWebAudio, WebSttError } from '../src/lib/web-stt-client'
const audio = new Blob([new Uint8Array([0x1a, 0x45, 0xdf, 0xa3])], { type: 'audio/webm;codecs=opus' })
test.describe('web STT fail-closed client', () => {
test('sends one authenticated request and accepts only a strict real transcript', async () => {
let calls = 0
const result = await transcribeWebAudio({
audio,
accessToken: 'access-token',
supabaseUrl: 'https://project.supabase.co',
fetchImpl: async (input, init) => {
calls += 1
expect(String(input)).toBe('https://project.supabase.co/functions/v1/stt-proxy')
expect(init?.headers).toEqual({ Authorization: 'Bearer access-token' })
expect(init?.body).toBeInstanceOf(FormData)
return new Response(JSON.stringify({
transcript: '실제 전사 결과',
confidence: 0.97,
language_code: 'ko',
duration_seconds: 1.25,
provider: 'whisper.cpp-local',
}), { status: 200, headers: { 'Content-Type': 'application/json' } })
},
})
expect(calls).toBe(1)
expect(result.transcript).toBe('실제 전사 결과')
})
test('maps auth, quota, provider and upstream failures without a fallback request', async () => {
for (const [status, error, code] of [
[401, 'invalid_token', 'auth_required'],
[429, 'quota_exceeded', 'quota_exceeded'],
[503, 'stt_provider_unavailable', 'provider_unavailable'],
[502, 'stt_upstream_failed', 'upstream_failed'],
] as const) {
let calls = 0
const rejection = transcribeWebAudio({
audio,
accessToken: 'token',
supabaseUrl: 'https://project.supabase.co',
fetchImpl: async () => {
calls += 1
return new Response(JSON.stringify({ error }), { status })
},
})
await expect(rejection).rejects.toMatchObject({ code })
expect(calls).toBe(1)
}
})
test('rejects empty, oversized, wrong MIME, malformed success and insecure endpoints', async () => {
const noFetch = async (): Promise<Response> => { throw new Error('must not fetch') }
const invalidCalls = [
transcribeWebAudio({ audio: new Blob([], { type: 'audio/webm' }), accessToken: 't', supabaseUrl: 'https://p.supabase.co', fetchImpl: noFetch }),
transcribeWebAudio({ audio: new Blob([new Uint8Array(25 * 1024 * 1024 + 1)], { type: 'audio/webm' }), accessToken: 't', supabaseUrl: 'https://p.supabase.co', fetchImpl: noFetch }),
transcribeWebAudio({ audio: new Blob(['x'], { type: 'audio/mpeg' }), accessToken: 't', supabaseUrl: 'https://p.supabase.co', fetchImpl: noFetch }),
transcribeWebAudio({ audio, accessToken: 't', supabaseUrl: 'http://remote.example', fetchImpl: noFetch }),
transcribeWebAudio({
audio,
accessToken: 't',
supabaseUrl: 'https://p.supabase.co',
fetchImpl: async () => new Response(JSON.stringify({ transcript: 'placeholder' }), { status: 200 }),
}),
]
for (const call of invalidCalls) await expect(call).rejects.toBeInstanceOf(WebSttError)
})
test('aborts the only provider request as cancelled', async () => {
const controller = new AbortController()
const promise = transcribeWebAudio({
audio,
accessToken: 'token',
supabaseUrl: 'https://project.supabase.co',
signal: controller.signal,
fetchImpl: async (_input, init) => new Promise((_resolve, reject) => {
init?.signal?.addEventListener('abort', () => reject(new DOMException('aborted', 'AbortError')), { once: true })
}),
})
controller.abort()
await expect(promise).rejects.toMatchObject({ code: 'cancelled' })
})
})