DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.
fix(ci): resume Beta review through supported group relationships
idealclover4ea1a733af1e
diff --git a/.github/scripts/ios-beta-review.py b/.github/scripts/ios-beta-review.pyindex eba40963..cd1d150a 100644--- a/.github/scripts/ios-beta-review.py+++ b/.github/scripts/ios-beta-review.py@@ -40,11 +40,12 @@ class NoRedirect(urllib.request.HTTPRedirectHandler):class ApiError(ValueError):- def __init__(self, status):+ def __init__(self, status, method=None, path=None):self.status = status- message = f'Apple API HTTP {status}; response omitted to protect account information'+ operation = f' {method} {urllib.parse.urlsplit(path).path}' if method and path else ''+ message = f'Apple API{operation} HTTP {status}; query and response omitted to protect account information'if status == 403:- message += '; Beta review operations may require an App Manager team API key; ask the account administrator, do not change permissions automatically'+ message += '; the endpoint may not support this operation, or the API key may lack permission; check the route before asking an administrator about App Manager access'super().__init__(message)@@ -96,7 +97,7 @@ class Client:if method == 'GET' and (status == 429 or 500 <= status <= 599) and attempt < 2:self.pause(5 * (attempt + 1))continue- raise ApiError(status) from None+ raise ApiError(status, method, url) from Noneexcept (urllib.error.URLError, TimeoutError):if method == 'GET' and attempt < 2:self.pause(5 * (attempt + 1))@@ -198,6 +199,8 @@ def submit(client, group_id, marketing, number, source_sha, check=False):build = wait_for_build(client, app_id, marketing, number, check)build_id = resource_id(build['id'])detail, state, submitted = review_state(client, build_id, wait=not check)+ group_builds = client.collection(f'/v1/betaGroups/{resource_id(group_id)}/relationships/builds?limit=200')+ require(all(item.get('type') == 'builds' for item in group_builds), 'Expected build identifiers in the Beta group relationship')if check:return f'Preflight passed for {marketing} ({number}); no Apple resources changed'if state == 'READY_FOR_BETA_SUBMISSION' and not submitted:@@ -222,8 +225,7 @@ def submit(client, group_id, marketing, number, source_sha, check=False):raise_, current, exists = review_state(client, build_id)require(current in ACTIVE or exists, 'Apple rejected review submission; no duplicate submission attempted')- groups = client.collection(f'/v1/builds/{build_id}/betaGroups?limit=200')- if not any(item['id'] == group_id for item in groups):+ if not any(item['id'] == build_id for item in group_builds):client.request(f'/v1/builds/{build_id}/relationships/betaGroups', 'POST', {'data': [{'type': 'betaGroups', 'id': group_id}]})final, final_state, final_submitted = review_state(client, build_id)require(final['attributes'].get('autoNotifyEnabled') is True, 'Apple did not retain automatic tester notification setting')diff --git a/.github/scripts/test_ios_beta_review.py b/.github/scripts/test_ios_beta_review.pyindex 1b376ae6..a7d1b87e 100644--- a/.github/scripts/test_ios_beta_review.py+++ b/.github/scripts/test_ios_beta_review.py@@ -21,6 +21,7 @@ SHA = 'a' * 40class FakeApple:def __init__(self):self.writes = []+ self.reads = []self.pauses = []self.processing = ['VALID']self.state = 'READY_FOR_BETA_SUBMISSION'@@ -78,6 +79,7 @@ class FakeApple:else:raise AssertionError('Unexpected mutation route')return {}+ self.reads.append(route)if route == '/v1/apps':assert query['filter[bundleId]'] == ['com.dshtauri.dshbridge']return {'data': [{'id': 'app1', 'attributes': {'bundleId': helper.BUNDLE_ID}}]}@@ -104,7 +106,9 @@ class FakeApple:if route == '/v1/betaBuildLocalizations':return {'data': copy.deepcopy(self.locales)}if route == '/v1/builds/build1/betaGroups':- return {'data': copy.deepcopy(self.groups)}+ raise helper.ApiError(403)+ if route == '/v1/betaGroups/group1/relationships/builds':+ return {'data': [{'type': 'builds', 'id': 'build1'}] if any(item['id'] == 'group1' for item in self.groups) else []}raise AssertionError('Unexpected read route: ' + route)def build_page(self, state='VALID'):@@ -136,6 +140,36 @@ class SubmitTests(unittest.TestCase):self.assertEqual(self.api.writes[-1][2], {'data': [{'type': 'betaGroups', 'id': 'group1'}]})self.assertIn('No notification delivery is claimed', result)+ def test_pending_review_recovers_group_link_via_supported_reverse_relationship(self):+ self.api.state = 'WAITING_FOR_BETA_REVIEW'+ self.api.submissions = [{'id': 'submission1', 'attributes': {'betaReviewState': 'WAITING_FOR_REVIEW'}}]+ self.api.auto_notify = True+ self.submit()+ self.assertIn('/v1/betaGroups/group1/relationships/builds', self.api.reads)+ self.assertNotIn('/v1/builds/build1/betaGroups', self.api.reads)+ self.assertEqual(self.api.writes, [('/v1/builds/build1/relationships/betaGroups', 'POST', {'data': [{'type': 'betaGroups', 'id': 'group1'}]})])+ self.api.writes.clear()+ self.submit()+ self.assertEqual(self.api.writes, [])++ def test_check_verifies_group_build_read_access_without_linking(self):+ self.submit(check=True)+ self.assertIn('/v1/betaGroups/group1/relationships/builds', self.api.reads)+ self.assertFalse(self.api.writes)++ def test_group_read_failure_prevents_any_review_or_metadata_mutation(self):+ original = self.api.collection++ def denied(path):+ if '/relationships/builds' in path:+ raise helper.ApiError(403)+ return original(path)++ self.api.collection = denied+ with self.assertRaises(helper.ApiError):+ self.submit()+ self.assertFalse(self.api.writes)+def test_repeated_run_does_not_duplicate_review_or_group(self):self.submit()self.api.writes.clear()@@ -353,6 +387,17 @@ class HttpTests(unittest.TestCase):self.assertNotIn('private', str(context.exception))self.assertEqual(self.client.opener.open.call_count, 1)+ def test_api_error_reports_method_and_path_without_query_response_or_token(self):+ self.client.opener.open.side_effect = urllib.error.HTTPError('https://api.appstoreconnect.apple.com/v1/builds/build1/betaGroups', 403, 'sensitive response', {}, io.BytesIO(b'private detail'))+ with self.assertRaises(helper.ApiError) as context:+ self.client.request('/v1/builds/build1/betaGroups?filter[email][email protected]')+ message = str(context.exception)+ self.assertIn('GET /v1/builds/build1/betaGroups HTTP 403', message)+ self.assertIn('endpoint may not support this operation', message)+ for hidden in ('[email protected]', 'filter[email]', 'private detail', 'sensitive response', 'fake-token-not-a-secret'):+ self.assertNotIn(hidden, message)+ self.assertEqual(helper.ApiError(403).status, 403)+def test_get_retry_budget_and_deadline_are_finite(self):self.client.opener.open.side_effect = urllib.error.URLError('sensitive')with patch.object(helper.time, 'sleep', side_effect=self.advance), self.assertRaisesRegex(ValueError, 'transport failed'):diff --git a/.github/workflows/review-testflight.yml b/.github/workflows/review-testflight.ymlnew file mode 100644index 00000000..e63e801d--- /dev/null+++ b/.github/workflows/review-testflight.yml@@ -0,0 +1,98 @@+name: Review Existing TestFlight Build++on:+ workflow_dispatch:+ inputs:+ ios_version:+ description: Exact numeric iOS marketing version already uploaded+ required: true+ type: string+ build_number:+ description: Exact existing CFBundleVersion; no new upload will be performed+ required: true+ type: string+ source_sha:+ description: Original uploaded build source commit on official main+ required: true+ type: string++permissions:+ contents: read++concurrency:+ group: ios-testflight-distribution+ cancel-in-progress: false++jobs:+ review:+ if: >-+ github.repository == 'dsh-tauri/deepseek-harness-desktop' &&+ github.ref == 'refs/heads/main' &&+ vars.IOS_BETA_REVIEW_ENABLED == 'true'+ runs-on: ubuntu-latest+ timeout-minutes: 35+ env:+ IOS_VERSION: ${{ inputs.ios_version }}+ BUILD_NUMBER: ${{ inputs.build_number }}+ SOURCE_SHA: ${{ inputs.source_sha }}+ steps:+ - name: Checkout trusted workflow revision+ uses: actions/checkout@v7+ with:+ repository: dsh-tauri/deepseek-harness-desktop+ ref: ${{ github.sha }}+ fetch-depth: 0+ persist-credentials: false++ - name: Validate original build source+ shell: bash+ run: |+ set -euo pipefail+ [[ "$SOURCE_SHA" =~ ^[0-9a-f]{40}$ ]]+ git merge-base --is-ancestor "$SOURCE_SHA" refs/remotes/origin/main++ - name: Install temporary API key only+ env:+ APP_STORE_CONNECT_API_KEY: ${{ secrets.APP_STORE_CONNECT_API_KEY }}+ APP_STORE_CONNECT_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }}+ run: |+ python3 - <<'PY'+ import os+ from pathlib import Path+ import re+ import tempfile+ os.umask(0o077)+ key_id = os.environ['APP_STORE_CONNECT_KEY_ID']+ key = os.environ['APP_STORE_CONNECT_API_KEY']+ if not re.fullmatch(r'[A-Z0-9]{10}', key_id) or not key.startswith('-----BEGIN PRIVATE KEY-----'):+ raise ValueError('Configure the App Store Connect API key and ID')+ root = Path(tempfile.mkdtemp(prefix='ios-beta-review-', dir=Path(os.environ['RUNNER_TEMP']).resolve()))+ with open(os.environ['GITHUB_ENV'], 'a') as stream:+ stream.write(f'SIGNING_ROOT={root}\n')+ (root / 'private_keys').mkdir()+ (root / 'private_keys' / f'AuthKey_{key_id}.p8').write_text(key)+ PY++ - name: Resume external Beta review without uploading another build+ env:+ APP_STORE_CONNECT_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }}+ APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}+ TESTFLIGHT_BETA_GROUP_ID: ${{ vars.TESTFLIGHT_BETA_GROUP_ID }}+ run: python3 .github/scripts/ios-beta-review.py++ - name: Always remove temporary API key+ if: always()+ run: |+ python3 - <<'PY'+ import os+ from pathlib import Path+ import shutil+ value = os.environ.get('SIGNING_ROOT')+ if value:+ root = Path(value)+ temp = Path(os.environ['RUNNER_TEMP']).resolve()+ if not root.is_absolute() or root.parent != temp or not root.name.startswith('ios-beta-review-') or root.is_symlink() or root.resolve() != root:+ raise ValueError('Refusing unsafe API key cleanup path')+ if root.exists():+ shutil.rmtree(root)+ PYdiff --git a/docs/TESTFLIGHT.zh.md b/docs/TESTFLIGHT.zh.mdindex 57b3782e..de7496c6 100644--- a/docs/TESTFLIGHT.zh.md+++ b/docs/TESTFLIGHT.zh.md@@ -87,6 +87,15 @@ gh variable set IOS_BETA_REVIEW_ENABLED --body true --repo dsh-tauri/deepseek-ha已处于审核中、已批准或正在外部测试的目标构建不会重复送审;被拒绝或缺失合规信息时直接报出需要人工处理的状态,不通过重试规避审核。苹果限制同一版本同时在审的构建数量,且有每日 Beta 送审限额,遇到此类限制不会撤销其他构建的审核。+若上传已成功而送审后续步骤失败,使用 `Review Existing TestFlight Build` 工作流补跑,准确填写原上传的营销版本、构建号和源码提交;该任务只使用 API Key,不访问分发证书、不重新上传 IPA。它同样要求官方 main 与审核开关开启,并与签名上传共用串行并发组:++```bash+gh workflow run review-testflight.yml --repo dsh-tauri/deepseek-harness-desktop --ref main \+ -f ios_version="${IOS_VERSION:?}" -f build_number="${BUILD_NUMBER:?}" -f source_sha="${SOURCE_SHA:?}"+```++读取测试组成员关系应使用 `/v1/betaGroups/{id}/relationships/builds`;苹果不支持对 `/v1/builds/{id}/betaGroups` 执行 GET,会返回 403,即使密钥职能足够。403 不一定意味着需要升级密钥权限。+官方要求参考:[邀请外部测试员](https://developer.apple.com/help/app-store-connect/test-a-beta-version/invite-external-testers/)。需要 App Manager、Admin 或账户持有人权限;只给 Developer 的上传密钥可能在送审或测试组管理接口返回 403。替换密钥时同步更新 `.p8`、Key ID 与 Issuer ID,验证成功前不要撤销旧密钥。## 验证边界diff --git a/test/mobile-release-workflows.test.ts b/test/mobile-release-workflows.test.tsindex 47bf0644..3247e995 100644--- a/test/mobile-release-workflows.test.ts+++ b/test/mobile-release-workflows.test.ts@@ -158,6 +158,21 @@ describe('mobile release workflow contracts', () => {expect(readSource('.github/workflows/ci.yml')).toContain('-p \'test_ios_*.py\'')})+ it('recovers review of an existing build without signing or uploading another IPA', () => {+ const recovery = readSource('.github/workflows/review-testflight.yml')+ expect([...section(recovery, 'on').matchAll(/^ {2}(\w+):/gm)].map(match => match[1])).toEqual(['workflow_dispatch'])+ expect(recovery).toContain('github.repository == \'dsh-tauri/deepseek-harness-desktop\'')+ expect(recovery).toContain('github.ref == \'refs/heads/main\'')+ expect(recovery).toContain('vars.IOS_BETA_REVIEW_ENABLED == \'true\'')+ expect(recovery).toContain('group: ios-testflight-distribution')+ for (const name of ['ios_version', 'build_number', 'source_sha'])+ expect(recovery).toContain(`${name}:`)+ expect(recovery).toContain('git merge-base --is-ancestor "$SOURCE_SHA" refs/remotes/origin/main')+ expect(recovery).toContain('run: python3 .github/scripts/ios-beta-review.py')+ expect(recovery).toContain('if: always()')+ expect(recovery).not.toMatch(/IOS_DISTRIBUTION_CERTIFICATE|IOS_PROVISIONING_PROFILE|xcodebuild|altool|workflow_run/)+ })+it('pins TestFlight to the locally verified Xcode toolchain on macOS 26', () => {const signed = readSource('.github/workflows/release-testflight.yml')expect(signed).toContain('runs-on: macos-26')