Files
browser/openspec/changes/implement-browser-acceptance-suite/tasks.md
T
2026-07-11 14:56:10 +08:00

7.6 KiB

1. Acceptance Harness and Command Shape

  • 1.1 Add an automated browser acceptance harness in the existing platform_web test/tooling structure, keeping route assertions near frontend code and stack orchestration in repository scripts.
  • 1.2 Add a repository command wrapper for running browser acceptance against the local debug stack, with configurable LOCAL_DEBUG_PLATFORM_PORT, LOCAL_DEBUG_WEB_PORT, and LOCAL_DEBUG_ROOT.
  • 1.3 Ensure the command can self-start or explicitly reuse the documented local debug stack, and records the resolved platform URL, platform_web URL, log paths, and evidence directory.
  • 1.4 Ensure self-started runs clean up with scripts/local-debug-reset.sh and only remove allowed local debug roots.

2. Local Debug Fixture Prerequisites

  • 2.1 Reuse scripts/local-debug-smoke.sh or equivalent platform-owned setup before browser assertions so game.example, server-local-debug, and run-local-debug exist.
  • 2.2 Fail early when platform health, API login, plugin manifest validation, plugin registration, run heartbeat, server lifecycle fixture creation, or job/log/artifact/marketplace references are missing.
  • 2.3 Preserve the existing browser/API boundary: platform_web must use PLATFORM_API_PROXY and VITE_PLATFORM_API_BASE_URL=/api/v1, with VITE_ENABLE_LOCAL_AUTH_FALLBACK=false.
  • 2.4 Keep fixture commands harmless and bounded, with no Docker-only dependency, real game binaries, raw credentials, raw AI keys, direct sockets, or browser/plugin direct access to run.

3. Browser Route Assertions

  • 3.1 Automate login at platform_web with operator.local@example.test / operator-local and verify the session lands on an API-backed workspace.
  • 3.2 Verify 首页 #/home includes API-backed platform overview signals such as 平台概览, 数据已加载, game/plugin instance counts, and run node state.
  • 3.3 Verify 服务器管理 #/servers includes Local Debug Example Server and server-local-debug.
  • 3.4 Verify 插件市场 #/plugins includes game.example, installed state, manifest reference metadata, lifecycle capabilities, platform-mediated permissions, and bridge actions.
  • 3.5 Verify 用户管理 #/users includes API-connected account data for operator.local@example.test.
  • 3.6 Verify AI 提供商管理 #/aiProviders includes API-backed provider rows with redacted key references only.

4. Plugin and Server Operation Surface Assertions

  • 4.1 Verify server detail #/servers/server-local-debug includes Local Debug Example Server, game.example@0.1.0, run-local-debug, lifecycle controls, logs, config, plugin controls, AI assistant, and operation history entry points.
  • 4.2 Trigger or inspect a platform-mediated lifecycle operation and verify platform-owned job or operation-history evidence without requiring direct run access from browser or plugin pages.
  • 4.3 Verify log and artifact entry points are represented by logical IDs, platform routes, log refs, artifact refs, or safe metadata only.
  • 4.4 Record route-level assertion results in machine-readable evidence, including URL, required markers, and plugin/server operation proof.

5. Safety and Fallback Scanning

  • 5.1 Add a shared fallback scanner that fails on local/demo/fallback workspace indicators on all accepted routes.
  • 5.2 Add a shared visible-content forbidden-fragment scanner for /Users/, /private/, unix://, tcp://, Bearer , sk-, password=, apiKeyRef, rawApiKey, run session tokens, direct run URLs, and plugin-owned transport details.
  • 5.3 Ensure scanner failures report the route, matched fragment class, and safe nearby evidence without printing raw credentials.
  • 5.4 Confirm sensitive values remain hidden from browser-visible output while safe redacted references such as secret://... or env://... are allowed when expected.

6. Documentation and Verification

  • 6.1 Document the browser acceptance command and expected evidence output in the appropriate local debug or frontend development documentation.
  • 6.2 Run LOCAL_DEBUG_PLATFORM_PORT=18189 LOCAL_DEBUG_WEB_PORT=5183 LOCAL_DEBUG_ROOT=/private/tmp/browser-local-debug-acceptance <browser-acceptance-command> and record the exact final command after implementation.
  • 6.3 Run LOCAL_DEBUG_PLATFORM_PORT=18189 LOCAL_DEBUG_WEB_PORT=5183 LOCAL_DEBUG_ROOT=/private/tmp/browser-local-debug-acceptance scripts/local-debug-smoke.sh or document why the acceptance command already ran the same smoke prerequisite.
  • 6.4 Run cd platform_web && npm run typecheck && npm test && npm run build and record evidence.
  • 6.5 Run relevant touched-root checks, including cd plugins && npm run typecheck && npm run test && npm run validate:manifest, cd platform && GOCACHE=/private/tmp/browser-go-build-cache go test ./... -count=1, and cd run && GOCACHE=/private/tmp/browser-go-build-cache go test ./... -count=1 when implementation touches those roots or local debug orchestration.
  • 6.6 Run scripts/check-structure.sh and record evidence.
  • 6.7 Run openspec validate implement-browser-acceptance-suite --strict and record evidence.
  • 6.8 Update openspec/changes/architecture-delivery-stream/delivery-plan.md and openspec/changes/architecture-delivery-stream/NEXT_CHANGE.md after implementation evidence exists, then stop without implementing polish-platform-interaction-design unless explicitly asked.

Evidence

  • Implemented platform_web/acceptance/browser-acceptance.mjs, scripts/browser-acceptance.sh, platform_web package script acceptance:browser, and documentation in docs/local-debug-workspace.md plus platform_web/README.md.
  • node --check platform_web/acceptance/browser-acceptance.mjs passed.
  • bash -n scripts/browser-acceptance.sh passed.
  • LOCAL_DEBUG_PLATFORM_PORT=18189 LOCAL_DEBUG_WEB_PORT=5183 LOCAL_DEBUG_ROOT=/private/tmp/browser-local-debug-acceptance scripts/browser-acceptance.sh passed after clearing a stale listener from an earlier interrupted run.
  • Browser acceptance evidence: /private/tmp/browser-local-debug-acceptance/browser-acceptance/browser-acceptance-evidence.json, checked at 2026-07-08T05:13:43.494Z.
  • Acceptance command ran scripts/local-debug-smoke.sh as a prerequisite and wrote seed evidence under /private/tmp/browser-local-debug-acceptance/smoke.
  • Browser routes verified: 首页, 服务器管理, 插件市场, 用户管理, AI 提供商管理, 服务器详情, and 服务器详情 / 插件控制.
  • Operation proof verified platform API accepted process.start for server-local-debug, platform-owned jobs endpoint returned server-lifecycle:server-local-debug:start:e93f12eb71c03646, and browser operation history exposed platform task records without direct run access.
  • cd platform_web && npm run typecheck && npm test && npm run build passed: 11 test files and 49 tests passed, Vite production build succeeded.
  • cd plugins && npm run typecheck && npm run test passed: 1 test file and 11 tests passed.
  • cd plugins && npm run validate:manifest passed after an escalated rerun because sandboxed tsx IPC failed with listen EPERM.
  • cd platform && GOCACHE=/private/tmp/browser-go-build-cache go test ./... -count=1 passed.
  • cd run && GOCACHE=/private/tmp/browser-go-build-cache go test ./... -count=1 passed after an escalated rerun because sandboxed httptest localhost binding failed with listen tcp6 [::1]:0: bind: operation not permitted.
  • scripts/check-structure.sh passed.
  • openspec validate implement-browser-acceptance-suite --strict passed. OpenSpec emitted PostHog DNS flush warnings after validation, but the command exited 0 and reported Change 'implement-browser-acceptance-suite' is valid.