plans/machine-followup.md
Proposed follow-up to plans/correct-state-machines.md and the PR9 evaluation.
PR9 correctly records that the original MVP GO criteria were not met. This follow-up does not rewrite that evidence. It records a new rollout decision: the team accepts the three bounded image-generation lifecycle and compatibility risks as backlog work and will continue migrating the remaining distributed domains because the pilots materially improved admission, settlement, late-producer, renderer-ownership, and auditability guarantees.
The accepted image-generation risks are:
These issues should remain visible and tested, but they do not block the migration sequence below.
Migrate the remaining distributed-machine domains to the safe framework path:
For every migrated domain:
The program optimizes for correctness, consistency, and reviewability. Production line-count reduction is not a rollout gate.
Keep protocol v1, public IPC endpoints, renderer hook and manager methods, dialogs, error presentation, and existing promise façades compatible. Use adapters so a domain can migrate internally without requiring a coordinated renderer/main-process cutover.
No migration should require a database migration unless its durable checkpoint work explicitly needs one and receives a separate schema review.
Do not require irrelevant capabilities from simple or purely local machines. Each migrated remote definition declares only the applicable contracts:
Long-running streams and fire-and-observe commands are not automatically tracked-completion mutations. Completion policy follows the user-visible authority of the operation.
Avoid combining remote-intent conversion, persistence, presentation routing, queue ownership, and destructive lifecycle changes in one large PR. Each PR must have one authoritative ownership change and a rollback boundary.
Use the existing framework primitives first:
actor.request();PreparedRequest;OperationRegistry;RemoteSubscriptionLease;KeyedAdmissionGate;useMachineMutation.Add a shared route, checkpoint, or queue abstraction only when at least two
concrete domain implementations establish the common contract. Do not recreate
a monolithic MachineSpec or generic domain controller.
Add a narrow, main-process-only OperationRouteRegistry.
Required behavior:
Do not add scheduler- or observer-timed cleanup. Route lifetime follows the authoritative operation lifetime.
Initial consumers are GitHub operations and version preview. Image generation may adopt the registry later to resolve its missing fallback, but that is not a prerequisite for the remaining migrations.
GitHub operations are the next migration because they resemble the image-generation request model without streaming or checkpoint recovery.
githubOpsDefinition to
defineFrameworkCoveredRemoteMachine.useGithubOps with a domain façade backed by
actor.request().useMachineMutation for completion-aware mutations.KeyedAdmissionGate.OperationRouteRegistry.compatibilityBoundaryInventory.Split version preview into volatile lifecycle and durable-effect PRs.
versionPreviewDefinition to the framework-covered constructor.RemoteSubscriptionLease.OperationRouteRegistry.Exit Phase 3A by removing the version-preview compatibility entries for raw dispatch, bespoke waiters, window-interest maps, presentation maps, and deletion/reset counters. Persistence-related compatibility may remain exact and explicit until Phase 3B.
Pilot the durable checkpoint recipe on version preview:
The guarantee is checkpoint ordering and explicit recovery, not exactly-once external effects or generic compensation. Any new database or file journal gets its own schema and migration review.
Migrate plan handoff after the version-preview volatile lifecycle establishes the remote-intent and checkpoint recipes.
planHandoffDefinition to the framework-covered constructor.startPlanHandoffFromMain as a compatible composition root.Chat is last because streaming, queue ownership, user-input follow-ups, subscriptions, replacement, and destructive deletion interact. Split this work into independently reviewable PRs.
RemoteSubscriptionLease.chatStreamDefinition to the framework-covered constructor.Add a narrow shared queue abstraction only if chat and plan handoff still show the same concrete lifecycle:
Add composition simulations spanning chat streaming, queued prompts, user-input follow-ups, plan handoff, renderer reconnect, and destructive deletion.
After all six distributed definitions are framework-covered:
defineLegacyRemoteMachineCompatibility;Generated renderer bindings, an actor-host representation rewrite, a graphical inspector, and property-based expansion remain optional. Consider them only when later migrations demonstrate concrete leverage.
A migration is complete when:
Use the narrowest test capable of proving each behavior:
Every migration PR should run:
npm test -- <targeted test files>
npm run fmt
npm run lint
npm run ts
If application behavior requires E2E coverage:
npm run build
npm run e2e -- <targeted test>
Do not weaken an inventory or conformance assertion to make a migration pass. Classify retained behavior explicitly and remove the entry in the PR that replaces it.
Each PR removes only the compatibility entries it demonstrably replaces.
The three image-generation issues remain named regression tests and backlog items. Future domains should not copy them:
The framework's settlement is in-process and bounded. This plan makes no crash-safe exactly-once claim. Durable checkpoints, where added, provide ordering and recovery evidence rather than magical external-effect transactions.