Phase 008: close the test and CI loop around the migration

Adds the checks that make the constraints from Phase 001-007 mechanical
instead of tribal knowledge, and clears the legacy brand text that was still
reachable at runtime.

New red-line tests:
  - no-legacy-brand mirrors the harness scan under vitest, and asserts its
    allow-list has not drifted from harness-check.mjs
  - hermes-db-readonly classifies every new DatabaseSync call site by
    following the path it opens, and fails if a state.db handle drops
    readOnly. It also pins the one legitimately writable database.
  - i18n-parity compares the raw zh/en locale objects both ways. The
    existing coverage test merged en into zh at import time, so a key
    missing from zh could never fail there.

harness:check gains the four missing gates from the phase brief - retired
package directories, retired package scripts, a single UI library, and the
required root files. Each was verified to fail by mutating the repo.

The online-update channel had hardcoded upstream URLs. It now reads
HERMES_WEB_UI_VERSION_MANIFEST_URL and friends and degrades with a named
error, because a reimplementation has nowhere to pull releases from.

The remaining legacy strings are deliberate and each carries a reason in the
allow-list: the global-agent relay address and the OpenRouter referer are
load-bearing, the socket role identifier is a wire contract, and the pre-rename
DB filenames would orphan existing deployments if changed. AGENTS.md now says
so explicitly, so a future agent does not "clean them up".

Also removes a dead electron mock alias, an i18n exemption that had stopped
exempting anything, and a teardown race in plugins-view.test.ts where a-spin
animation frames outlived the jsdom environment.

Verified self-contained: with reference_code/ moved aside, harness:check,
build, test and test:e2e all pass, so the directory can now be deleted.
This commit is contained in:
2026-10-19 00:23:19 +08:00
parent 836d0228d2
commit cc644c59f6
17 changed files with 1135 additions and 56 deletions
+20 -4
View File
@@ -1,6 +1,6 @@
// @vitest-environment jsdom
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { flushPromises, mount } from '@vue/test-utils'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { flushPromises, mount, type VueWrapper } from '@vue/test-utils'
import ArcoVue from '@arco-design/web-vue'
const messageMock = vi.hoisted(() => ({
@@ -46,6 +46,22 @@ function buttonByText(wrapper: any, text: string) {
}
describe('PluginsView management actions', () => {
// a-spin drives its indicator with requestAnimationFrame. Without unmounting,
// those callbacks land after jsdom tears down and surface as an unhandled
// "Cannot read properties of null (reading '_location')" roughly a third of
// the time. Unmount before the environment goes away.
const wrappers: VueWrapper[] = []
afterEach(() => {
while (wrappers.length) wrappers.pop()?.unmount()
})
const mountView = () => {
const wrapper = mount(PluginsView, { global: arcoGlobal })
wrappers.push(wrapper)
return wrapper
}
beforeEach(() => {
vi.clearAllMocks()
profilesStoreMock.activeProfileName = 'default'
@@ -73,7 +89,7 @@ describe('PluginsView management actions', () => {
})
it('enables manageable standalone plugins and refreshes the inventory', async () => {
const wrapper = mount(PluginsView, { global: arcoGlobal })
const wrapper = mountView()
await flushPromises()
await buttonByText(wrapper, 'common.enable').trigger('click')
@@ -105,7 +121,7 @@ describe('PluginsView management actions', () => {
metadata: null,
})
const wrapper = mount(PluginsView, { global: arcoGlobal })
const wrapper = mountView()
await flushPromises()
expect(wrapper.text()).toContain('plugins.managedElsewhere')