interaqt 1.5.5 → 1.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agent/skill/interaqt-migration.md +74 -1
- package/dist/index.js +2496 -2332
- package/dist/index.js.map +1 -1
- package/dist/runtime/Controller.d.ts.map +1 -1
- package/dist/runtime/MonoSystem.d.ts.map +1 -1
- package/dist/runtime/migration.d.ts +50 -1
- package/dist/runtime/migration.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -13,7 +13,7 @@ Phase 1.5 uses a two-step review workflow:
|
|
|
13
13
|
1. Generate a structured diff with `controller.generateMigrationDiff()`.
|
|
14
14
|
2. Review the diff, set `status: "approved"`, add explicit decisions, then execute `controller.migrate({ approvedDiff })`.
|
|
15
15
|
|
|
16
|
-
Migration supports additive schema changes, changed/new computation recompute, downstream propagation, filtered membership rebuild, destructive-scope review,
|
|
16
|
+
Migration supports additive schema changes, changed/new computation recompute, downstream propagation, filtered membership rebuild, destructive-scope review, post-backfill constraint verification, and explicit fact-to-computation takeover.
|
|
17
17
|
|
|
18
18
|
Phase 1.5 does not guess or execute rename/copy/merge/split primitives. Rename candidates may be recorded for review, but compute-route migration will still obey physical layout and destructive-change safety gates.
|
|
19
19
|
|
|
@@ -135,6 +135,22 @@ const approvedDiff = {
|
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
+
if (item.kind === 'computation-takeover') {
|
|
139
|
+
return {
|
|
140
|
+
kind: 'computation-takeover' as const,
|
|
141
|
+
dataContext: item.dataContext,
|
|
142
|
+
computationId: item.computationId,
|
|
143
|
+
targetType: item.targetType,
|
|
144
|
+
previousAuthority: item.previousAuthority,
|
|
145
|
+
nextAuthority: item.nextAuthority,
|
|
146
|
+
oldDataStrategy: item.oldDataStrategy,
|
|
147
|
+
expectedExistingCount: item.expectedExistingCount,
|
|
148
|
+
expectedHostCount: item.expectedHostCount,
|
|
149
|
+
destructiveScopeRef: item.destructiveScopeRef,
|
|
150
|
+
reason: 'legacy fact output may be discarded and rebuilt by computation',
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
138
154
|
return {
|
|
139
155
|
kind: 'destructive-scope' as const,
|
|
140
156
|
dataContext: item.dataContext,
|
|
@@ -217,6 +233,48 @@ New computations must be approved as `changed`.
|
|
|
217
233
|
|
|
218
234
|
---
|
|
219
235
|
|
|
236
|
+
## Fact-to-Computation Takeover
|
|
237
|
+
|
|
238
|
+
Use `computation-takeover` when an existing fact property, entity, or relation becomes controlled by a computation with the same data context.
|
|
239
|
+
|
|
240
|
+
Supported first-phase strategy:
|
|
241
|
+
|
|
242
|
+
```typescript
|
|
243
|
+
{
|
|
244
|
+
kind: 'computation-takeover',
|
|
245
|
+
dataContext: 'property:Ticket.status',
|
|
246
|
+
computationId: 'computation:property:Ticket.status:Custom',
|
|
247
|
+
targetType: 'property',
|
|
248
|
+
previousAuthority: 'fact',
|
|
249
|
+
nextAuthority: 'computation',
|
|
250
|
+
oldDataStrategy: 'discard-and-rebuild',
|
|
251
|
+
expectedExistingCount: 128,
|
|
252
|
+
expectedHostCount: 128,
|
|
253
|
+
reason: 'status is now derived from durable ticket facts',
|
|
254
|
+
}
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
Rules:
|
|
258
|
+
|
|
259
|
+
- Takeover is never implicit. The diff must contain a required `computation-takeover` item and the approved diff must contain the matching decision.
|
|
260
|
+
- The old fact value is discarded as authority. interaqt does not map, merge, rename, copy, or replay old handwritten values.
|
|
261
|
+
- The same computation must also have a `kind: 'computation'` decision with `decision: 'changed'`.
|
|
262
|
+
- Property takeover recomputes every host record, including hosts whose old value was `null` or missing.
|
|
263
|
+
- Property `ComputationResult.skip()` means `null` only for nullable properties. It fails for non-null properties instead of preserving old handwritten data.
|
|
264
|
+
- Entity and relation takeover additionally require a matching `destructive-scope` decision with exact ids. Execution re-reads the ids and fails if they changed after review.
|
|
265
|
+
- Entity and relation output migration is still limited to data-based `Transform` outputs with stable `sourceRecordId` and `transformIndex` state. Non-`Transform` output computations remain blocked.
|
|
266
|
+
- `StateMachine` property takeover is blocked in this phase because bound state cannot yet be rebuilt consistently from old fact values.
|
|
267
|
+
|
|
268
|
+
Review checklist for takeover:
|
|
269
|
+
|
|
270
|
+
- Confirm the target really changed from fact authority to computation authority.
|
|
271
|
+
- Confirm the old data may be discarded.
|
|
272
|
+
- Confirm `expectedExistingCount` and, for properties, `expectedHostCount`.
|
|
273
|
+
- For entity/relation takeover, inspect and approve the exact destructive ids.
|
|
274
|
+
- Run dry-run after approval; do not reuse a stale approval if counts or ids changed.
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
220
278
|
## Event and Async Handlers
|
|
221
279
|
|
|
222
280
|
Event-based computations without full compute support require external rebuild handlers.
|
|
@@ -263,6 +321,7 @@ Approved diff cannot bypass core safety gates:
|
|
|
263
321
|
- Fact physical path moves remain blocked.
|
|
264
322
|
- Fact destructive schema changes remain blocked.
|
|
265
323
|
- Entity/relation output replacement still needs previous manifest ownership proof.
|
|
324
|
+
- Fact-to-computation takeover requires explicit `computation-takeover` approval and, for entity/relation targets, exact destructive-scope approval.
|
|
266
325
|
- Async computations require an approved async completion decision and runtime handler.
|
|
267
326
|
- Event-based computations without full compute require an approved event rebuild decision and runtime handler.
|
|
268
327
|
- Destructive computed output requires exact approved ids.
|
|
@@ -333,6 +392,18 @@ A fact record/property/relation moved physical storage location. Phase 1.5 will
|
|
|
333
392
|
|
|
334
393
|
Migration would delete computed output or host records. Inspect `diff.safety.destructiveScopes` and dry-run `deletionScope`, then approve exact ids only when intended.
|
|
335
394
|
|
|
395
|
+
### `Migration computation takeover requires an approved changed computation decision`
|
|
396
|
+
|
|
397
|
+
A takeover decision only authorizes discarding old fact output. It does not replace the normal computation review decision. Add a matching `kind: 'computation'` decision with `decision: 'changed'`.
|
|
398
|
+
|
|
399
|
+
### `Computation takeover count mismatch` / `host count mismatch` / `destructive scope mismatch`
|
|
400
|
+
|
|
401
|
+
The database changed after the diff was reviewed. Generate a fresh diff, review the new counts or ids, and approve again.
|
|
402
|
+
|
|
403
|
+
### `StateMachine computation takeover requires a state rebuild handler`
|
|
404
|
+
|
|
405
|
+
This phase does not support converting handwritten properties to `StateMachine` control because bound state cannot yet be rebuilt safely.
|
|
406
|
+
|
|
336
407
|
---
|
|
337
408
|
|
|
338
409
|
## Safe Migration Checklist
|
|
@@ -340,6 +411,8 @@ Migration would delete computed output or host records. Inspect `diff.safety.des
|
|
|
340
411
|
- [ ] Run `controller.generateMigrationDiff({ includeDestructiveScope: true })`.
|
|
341
412
|
- [ ] Review logical model changes, storage changes, function hashes/text, required decisions, and safety output.
|
|
342
413
|
- [ ] Add one explicit decision for every required decision.
|
|
414
|
+
- [ ] For fact-to-computation takeover, approve both `computation-takeover` and the matching `computation: changed` decision.
|
|
415
|
+
- [ ] For entity/relation takeover, approve the exact destructive ids and rerun dry-run if the database changed.
|
|
343
416
|
- [ ] Provide runtime handlers for event rebuild and async completion decisions.
|
|
344
417
|
- [ ] Run `controller.migrate({ approvedDiff, dryRun: true, handlers })`.
|
|
345
418
|
- [ ] Confirm `blockingChanges` is empty and `rebuildPlan` is expected.
|