Skip to content

refactor: remove what the first-party plugin era left in live code #769

refactor: remove what the first-party plugin era left in live code

refactor: remove what the first-party plugin era left in live code #769

name: Downstream Verify
on:
push:
branches:
- main
- 'sync/**'
pull_request:
branches:
- main
workflow_dispatch:
permissions:
contents: read
concurrency:
group: downstream-verify-${{ github.ref }}
cancel-in-progress: true
jobs:
backend:
name: Downstream backend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6
with:
go-version-file: backend/go.mod
check-latest: false
cache: true
cache-dependency-path: backend/go.sum
- name: Release metadata contracts
run: |
python3 .github/scripts/test_release_preflight.py
- name: Agent protocol contracts
run: bash .github/scripts/test_agent_protocol.sh
- name: Reasoning recovery contracts
run: bash .github/scripts/test_reasoning_recovery.sh
- name: Model context capacity contracts
run: bash .github/scripts/test_model_context_capacity.sh
- name: Service tests
working-directory: backend
run: go test -p=1 -tags unit ./internal/service -run 'Test.*(Refusal|CyberPolicy|Continuation|InvalidEncryptedContent|PreviousResponseNotFound|CapacityShed|RequestScopedTransient|ServerOverloaded|AlphaSearch|SelectedWorkspace)|Test(UpdateService|NormalizeAccountTaxonomyName|AccountTaxonomyRules|AccountTestReasoningValidated|FilterConsoleAccounts|AccountConsolePlan|AccountFacetMatcher)' -count=1
- name: Upstream automation classifier tests
run: |
python3 .github/scripts/test_upstream_risk.py
python3 .github/scripts/test_upstream_automation_contract.py
- name: OpenAI probe ownership race tests
working-directory: backend
run: go test -race -tags unit ./internal/service -run 'TestOpenAIRuntimeBreaker_(APIKeySameAccountRetryDoesNotUseRedisLease|OAuthSameAccountRetryTransfersProbeUntilFinalFailure|SuppressedRetryReleasesSelectionClaim)' -count=1
- name: Gateway management isolation race test
working-directory: backend
run: go test -race ./internal/handler -run '^TestOpenAIBlockedUpstreamsDoNotSerializeManagementPlane$' -count=1
- name: Image, model list, and turn-state tests
working-directory: backend
run: |
go test -p=1 -tags unit ./internal/repository ./internal/service ./internal/handler ./internal/handler/admin -run 'Test.*(CodexImageGenerationBridgeOverridePrecedence|TurnStateCommits|SchedulerCache|GatewayModels|WriteOpenAIModelsList|AccountHandlerGetAvailableModels|ForwardResponsesOllamaClampPreservesContinuationPolicy|AccountAvailableModels|FetchOpenAIAccountModels|SetAnthropicAPIKeyAuthHeader|OllamaCloud.*(MaxTokens|MaxOutputTokens|Bearer)|Clamps.*OllamaBase)' -count=1
go test -p=1 -tags unit ./migrations -run 'Test.*(Migration222|Migration223|Migration224|Migration230|Migration231|Migration232|Migration235|Migration236|GroupModelAllowlistRepairMigration|ReleaseAcceptance)' -count=1
- name: Request body recovery tests
working-directory: backend
run: go test -p=1 ./internal/pkg/httputil ./internal/handler -run 'Test(ReadRequestBodyWithPrealloc|ReadLenientJSONRequestBodyWithPrealloc|RequestBodyReadDiagnostics|ClassifyRequestContentEncoding)' -count=1
- name: Handler tests
working-directory: backend
run: |
go test -p=1 -tags unit ./internal/handler ./internal/handler/admin -run 'Test.*(Refusal|Cyber|Continuation|AlphaSearch)' -count=1
go test -p=1 -tags unit ./internal/handler/admin -run 'TestUpdateSettings(PartialPayload|RejectsTwoCaptchaProviders|RequiresFourTencentCaptchaCredentials|RetainsStoredTencentCaptchaCredentials|ValidatesTencentCaptchaAppID|ValidatesTurnstileSiteKey)' -count=1
go test -p=1 ./internal/handler/admin ./internal/service -run 'Test(ExportData|PreviewDataImport|ImportData|DataAccountIdentityKeys|DataIdentityIndex|AccountJobDataImport|OpsMetricsCollectorRecordsDatabasePoolWaitDelta|BulkUpdateAccepts|AccountHandler)' -count=1
go build ./internal/repository
- name: Account job contracts
working-directory: backend
run: go test -p=1 -tags unit ./internal/handler/admin -run '^TestAccountJobBulk.*$' -count=1
- name: Account taxonomy migration integration test
working-directory: backend
run: go test -p=1 -tags integration ./internal/repository -run '^Test(AccountTaxonomy.*|DeleteAccountFolder.*)Integration$|^TestAPIKeyRepoSuite$/^TestReleaseAcceptanceKeyIsAdminListedReadOnlyAndAuthenticates$' -count=1
- name: Repository audit integration tests
working-directory: backend
run: go test -p=1 -tags integration ./internal/repository -run '^Test(PGXBatchInsertAuditAndSystemLogs|Migration236.*)$' -count=1
- name: Historical Cindy migration tests
working-directory: backend
run: |
go test -p=1 ./migrations -run '^(TestMigration(207RestoresOnlyCindyNativeOpenAIModes|208UsesCindyPromptCacheHashOnly|209RestoresOnlyCindyAlphaSearchBridge|210ResetsOnlyLegacyCindyBalanceMarkers|211RestoresOnlyExactUnresolvedCindyBudgetMarkers|213ResetsOnlyStrictCindyBalanceMarkers)|TestMigration235RestrictsLedgerReplayToLifecycleExcludedRows)$' -count=1
go test -p=1 -tags integration ./migrations -run '^(TestCindy(OpenAIDefaults|PromptCacheHash|AlphaSearchBridge|BalanceMarkerReset|BalanceMarkerRestore|BalanceConfirmationReset|PlatformProjectionRoundTrip)MigrationIsStrictAndIdempotent|TestMigration235PreservesMixedOpenAIGroupsAfterCanonicalReplay)$' -count=1
frontend:
name: Downstream frontend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6
with:
version: 9.15.9
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
with:
node-version: '20'
cache: pnpm
cache-dependency-path: frontend/pnpm-lock.yaml
- name: Install dependencies
working-directory: frontend
run: pnpm install --frozen-lockfile
- name: Typecheck
working-directory: frontend
run: |
pnpm run lint:check
pnpm run typecheck
- name: Focused downstream tests
working-directory: frontend
run: |
pnpm exec vitest run \
src/components/admin/account/__tests__/AccountTestModal.spec.ts \
src/components/admin/account/__tests__/AccountTestModal.displayContract.spec.ts \
src/components/admin/account/__tests__/AccountTestModal.testPlan.spec.ts \
src/components/keys/__tests__/UseKeyModal.spec.ts \
src/views/admin/__tests__/SettingsView.spec.ts \
src/components/common/__tests__/VersionBadge.downstream.spec.ts \
src/components/common/__tests__/BaseDialog.spec.ts \
src/views/admin/__tests__/PluginsView.spec.ts \
src/components/admin/codex/__tests__/CodexRuntime.spec.ts \
src/api/__tests__/downstreamStatus.spec.ts \
src/i18n/__tests__/accountConsoleLocales.spec.ts \
src/__tests__/integration/data-import.spec.ts \
src/components/admin/account/__tests__/ImportDataModal.spec.ts \
src/components/admin/account-jobs/__tests__/AccountTaskDrawer.spec.ts \
src/stores/__tests__/accountJobs.spec.ts \
src/api/__tests__/accountOperationIdempotency.spec.ts \
src/components/admin/account/__tests__/AccountFolderBar.spec.ts \
src/components/admin/account/__tests__/AccountTaxonomyManager.spec.ts \
src/components/admin/account/__tests__/AccountBulkTaxonomyModal.spec.ts \
src/components/admin/account/__tests__/AccountBulkActionsBar.spec.ts \
src/components/admin/account/__tests__/AccountActionMenu.spark_shadow.spec.ts \
src/components/admin/account/__tests__/AccountConsoleFilters.spec.ts \
src/components/admin/account/__tests__/AccountUsageViews.spec.ts \
src/components/admin/usage/__tests__/UsageTable.latency.spec.ts \
src/components/account/__tests__/AccountUsageCell.spec.ts \
src/components/account/__tests__/AccountUsageCell.list.spec.ts \
src/components/account/__tests__/UsageProgressBar.spec.ts \
src/components/account/__tests__/CreateAccountModal.spec.ts \
src/components/payment/__tests__/StripePaymentInline.contrast.spec.ts \
src/views/user/__tests__/StripePaymentView.spec.ts \
src/views/admin/__tests__/ReasoningRecoveryView.spec.ts \
src/components/account/__tests__/EditAccountModal.spec.ts \
src/utils/__tests__/openaiProtocolModeEdits.spec.ts \
src/components/account/__tests__/ModelWhitelistSelector.spec.ts \
src/components/account/__tests__/ModelContextCapacityField.spec.ts \
src/utils/__tests__/modelContextCapacity.spec.ts \
src/composables/__tests__/useModelContextCapacities.spec.ts \
src/api/__tests__/admin.accounts.contextCapacity.spec.ts \
src/composables/__tests__/useModelWhitelist.spec.ts \
src/components/account/__tests__/BulkEditAccountModal.spec.ts \
src/views/admin/__tests__/AccountsView.console.spec.ts \
src/utils/__tests__/accountKeySearch.spec.ts \
src/views/admin/__tests__/AccountsView.priorityColumn.spec.ts \
src/components/layout/__tests__/AppSidebar.spec.ts \
src/components/layout/__tests__/AppSidebar.simple-mode.spec.ts \
src/views/admin/__tests__/GroupsView.columnSettings.spec.ts \
src/views/admin/__tests__/AccountsView.bulkEdit.spec.ts \
src/views/admin/__tests__/AccountsView.selectionScope.spec.ts \
src/views/admin/__tests__/AccountsView.schedulerScore.spec.ts \
src/views/admin/__tests__/AccountsView.sparkShadow.spec.ts \
src/views/admin/__tests__/AccountsView.usageWindowsHint.spec.ts
- name: MiniMax quota and Grok save compatibility
working-directory: frontend
run: |
pnpm exec vitest run \
src/constants/__tests__/platforms.spec.ts \
src/api/__tests__/settings.authSourceDefaults.spec.ts \
src/components/admin/user/__tests__/UserPlatformQuotaModal.spec.ts \
src/components/account/__tests__/EditAccountModal.grokMediaEligibility.spec.ts \
-t 'platform option catalogs|全部 concrete 平台全 null|缺失平台填充为全 null|MiniMax scheduling threshold compatibility|已有数据正确填充 limit input|保存提交完整 platform payload|updates the dedicated endpoint only when the mode changes|reports partial-save errors when the dedicated endpoint fails'
- name: Production build
working-directory: frontend
run: pnpm run build
candidate-image:
name: Candidate OCI image
if: github.event_name == 'pull_request' || startsWith(github.ref, 'refs/heads/sync/')
needs: [backend, frontend]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
- name: Resolve candidate compatibility version
id: version
shell: bash
# Keep candidate versions distinct from every numbered codexrip release.
run: printf 'value=%s-codexrip.candidate\n' "$(tr -d '\r\n' < backend/cmd/server/VERSION)" >> "$GITHUB_OUTPUT"
- uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
- name: Build candidate
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
with:
context: .
file: Dockerfile
platforms: linux/amd64
push: false
outputs: type=oci,dest=/tmp/sub2api-candidate.tar
build-args: |
VERSION=${{ steps.version.outputs.value }}
COMMIT=${{ github.sha }}
GOPROXY=https://proxy.golang.org,direct
GOSUMDB=sum.golang.org
cache-from: type=gha,scope=sub2api-candidate-amd64
cache-to: type=gha,mode=max,scope=sub2api-candidate-amd64
- name: Upload candidate
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: sub2api-candidate-linux-amd64-${{ github.sha }}
path: /tmp/sub2api-candidate.tar
retention-days: 3
if-no-files-found: error