Skip to content

Commit 3596581

Browse files
V48: Finish settle ownership outside synthesis
Remove settlement-rights build from synthesis preprocess. Document exclusive settle pipeline ownership. Synthesis paths never invoke settle/delivery builders.
1 parent c3a57d6 commit 3596581

5 files changed

Lines changed: 84 additions & 55 deletions

File tree

packages/asset-packs-pipelines/domain/README.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
# AssetPack Pipeline
1+
# AssetPack Pipeline Domain
22

3-
Canonical package owner for the Bitcode phased pipeline corridor.
4-
This package turns a measured Bitcode Read into AssetPack synthesis artifacts,
5-
Exchange-stored AssetPack evidence, and optional connected-interface
6-
delivery-mechanism artifacts.
3+
Canonical package owner for **AssetPack synthesis** (deposit + read SDIVF) and
4+
shared measurement/selection primitives.
5+
6+
**Settlement and buyer-repo delivery are not this package’s product algorithm.**
7+
They are exclusive to `execution-pipeline-simple-settle-asset-pack`. See
8+
[`src/SETTLEMENT_BOUNDARY.md`](src/SETTLEMENT_BOUNDARY.md).
9+
10+
Synthesis terminals: **selection envelopes / options** for `/deposits` or
11+
`/reads` — never `settleDelivery` / shippable PR.
712

813
Active route and payload seams use Bitcode nouns: `definitionOfRead`, `read`,
9-
`writtenAssetType`, `writtenAssets`, `Finish`, `Delivering`, and `SDIVF`.
10-
Compatibility payload keys are subordinate mirrors and do not define product
11-
semantics.
14+
`writtenAssetType`, `writtenAssets`, `selectionEnvelope`, and `SDIVF`.
1215

1316
## SDIVF Shape
1417

@@ -17,7 +20,7 @@ semantics.
1720
3. **Discovery** - source-grounded research, codebase search, file selection, and approach planning.
1821
4. **Implementation** - AssetPack synthesis artifacts using Divide, Apply, and Correct agents.
1922
5. **Validation** - Read satisfaction, proof posture, and readiness-to-Finish checks.
20-
6. **Finish** - save result state, summarize AssetPack evidence, and run Delivering when requested.
23+
6. **Finish** - store artifacts, ledgerize, emit selection envelope (options for deposit or read UI). **No settle / no buyer-repo PR.**
2124

2225
The `Discovery -> Implementation -> Validation` loop may iterate up to the
2326
configured limit before Finish.
@@ -42,8 +45,8 @@ AssetPackPipeline (SDIVF with DIV iteration)
4245
│ └── Validation
4346
└── Finish
4447
├── Save AssetPack synthesis artifacts and Exchange evidence
45-
├── Produce AssetPack completion summary
46-
└── Deliver AssetPacks or AssetPackPartials to connected destinations
48+
├── Produce selection envelope / options for UI
49+
└── (Settlement + buyer PR only on settle-asset-pack-pipeline — separate run)
4750
```
4851

4952
## Usage
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Settlement / delivery ownership law
2+
3+
## Exclusive owner
4+
5+
**`execution-pipeline-simple-settle-asset-pack`** (settle-asset-pack-pipeline) is the
6+
**only** product pipeline that may:
7+
8+
- Observe BTC payment / finality
9+
- Build settlement rights / BTD unlock
10+
- Open or record buyer-repo **shippable** PRs
11+
- Emit **`settleDelivery`**, **`shippable`**, delivery unlock, settlement replay
12+
13+
## Synthesis (deposit + read SDIVF)
14+
15+
`execution-pipeline-sdivf-synthesize-deposits-asset-packs` and
16+
`execution-pipeline-sdivf-synthesize-reads-asset-packs` (and shared synthesis
17+
postprocess/Finish) **must not**:
18+
19+
| Forbidden on synthesis | OK on synthesis |
20+
| --- | --- |
21+
| `settleDelivery` | `selectionEnvelope` / `options` |
22+
| `shippable` / buyer PR URL | `assetPackSynthesisArtifacts` |
23+
| Settlement rights delivery boundary | Source-safe **preview** / fee quote (selection UI) |
24+
| Delivery unlock after payment | `deliveryMechanismTemplate` (catalog only) |
25+
| Kind `settle_delivery` | Kind `deposit_options` / `read_options` / `asset_pack_synthesis` |
26+
27+
## Shared library modules
28+
29+
`asset-pack-settlement-rights-delivery.ts` (and related BTD/BTC statement helpers)
30+
live under `domain` as a **library** for the settle pipeline and host settle
31+
staging. They are **not** part of the synthesis algorithm.
32+
33+
- **May import:** settle pipeline, host settle path after purchase
34+
- **Must not import/call from:** synthesis preprocess, synthesis postprocess,
35+
deposit/read Finish agents, deposit/read phase runners
36+
37+
## Hand-off
38+
39+
Read synthesis finishes with options for `/reads` selection and
40+
`nextPipeline: settle-asset-pack-pipeline`.
41+
Deposit synthesis finishes with options for `/deposits` review.
42+
**A separate settle run** performs payment + delivery.

packages/asset-packs-pipelines/domain/src/index.ts

Lines changed: 21 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
/**
2-
* AssetPack Pipeline
2+
* AssetPack domain library for **synthesis** SDIVF product pipelines
3+
* (deposit + read) and shared measurement/selection primitives.
34
*
4-
* Bitcode SDIVF pipeline runs (Setup → Discovery → Implementation → Validation
5-
* → Finish) that satisfy Reads, synthesize AssetPack artifacts and Exchange
6-
* evidence, and use Finish-phase Delivering only for connected-interface
7-
* delivery.
5+
* Settlement / buyer-repo delivery / shippable PR are **not** synthesis work.
6+
* They are exclusive to `execution-pipeline-simple-settle-asset-pack`.
7+
* Modules such as `asset-pack-settlement-rights-delivery` remain in this package
8+
* only as a library for the settle pipeline / host settle path — synthesis
9+
* preprocess/postprocess/Finish must never invoke or project them.
810
*/
911

1012
import { Executor, Execution } from '@bitcode/execution-generics';
@@ -34,10 +36,7 @@ import {
3436
buildAssetPackPreviewBoundary,
3537
persistAssetPackPreviewBoundary,
3638
} from './asset-pack-preview-boundary';
37-
import {
38-
buildAssetPackSettlementRightsDeliveryBoundary,
39-
persistAssetPackSettlementRightsDeliveryBoundary,
40-
} from './asset-pack-settlement-rights-delivery';
39+
// Intentionally no settlement-rights import for synthesis preprocess.
4140
import {
4241
buildReadingOperationalTelemetryRepairReadback,
4342
persistReadingOperationalTelemetryRepairReadback,
@@ -306,29 +305,15 @@ function factoryPreprocess(): Executor<any, any> {
306305
processedInput.sourceSafePreview = assetPackPreviewBoundary.sourceSafePreview;
307306
processedInput.assetPackPreviewBoundary = assetPackPreviewBoundary;
308307
processedInput.assetPackQuoteReceipt = assetPackPreviewBoundary.quoteReceipt;
309-
const suppliedSettlement =
310-
processedInput?.settlementObservation ||
311-
processedInput?.paymentObservation ||
312-
processedInput?.btcPaymentObservation ||
313-
null;
314-
if (suppliedSettlement) {
315-
const settlementBoundary = buildAssetPackSettlementRightsDeliveryBoundary({
316-
previewBoundary: assetPackPreviewBoundary,
317-
paymentObservation: suppliedSettlement,
318-
finality: processedInput?.settlementFinality || processedInput?.btcFinality || undefined,
319-
readerWalletId: processedInput?.readerWalletId || null,
320-
depositorWalletId: processedInput?.depositorWalletId || null,
321-
pullRequestTarget: processedInput?.deliveryTarget || null,
322-
});
323-
persistAssetPackSettlementRightsDeliveryBoundary(execution, settlementBoundary);
324-
persistAssetPackSettlementRightsDeliveryBoundary(execution.parent as any, settlementBoundary);
325-
processedInput.assetPackSettlementRightsDeliveryBoundary = settlementBoundary;
326-
processedInput.assetPackSettlementReplayReceipt = settlementBoundary.replayReceipt;
327-
processedInput.assetPackDeliveryUnlock = settlementBoundary.deliveryUnlock;
328-
}
308+
// Never build settlement rights / delivery unlock during synthesis preprocess.
309+
// Payment observation + PR unlock belong exclusively to settle-asset-pack-pipeline.
310+
delete processedInput.assetPackSettlementRightsDeliveryBoundary;
311+
delete processedInput.assetPackSettlementReplayReceipt;
312+
delete processedInput.assetPackDeliveryUnlock;
329313
}
330314
} catch {}
331315
try {
316+
// settlementBoundary always null on synthesis preprocess path.
332317
const operationalReadback = buildReadingOperationalTelemetryRepairReadback({
333318
runId: String(execution.id || processedInput?.transactionId || processedInput?.id || ''),
334319
readNeedRuntime:
@@ -346,11 +331,7 @@ function factoryPreprocess(): Executor<any, any> {
346331
(execution.get('asset-pack/preview', 'boundary') as any) ||
347332
((execution.parent as any)?.get?.('asset-pack/preview', 'boundary') as any) ||
348333
null,
349-
settlementBoundary:
350-
processedInput?.assetPackSettlementRightsDeliveryBoundary ||
351-
(execution.get('asset-pack/settlement', 'boundary') as any) ||
352-
((execution.parent as any)?.get?.('asset-pack/settlement', 'boundary') as any) ||
353-
null,
334+
settlementBoundary: null,
354335
createdAt: new Date().toISOString(),
355336
});
356337
persistReadingOperationalTelemetryRepairReadback(execution, operationalReadback);
@@ -375,11 +356,7 @@ function factoryPreprocess(): Executor<any, any> {
375356
(execution.get('asset-pack/preview', 'boundary') as any) ||
376357
((execution.parent as any)?.get?.('asset-pack/preview', 'boundary') as any) ||
377358
null,
378-
settlementBoundary:
379-
processedInput?.assetPackSettlementRightsDeliveryBoundary ||
380-
(execution.get('asset-pack/settlement', 'boundary') as any) ||
381-
((execution.parent as any)?.get?.('asset-pack/settlement', 'boundary') as any) ||
382-
null,
359+
settlementBoundary: null,
383360
operationalReadback,
384361
});
385362
persistReadingInterfaceProductParity(execution, interfaceParity);
@@ -409,11 +386,7 @@ function factoryPreprocess(): Executor<any, any> {
409386
(execution.get('asset-pack/preview', 'boundary') as any) ||
410387
((execution.parent as any)?.get?.('asset-pack/preview', 'boundary') as any) ||
411388
null,
412-
settlementBoundary:
413-
processedInput?.assetPackSettlementRightsDeliveryBoundary ||
414-
(execution.get('asset-pack/settlement', 'boundary') as any) ||
415-
((execution.parent as any)?.get?.('asset-pack/settlement', 'boundary') as any) ||
416-
null,
389+
settlementBoundary: null,
417390
operationalReadback,
418391
interfaceParity,
419392
});
@@ -664,6 +637,10 @@ export * from './depository-search';
664637
export * from './depository-supply-index';
665638
export * from './read-fits-finding-runtime';
666639
export * from './asset-pack-preview-boundary';
640+
/**
641+
* Settle-pipeline library only (rights unlock / delivery after payment).
642+
* Synthesis deposit/read SDIVF must not call these builders or project their results.
643+
*/
667644
export * from './asset-pack-settlement-rights-delivery';
668645
export * from './reading-operational-telemetry-repair-readback';
669646
export * from './reading-interface-product-parity';

packages/asset-packs-pipelines/execution-pipeline-sdivf-synthesize-deposits-asset-packs/src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
*
1010
* Depositor supplies a repository; pipeline synthesizes DepositSynthesizedAssetPack
1111
* options for Depository review/admission. Not mode/lens-parameterized.
12+
*
13+
* Settlement / buyer-repo delivery / settleDelivery are **not** this pipeline —
14+
* see settle-asset-pack-pipeline (ExecutionPipelineSimpleSettleAssetPack).
1215
*/
1316

1417
import type { Execution } from '@bitcode/execution-generics';

packages/asset-packs-pipelines/execution-pipeline-simple-settle-asset-pack/src/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
*
44
* Product pipeline name: **settle-asset-pack-pipeline** (singular AssetPack).
55
*
6+
* **Exclusive owner** of settlement and buyer-repo delivery: BTC payment,
7+
* BTD rights, shippable PR, settleDelivery. Synthesis deposit/read SDIVF
8+
* pipelines must not author those surfaces (see domain SETTLEMENT_BOUNDARY.md).
9+
*
610
* Hierarchy (left→right): Execution → Pipeline → Simple → SettleAssetPack
711
* factoryExecutionPipelineSimpleSettleAssetPack
812
* → ExecutionPipelineSimpleSettleAssetPack

0 commit comments

Comments
 (0)