mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-10-21 14:21:48 +00:00
* chore(desktop): rename packages/desktop-shell to packages/desktop The Electron-era packages/desktop was removed in #9085 and the OpenWork downstream has forked, so the short name is free and the shell suffix is the only thing left of the transition. Rename the package directory and every load-bearing reference: workspace negations (npm + pnpm), the ci.yml crate filter, desktop-release.yml, the isolation guard, lint/ignore configs, scripts tests, CLI workspace-fixture tests, and living docs. User-facing identity is untouched: the crate stays qwen-code-desktop, productName stays "Qwen Code Desktop", the bundle identifier, updater feed, release tag scheme, and the legacy electron-bridge asset names are all unchanged. check-desktop-isolation now guards both path names so the old one cannot re-enter a workspace set. Dated design docs under docs/design/ keep their historical paths deliberately. Refs #8596 * docs(design): follow the rename in the undated notification design notes The web-shell-browser-notification-details pair is a living doc without a date prefix, so it falls under the PR's update rule rather than the historical-record exception. * docs(desktop): stop citing paths the rename invalidated Three prose sites and one CI comment still described the pre-rename world, or contradicted themselves once `packages/desktop` named both the removed Electron app and the living Tauri shell. - ci.yml `desktop_shell`: the comment this branch added credited the Cargo.toml guard with keeping "branches from either side of the rename" green. It does not. A pre-rename head's files sit under `packages/desktop-shell`, which the changed-files filter no longer matches, so the job skips before the guard ever runs. Say that, and say what the guard does cover (a head the filter matched because ci.yml itself changed, with no crate at the new path). - docs/design/web-shell-user-message-links.md: "desktop-shell routing" / "desktop-shell clicks" -> "desktop-host", the wording this branch already chose in LinkifiedText.tsx for the same rule. - docs/design/telemetry-runtime-client-attribution-design.md: repoint the `runtime.rs` citation. It backs the live `QWEN_CODE_DESKTOP=1` claim, and the other document of record for that invariant -- the comment in acp-channel-fallback.ts -- was already repointed by this branch, so the two disagreed. Only the path token changes; the doc's dated findings are untouched. - brand-create.mjs / SKILL.md / src-tauri/src/main.rs: name the historical referent as historical (the Electron `packages/desktop` removed in PR 9085) instead of letting it read as a self-reference. In main.rs the citation `packages/desktop/packages/shared/src/config/storage.ts` now looked like a subpath of the file's own package. Rewritten, not deleted: the `QWEN_DEFAULT_WORKSPACE_DIR` clause next to it is the only in-code documentation of that override and still resolves. Deliberately not swept: `scripts/check-desktop-isolation.js`'s `packages/desktop-shell` tripwire, ci.yml's #8132 history comment, `docs/design/9152-architecture-invariant-classification.md` (names both spellings and is accurate), and the date-prefixed `docs/design/2026-07-31-desktop-web-shell-release.md`. Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> Patrol-Run: qwen-pr-closeout/jmug1iw422v * test(scripts): pin the desktop crate path and the isolation guard's coverage Both invariants fail green today, and this rename is the second time the crate directory has moved. `scripts/check-desktop-isolation.js` gained `'packages/desktop'` in `nativePrefixes` -- the only production-logic line in this branch -- and nothing read it. Deleting that line leaves the guard's output and exit code byte-identical, because `isNativeLocation('packages/desktop')` then matches no remaining prefix; a later PR that drops `!packages/desktop` from the root workspace list would re-admit the package with CI green. The `desktop_shell` job names the crate directory in five places (the changed-files filter, the Cargo.toml guard and its `::notice::` text, the rust-cache `workspaces:`, and two `working-directory:` values). Nothing asserted they agree with each other or with a directory that exists, so the next drift reports a skipped job as a passed one. The new suite parses both instead of re-running them, and is superset-shaped on purpose: `nativePrefixes` carries a fourth entry (the `packages/desktop-shell` tripwire) that nothing negates, and an exact-match assertion would invite deleting it. The npm/pnpm mirror of the negation list is already pinned by package-scripts.test.js, so this reads package.json only. Verified by mutation, each applied alone and then restored: reverting the filter alternative or either `working-directory` to `packages/desktop-shell`, dropping `'packages/desktop'` from `nativePrefixes`, and dropping `!packages/desktop` from package.json all turn this suite red. Today no other test does. Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> Patrol-Run: qwen-pr-closeout/jmug1iw422v * test(scripts): pin what the desktop-isolation tests actually claim Four review findings on scripts/tests/desktop-isolation.test.js, each verified by mutating the thing it claims to pin, before and after. - The comment above the local `isNativeLocation` copy claimed a change to the script's rule "has to be made here too". Nothing reads the rule back from the producer -- `nativePrefixesFromSource` parses the array literal only -- and narrowing the script's rule to prefix equality leaves the suite green. Describe the copy instead of claiming coupling that does not exist. - `still carries the Cargo.toml existence guard` matched only the guard's condition text. Flip the body's `changed=false` to `changed=true`, or move it after `fi`, and the suite stayed green at 5/5 while the job runs every gated step against a crate that is not there. Assert the assignment sits inside the guard's own `if ... fi` body. - Both on-disk checks keyed on the bare directory, so git-ignored residue under `packages/desktop-shell` (`node_modules`, which survives a branch switch with an empty `git status`) reddened two tests on a tree with no defect and blamed the root workspace set. Key on `package.json`, which is what `packages/*` requires to make a directory a workspace member; a real re-entry still reddens both. - The `startsWith(filterAlternative)` assertion compared a path built from `crateDir` -- `filterAlternative` with one trailing slash stripped -- back against `filterAlternative`, so it could not fail for any input. Dropping the trailing slash from the changed-files filter in ci.yml left it green. Replace it with the property that makes the alternative a path prefix rather than a bare string prefix. Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> Patrol-Run: qwen-pr-closeout/jmugedurp3j --------- Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
126 lines
3.7 KiB
JavaScript
126 lines
3.7 KiB
JavaScript
/**
|
|
* @license
|
|
* Copyright 2026 Qwen Team
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
|
|
import { tmpdir } from 'node:os';
|
|
import path from 'node:path';
|
|
import { afterEach, describe, expect, it } from 'vitest';
|
|
import {
|
|
getTestCiWorkspacePackageJsonPaths,
|
|
getWorkspacePackageJsonPaths,
|
|
} from '../workspaces.js';
|
|
|
|
describe('workspace helpers', () => {
|
|
const tempDirs = [];
|
|
|
|
afterEach(() => {
|
|
for (const tempDir of tempDirs.splice(0)) {
|
|
rmSync(tempDir, { force: true, recursive: true });
|
|
}
|
|
});
|
|
|
|
it('honors negated workspace patterns', () => {
|
|
const root = mkdtempSync(path.join(tmpdir(), 'qwen-workspaces-'));
|
|
tempDirs.push(root);
|
|
|
|
for (const packagePath of [
|
|
'packages/cli/package.json',
|
|
'packages/core/package.json',
|
|
'packages/desktop/package.json',
|
|
'packages/channels/base/package.json',
|
|
]) {
|
|
writeFile(root, packagePath, '{}\n');
|
|
}
|
|
|
|
expect(
|
|
getWorkspacePackageJsonPaths(root, [
|
|
'packages/*',
|
|
'packages/channels/base',
|
|
'!packages/desktop',
|
|
]),
|
|
).toEqual([
|
|
'packages/channels/base/package.json',
|
|
'packages/cli/package.json',
|
|
'packages/core/package.json',
|
|
]);
|
|
});
|
|
|
|
it('normalizes Windows-style workspace patterns', () => {
|
|
const root = mkdtempSync(path.join(tmpdir(), 'qwen-workspaces-'));
|
|
tempDirs.push(root);
|
|
|
|
for (const packagePath of [
|
|
'packages/cli/package.json',
|
|
'packages/core/package.json',
|
|
'packages/desktop/package.json',
|
|
'packages/channels/base/package.json',
|
|
]) {
|
|
writeFile(root, packagePath, '{}\n');
|
|
}
|
|
|
|
expect(
|
|
getWorkspacePackageJsonPaths(root, [
|
|
'packages\\*',
|
|
'packages\\channels\\base',
|
|
'!packages\\desktop',
|
|
]),
|
|
).toEqual([
|
|
'packages/channels/base/package.json',
|
|
'packages/cli/package.json',
|
|
'packages/core/package.json',
|
|
]);
|
|
});
|
|
|
|
it('returns exactly the package.json paths of workspaces with a test:ci script', () => {
|
|
const root = mkdtempSync(path.join(tmpdir(), 'qwen-workspaces-'));
|
|
tempDirs.push(root);
|
|
|
|
writeFile(
|
|
root,
|
|
'package.json',
|
|
'{"workspaces": ["integrations/*", "packages/*", ' +
|
|
'"packages/channels/nested-ci", "packages/channels/nested-no-ci"]}\n',
|
|
);
|
|
// Both repo layouts are witness-bearing: the flat integrations/* layout
|
|
// and the nested packages/channels/* layout. The nested members need
|
|
// explicit root-list entries because packages/* does not match nested
|
|
// directories — exactly why a filter mutation that drops the subtree
|
|
// (say `!path.startsWith('packages/channels/')`) would stay invisible
|
|
// to every consumer that derives its set from the selector. This
|
|
// exact-set pin is what catches it.
|
|
writeFile(
|
|
root,
|
|
'integrations/with-ci/package.json',
|
|
'{"scripts": {"test:ci": "vitest run"}}\n',
|
|
);
|
|
writeFile(
|
|
root,
|
|
'packages/without-ci/package.json',
|
|
'{"scripts": {"test": "vitest run"}}\n',
|
|
);
|
|
writeFile(
|
|
root,
|
|
'packages/channels/nested-ci/package.json',
|
|
'{"scripts": {"test:ci": "vitest run"}}\n',
|
|
);
|
|
writeFile(
|
|
root,
|
|
'packages/channels/nested-no-ci/package.json',
|
|
'{"scripts": {"test": "vitest run"}}\n',
|
|
);
|
|
|
|
expect(getTestCiWorkspacePackageJsonPaths(root)).toEqual([
|
|
'integrations/with-ci/package.json',
|
|
'packages/channels/nested-ci/package.json',
|
|
]);
|
|
});
|
|
|
|
function writeFile(root, relativePath, content) {
|
|
const filePath = path.join(root, relativePath);
|
|
mkdirSync(path.dirname(filePath), { recursive: true });
|
|
writeFileSync(filePath, content);
|
|
}
|
|
});
|