341 lines
14 KiB
Markdown
341 lines
14 KiB
Markdown
# DxDesigner Part Replacement Trial Task Center Design
|
|
|
|
## 1. Purpose
|
|
|
|
Build a Windows desktop EXE that makes the current DxDesigner 7.9.5
|
|
replacement investigation usable on one disposable project first, while using
|
|
the same task, project, mapping, status, and evidence model needed for later
|
|
multi-project execution.
|
|
|
|
The application is a trial task center. It manages work, collects before/after
|
|
probe evidence, guides the operator through the native DxDesigner replacement,
|
|
verifies the observed result, advances successful projects to Completed, and
|
|
records every application and task error. It does not claim that the
|
|
uncertified production replacement path is ready.
|
|
|
|
## 2. Release Boundary
|
|
|
|
The first release is `evaluation-only` and may be used only with complete,
|
|
disposable project copies.
|
|
|
|
It does not:
|
|
|
|
- automate DxDesigner controls with window coordinates, `SendKeys`, or delays;
|
|
- bypass the existing production certification or compatibility-profile gates;
|
|
- save, reconnect, move, add, or delete schematic objects;
|
|
- write `Value` or parameter presentation fields;
|
|
- delete source projects when a task is deleted; or
|
|
- present a manually confirmed replacement as machine-verified success.
|
|
|
|
The operator still performs native `Replace Part` with `Library Wins` in
|
|
DxDesigner. The EXE makes that process repeatable, correlated, reviewable, and
|
|
ready for later replacement-adapter integration.
|
|
|
|
## 3. Technology and Packaging
|
|
|
|
- Python 3.12.
|
|
- PySide6 for the native Windows UI.
|
|
- SQLite from the Python standard library for mutable task drafts and status.
|
|
- Existing `dx_productivity.part_replace` discovery, validation, identity, and
|
|
verification helpers where their contracts fit the trial flow.
|
|
- Existing ASCII-only DxDesigner 7.9.5 menu probe for live evidence.
|
|
- Python logging plus append-only JSON Lines task events.
|
|
- PyInstaller `onedir` output containing `DxPartReplace.exe` and its runtime
|
|
files. A single-file build is deferred until the installed-machine behavior
|
|
is proven.
|
|
|
|
The executable must not require a separate Python installation. The DxDesigner
|
|
menu integration remains a separately installed site integration because it is
|
|
loaded by DxDesigner itself.
|
|
|
|
## 4. Storage
|
|
|
|
Mutable task-center data lives outside engineering projects:
|
|
|
|
```text
|
|
%LOCALAPPDATA%\DxProductivity\trial-task-center\
|
|
task-center.db
|
|
logs\application.log
|
|
tasks\<task-id>\
|
|
task.json
|
|
events.jsonl
|
|
logs\task.log
|
|
evidence\
|
|
<project-id>\before-profile.json
|
|
<project-id>\after-profile.json
|
|
<project-id>\comparison.json
|
|
```
|
|
|
|
`task-center.db` uses schema version 1 and stores tasks, mapping rules, scanned
|
|
projects, project selection, project state, timestamps, and the last error
|
|
identifier. All database writes use transactions. Evidence JSON is written
|
|
atomically and referenced by SHA-256 from `events.jsonl`.
|
|
|
|
Task deletion is a soft delete recorded by `deleted_at`. It hides the task from
|
|
the normal task list but keeps logs and evidence. A future retention tool may
|
|
purge archived records; the MVP never recursively deletes task or project
|
|
directories.
|
|
|
|
## 5. Domain Records
|
|
|
|
### Task
|
|
|
|
- immutable UUID task ID;
|
|
- editable unique nonblank name;
|
|
- optional note;
|
|
- selected discovery root;
|
|
- status: `draft`, `ready`, `running`, `paused`, `completed`, `failed`, or
|
|
`deleted`;
|
|
- created, updated, started, and completed UTC timestamps; and
|
|
- last error ID and summary.
|
|
|
|
The application supports task create, read/list, rename/edit, soft delete, and
|
|
restore. A running task cannot be deleted; it must be paused first.
|
|
|
|
### Mapping Rule
|
|
|
|
- immutable rule UUID;
|
|
- task ID;
|
|
- ordered position;
|
|
- old `Part Number`;
|
|
- new `Part Number`; and
|
|
- enabled flag.
|
|
|
|
Rules support create, read, edit, delete, and reorder. Validation reuses the
|
|
existing mapping semantics: trim surrounding whitespace, compare identities
|
|
case-insensitively, reject blanks, self-maps, duplicate sources, chains, and
|
|
cycles. Material numbers such as `4300-CA2260-A300` remain ordinary strings and
|
|
are not constrained by a format regular expression.
|
|
|
|
### Project
|
|
|
|
- stable project ID derived from the canonical project-definition path;
|
|
- task ID, display name, path, and discovery root;
|
|
- selected flag;
|
|
- state: `pending`, `capturing_before`, `awaiting_operator`,
|
|
`capturing_after`, `verifying`, `completed`, `failed`, or `skipped`;
|
|
- retry count; and
|
|
- last error ID and summary.
|
|
|
|
Rescanning updates candidates without silently selecting new projects or
|
|
removing prior evidence. Missing projects are visibly marked unavailable.
|
|
|
|
## 6. User Interface
|
|
|
|
The application opens directly into the task center, not a landing page.
|
|
|
|
### Task List
|
|
|
|
The left navigation contains Active, Completed, and Deleted views. It supports
|
|
create, rename/edit, open, soft delete, and restore. Active-task rows show a
|
|
compact progress count and the last updated time.
|
|
|
|
### Task Workspace
|
|
|
|
The main workspace contains:
|
|
|
|
- a directory path field and native directory picker;
|
|
- Scan and Rescan commands;
|
|
- a project table with selection checkboxes, Select All, Clear Selection,
|
|
project name, canonical path, state, last result, and retry command;
|
|
- an editable mapping table with Add, Edit, Delete, and reorder commands;
|
|
- Start, Pause, Resume, and Open Evidence Folder commands;
|
|
- a current-operator-action band containing the exact project, old/new part
|
|
number, expected count when known, and the next DxDesigner instruction; and
|
|
- a docked log view showing timestamp, level, project, operation, and message.
|
|
|
|
The UI remains work-focused: dense tables, restrained color, no decorative
|
|
cards, no nested cards, and no required control below the fold. Completed
|
|
projects leave the active queue immediately and remain accessible through the
|
|
Completed filter.
|
|
|
|
## 7. Trial Execution Flow
|
|
|
|
### 7.1 Validation
|
|
|
|
Start is enabled only when the task has at least one enabled valid mapping and
|
|
one selected available `.prj` project. The operator must confirm that every
|
|
selected project is a complete disposable copy. The confirmation is recorded
|
|
with timestamp and task ID; it does not waive any verification rule.
|
|
|
|
Only one project is active at a time. Remaining selected projects stay queued.
|
|
Pause prevents the next project from starting but does not interrupt a probe or
|
|
verification that is already being committed.
|
|
|
|
### 7.2 Before Capture
|
|
|
|
For the active project, the EXE records the current menu-probe file hash and
|
|
timestamp, then instructs the operator to:
|
|
|
|
1. open the exact project in DxDesigner 7.9.5;
|
|
2. save any unrelated edits;
|
|
3. run `Dx Productivity -> Part replacement probe`; and
|
|
4. return to the EXE and choose Capture Result.
|
|
|
|
The EXE accepts the profile only when it is newer or byte-different from the
|
|
recorded predecessor, parses as the expected profile version, and its canonical
|
|
`project.identity` exactly matches the selected project. It atomically copies
|
|
the bytes into task evidence before advancing.
|
|
|
|
The before profile is searched exclusively by the `Part Number` attribute. For
|
|
each enabled rule it records all matching logical identities and counts. A rule
|
|
with no matches is reported and skipped for that project; ambiguous or
|
|
unreadable identity/parameter evidence fails the project before replacement.
|
|
|
|
### 7.3 Native Replacement
|
|
|
|
The project moves to `awaiting_operator`. The UI shows one mapping at a time and
|
|
the exact identities/count found in the trusted before profile. The operator
|
|
uses DxDesigner Find, selects those components, invokes native Replace Part,
|
|
chooses the requested new part, and selects `Library Wins`.
|
|
|
|
The EXE does not click the dialog, infer completion from elapsed time, or alter
|
|
the schematic. The operator confirms only that the native action was attempted;
|
|
this confirmation is not success evidence.
|
|
|
|
After all matching rules have been attempted, the EXE instructs the operator to
|
|
run the read-only menu probe again and capture the result.
|
|
|
|
### 7.4 Verification
|
|
|
|
The after profile must pass the same freshness, schema, and project-identity
|
|
checks. For every logical identity matched before replacement:
|
|
|
|
- the after `Part Number` must equal the rule's new value using the normal
|
|
trimmed, case-insensitive identity comparison;
|
|
- no matched logical identity may disappear or become ambiguous;
|
|
- RefDes, hierarchy, placed-unit count, component origin/position, rotation,
|
|
mirror state, pin numbers, pin coordinates, and pin-to-net identity must be
|
|
unchanged wherever the probe supplied trusted evidence; and
|
|
- unrelated logical components must retain their observed identity and
|
|
protected fields.
|
|
|
|
The comparison records `Part Label`, `Value`, and parameter-presentation
|
|
capability differences but does not write them in this release. Missing or
|
|
unsupported presentation fields produce explicit capability warnings. A target
|
|
part mismatch or protected-invariant change is a failed project.
|
|
|
|
Only a machine comparison with no hard failures moves the project to
|
|
`completed`. The runner then automatically selects the next pending project.
|
|
When every selected project is completed or skipped, the task moves to
|
|
`completed`; any failed project keeps the task in `failed` until it is retried,
|
|
skipped explicitly, or removed from selection while paused.
|
|
|
|
## 8. Logging and Diagnostics
|
|
|
|
Logging starts before the main window is constructed.
|
|
|
|
### Application Log
|
|
|
|
`application.log` is UTF-8, rotated at 5 MiB, and keeps five backups. It records:
|
|
|
|
- process start, version, executable path, OS, and storage paths;
|
|
- database migration and recovery;
|
|
- UI command start/completion;
|
|
- scan roots and candidate counts;
|
|
- task/project/rule IDs and state transitions;
|
|
- probe source/destination hashes and validation outcomes;
|
|
- subprocess command, exit code, stdout, and stderr when a subprocess is used;
|
|
- handled exceptions with stable error IDs; and
|
|
- uncaught main-thread, worker-thread, Qt callback, and shutdown exceptions with
|
|
complete Python tracebacks.
|
|
|
|
### Task Evidence Log
|
|
|
|
Every meaningful task action appends one canonical JSON object to
|
|
`events.jsonl` containing sequence, UTC timestamp, level, task ID, project ID,
|
|
operation, state before/after, error ID, message, and structured details. The
|
|
append is flushed before the UI reports completion.
|
|
|
|
The visible error dialog contains a concise Chinese explanation, the stable
|
|
error ID, and actions to open the task log or evidence folder. Raw tracebacks
|
|
remain in logs rather than being shown as the primary UI message.
|
|
|
|
## 9. Failure and Recovery
|
|
|
|
- A scan failure leaves the previous project list intact and records the error.
|
|
- A database transaction failure does not update in-memory UI state as if it
|
|
succeeded.
|
|
- An invalid or stale probe file is rejected without consuming it.
|
|
- A crash during execution is reconstructed from SQLite state and append-only
|
|
events on the next start. `capturing_*` and `verifying` projects become
|
|
paused with an interruption error; the operator chooses retry.
|
|
- Retrying creates a new attempt number and never overwrites prior evidence.
|
|
- A failed comparison never marks a project completed and never automatically
|
|
saves or modifies the source project.
|
|
|
|
## 10. Module Boundaries
|
|
|
|
```text
|
|
src/dx_productivity/trial_task_center/
|
|
models.py immutable task/project/rule records and enums
|
|
store.py SQLite schema, transactions, CRUD, and recovery
|
|
scanner.py directory discovery adapter
|
|
evidence.py probe freshness, identity, hashing, and atomic copies
|
|
comparison.py before/after rule and invariant comparison
|
|
runner.py one-project-at-a-time state machine
|
|
logging_setup.py rotating logs, JSONL events, and exception hooks
|
|
application.py application bootstrap and resource paths
|
|
ui/
|
|
main_window.py task navigation and workspace shell
|
|
task_list.py task filters and CRUD actions
|
|
project_table.py scan results, selection, states, and retry
|
|
mapping_table.py mapping CRUD and validation display
|
|
run_panel.py operator instruction and live log surfaces
|
|
```
|
|
|
|
The UI depends on service interfaces, not SQLite or profile JSON directly.
|
|
Comparison code has no Qt imports and is testable with fixture profiles. The
|
|
runner changes task/project state only through the store transaction API.
|
|
|
|
## 11. Tests
|
|
|
|
Automated tests cover:
|
|
|
|
- task, mapping, and project CRUD plus soft-delete/restore;
|
|
- mapping validation, including representative material numbers;
|
|
- recursive `.prj` scanning, deterministic ordering, rescan, duplicates,
|
|
missing paths, and selection preservation;
|
|
- application and per-task logs, rotation configuration, exception hooks, and
|
|
subprocess stdout/stderr capture;
|
|
- probe freshness, exact project identity, atomic evidence copies, SHA-256, and
|
|
rejection of stale/corrupt/wrong-project profiles;
|
|
- before-match extraction, no-match handling, exact logical-identity
|
|
correlation, target replacement, unrelated-object checks, and every protected
|
|
invariant;
|
|
- runner pause, resume, retry, crash recovery, automatic next-project advance,
|
|
and completed-task transition;
|
|
- PySide6 task/mapping/project CRUD interactions and disabled/enabled run gates;
|
|
- responsive worker execution without blocking the Qt UI thread;
|
|
- visual screenshots at 1100x700 and 1440x900 logical pixels with no clipped or
|
|
overlapping text; and
|
|
- a PyInstaller smoke test that starts the built EXE with an isolated temporary
|
|
application-data root, opens the main window, writes a startup log, and exits
|
|
cleanly.
|
|
|
|
No mock or automated test is accepted as proof that a DxDesigner 7.9.5 live
|
|
route works. Live acceptance requires one complete disposable project copy, a
|
|
before profile, a native replacement, an after profile, the comparison file,
|
|
and the corresponding logs.
|
|
|
|
## 12. MVP Acceptance
|
|
|
|
The first executable is acceptable for user testing when it can:
|
|
|
|
1. start without a separate Python installation and write its startup log;
|
|
2. create, edit, list, soft-delete, and restore tasks;
|
|
3. scan a selected directory, select one or more `.prj` projects, and preserve
|
|
the selection after rescan;
|
|
4. create, edit, reorder, enable, and delete mapping rules;
|
|
5. capture and correlate fresh before/after profiles for one selected project;
|
|
6. guide the operator through the native replacement without UI automation;
|
|
7. compare the selected project's before/after evidence and move it to
|
|
Completed only when hard verification passes;
|
|
8. retain failed projects with a visible error ID and retry action;
|
|
9. automatically advance to the next selected project; and
|
|
10. preserve complete application, task-event, evidence, and crash logs.
|
|
|
|
Parameter-style restoration and exact `Part Label -> Value` writes are the next
|
|
phase. The trial task center records the evidence needed to implement and
|
|
certify them without redesigning task storage or the UI.
|