feat(native): add correlated read-only snapshot adapter
This commit is contained in:
1 parent
5b625b076e
commit
2f6060dfe3
4 files changed
+440
No files matched your search
@@ -0,0 +1,65 @@
|
||||
# Native Readonly Snapshot Implementation Plan
|
||||
|
||||
> **For agentic workers:** Execute this plan inline with existing user authorization; use independent requesting-code-review for the final boundaries. Steps use checkbox syntax for tracking.
|
||||
|
||||
**Goal:** Speed up complete unselected-state acquisition without removing any save/reopen verification.
|
||||
|
||||
**Architecture:** A separate VBScript adapter builds a native-host script from the existing read-only production routines. Python combines the adapter with the main worker at preparation time. Correlated, complete U/G frames are checked before capture or verification consumes them.
|
||||
|
||||
**Tech Stack:** Python 3.12, VBScript, installed DxDesigner 7.9.5 script host, existing private desktop supervisor.
|
||||
|
||||
**Spec:** ../specs/2026-10-19-native-readonly-snapshot.md
|
||||
|
||||
## Global Constraints
|
||||
|
||||
- Only owned private-desktop batches use the adapter; manual/legacy paths retain external COM.
|
||||
- Keep original full fields, live pin owners, context checks, save/reopen and recovery boundaries.
|
||||
- Native error or incomplete proof fails closed after dispatch; no CAD writes from the reader.
|
||||
- Do not package/release, modify feedback/, or run real CAD on source projects.
|
||||
|
||||
## Task 1: Correlated read frame and native script adapter
|
||||
|
||||
Files: create integration/dxdesigner795/NativeSnapshotReader.vbs and tests/v1_1/test_native_snapshot_reader.py.
|
||||
|
||||
Interfaces:
|
||||
|
||||
- QPNativeReadUntouched(SelectedUids): dictionary with total, text, and rows keyed by unselected UID.
|
||||
- QPParseNativeSnapshot(Text, Token, Project, Sheet, SelectedUids): validates NR1/header, U/G pairs, END/token/count and exact pair identity; returns the dictionary above.
|
||||
- QPNativeCollect(SelectedUids, Token, Project, Sheet, Guid): freshly queries the owned view and produces the complete frame with existing QPUntouchedComponent.
|
||||
- QPBuildNativeSnapshotScript(SelectedUids, Token, Project, Sheet, Guid, ResultPath): emits native bootstrap plus an explicit whitelist of original read-only routines; native QPProgress checks cancellation only.
|
||||
|
||||
- [ ] Write literal frame tests: one zero-pin unselected component, one selected UID, total=2; expected rows["u2"] equals its original U/G pair.
|
||||
|
||||
```python
|
||||
assert parsed_total == 2
|
||||
assert parsed_uids == ['u2']
|
||||
```
|
||||
|
||||
- [ ] Run tests and observe missing adapter failure. Add negative fixtures for stale token, wrong context, truncation, duplicate UID, wrong G owner, inconsistent U/G, extra selected UID, malformed count and propagated error frame.
|
||||
- [ ] Implement strict parsing and script generation; collect with the same read functions and no selection/save operations. Exercise generated code using COM-shaped fakes, including cancellation and missing targets.
|
||||
- [ ] Run the adapter tests and commit after they pass.
|
||||
|
||||
## Task 2: Runtime composition and capture/verification integration
|
||||
|
||||
Files: modify src/dx_productivity/trial_task_center/quick_run.py, integration/dxdesigner795/QuickPartReplace.vbs, packaging/DxPartReplace.spec and focused runtime tests.
|
||||
|
||||
Interfaces:
|
||||
|
||||
- _copy_worker_script(source: Path, destination: Path): copy source and append its sibling NativeSnapshotReader.vbs when present; preserve custom script compatibility.
|
||||
- QPUseNativeSnapshot(): true only for owned batches with a private-desktop environment and an available adapter function.
|
||||
- QPVerifyNativeUntouched(Records): compare complete actual rows, total and unselected UID set to existing persisted baselines.
|
||||
|
||||
- [ ] Reproduce a prepared default worker missing the adapter and a custom worker that must remain unchanged.
|
||||
- [ ] Compose all three existing source-copy callsites through _copy_worker_script; include the adapter in the frozen resource specification without building.
|
||||
- [ ] Route capture and QPVerifyUntouched through native reads only behind QPUseNativeSnapshot. Retain original external loops for other modes and all invalidation calls.
|
||||
- [ ] Run focused runtime, VBS, execution/recovery and existing accuracy tests. Review any failures before continuing; commit tested integration.
|
||||
|
||||
## Task 3: Independent review and real BOM acceptance
|
||||
|
||||
Files: add docs/reviews/2026-10-19-native-snapshot.md and sanitized docs/testing/evidence/2026-10-19-native-snapshot.json.
|
||||
|
||||
- [ ] Request an independent read-only review of ownership gating, native function whitelist, nonce/context checks, failure propagation and exact full-baseline comparison.
|
||||
- [ ] Run the established default-template BOM harness on a fresh build/ copy with RV05 and RV14, recording script hashes and timings.
|
||||
- [ ] Compare initial snapshots with the 120-row previous baseline; independently export hier/flat and verify 55 untouched components, 103 pin connections and 22 nets, plus exact target changes.
|
||||
- [ ] Exercise read-only recovery on the disposable successful queue because it also calls full verification; confirm no additional replacement/save and safe release.
|
||||
- [ ] Record failed research probes and remaining release gaps honestly, update plan checkboxes, commit evidence and push. Verify remote HEAD equals local and only feedback/ remains untracked.
|
||||
@@ -0,0 +1,19 @@
|
||||
# 原生宿主只读完整快照
|
||||
|
||||
目标是在自有私有桌面的正式批次中,把完整未选中器件快照交给 CAD 自带 VBS 宿主执行,消除逐字段跨进程 COM 开销。替换窗口、恢复写入、逐项保存和磁盘重开协议保持原样。
|
||||
|
||||
只读探针已取得两轮证据:57 个器件的 114 行 U/G 完整快照与外部采集一致;连续运行也一致。批量属性接口因空格/空串差异及缺失样式字段不接入。
|
||||
|
||||
约束:
|
||||
|
||||
- 仅在已确认拥有工程的私有桌面批次启用。手动模式、旧运行时或缺少适配模块时使用原采集路径。
|
||||
- 单独维护 NativeSnapshotReader.vbs;准备运行时时与主脚本合成一个可执行文件,不复制完整快照实现。原生脚本从该文件提取限定的只读函数。
|
||||
- 每次调用使用独立令牌、结果路径和 CAD GUID;核对工程与图页,重新建立引脚索引,保留逐引脚归属、全部属性/样式/连接读取和上下文检查。
|
||||
- 结果有版本头、令牌、工程、图页和完整结束标记。拒绝旧令牌、截断、重复 UID、U/G 不一致、未选中集合变化、丢失目标和错误总数。
|
||||
- 目标 UID 只用于排除未选中集合;原生读前后核对目标集合存在。保存前及磁盘重开后均重新执行完整读取。
|
||||
- 原生错误、命令失败、缺失结果、取消均不得生成成功证明;命令已发出后不静默回退。原生读取不写 CAD、不改选择、不保存。
|
||||
- 原生宿主预定义 Vd 枚举,不重复声明;支持同一 CAD 会话连续调用。
|
||||
- 取消检查使用当前监控令牌,在原有可安全中止的边界响应;外层监控和自有进程释放仍保留。
|
||||
- 不打包发布;不触碰 feedback/,实机只用 build/ 下新副本。
|
||||
|
||||
验收使用默认 BOM 的两条正式替换,覆盖错误行拒绝、导入确认、每项保存重开、独立库存及完整层级/扁平导出、原始工程哈希与桌面释放。性能只报告实际测得的同源样例,不承诺普遍倍数。
|
||||
Reference in new issue
Block a user