Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3cec9adc5f | ||
|
|
c1ad438591 | ||
|
|
2b2fdad56f | ||
|
|
c96c369161 | ||
|
|
4ef08e06d2 | ||
|
|
cd9431985e | ||
|
|
344a2797b0 | ||
|
|
caa79e7fcf | ||
|
|
df250e04ba | ||
|
|
efe7e8c813 | ||
|
|
b80988ccf7 |
No files matched your search
@@ -0,0 +1,64 @@
|
||||
name: Core regression
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, 'codex/**']
|
||||
tags: ['v*']
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
portable-regression:
|
||||
name: Python core and release configuration
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: node:20-bookworm
|
||||
timeout-minutes: 20
|
||||
steps:
|
||||
- name: Checkout tested commit
|
||||
run: |
|
||||
git init .
|
||||
git remote add origin "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git"
|
||||
git fetch --depth=1 origin "${GITHUB_SHA}"
|
||||
git checkout --detach FETCH_HEAD
|
||||
- name: Install runner Python and test dependencies
|
||||
run: |
|
||||
apt-get update
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends python3 python3-pytest
|
||||
python3 --version
|
||||
- name: Compile application and build helpers
|
||||
run: python3 -m compileall -q src packaging tools
|
||||
- name: Core regression (no CAD or production credentials)
|
||||
run: >-
|
||||
python3 -m pytest -q
|
||||
tests/dsh/test_core.py
|
||||
tests/dsh/test_failure_policy.py
|
||||
tests/dsh/test_decision_log.py
|
||||
tests/dsh/test_experience.py
|
||||
tests/dsh/test_issue_broker.py
|
||||
tests/packaging/test_dsh_runtime_staging.py
|
||||
tests/packaging/test_release_configuration.py
|
||||
--junitxml=build/ci-results.xml --tb=short
|
||||
- name: Windows release scope
|
||||
run: |
|
||||
echo 'Windows PyInstaller, Qt WebEngine startup, full runtime file hashes and extracted EXE smoke are validated on the Windows build host.'
|
||||
echo 'This Linux job does not claim Windows/CAD or live model acceptance.'
|
||||
|
||||
javascript-regression:
|
||||
name: JavaScript syntax
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: node:20-bookworm
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: Checkout tested commit
|
||||
run: |
|
||||
git init .
|
||||
git remote add origin "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git"
|
||||
git fetch --depth=1 origin "${GITHUB_SHA}"
|
||||
git checkout --detach FETCH_HEAD
|
||||
- name: Check runtime syntax
|
||||
run: |
|
||||
node --check integration/dsh/start.mjs
|
||||
node --check integration/dsh/task-plugin/host.mjs
|
||||
node --check integration/dsh/task-plugin/client.js
|
||||
@@ -4,14 +4,38 @@
|
||||
|
||||
面向 **Windows + DxDesigner / Expedition Enterprise 7.9.5** 的器件批量替换工具。一个工程对应一个任务,可以只替换同料号下的部分位号;支持直接编辑和 Excel BOM 导入,同批工程按顺序执行。
|
||||
|
||||
**最新版本:V1.1.4 Beta 4(预发布)** · [下载便携包](https://git.simgreek.com/simgreek/dxdesigner-part-replacement/releases/download/v1.1.4-beta.4/DxPartReplace-1.1.4-beta.4.zip) · [版本说明与附件](https://git.simgreek.com/simgreek/dxdesigner-part-replacement/releases/tag/v1.1.4-beta.4) · [完整使用说明](docs/user/v1.1.0-project-tasks.md)
|
||||
**最新版本:V1.2.1(预发布)** · [下载便携包](https://git.simgreek.com/Skyworth_Digital_Hardware/dxdesigner-part-replacement/releases/download/v1.2.1/DxPartReplace-1.2.1.zip) · [版本说明与附件](https://git.simgreek.com/Skyworth_Digital_Hardware/dxdesigner-part-replacement/releases/tag/v1.2.1) · [完整使用说明](docs/user/v1.1.0-project-tasks.md)
|
||||
|
||||
所有发布均标记为 **Beta 预发布**。V1.1.4 Beta 1 因 BOM 导入缺少 `win32timezone` 已撤回,请使用 Beta 4;旧 Git 标签保留供回溯。升级前备份 `data`,完整更新 EXE 与 `_internal`,不要只替换 EXE。
|
||||
V1.2.1 提供完整 Node/Qt 运行时、DSH 任务功能和全部 UI 资源。升级前备份 data,完整更新 EXE 与 _internal,不要只替换 EXE。
|
||||
|
||||
Beta 4 面向停止与资源收尾复测:普通暂停等待当前项保存核验,写入中无进度不再自动杀进程;新增明确确认的强制结束,保留中断证据与恢复入口。[本版变更和复测说明](docs/releases/v1.1.4-beta.4.md)。
|
||||
本版修复冻结应用缺少 SVG 资源的问题,保留维护者配置的工单上报能力,并增加云端 CI。[本版变更](docs/releases/v1.2.1.md)。
|
||||
|
||||
本版提供[目标封装选择](docs/user/target-cell-selection.md):目标封装可留空,此时工具不主动覆写封装,可后续与中心库同步;需要指定时,在料号规则中读取并选择合法封装。BOM 保持原 11 列。
|
||||
|
||||
## DSH助手:在工具内使用 AI
|
||||
|
||||
本项目已将 **DSH助手** 集成到任务中心主窗口。顶部固定显示两个入口:左侧 **任务中心**、右侧 **DSH助手**,单击即可切换,无需展开菜单;助手保留 DeepSeek Harness 官方三栏界面、SVG 动画、模型选择、会话和未发送草稿。也可以使用 `Ctrl+Shift+D` 打开助手。
|
||||
|
||||
DSH助手围绕真实任务中心工作,支持:
|
||||
|
||||
- 用自然语言创建任务、修改规则、复制或归档任务;工程选择和提交仍由原生窗口确认。
|
||||
- 查询任务快照、执行预检、影响范围和实际执行历史。
|
||||
- 在原生确认后按冻结范围执行任务,支持安全暂停、原队列恢复和排期授权。
|
||||
- 发生异常时自动介入,收集脱敏证据链、保留诊断记录,并在需要时提交受限 Git 工单。
|
||||
- 在右侧任务监管中查看运行、影响、排期、经验、工单和用量;审计损坏、证据缺失和未知计数会明确显示。
|
||||
|
||||
AI 不能直接写入 CAD、运行 Shell、访问任意文件或绕过确认门禁。自动异常诊断为只读;不确定执行不会自动重放,恢复必须重新核对冻结计划、检查点和业务证据。未配置模型时仍可使用任务监管和本地恢复功能,但不会产生真实模型回复。
|
||||
|
||||
模型配置保存在本机任务中心数据目录,密钥使用 Windows DPAPI 保护,不写入仓库或环境变量。首次接入可在 **工具设置 → DSH工具** 中配置 OpenAI 兼容端点和模型;开发环境也可通过 `DSH_API_BASE`、`DSH_MODEL`、`DSH_API_KEY` 临时提供配置。不要把 API key、Git 凭据或 `integration/dsh/issue-bootstrap.json` 提交到 Git。
|
||||
|
||||
详细的能力边界、异常介入、证据链、排期和工单说明见 [DSH助手使用与监管说明](docs/user/dsh-ai-supervision.md)。源码环境可用下面的命令检查运行时门禁:
|
||||
|
||||
```powershell
|
||||
$env:PYTHONPATH = 'src'
|
||||
python -X utf8 -m dx_productivity.dsh --doctor
|
||||
node tools/verify_dsh_runtime.mjs
|
||||
```
|
||||
|
||||
## 图文教程
|
||||
|
||||
按下面 **13 步**,完成“创建任务 → 填 BOM → 导入校验 → 保存计划 → 替换 → 查看结果”。本例有两个工程 `Audio_D2128`、`Audio_T605A`,各自只替换 `RV05`,保留同料号下的 `RV11`。
|
||||
@@ -20,7 +44,7 @@ Beta 4 面向停止与资源收尾复测:普通暂停等待当前项保存核
|
||||
|
||||
### 第 1 步:解压并打开应用
|
||||
|
||||
[下载 V1.1.4 Beta 4 便携包](https://git.simgreek.com/simgreek/dxdesigner-part-replacement/releases/download/v1.1.4-beta.4/DxPartReplace-1.1.4-beta.4.zip),**完整解压**,双击 `DxPartReplace.exe`。保留它与 `_internal` 的相对位置,无需安装 Python;本机需要可用的 DxDesigner、许可证和中央库。
|
||||
[下载 V1.2.1 便携包](https://git.simgreek.com/Skyworth_Digital_Hardware/dxdesigner-part-replacement/releases/download/v1.2.1/DxPartReplace-1.2.1.zip),**完整解压**,双击 `DxPartReplace.exe`。保留它与 `_internal` 的相对位置,无需安装 Python;本机需要可用的 DxDesigner、许可证和中央库。
|
||||
|
||||
打开后看到下图主窗口。首次使用请准备完整的工程副本,执行前保存并关闭待处理工程。
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
# V1.2.1
|
||||
|
||||
本版合并 PR #14 的 DSH 启动错误提示,并提供完整 Windows 便携运行包。
|
||||
|
||||
- 包含整个已安装的 DSH Node 依赖目录、Node 可执行文件、官方前端、任务插件、Qt WebEngine 运行库和全部 UI 图标。
|
||||
- 按维护者的部署要求保留 issue reporter 配置;模型 API 密钥及个人任务数据不随包分发。
|
||||
- 应用标题、Python 项目元数据和 Windows 产品版本统一为 1.2.1。
|
||||
- 新增 Gitea Actions 回归,覆盖平台无关核心逻辑与发行配置。Windows 冻结程序另在构建机验收。
|
||||
|
||||
完整解压 `DxPartReplace-1.2.1.zip`,运行目录内的 `DxPartReplace.exe`。请保留 `_internal` 的完整目录结构,升级前备份旧版 `data`。
|
||||
|
||||
旧版在本版通过验证并公开后转为草稿下架,历史标签保留。运行和云端验证的实际结果见发行附件中的 build-validation.json。
|
||||
@@ -0,0 +1,17 @@
|
||||
# DSH 运行包与入口修复验证
|
||||
|
||||
## 问题
|
||||
|
||||
发布规格此前把 `integration/dsh/node_modules` 整个目录递归复制进 PyInstaller,包含非 Windows 平台二进制、实验包、测试目录、TypeScript 源码、source map 和文档,导致包体偏大。另一个问题是 DSH 懒启动发生导入、Qt WebEngine 或 Node 运行包异常时,异常从 QAction 槽冒出,桌面上看起来像点击没有反应。
|
||||
|
||||
## 修复
|
||||
|
||||
- 打包前生成 Windows x64 DSH 运行时暂存目录:保留当前平台依赖、JavaScript/JSON/原生运行文件和官方 Harness 包;去除其他平台包、测试/示例/缓存目录、TypeScript 源码、source map 和文档。优先使用硬链接暂存,跨卷时自动回退复制,不修改源 `node_modules`。
|
||||
- DSH助手入口捕获懒启动异常,写入现有应用错误日志,并在任务中心操作栏显示“DSH助手启动失败,请检查发布包中的运行时和 Node.js”,避免无反馈点击。
|
||||
|
||||
## 验证
|
||||
|
||||
- 精简运行时单元回归和 DSH UI/打包/原生运行时回归:**48 passed**。
|
||||
- 精简后的实际 Harness 暂存目录运行 `start.mjs --doctor`:返回 `status=ready`,官方前端、7 个受控工具和 Node 版本信息正常。
|
||||
- 源码真实 Qt/CDP 点击验收:报告 `build/dsh-click-after-fix-9267/desktop-report.json`,直接导航、官方三栏页面、SVG/动画、模型选择、原生取消确认、草稿保留和正常退出通过;`uncaughtErrors=false`、`unexpectedUiErrors=false`。
|
||||
- 本轮未构建发布 EXE,未操作真实 CAD 或远端工单;PyInstaller 发布时会使用新的暂存逻辑。
|
||||
@@ -18,7 +18,7 @@ if viewdraw_api is None:
|
||||
shutil.copyfile(viewdraw_api.__file__, generated_root / "viewdraw_api.py")
|
||||
legacy_runtime_datas = [
|
||||
(
|
||||
str(project_root / 'src/dx_productivity/trial_task_center/assets/app.ico'),
|
||||
str(project_root / 'src/dx_productivity/trial_task_center/assets'),
|
||||
'dx_productivity/trial_task_center/assets',
|
||||
),
|
||||
(
|
||||
@@ -38,11 +38,14 @@ if (dsh_root / 'issue-bootstrap.json').is_file():
|
||||
if (dsh_root / 'node_modules' / '@deepseek-ai' / 'dsh' / 'package.json').is_file():
|
||||
if not (dsh_root / 'issue-bootstrap.json').is_file():
|
||||
raise RuntimeError('Provision the DSH issue-only reporter before packaging the native assistant.')
|
||||
# Release distribution keeps the complete installed runtime, including
|
||||
# lazily loaded packages, native binaries, frontend assets and metadata.
|
||||
staged_node_modules = dsh_root / 'node_modules'
|
||||
legacy_runtime_datas.extend([
|
||||
(str(dsh_root / 'start.mjs'), 'dsh-runtime'),
|
||||
(str(dsh_root / 'package.json'), 'dsh-runtime'),
|
||||
(str(dsh_root / 'task-plugin'), 'dsh-runtime/task-plugin'),
|
||||
(str(dsh_root / 'node_modules'), 'dsh-runtime/node_modules'),
|
||||
(str(staged_node_modules), 'dsh-runtime/node_modules'),
|
||||
(shutil.which('node'), 'dsh-runtime'),
|
||||
(str(project_root / 'licenses' / 'DeepSeek-Harness-MIT.txt'), 'licenses'),
|
||||
])
|
||||
@@ -65,19 +68,19 @@ a = Analysis(
|
||||
"pywinauto.controls.uiawrapper",
|
||||
"PySide6.QtWebEngineCore",
|
||||
"PySide6.QtWebEngineWidgets",
|
||||
"PySide6.QtWebChannel",
|
||||
"PySide6.QtQml",
|
||||
"PySide6.QtQuick",
|
||||
"PySide6.QtQuickWidgets",
|
||||
"PySide6.QtOpenGL",
|
||||
"PySide6.QtOpenGLWidgets",
|
||||
],
|
||||
excludes=[
|
||||
"PySide6.QtDesigner",
|
||||
"PySide6.QtMultimedia",
|
||||
"PySide6.QtMultimediaWidgets",
|
||||
"PySide6.QtOpenGL",
|
||||
"PySide6.QtOpenGLWidgets",
|
||||
"PySide6.QtPdf",
|
||||
"PySide6.QtPdfWidgets",
|
||||
"PySide6.QtQml",
|
||||
"PySide6.QtQuick",
|
||||
"PySide6.QtQuickWidgets",
|
||||
"PySide6.QtWebChannel",
|
||||
],
|
||||
noarchive=False,
|
||||
)
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
"""Create a small, Windows-only copy of the installed DSH Node runtime."""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
|
||||
_PRUNED_DIRS = frozenset({
|
||||
".bin", ".cache", ".github", "__tests__", "benchmark", "benchmarks",
|
||||
"coverage", "example", "examples", "test", "tests",
|
||||
})
|
||||
_PRUNED_SUFFIXES = frozenset({".map", ".ts", ".tsx"})
|
||||
_PRUNED_NAMES = frozenset({"changelog", "changelog.md", "history.md", "readme", "readme.md"})
|
||||
|
||||
|
||||
def _matches(value: str, rule: str) -> bool:
|
||||
return value.casefold() == rule.lstrip("!").casefold()
|
||||
|
||||
|
||||
def _compatible(package: Path, *, platform: str, arch: str) -> bool:
|
||||
try:
|
||||
value = json.loads((package / "package.json").read_text(encoding="utf8"))
|
||||
except (OSError, ValueError, TypeError):
|
||||
return True
|
||||
if not isinstance(value, dict):
|
||||
return True
|
||||
for field, current in (("os", platform), ("cpu", arch)):
|
||||
rules = value.get(field)
|
||||
if not isinstance(rules, list):
|
||||
continue
|
||||
if any(isinstance(rule, str) and rule.startswith("!") and _matches(current, rule)
|
||||
for rule in rules):
|
||||
return False
|
||||
positive = [rule for rule in rules if isinstance(rule, str) and not rule.startswith("!")]
|
||||
if positive and not any(_matches(current, rule) for rule in positive):
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def _ignore(directory: str, names: list[str], *, platform: str, arch: str) -> set[str]:
|
||||
ignored: set[str] = set()
|
||||
for name in names:
|
||||
path = Path(directory) / name
|
||||
if path.is_dir():
|
||||
if name.casefold() in _PRUNED_DIRS or not _compatible(path, platform=platform, arch=arch):
|
||||
ignored.add(name)
|
||||
elif Path(name).suffix.casefold() in _PRUNED_SUFFIXES or name.casefold() in _PRUNED_NAMES:
|
||||
ignored.add(name)
|
||||
return ignored
|
||||
|
||||
|
||||
def stage_node_modules(source: Path, destination: Path, *, platform: str = "win32", arch: str = "x64") -> Path:
|
||||
"""Stage runtime packages without other-platform binaries or documentation."""
|
||||
source = Path(source)
|
||||
destination = Path(destination)
|
||||
if not (source / "@deepseek-ai" / "dsh" / "package.json").is_file():
|
||||
raise FileNotFoundError("DSH runtime package is not installed")
|
||||
if destination.exists():
|
||||
shutil.rmtree(destination)
|
||||
destination.parent.mkdir(parents=True, exist_ok=True)
|
||||
def link_or_copy(source_file: str, destination_file: str) -> None:
|
||||
try:
|
||||
os.link(source_file, destination_file)
|
||||
except OSError:
|
||||
shutil.copy2(source_file, destination_file)
|
||||
|
||||
shutil.copytree(source, destination, ignore=lambda directory, names: _ignore(
|
||||
directory, names, platform=platform, arch=arch), copy_function=link_or_copy,
|
||||
symlinks=False)
|
||||
return destination
|
||||
@@ -1,8 +1,8 @@
|
||||
# UTF-8
|
||||
VSVersionInfo(
|
||||
ffi=FixedFileInfo(
|
||||
filevers=(1, 1, 4, 4),
|
||||
prodvers=(1, 1, 4, 4),
|
||||
filevers=(1, 2, 1, 0),
|
||||
prodvers=(1, 2, 1, 0),
|
||||
mask=0x3f,
|
||||
flags=0x2,
|
||||
OS=0x40004,
|
||||
@@ -15,11 +15,11 @@ VSVersionInfo(
|
||||
StringTable('040904B0', [
|
||||
StringStruct('CompanyName', 'DxProductivity'),
|
||||
StringStruct('FileDescription', 'DxDesigner Part Replacement'),
|
||||
StringStruct('FileVersion', '1.1.4.4'),
|
||||
StringStruct('FileVersion', '1.2.1.0'),
|
||||
StringStruct('InternalName', 'DxPartReplace'),
|
||||
StringStruct('OriginalFilename', 'DxPartReplace.exe'),
|
||||
StringStruct('ProductName', 'DxDesigner Part Replacement'),
|
||||
StringStruct('ProductVersion', '1.1.4-beta.4')
|
||||
StringStruct('ProductVersion', '1.2.1')
|
||||
])
|
||||
]),
|
||||
VarFileInfo([VarStruct('Translation', [1033, 1200])])
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "dx-productivity"
|
||||
version = "1.1.4b4"
|
||||
version = "1.2.1"
|
||||
requires-python = ">=3.12,<3.13"
|
||||
dependencies = ["PySide6>=6.7,<7", "pywin32>=306", "pywinauto>=0.6.9,<1", "openpyxl>=3.1,<4"]
|
||||
|
||||
|
||||
@@ -1028,10 +1028,21 @@ class TrialTaskCenterWindow(MaterialMainWindow):
|
||||
self.run_panel.operator_band.style().polish(self.run_panel.operator_band)
|
||||
|
||||
def _open_dsh(self):
|
||||
self._ensure_dsh_view()
|
||||
self.content_stack.setCurrentWidget(self._dsh_view)
|
||||
if self._dsh_automation is not None and self._dsh_automation.latest:
|
||||
self._dsh_automation._publish_context()
|
||||
try:
|
||||
self._ensure_dsh_view()
|
||||
self.content_stack.setCurrentWidget(self._dsh_view)
|
||||
if self._dsh_automation is not None and self._dsh_automation.latest:
|
||||
self._dsh_automation._publish_context()
|
||||
except Exception as error:
|
||||
# QAction slots do not surface exceptions visibly in a frozen Qt
|
||||
# app. Route lazy import/WebEngine failures through the operator
|
||||
# error path instead of making the click appear to do nothing.
|
||||
try:
|
||||
self.service.report_ui_error(error)
|
||||
except Exception:
|
||||
pass
|
||||
self._show_error(TaskCenterError(
|
||||
'dsh_startup', 'DSH助手启动失败,请检查发布包中的运行时和 Node.js。'))
|
||||
|
||||
def _ensure_dsh_view(self):
|
||||
if self._dsh_view is None:
|
||||
|
||||
@@ -4,6 +4,7 @@ import json
|
||||
import re
|
||||
|
||||
ERROR_TEXT = {
|
||||
"dsh_startup": "DSH助手启动失败,请检查发布包中的运行时和 Node.js。",
|
||||
'user_forced_stop': '操作已强制中断,结果待核验。',
|
||||
'application_shutdown_failed': '业务结果已保留,但应用收尾异常。',
|
||||
"batch_resources_pending": "后台资源尚未确认释放,请使用“重新清理资源”后再开始下一批。",
|
||||
|
||||
@@ -1 +1 @@
|
||||
VERSION = "1.1.4-beta.4"
|
||||
VERSION = "1.2.1"
|
||||
@@ -0,0 +1,40 @@
|
||||
from pathlib import Path
|
||||
import importlib.util
|
||||
|
||||
_MODULE = Path(__file__).resolve().parents[2] / 'packaging' / 'dsh_runtime_staging.py'
|
||||
_SPEC = importlib.util.spec_from_file_location('dsh_runtime_staging', _MODULE)
|
||||
_LOADED = importlib.util.module_from_spec(_SPEC)
|
||||
assert _SPEC and _SPEC.loader
|
||||
_SPEC.loader.exec_module(_LOADED)
|
||||
stage_node_modules = _LOADED.stage_node_modules
|
||||
|
||||
|
||||
def _package(root: Path, name: str, *, os=None, cpu=None, files=()):
|
||||
path = root / name
|
||||
path.mkdir(parents=True)
|
||||
manifest = {'name': name, 'version': '1.0.0'}
|
||||
if os is not None:
|
||||
manifest['os'] = os
|
||||
if cpu is not None:
|
||||
manifest['cpu'] = cpu
|
||||
import json
|
||||
(path / 'package.json').write_text(json.dumps(manifest), encoding='utf8')
|
||||
for relative, content in files:
|
||||
target = path / relative
|
||||
target.parent.mkdir(parents=True, exist_ok=True)
|
||||
target.write_text(content, encoding='utf8')
|
||||
|
||||
|
||||
def test_stage_dsh_runtime_keeps_windows_runtime_and_prunes_other_platforms(tmp_path):
|
||||
source = tmp_path / 'node_modules'
|
||||
(source / '@deepseek-ai' / 'dsh').mkdir(parents=True)
|
||||
(source / '@deepseek-ai' / 'dsh' / 'package.json').write_text('{}', encoding='utf8')
|
||||
_package(source, 'win-addon', os=['win32'], cpu=['x64'], files=[('index.js', 'ok')])
|
||||
_package(source, 'linux-addon', os=['linux'], files=[('index.js', 'drop')])
|
||||
_package(source, 'docs-only', files=[('index.js', 'ok'), ('README.md', 'drop'), ('source.ts', 'drop')])
|
||||
staged = stage_node_modules(source, tmp_path / 'staged')
|
||||
assert (staged / 'win-addon' / 'index.js').read_text(encoding='utf8') == 'ok'
|
||||
assert not (staged / 'linux-addon').exists()
|
||||
assert (staged / 'docs-only' / 'index.js').is_file()
|
||||
assert not (staged / 'docs-only' / 'README.md').exists()
|
||||
assert not (staged / 'docs-only' / 'source.ts').exists()
|
||||
@@ -0,0 +1,36 @@
|
||||
"""Catch missing runtime assets and mismatched version identity before release."""
|
||||
import ast
|
||||
from pathlib import Path
|
||||
import tomllib
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
|
||||
|
||||
def test_release_version_matches_python_and_windows_resources():
|
||||
namespace = {}
|
||||
exec((ROOT / 'src/dx_productivity/trial_task_center/version.py').read_text(), namespace)
|
||||
version = namespace['VERSION']
|
||||
assert tomllib.loads((ROOT / 'pyproject.toml').read_text())['project']['version'] == version
|
||||
info = (ROOT / 'packaging/windows-version-info.txt').read_text()
|
||||
assert f"StringStruct('ProductVersion', '{version}')" in info
|
||||
parts = tuple(int(n) for n in version.split('.')) + (0,)
|
||||
assert f'filevers={parts}' in info and f'prodvers={parts}' in info
|
||||
|
||||
|
||||
def test_release_spec_includes_all_assets_and_complete_runtime():
|
||||
tree = ast.parse((ROOT / 'packaging/DxPartReplace.spec').read_text())
|
||||
constants = {node.value for node in ast.walk(tree) if isinstance(node, ast.Constant) and isinstance(node.value, str)}
|
||||
assert 'src/dx_productivity/trial_task_center/assets' in constants
|
||||
assert not any(isinstance(node, ast.Call) and isinstance(node.func, ast.Name)
|
||||
and node.func.id == 'stage_node_modules' for node in ast.walk(tree))
|
||||
assert {'dsh-runtime/node_modules', 'dsh-runtime/task-plugin',
|
||||
'issue-bootstrap.json', 'PySide6.QtWebEngineCore',
|
||||
'PySide6.QtWebEngineWidgets'} <= constants
|
||||
analysis = next(node for node in ast.walk(tree) if isinstance(node, ast.Call)
|
||||
and isinstance(node.func, ast.Name) and node.func.id == 'Analysis')
|
||||
options = {arg.arg: ast.literal_eval(arg.value) for arg in analysis.keywords
|
||||
if arg.arg in {'hiddenimports', 'excludes'}}
|
||||
web_dependencies = {'PySide6.QtWebChannel', 'PySide6.QtQml', 'PySide6.QtQuick',
|
||||
'PySide6.QtOpenGL', 'PySide6.QtOpenGLWidgets'}
|
||||
assert web_dependencies <= set(options['hiddenimports'])
|
||||
assert web_dependencies.isdisjoint(options['excludes'])
|
||||
@@ -58,6 +58,15 @@ def test_direct_navigation_opens_harness_and_returns_without_losing_task(ui, mon
|
||||
assert window._dsh_view.starts == 1
|
||||
|
||||
|
||||
def test_dsh_navigation_surfaces_lazy_startup_failure(ui, monkeypatch, qtbot):
|
||||
window = ui.window
|
||||
def fail(_self):
|
||||
raise RuntimeError('controlled missing WebEngine')
|
||||
monkeypatch.setattr(type(window), '_create_dsh_view', fail)
|
||||
qtbot.mouseClick(window.dsh_navigation, Qt.MouseButton.LeftButton)
|
||||
assert 'DSH助手启动失败' in window.run_panel.operator_band.text()
|
||||
|
||||
|
||||
def test_cross_task_harness_action_never_reaches_task_service(ui, monkeypatch):
|
||||
window = ui.window
|
||||
monkeypatch.setattr(type(window), '_create_dsh_view', lambda self: HarnessView(self), raising=False)
|
||||
|
||||
Reference in new issue
Block a user