fix(client-ui-plugin-config): declare the browser half under dsh.client

Merging master's rename of the client manifest field left this package on the
old `dshClient` name. The row still composed and its empty node half still
activated, but the browser roster scan never matched it, so the whole settings
section vanished with no error anywhere.

verify-cordis-config now requires a packages/client package's "./client"
export and its dsh.client declaration to agree in both directions; the
composition file cannot tell a surface plugin from a Host plugin, so the
manifests are where this is checkable. The check is scoped to that group
because a Host package's "./client" export is the typed wire face its browser
consumers import, not a plugin the roster serves.
This commit is contained in:
Yichen Jiang
2026-08-10 23:56:12 +08:00
parent 0b42259b82
commit ed4d7e7784
6 changed files with 47 additions and 11 deletions

View File

@@ -79,6 +79,7 @@ errors.push(...validateExampleResolution())
errors.push(...validateAppResolution())
errors.push(...validateSourcePlaneResolution())
errors.push(...validatePresetPlaneSeparation())
errors.push(...validateClientHalvesDeclared())
if (errors.length > 0) {
console.error('verify-cordis-config: invalid Loader metadata or plugin package resolution:')
@@ -88,6 +89,35 @@ if (errors.length > 0) {
console.log(`verify-cordis-config: ${files.length} config files passed.`)
}
/**
* A browser plugin must declare the browser half it ships.
*
* The browser roster is discovered by scanning composed packages for a
* `dsh.client` block, and the node half of a surface plugin is an empty
* `apply`. A `packages/client` package that exports `./client` without that
* block therefore composes, activates, and contributes nothing — its bundle is
* never served and no error is raised anywhere. The mismatch is invisible in
* the composition file, so it is checked against the manifests instead. Only
* this group is checked: a Host package's `./client` export is the typed wire
* face its browser consumers import, not a plugin the roster serves.
* @returns one violation per client package whose `./client` export and
* `dsh.client` declaration disagree.
*/
function validateClientHalvesDeclared(): string[] {
return globSync('packages/client/*/package.json', { cwd: root }).flatMap((manifestPath) => {
const manifest = readManifest(manifestPath) as PackageManifest & {
exports?: Record<string, unknown>
dsh?: { client?: unknown }
}
const shipsClient = manifest.exports !== undefined && Object.hasOwn(manifest.exports, './client')
const declaresClient = manifest.dsh?.client !== undefined
if (shipsClient === declaresClient) return []
return [shipsClient
? `${manifestPath}: exports "./client" but declares no dsh.client, so its browser half is never served`
: `${manifestPath}: declares dsh.client but exports no "./client" entry to serve`]
})
}
/**
* No shipped agent preset may repeat a row the host composition still runs.
*