Files
dxdesigner-part-replacement/docs/superpowers/plans/2026-10-14-single-project-ui-background-task-1-report.md
T

2.7 KiB

Task 1 report: single-project context and isolated worker

Implemented the backend portion of the single-project workflow without starting CAD, packaging, or modifying project files.

Public API

TaskCenterService.task_context(task_id: str) -> ProjectTaskContext returns a fresh immutable context for UI refreshes; only the per-task service facade is cached. TaskCenterService.refresh_bound_project(task_id: str) -> ProjectTaskContext rereads the task and its bound project from SQLite, without scanning a directory or attaching COM. A bound task must have one primary_project_id and exactly one project. Historical tasks without that binding remain available through task_context with legacy=True and project=None; refresh_bound_project rejects them so new execution cannot accidentally mutate a multi-project record.

ProjectTaskContext fields are:

ProjectTaskContext(
    task, project, rules, targets, progress, phase,
    has_evidence, interrupted, legacy
)

The target plan is authoritative for target-plan tasks. An empty or fully disabled plan produces zero queued items and never falls back to broad mapping rules.

IsolatedDesktopWorker is an opt-in research boundary. Its request contract is IsolatedWorkerRequest(protocol_version, task_id, project_path, target_uids, plan_hash, allow_writes=False). run() rejects the default disabled mode, rejects unrelated existing CAD identity, rejects write enablement, and emits versioned request.json/evidence.json files when an evidence root is given. It does not attach COM or launch CAD.

PrivateDesktop owns the Windows desktop handle and processes started with STARTUPINFO.lpDesktop="winsta0\\<private>"; launch uses pywin32 CreateProcess, a Job Object with kill-on-close, and fails when no private desktop was created, so there is no input-desktop fallback. Cleanup terminates only processes created by the worker and closes the owned desktop handle.

IsolatedDesktopWorker.read_only_probe(request, cad_probe, evidence_root=...) is the usable native boundary: it runs the injected native reader inside the owned private desktop, then checks its CadIdentity(pid, project_path) against the request before read_only_verified evidence is published. The worker refuses unrelated CAD identity and write enablement. It remains opt-in and does not mutate CAD.

Verification

  • tests/v1_1/test_project_context.py and test_isolated_desktop.py: 11 passed.
  • Existing target/quick-run checks (test_service_target_integration.py, test_target_execution.py): 8 passed.
  • Python bytecode compilation passed for all changed backend modules.

The private desktop path remains research-only until a native DxDesigner build is validated on a disposable project; no production write claims are made.