Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 33 additions & 21 deletions .github/scripts/image-header-timeout-screenshot.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// CI only: actual SettingsView and controls, synthetic API, no production login.
import { execFileSync } from 'node:child_process'
import { createRequire } from 'node:module'
import { mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
import { mkdirSync, readFileSync, rmSync, symlinkSync, writeFileSync } from 'node:fs'
import { join, resolve } from 'node:path'
import { pathToFileURL } from 'node:url'

Expand All @@ -14,12 +14,12 @@ const { build, preview } = await import(pathToFileURL(join(root, 'node_modules/v
const vue = (await import(pathToFileURL(require.resolve('@vitejs/plugin-vue')).href)).default
const tailwindcss = require('tailwindcss')
const autoprefixer = require('autoprefixer')
const tailwindConfig = (await import(pathToFileURL(join(root, 'tailwind.config.js')).href)).default
const { chromium } = await import(pathToFileURL(join(process.env.PLAYWRIGHT_ROOT, 'index.mjs')).href)
const suffix = `.ci-image-header-${process.pid}`
const files = []
const create = (path, text) => { writeFileSync(path, text, { flag: 'wx' }); files.push(path); return path }
const previewDirectory = join(output, 'preview-build')
const baselineDirectory = join(output, suffix + '-baseline')
const testSource = readFileSync(join(root, 'src/views/admin/__tests__/SettingsView.spec.ts'), 'utf8')
const fixtureStart = testSource.indexOf('const baseSettingsResponse = {')
const fixtureEnd = testSource.indexOf('\n};', fixtureStart) + 3
Expand All @@ -28,14 +28,25 @@ const baseFixture = testSource.slice(fixtureStart, fixtureEnd).replaceAll('sub3.
const errors = []
let browser, server
try {
const baseline = create(join(root, 'src/views/admin', suffix + '-before.vue'),
execFileSync('git', ['show', `${process.env.SOURCE_BASE}:frontend/src/views/admin/SettingsView.vue`], { encoding: 'utf8' }))
const shell = create(join(root, suffix + '-layout.js'), `import {h} from 'vue';export default {setup(_,ctx){return()=>h('main',{class:'p-4 bg-gray-50 dark:bg-dark-900'},ctx.slots.default?.())}}`)
const html = create(join(root, suffix + '.html'), `<html lang="zh"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><div id="app"></div><script type="module" src="./${suffix}.js"></script></html>`)
create(join(root, suffix + '.js'), `
// Preserve the full revision: frontend imports also read docs/legal via ?raw.
mkdirSync(baselineDirectory)
const archive = join(baselineDirectory, 'source.tar')
execFileSync('git', ['archive', '--format=tar', `--output=${archive}`, process.env.SOURCE_BASE])
execFileSync('tar', ['-xf', archive, '-C', baselineDirectory])
const baselineRoot = join(baselineDirectory, 'frontend')
for (const dependency of ['package.json', 'pnpm-lock.yaml']) {
if (!readFileSync(join(baselineRoot, dependency)).equals(readFileSync(join(root, dependency)))) throw Error('Baseline dependency mismatch: ' + dependency)
}
symlinkSync(join(root, 'node_modules'), join(baselineRoot, 'node_modules'), 'dir')
for (const mode of ['before', 'after']) {
const sourceRoot = mode === 'before' ? baselineRoot : root
const tailwindConfig = (await import(pathToFileURL(join(sourceRoot, 'tailwind.config.js')).href)).default
const shell = create(join(sourceRoot, suffix + '-layout.js'), `import {h} from 'vue';export default {setup(_,ctx){return()=>h('main',{class:'p-4 bg-gray-50 dark:bg-dark-900'},ctx.slots.default?.())}}`)
const html = create(join(sourceRoot, suffix + '.html'), `<html lang="zh"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><div id="app"></div><script type="module" src="./${suffix}.js"></script></html>`)
create(join(sourceRoot, suffix + '.js'), `
import {createApp,h} from 'vue';import {createPinia} from 'pinia';import {createRouter,createWebHistory,RouterView} from 'vue-router';
import {createI18n} from 'vue-i18n';import {apiClient} from '/src/api/client.ts';import {useAuthStore} from '/src/stores/auth.ts';
import Before from '/src/views/admin/${suffix}-before.vue';import After from '/src/views/admin/SettingsView.vue';
import View from '/src/views/admin/SettingsView.vue';
import zh from '/src/i18n/locales/zh/index.ts';import '/src/style.css';
${baseFixture}
const initial={enabled:true,seconds:60,image_group_ids:[7],image_seconds:180};
Expand All @@ -57,19 +68,19 @@ try {
else if(path.includes('/settings')||path.includes('rectifier')||path.includes('beta-policy'))data={enabled:false,seconds:20,interval_minutes:60,debounce_minutes:1,window_minutes:60,rules:[]};
return{data:{code:0,message:'success',data},status:200,statusText:'OK',headers:{},config:request};
};
const mode=new URLSearchParams(location.search).get('mode');
const pinia=createPinia(),router=createRouter({history:createWebHistory(),routes:[{path:'/:pathMatch(.*)*',component:mode==='before'?Before:After}]});
const pinia=createPinia(),router=createRouter({history:createWebHistory(),routes:[{path:'/:pathMatch(.*)*',component:View}]});
const app=createApp(RouterView);app.use(pinia);useAuthStore().user={id:41,role:'admin',status:'active',email:'admin@example.invalid'};
app.use(router).use(createI18n({legacy:false,locale:'zh-CN',messages:{'zh-CN':zh}})).mount('#app');
`)
await build({
root, configFile: false, cacheDir: join(output, 'vite-cache'),
resolve: { alias: [{ find: '@/components/layout/AppLayout.vue', replacement: shell }, { find: '@', replacement: join(root, 'src') }] },
plugins: [vue()],
css: { postcss: { plugins: [tailwindcss({ ...tailwindConfig, content: [html, join(root, 'src/**/*.{vue,js,ts}')] }), autoprefixer()] } },
build: { outDir: previewDirectory, emptyOutDir: true, minify: false, rollupOptions: { input: html } },
})
server = await preview({ root, configFile: false, build: { outDir: previewDirectory }, preview: { host: '127.0.0.1', port: 4198, strictPort: true } })
await build({
root: sourceRoot, base: './', configFile: false, cacheDir: join(output, 'vite-cache', mode),
resolve: { alias: [{ find: '@/components/layout/AppLayout.vue', replacement: shell }, { find: '@', replacement: join(sourceRoot, 'src') }] },
plugins: [vue()],
css: { postcss: { plugins: [tailwindcss({ ...tailwindConfig, content: [html, join(sourceRoot, 'src/**/*.{vue,js,ts}')] }), autoprefixer()] } },
build: { outDir: join(previewDirectory, mode), emptyOutDir: true, minify: false, rollupOptions: { input: html } },
})
}
server = await preview({ root, base: '/', configFile: false, build: { outDir: previewDirectory }, preview: { host: '127.0.0.1', port: 4198, strictPort: true } })
browser = await chromium.launch({ headless: true })
const page = await browser.newPage({ viewport: { width: 1280, height: 950 }, locale: 'zh-CN', timezoneId: 'UTC' })
page.on('pageerror', error => errors.push(error.message))
Expand All @@ -79,12 +90,12 @@ try {
errors.push('Blocked external origin: ' + url.origin)
return route.abort()
})
const url = `http://127.0.0.1:4198/${suffix}.html?tab=gateway`
const url = mode => `http://127.0.0.1:4198/${mode}/${suffix}.html?tab=gateway&mode=${mode}`
const card = () => page.locator('.card').filter({ has: page.locator('#settings-section-openai-response-header-timeout') })
await page.goto(url + '&mode=before')
await page.goto(url('before'))
await page.locator('[data-testid="openai-header-timeout-seconds"]').waitFor()
await card().screenshot({ path: join(output, 'before.png'), animations: 'disabled' })
await page.goto(url + '&mode=after')
await page.goto(url('after'))
await page.locator('[data-testid="openai-image-header-timeout-seconds"]').waitFor()
await card().screenshot({ path: join(output, 'after.png'), animations: 'disabled' })
await card().locator('input[type="checkbox"][value="8"]').check()
Expand Down Expand Up @@ -120,4 +131,5 @@ try {
for (const file of files) rmSync(file, { force: true })
rmSync(join(output, 'vite-cache'), { recursive: true, force: true })
rmSync(previewDirectory, { recursive: true, force: true })
rmSync(baselineDirectory, { recursive: true, force: true })
}
2 changes: 1 addition & 1 deletion .github/workflows/account-alert-data-ux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ permissions:
contents: read
jobs:
acceptance:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- uses: actions/checkout@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/account-connection-timing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
frontend:
needs: backend
if: github.head_ref == 'feat/account-connection-timing'
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 20
env:
EXPECTED_HEAD: ${{ github.event.pull_request.head.sha }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/account-ops-selector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ concurrency:
cancel-in-progress: true
jobs:
acceptance:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- uses: actions/checkout@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/account-ops-team.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- run: go test -tags=integration ./internal/repository -run '^TestAccountOpsProviderSnapshot' -count=1 -v -timeout=10m
working-directory: backend
frontend:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 25
steps:
- uses: actions/checkout@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/admin-usage-platform-filter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
${{ runner.temp }}/platform-sql.log
${{ runner.temp }}/platform-unit.log
browser:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- uses: actions/checkout@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/api-key-model-policy-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ permissions:

jobs:
policy-ui:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- uses: actions/checkout@v6
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/balance-forecast.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
working-directory: backend
run: go test -race -tags=unit ./internal/service ./internal/handler/admin ./cmd/server -run 'TestBalanceForecastRetired|TestProvideCleanup|TestResolveBalanceThreshold|TestNotificationEmail' -count=1 -v -timeout=10m
ui:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- uses: actions/checkout@v6
Expand All @@ -48,15 +48,16 @@ jobs:
- run: pnpm --dir frontend exec vitest run src/views/admin/__tests__/SettingsView.spec.ts
- name: Prepare baseline and isolated browser
env:
SOURCE_BASE: ${{ github.event.pull_request.base.sha }}
# Parent of the forecast-removal commit; the PR base already lacks the control.
SOURCE_BASE: 4c660794b89279dcbf699275091340eb2c87959a
run: |
git worktree add --detach "$RUNNER_TEMP/forecast-before" "$SOURCE_BASE"
pnpm --dir "$RUNNER_TEMP/forecast-before/frontend" install --frozen-lockfile
npm install --prefix "$RUNNER_TEMP/forecast-browser" --no-save --ignore-scripts playwright@1.56.1
"$RUNNER_TEMP/forecast-browser/node_modules/.bin/playwright" install --with-deps chromium
- name: Render actual settings page before and after removal
env:
SOURCE_BASE: ${{ github.event.pull_request.base.sha }}
SOURCE_BASE: 4c660794b89279dcbf699275091340eb2c87959a
BASELINE_ROOT: ${{ runner.temp }}/forecast-before/frontend
PLAYWRIGHT_ROOT: ${{ runner.temp }}/forecast-browser/node_modules/playwright
SCREENSHOT_DIR: ${{ runner.temp }}/forecast-ui
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bps-diagnostics-auth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- working-directory: backend
run: go test -race -tags=unit ./internal/service ./internal/handler/admin ./internal/server/middleware -run 'Test(ExcelBPSToolArgumentsDiagnostic|ConnectionAuthorizationStatus|OpenAIConnectionManagement|OpenAIConnectionHandlerAccountType|OpenAIAuthConnection|Audit)' -count=1 -v -timeout=10m
authorization-ui:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- uses: actions/checkout@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bps-search.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ jobs:
path: ${{ runner.temp }}/issue871-evidence/
retention-days: 30
search-ui:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- uses: actions/checkout@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/channel-operations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
working-directory: backend
run: go test -tags=integration ./internal/repository -run '^TestChannelOperations' -count=1 -v
frontend-workflow:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- uses: actions/checkout@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/encrypted-history-409.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ jobs:
${{ runner.temp }}/omit-history-red.log
${{ runner.temp }}/omit-history-red-compat.txt
screenshots:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- uses: actions/checkout@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/http2-stream-reset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ jobs:

user-surface:
if: github.head_ref == 'fix/http2-stream-error-clarity' || github.ref_name == 'fix/http2-stream-error-clarity' || github.head_ref == 'fix/http2-reset-review-followup-20261114' || github.ref_name == 'fix/http2-reset-review-followup-20261114'
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- uses: actions/checkout@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/image-header-timeout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
name: image-header-backend-${{ github.event.pull_request.head.sha || github.sha }}
path: ${{ runner.temp }}/image-header-tests.log
ui:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- uses: actions/checkout@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/issue603-observability.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ jobs:
retention-days: 14
ui:
if: github.head_ref == 'feat/issue603-latency-observability'
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 30
env:
BASELINE: ec007920de042797299fc7cf2c034ad24c136462
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/issue733-priority-filters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ jobs:
- run: pnpm --dir frontend run build

browser:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- uses: actions/checkout@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/issue733-priority-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
- run: pnpm --dir frontend install --frozen-lockfile
- run: pnpm --dir frontend run build
browser:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- uses: actions/checkout@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/issue825-video-pricing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
if-no-files-found: error
rendered:
if: github.head_ref == 'fix/issue825-video-pricing-unit' || github.ref_name == 'fix/issue825-video-pricing-unit'
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- uses: actions/checkout@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/keys-usage-layout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ concurrency:

jobs:
browser:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- uses: actions/checkout@v6
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/mature-channel-community-ops.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ jobs:

before-ui:
if: github.sha == '59d409b49df3dd90815a054cb6dffdd405c06c3e'
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- uses: actions/checkout@v6
Expand Down Expand Up @@ -354,7 +354,7 @@ jobs:

account-before:
if: github.sha == 'a51c3e8d8e61c897a3a2aad9dd1cdc7d9b114c56'
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- uses: actions/checkout@v6
Expand Down Expand Up @@ -647,7 +647,7 @@ jobs:
key: mature-go-${{ runner.os }}-${{ hashFiles('backend/go.sum') }}-${{ github.job }}-${{ github.sha }}

after-ui:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- uses: actions/checkout@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mistral-budget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- working-directory: backend
run: go test -race -tags=unit ./internal/service -run '^(TestMistral|TestCNProviderBalanceCheckRunOnceProbesMistral|TestHandleUpstreamError_Mistral)' -count=1 -v -timeout=10m
ui:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- uses: actions/checkout@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mobile-groups-search.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ concurrency:

jobs:
browser:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 20
defaults:
run:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/moderation-upstream-scope.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
name: moderation-scope-red-${{ github.sha }}
path: ${{ runner.temp }}/moderation-scope
ui-evidence:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- uses: actions/checkout@v6
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/oauth-degradation-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: OAuth degradation actions
on:
push:
branches: [production, feat/oauth-degradation-actions-20261109, ci/oauth-workflow-mirror-recovery-20261111]
pull_request:
branches: [production]
paths:
- '.github/workflows/oauth-degradation-actions.yml'
permissions:
contents: read
jobs:
Expand Down Expand Up @@ -256,7 +260,7 @@ jobs:
name: oauth-degradation-integration-race-${{ github.run_id }}-${{ github.run_attempt }}
path: evidence/
ui:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 25
steps:
- uses: actions/checkout@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/oauth-fallback-scope.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ permissions:
contents: read
jobs:
screenshots:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- uses: actions/checkout@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/oauth-initial-ws-screenshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ concurrency:

jobs:
screenshots:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- uses: actions/checkout@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr598-repair-regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ jobs:
if-no-files-found: error

actual-ui-screenshot:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- uses: actions/checkout@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr610-queue-timing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ jobs:

ui:
if: github.head_ref == 'fix/queue-wait-ttft'
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 25
env:
SOURCE_HEAD: ${{ github.event.pull_request.head.sha }}
Expand Down
Loading
Loading