Files
dxdesigner-part-replacement/docs/superpowers/plans/2026-10-19-native-readonly-snapshot.md
T

5.5 KiB

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(Source, SelectedUids, Token, Project, Sheet, Guid, ResultPath, StopToken, Safe): 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.

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 (2f6060d).

Task 2: Runtime composition and capture/verification integration

Files: modify src/dx_productivity/trial_task_center/quick_run.py, recovery.py, integration/dxdesigner795/QuickPartReplace.vbs, packaging/DxPartReplace.spec; add worker_runtime.py 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 and same-path no-op.

  • QPUseNativeSnapshot(): true only for owned batches with a private-desktop environment and an available adapter function.

  • QPTryNativeVerifyUntouched(Records) and QPCompareNativeUntouched(Records, Actual): compare complete actual rows, total and unselected UID set to existing persisted baselines. Unsupported script paths may fall back only before command dispatch; any failure after dispatch stops the step.

  • Reproduce a prepared default worker missing the adapter and a custom worker that must remain unchanged.

  • Compose all four existing source-copy callsites (prepare, begin session, resume step and recovery) 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. Correct the extracted guard fixture to include QPUseNativeSnapshot; final runs: 239 passed and 81 passed / 1 deselected. Commit tested integration (81f3468).

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. No Critical/Important findings; suggested gating and orchestration cases added.
  • Run the established default-template BOM harness on a fresh build/ copy with RV05 and RV14, recording script hashes and timings (189.250 seconds).
  • 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 (61.062 seconds, exact before/after graph equality).
  • 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.