@git-stunts/git-cas 6.5.8 → 6.5.10
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/ARCHITECTURE.md +11 -0
- package/CHANGELOG.md +46 -0
- package/GUIDE.md +30 -0
- package/README.md +14 -6
- package/UPGRADING.md +77 -0
- package/build-info.json +2 -2
- package/docs/API.md +49 -0
- package/docs/releases/v6.5.10.md +117 -0
- package/docs/releases/v6.5.9.md +119 -0
- package/index.d.ts +31 -0
- package/index.js +4 -0
- package/package.json +3 -1
- package/src/domain/services/AssetService.js +5 -0
- package/src/domain/services/BundleService.js +9 -9
- package/src/domain/services/PageService.js +10 -1
- package/src/domain/services/StagingWorkspace.js +75 -14
- package/src/domain/services/StagingWorkspaceRegistry.js +9 -4
- package/src/domain/services/WorkspaceCompoundAdmission.js +136 -0
- package/src/domain/services/WorkspaceCompoundScope.js +212 -0
- package/src/package-version.js +1 -1
package/ARCHITECTURE.md
CHANGED
|
@@ -182,6 +182,17 @@ The facade is orchestration glue. It is not the storage engine itself.
|
|
|
182
182
|
bundles build deterministic bounded-fanout trees and support targeted member
|
|
183
183
|
traversal without hydrating the complete structure.
|
|
184
184
|
|
|
185
|
+
- **`StagingWorkspaceRegistry` and `StagingWorkspace`** — own renewable
|
|
186
|
+
temporary RootSet generations for multi-step application construction.
|
|
187
|
+
`WorkspaceCompoundAdmission` and `WorkspaceCompoundScope` serialize an
|
|
188
|
+
explicitly bounded sequence of provisional asset, page, and bundle batches
|
|
189
|
+
through one operation-owned persistence view. Compound calls retain all new
|
|
190
|
+
targets by default or canonically validate an exact nonempty selection of
|
|
191
|
+
handles staged by that call, then install those selected roots together with
|
|
192
|
+
every prior workspace target in one exact generation. Existing workspace
|
|
193
|
+
methods retain each result independently and remain the boundary when a
|
|
194
|
+
handle leaves private construction code before later writes begin.
|
|
195
|
+
|
|
185
196
|
- **`RetentionService` and `PublicationService`** — validate complete handle
|
|
186
197
|
graphs, then either retain them in a RootSet with generation-scoped evidence
|
|
187
198
|
or publish them atomically under an allowlisted application ref.
|
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,52 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [6.5.10] — 2026-08-24
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **Compound asset admission and exact terminal roots** -
|
|
15
|
+
`workspace.batch()` now exposes bounded `scope.assets.putBatch()` alongside
|
|
16
|
+
page and ordered-bundle waves. An optional synchronous `retain(value)`
|
|
17
|
+
selector can retain a nonempty, canonical, deduplicated subset of handles
|
|
18
|
+
staged by that exact call while preserving every prior workspace root.
|
|
19
|
+
Malformed, asynchronous, empty, oversized, lookalike, and
|
|
20
|
+
valid-but-unstaged selections fail before ref movement. Omitting the selector
|
|
21
|
+
preserves v6.5.9 retain-all behavior.
|
|
22
|
+
|
|
23
|
+
### Performance
|
|
24
|
+
|
|
25
|
+
- **One admission for payload-to-terminal graphs** - replay and provenance
|
|
26
|
+
assets can share the compound persistence scope and final workspace
|
|
27
|
+
installation with their support bundles, descriptor, and terminal bundle.
|
|
28
|
+
In the downstream controlled 65-node/65-patch git-warp prototype, cold Git
|
|
29
|
+
commands fell from 139 to 50 and median wall time from 2.823 s to 1.329 s;
|
|
30
|
+
incremental commands fell from 149 to 60 and median wall time from 3.040 s to
|
|
31
|
+
1.387 s. Semantic fingerprints, cache posture, replay counts, storage
|
|
32
|
+
formats, handles, and the 25-command warm read path remained unchanged.
|
|
33
|
+
|
|
34
|
+
## [6.5.9] — 2026-08-24
|
|
35
|
+
|
|
36
|
+
### Added
|
|
37
|
+
|
|
38
|
+
- **Compound staging-workspace admission** - `workspace.batch()` runs an
|
|
39
|
+
explicitly operation-bounded sequence of dependent page and ordered-bundle
|
|
40
|
+
batches through one private persistence scope, then returns the callback
|
|
41
|
+
value only after one exact workspace generation retains every staged handle.
|
|
42
|
+
Scope calls serialize by invocation order, return frozen handle arrays, stop
|
|
43
|
+
queued work after failure, and preserve the prior generation on refusal.
|
|
44
|
+
|
|
45
|
+
### Performance
|
|
46
|
+
|
|
47
|
+
- **One retained generation for dependent write waves** - a clean five-sample
|
|
48
|
+
SHA-1/SHA-256 witness reduced a 33-operation, 81-handle graph from 200 to 23
|
|
49
|
+
Git child processes and from 33 workspace commits and checked ref updates to
|
|
50
|
+
one, with identical application-handle digests. Median wall time fell by
|
|
51
|
+
80.5% on the measured host. Compound admission changes workspace-ref update
|
|
52
|
+
frequency, while object bytes, handle identity, ref layout and namespaces,
|
|
53
|
+
readers, and existing independently retained workspace methods remain
|
|
54
|
+
compatible.
|
|
55
|
+
|
|
10
56
|
## [6.5.8] — 2026-08-23
|
|
11
57
|
|
|
12
58
|
### Added
|
package/GUIDE.md
CHANGED
|
@@ -202,6 +202,36 @@ no partial result array on failure. Higher `maxBatchAssets` values can reduce
|
|
|
202
202
|
protocol round trips when the caller can afford more simultaneously live
|
|
203
203
|
source pipelines; the default remains four.
|
|
204
204
|
|
|
205
|
+
When later bundle waves depend on handles created by earlier waves, keep the
|
|
206
|
+
intermediate handles inside one compound staging-workspace operation:
|
|
207
|
+
|
|
208
|
+
```js
|
|
209
|
+
const admitted = await workspace.batch({
|
|
210
|
+
maxOperations: 4,
|
|
211
|
+
operation: async (scope) => {
|
|
212
|
+
const assets = await scope.assets.putBatch({ assets: assetRequests });
|
|
213
|
+
const pages = await scope.pages.putBatch({ pages: pageRequests });
|
|
214
|
+
const leaves = await scope.bundles.putOrderedBatch({
|
|
215
|
+
bundles: leafRequests(assets, pages),
|
|
216
|
+
});
|
|
217
|
+
return (await scope.bundles.putOrderedBatch({
|
|
218
|
+
bundles: [rootRequest(leaves)],
|
|
219
|
+
}))[0];
|
|
220
|
+
},
|
|
221
|
+
retain: (terminal) => [terminal],
|
|
222
|
+
});
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
`admitted.value` becomes caller-visible only with `admitted.retention`, after
|
|
226
|
+
one exact workspace generation anchors the selected terminal plus every root
|
|
227
|
+
retained before the compound call. Omit `retain` to preserve the retain-all
|
|
228
|
+
behavior. A selector must synchronously return at least one canonical handle
|
|
229
|
+
staged by that exact callback; it cannot import another operation's handle or
|
|
230
|
+
remove a prior workspace root. The default operation ceiling is 64 and the hard
|
|
231
|
+
ceiling is 1,024; each scope call also preserves its ordinary asset, page, or
|
|
232
|
+
bundle batch bounds. Use the existing independently retained workspace methods
|
|
233
|
+
when intermediate handles must leave the private callback.
|
|
234
|
+
|
|
205
235
|
Repeated `pages.get()` calls reuse immutable payload reads within the store's
|
|
206
236
|
bounded page cache. The defaults retain at most 128 payloads and 8 MiB; use
|
|
207
237
|
`pageCacheEntries` and `pageCacheBytes` to tune that ceiling. Every result is a
|
package/README.md
CHANGED
|
@@ -41,8 +41,10 @@ Unlike traditional LFS which moves files to external servers, `git-cas` treats t
|
|
|
41
41
|
blob reads at or below a fixed 10 MiB ceiling use one bounded session read;
|
|
42
42
|
larger payloads retain the genuine one-shot streaming path. Explicitly
|
|
43
43
|
bounded page, asset, and ordered-bundle batches pipeline independent Git
|
|
44
|
-
writes
|
|
45
|
-
|
|
44
|
+
writes. `workspace.batch()` can compose dependent asset, page, and bundle
|
|
45
|
+
waves in one private persistence scope and either retain their union or an
|
|
46
|
+
explicitly selected set of newly staged terminal roots under one exact final
|
|
47
|
+
generation without changing content identity.
|
|
46
48
|
- **Key Lifecycle**: Envelope encryption separates DEKs from KEKs. Rotate passphrases across an entire vault without re-encrypting data blobs. Privacy mode HMAC-hashes slug names to prevent metadata discovery.
|
|
47
49
|
- **Runtime-Adaptive**: A single core supports Node.js 22+, Bun, and Deno through a strict hexagonal port architecture with runtime-specific crypto adapters.
|
|
48
50
|
|
|
@@ -51,7 +53,7 @@ Unlike traditional LFS which moves files to external servers, `git-cas` treats t
|
|
|
51
53
|
Existing v5 users should read [UPGRADING.md](./UPGRADING.md) and run
|
|
52
54
|
`npm run upgrade` in dry-run mode before restoring old encrypted vault entries.
|
|
53
55
|
For the release overview, see the
|
|
54
|
-
[v6.5.
|
|
56
|
+
[v6.5.10 Release Notes](./docs/releases/v6.5.10.md).
|
|
55
57
|
|
|
56
58
|
### 1. CLI Usage
|
|
57
59
|
|
|
@@ -157,9 +159,11 @@ Core capabilities:
|
|
|
157
159
|
compare-and-swap refs, and immutable lifecycle evidence.
|
|
158
160
|
- **Scoped staging workspaces**: `workspaces.open()` mirrors application writes
|
|
159
161
|
behind one renewable temporary RootSet, supports one-generation bounded
|
|
160
|
-
asset/page/bundle batches
|
|
161
|
-
|
|
162
|
-
|
|
162
|
+
asset/page/bundle batches plus compound dependent asset/page/bundle admission
|
|
163
|
+
with exact newly staged terminal-root selection,
|
|
164
|
+
returns only after each public result is anchored, promotes destination-first,
|
|
165
|
+
and exposes bounded age, expiry, logical-content, and direct-root diagnostics
|
|
166
|
+
with opaque cleanup pagination.
|
|
163
167
|
- **Envelope recipients**: multi-recipient key wrapping and recipient rotation
|
|
164
168
|
avoid re-encrypting data blobs.
|
|
165
169
|
- **Operational diagnostics**: `cas.diagnostics.doctor()` streams repository
|
|
@@ -236,6 +240,10 @@ All three runtimes are tested in CI on every push. The hexagonal architecture is
|
|
|
236
240
|
sessions for small streaming blob reads while large payloads remain streamed.
|
|
237
241
|
- **[v6.5.8 Release Notes](./docs/releases/v6.5.8.md)**: Bounded application
|
|
238
242
|
write waves, one-generation workspace batches, and reusable ref sessions.
|
|
243
|
+
- **[v6.5.9 Release Notes](./docs/releases/v6.5.9.md)**: Compound dependent
|
|
244
|
+
write waves retained under one exact staging-workspace generation.
|
|
245
|
+
- **[v6.5.10 Release Notes](./docs/releases/v6.5.10.md)**: Compound asset,
|
|
246
|
+
page, and bundle admission with exact selected terminal roots.
|
|
239
247
|
- **[Upgrading](./UPGRADING.md)**: Migration guide for v5 → v6.
|
|
240
248
|
- **[Changelog](./CHANGELOG.md)**: Version history and migration notes.
|
|
241
249
|
|
package/UPGRADING.md
CHANGED
|
@@ -2,6 +2,83 @@
|
|
|
2
2
|
|
|
3
3
|
v6.0.0 is a major release that simplifies the encryption model, hardens security defaults, and cleans up the architecture. This guide covers every breaking change and what you need to do.
|
|
4
4
|
|
|
5
|
+
## v6.5.9 To v6.5.10
|
|
6
|
+
|
|
7
|
+
v6.5.10 adds compound asset admission and exact terminal-root selection and
|
|
8
|
+
requires no application or stored-data migration. Existing object bytes,
|
|
9
|
+
handles, descriptors, workspace generations, ref layouts, readers, and
|
|
10
|
+
retain-all compound calls remain compatible. Existing repositories open in
|
|
11
|
+
place.
|
|
12
|
+
|
|
13
|
+
Compound callbacks may now stage bounded asset batches alongside pages and
|
|
14
|
+
ordered bundles. An optional synchronous selector can retain only terminal
|
|
15
|
+
handles staged by that exact callback:
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
const admitted = await workspace.batch({
|
|
19
|
+
maxOperations: 4,
|
|
20
|
+
operation: async (scope) => {
|
|
21
|
+
const assets = await scope.assets.putBatch({ assets: assetRequests });
|
|
22
|
+
const pages = await scope.pages.putBatch({ pages: pageRequests });
|
|
23
|
+
const leaves = await scope.bundles.putOrderedBatch({
|
|
24
|
+
bundles: leafRequests(assets, pages),
|
|
25
|
+
});
|
|
26
|
+
return (
|
|
27
|
+
await scope.bundles.putOrderedBatch({
|
|
28
|
+
bundles: [rootRequest(leaves)],
|
|
29
|
+
})
|
|
30
|
+
)[0];
|
|
31
|
+
},
|
|
32
|
+
retain: (terminal) => [terminal],
|
|
33
|
+
});
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The selector must return a nonempty array of canonical handles staged by the
|
|
37
|
+
same admission. It is bounded by that admission's staged-artifact count,
|
|
38
|
+
deduplicates repeated handles in stable order, and cannot remove roots retained
|
|
39
|
+
before the call. Omit `retain` to preserve v6.5.9 retain-all behavior.
|
|
40
|
+
|
|
41
|
+
## v6.5.8 To v6.5.9
|
|
42
|
+
|
|
43
|
+
v6.5.9 adds `workspace.batch()` and requires no application or stored-data
|
|
44
|
+
migration. Existing handles, object bytes, workspace descriptors, ref
|
|
45
|
+
namespaces, retention witnesses, read paths, and independently retained
|
|
46
|
+
workspace methods remain compatible. Existing repositories open in place.
|
|
47
|
+
|
|
48
|
+
Use the new method only when intermediate page and bundle handles remain
|
|
49
|
+
private to one bounded construction:
|
|
50
|
+
|
|
51
|
+
```js
|
|
52
|
+
const admitted = await workspace.batch({
|
|
53
|
+
maxOperations: 3,
|
|
54
|
+
operation: async (scope) => {
|
|
55
|
+
const pages = await scope.pages.putBatch({ pages: pageRequests });
|
|
56
|
+
const leaves = await scope.bundles.putOrderedBatch({
|
|
57
|
+
bundles: buildLeafRequests(pages),
|
|
58
|
+
});
|
|
59
|
+
return (
|
|
60
|
+
await scope.bundles.putOrderedBatch({
|
|
61
|
+
bundles: [buildRootRequest(leaves)],
|
|
62
|
+
})
|
|
63
|
+
)[0];
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
admitted.value; // retained root BundleHandle
|
|
68
|
+
admitted.retention; // exact final workspace generation and witnesses
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The operation defaults to at most 64 scope calls and cannot exceed 1,024.
|
|
72
|
+
Every page or bundle call retains its existing count, object, member, and byte
|
|
73
|
+
bounds. A callback or staged-write failure publishes no compound generation;
|
|
74
|
+
immutable objects written before failure remain unreachable for Git's normal
|
|
75
|
+
reclamation. Use the existing workspace methods when a handle must become
|
|
76
|
+
independently retained before arbitrary caller code observes it.
|
|
77
|
+
|
|
78
|
+
The release changes physical admission cost only. It does not introduce a new
|
|
79
|
+
transaction format, migration command, authority cutover, or mixed-version
|
|
80
|
+
rewrite.
|
|
81
|
+
|
|
5
82
|
## v6.5.7 To v6.5.8
|
|
6
83
|
|
|
7
84
|
v6.5.8 adds bounded application-write batches and requires no application or
|
package/build-info.json
CHANGED
package/docs/API.md
CHANGED
|
@@ -1436,6 +1436,55 @@ await workspace.bundles.putOrdered(options);
|
|
|
1436
1436
|
await workspace.bundles.putOrderedBatch(options);
|
|
1437
1437
|
```
|
|
1438
1438
|
|
|
1439
|
+
Dependent page and bundle waves can instead share one bounded compound
|
|
1440
|
+
admission:
|
|
1441
|
+
|
|
1442
|
+
```javascript
|
|
1443
|
+
const admitted = await workspace.batch({
|
|
1444
|
+
maxOperations: 3,
|
|
1445
|
+
operation: async (scope) => {
|
|
1446
|
+
const pages = await scope.pages.putBatch({ pages: pageRequests });
|
|
1447
|
+
const leaves = await scope.bundles.putOrderedBatch({
|
|
1448
|
+
bundles: buildLeafRequests(pages),
|
|
1449
|
+
});
|
|
1450
|
+
return (await scope.bundles.putOrderedBatch({
|
|
1451
|
+
bundles: [buildRootRequest(leaves)],
|
|
1452
|
+
}))[0];
|
|
1453
|
+
},
|
|
1454
|
+
});
|
|
1455
|
+
|
|
1456
|
+
admitted.value; // BundleHandle returned by the callback
|
|
1457
|
+
admitted.retention; // exact WorkspaceCheckpointResult
|
|
1458
|
+
```
|
|
1459
|
+
|
|
1460
|
+
`batch({ operation, maxOperations })` calls `operation` exactly once. Its scope
|
|
1461
|
+
exposes only `pages.putBatch()` and `bundles.putOrderedBatch()`. Both methods
|
|
1462
|
+
retain their existing per-call limits and validation, serialize by invocation
|
|
1463
|
+
order, and return frozen arrays of provisional handles rather than staged
|
|
1464
|
+
result objects. The operation defaults to at most 64 scope calls and rejects a
|
|
1465
|
+
limit above the exported hard maximum of 1,024.
|
|
1466
|
+
|
|
1467
|
+
Success installs the union of previously retained targets and every compound
|
|
1468
|
+
target in one exact workspace generation. The returned `value` is the callback
|
|
1469
|
+
value; it becomes caller-visible only after scoped Git resources close and the
|
|
1470
|
+
paired `retention` result proves the final generation. The scope closes before
|
|
1471
|
+
the outer promise settles. Calling an escaped scope later fails with
|
|
1472
|
+
`WORKSPACE_STATE_INVALID`.
|
|
1473
|
+
|
|
1474
|
+
The callback is trusted application code, not a JavaScript capability sandbox.
|
|
1475
|
+
The API cannot prevent a callback from assigning a provisional handle into
|
|
1476
|
+
external state as a side effect. Such a handle has no compound retention
|
|
1477
|
+
witness and must not be used outside the callback. Only the settled outer
|
|
1478
|
+
result carries the admission guarantee.
|
|
1479
|
+
|
|
1480
|
+
An empty operation, invalid bound, callback failure, staged-write failure,
|
|
1481
|
+
session-close failure, or final checked-ref failure returns no admitted value.
|
|
1482
|
+
Queued work stops after the first failure, the prior workspace generation does
|
|
1483
|
+
not move, and distinct callback/write or operation/close failures remain
|
|
1484
|
+
available through `AggregateError`. Immutable objects written before refusal
|
|
1485
|
+
may remain unreachable for Git's ordinary reclamation. Compound admission is
|
|
1486
|
+
not a cross-workspace, cross-ref, or arbitrary application transaction.
|
|
1487
|
+
|
|
1439
1488
|
Each method returns only after a direct workspace generation reaches the
|
|
1440
1489
|
returned typed handle. The result is otherwise the ordinary staged result plus
|
|
1441
1490
|
a workspace `RetentionWitness`. Calls on one workspace serialize their ref
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# git-cas v6.5.10 Release Notes
|
|
2
|
+
|
|
3
|
+
v6.5.10 completes bounded compound staging-workspace admission by adding asset
|
|
4
|
+
waves and exact selected terminal roots. Applications can stage replay or
|
|
5
|
+
provenance payloads, pages, support bundles, descriptors, and one terminal
|
|
6
|
+
bundle through a shared persistence scope, then publish one exact workspace
|
|
7
|
+
generation without retaining every construction intermediate as a direct root.
|
|
8
|
+
|
|
9
|
+
## Compound Assets And Exact Roots
|
|
10
|
+
|
|
11
|
+
`workspace.batch()` now exposes the existing bounded asset-batch contract on
|
|
12
|
+
its private scope:
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
const admitted = await workspace.batch({
|
|
16
|
+
maxOperations: 4,
|
|
17
|
+
operation: async (scope) => {
|
|
18
|
+
const assets = await scope.assets.putBatch({ assets: assetRequests });
|
|
19
|
+
const pages = await scope.pages.putBatch({ pages: pageRequests });
|
|
20
|
+
const leaves = await scope.bundles.putOrderedBatch({
|
|
21
|
+
bundles: leafRequests(assets, pages),
|
|
22
|
+
});
|
|
23
|
+
return (
|
|
24
|
+
await scope.bundles.putOrderedBatch({
|
|
25
|
+
bundles: [rootRequest(leaves)],
|
|
26
|
+
})
|
|
27
|
+
)[0];
|
|
28
|
+
},
|
|
29
|
+
retain: (terminal) => [terminal],
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
admitted.value;
|
|
33
|
+
admitted.retention;
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Asset, page, and bundle calls serialize by invocation order and share the
|
|
37
|
+
operation-owned persistence scope. Every call retains its ordinary count,
|
|
38
|
+
object, member, and byte limits. Asset writes preserve the same chunking,
|
|
39
|
+
compression, encryption, manifest, and handle semantics as the public
|
|
40
|
+
`assets.putBatch()` method.
|
|
41
|
+
|
|
42
|
+
The optional `retain(value)` callback executes synchronously after the bounded
|
|
43
|
+
operation succeeds. It must return a nonempty array of canonical handles staged
|
|
44
|
+
by that exact admission. Input count cannot exceed the staged-artifact ledger;
|
|
45
|
+
repeated handles deduplicate in stable order. Malformed, asynchronous, empty,
|
|
46
|
+
oversized, lookalike, and valid-but-unstaged selections fail before the
|
|
47
|
+
workspace ref moves. Omitting the selector preserves v6.5.9 retain-all
|
|
48
|
+
behavior.
|
|
49
|
+
|
|
50
|
+
Exact selection affects only newly staged direct roots. Every root retained
|
|
51
|
+
before the compound call remains in the next generation. A selected terminal
|
|
52
|
+
bundle continues to retain its referenced pages, assets, and nested bundles
|
|
53
|
+
transitively through ordinary Git tree edges.
|
|
54
|
+
|
|
55
|
+
## Failure And Reachability
|
|
56
|
+
|
|
57
|
+
An asset failure poisons queued dependent work, publishes no compound
|
|
58
|
+
generation, and exposes no admitted callback result. A selector refusal also
|
|
59
|
+
leaves the prior generation unchanged. Immutable objects written before a
|
|
60
|
+
refusal may remain unreachable until normal Git maintenance reclaims them; the
|
|
61
|
+
selector is not a cross-ref transaction.
|
|
62
|
+
|
|
63
|
+
Real-Git integration tests cover fresh SHA-1 and SHA-256 repositories. They
|
|
64
|
+
prove one checked workspace update, closed scoped sessions, selected-root
|
|
65
|
+
readback after immediate prune, preservation of prior roots, reclamation after
|
|
66
|
+
workspace release, and no-generation refusal behavior.
|
|
67
|
+
|
|
68
|
+
## Downstream Process Witness
|
|
69
|
+
|
|
70
|
+
A controlled git-warp prototype compared a 65-node, 65-patch materialization
|
|
71
|
+
plus a five-patch suffix using public v6.5.9 as the control and this exact API
|
|
72
|
+
as a local prototype. Each scenario used one warmup and three measured runs.
|
|
73
|
+
|
|
74
|
+
| Scenario | Git commands | Median CPU ms | Median wall ms |
|
|
75
|
+
| ----------- | -----------: | ------------: | -------------: |
|
|
76
|
+
| Cold before | 139 | 545.476 | 2,822.893 |
|
|
77
|
+
| Cold after | 50 | 322.103 | 1,328.603 |
|
|
78
|
+
| Incr before | 149 | 555.478 | 3,039.536 |
|
|
79
|
+
| Incr after | 60 | 320.050 | 1,387.245 |
|
|
80
|
+
| Warm before | 25 | 166.882 | 548.191 |
|
|
81
|
+
| Warm after | 25 | 176.325 | 622.956 |
|
|
82
|
+
|
|
83
|
+
Cold writes fell from 139 to 50 Git commands: 64.029% fewer commands, 40.950%
|
|
84
|
+
less Node CPU, and 52.935% less wall time. Incremental writes fell from 149 to
|
|
85
|
+
60 commands: 59.732% fewer commands, 42.383% less Node CPU, and 54.360% less
|
|
86
|
+
wall time. Semantic fingerprints, node/edge/property counts, cache posture, and
|
|
87
|
+
replay counts matched. The warm read path materializes no writes and retained
|
|
88
|
+
its exact 25-command topology; elapsed variation there is host noise, not a
|
|
89
|
+
claimed regression or gain.
|
|
90
|
+
|
|
91
|
+
These downstream measurements are deliberately provisional until git-warp
|
|
92
|
+
installs the public v6.5.10 registry artifact and repeats the same corpus. The
|
|
93
|
+
deterministic contract is the equal semantic result and reduced command
|
|
94
|
+
topology, not a universal timing promise.
|
|
95
|
+
|
|
96
|
+
## Verification
|
|
97
|
+
|
|
98
|
+
Implementation review #128 merged normally as
|
|
99
|
+
`57cd300294a94660d2afb644c653a3be78c15d53`; its exact reviewed head is
|
|
100
|
+
`6714750620aa2310ad0279f957414be65898a66a`. Exact implementation checkpoint
|
|
101
|
+
`e663754bf221784f0e5856a41fe071bebfa5befb` passed all 14 release-verifier
|
|
102
|
+
stages with 7,186 observed tests across Node, Bun, Deno, public types,
|
|
103
|
+
executable examples, real-Git integrations, build stamping, npm packing, and a
|
|
104
|
+
JSR publication dry-run. Exact versioned candidate
|
|
105
|
+
`2a5be40c718e8069fb466af1be265357d8cb7ce0` then passed the same 14-stage
|
|
106
|
+
method with 7,192 observed tests: 2,194 Node, 2,193 Bun, 2,184 Deno, and 207
|
|
107
|
+
integration tests in each runtime. No tag, npm artifact, or GitHub Release is
|
|
108
|
+
claimed by this candidate.
|
|
109
|
+
|
|
110
|
+
## Compatibility
|
|
111
|
+
|
|
112
|
+
This release is additive and requires no application or stored-data migration.
|
|
113
|
+
It makes no stored object, handle, descriptor, ref layout, or reader change.
|
|
114
|
+
Existing repositories and workspace refs open in place; existing callers may
|
|
115
|
+
keep retain-all compound behavior by omitting `retain`. Custom asset services
|
|
116
|
+
that do not implement the scoped persistence hook remain compatible for page-
|
|
117
|
+
and bundle-only compound calls and reject only if the new asset scope is used.
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# git-cas v6.5.9 Release Notes
|
|
2
|
+
|
|
3
|
+
v6.5.9 adds bounded compound staging-workspace admission for applications that
|
|
4
|
+
construct dependency-ordered page and bundle graphs. It replaces one temporary
|
|
5
|
+
retention publication per construction wave with one exact final workspace
|
|
6
|
+
generation, without changing application handles, stored object bytes,
|
|
7
|
+
workspace descriptors, ref layout or namespaces, readers, or existing
|
|
8
|
+
workspace methods. Successful compound admission deliberately reduces
|
|
9
|
+
workspace-ref update frequency.
|
|
10
|
+
|
|
11
|
+
## Compound Workspace Admission
|
|
12
|
+
|
|
13
|
+
`workspace.batch()` owns one bounded callback and one operation-scoped Git
|
|
14
|
+
persistence view:
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
const admitted = await workspace.batch({
|
|
18
|
+
maxOperations: 3,
|
|
19
|
+
operation: async (scope) => {
|
|
20
|
+
const pages = await scope.pages.putBatch({ pages: pageRequests });
|
|
21
|
+
const leaves = await scope.bundles.putOrderedBatch({
|
|
22
|
+
bundles: buildLeafRequests(pages),
|
|
23
|
+
});
|
|
24
|
+
return (
|
|
25
|
+
await scope.bundles.putOrderedBatch({
|
|
26
|
+
bundles: [buildRootRequest(leaves)],
|
|
27
|
+
})
|
|
28
|
+
)[0];
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
admitted.value;
|
|
33
|
+
admitted.retention;
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The scope exposes only the existing bounded page-batch and ordered-bundle-batch
|
|
37
|
+
operations. Calls serialize by invocation order and return frozen handle
|
|
38
|
+
arrays for later dependency waves. The default scope limit is 64 operations;
|
|
39
|
+
the exported hard limit is 1,024. Every call also retains its existing page,
|
|
40
|
+
bundle, member, object, and byte ceilings.
|
|
41
|
+
|
|
42
|
+
Success installs the union of previously retained workspace targets and every
|
|
43
|
+
new compound target exactly once. The callback value becomes caller-visible
|
|
44
|
+
only after scoped Git resources close and the paired retention result names the
|
|
45
|
+
exact final generation. Existing staging methods continue to retain their
|
|
46
|
+
result independently and remain appropriate when an intermediate handle must
|
|
47
|
+
leave private construction code.
|
|
48
|
+
|
|
49
|
+
## Failure and Trust Boundary
|
|
50
|
+
|
|
51
|
+
Invalid bounds, empty operations, callback failure, staged-write failure,
|
|
52
|
+
session-close failure, and checked final-retention failure return no admitted
|
|
53
|
+
value and do not move the prior workspace generation. The first failure stops
|
|
54
|
+
later queued work. Distinct callback/write and operation/close failures remain
|
|
55
|
+
available through `AggregateError`. Immutable objects written before refusal
|
|
56
|
+
may remain unreachable for Git's ordinary reclamation.
|
|
57
|
+
|
|
58
|
+
The callback is trusted JavaScript. git-cas closes an escaped scope and never
|
|
59
|
+
returns the callback value before retention, but it cannot prevent callback
|
|
60
|
+
code from assigning a provisional handle into external state as a side effect.
|
|
61
|
+
Such a leaked handle has no compound retention witness and is outside the
|
|
62
|
+
contract.
|
|
63
|
+
|
|
64
|
+
## Process-Topology Witness
|
|
65
|
+
|
|
66
|
+
The committed five-sample witness compares the same 33-operation graph under
|
|
67
|
+
independent per-wave retention and compound admission. Each mode produces 64
|
|
68
|
+
pages, 16 leaf bundles, one root bundle, and the same ordered sequence of 81
|
|
69
|
+
application handles in fresh SHA-1 and SHA-256 bare repositories.
|
|
70
|
+
|
|
71
|
+
| Format | Mode | Git children | Git interactions | Median wall ms | Worker CPU ms |
|
|
72
|
+
| ------- | -------- | -----------: | ---------------: | -------------: | ------------: |
|
|
73
|
+
| SHA-1 | per-wave | 200 | 380 | 3763.820 | 370.336 |
|
|
74
|
+
| SHA-1 | compound | 23 | 238 | 733.116 | 113.672 |
|
|
75
|
+
| SHA-256 | per-wave | 200 | 380 | 3709.930 | 373.898 |
|
|
76
|
+
| SHA-256 | compound | 23 | 238 | 726.976 | 114.407 |
|
|
77
|
+
|
|
78
|
+
Both formats reduced Git child creation by 88.5% and median wall time by about
|
|
79
|
+
80.5% on the measured host: 200 to 23 Git children and 33 retained generations
|
|
80
|
+
to one. `fast-import`, `commit-tree`, symbolic-ref containment checks, and
|
|
81
|
+
checked ref updates fell from one per wave to one per compound admission. The
|
|
82
|
+
semantic handle digests matched exactly.
|
|
83
|
+
|
|
84
|
+
The remaining 18 `mktree` children preserve validation across interdependent
|
|
85
|
+
descriptor-pack visibility boundaries. Further reduction requires a separately
|
|
86
|
+
proved typed tree-writing protocol or equivalent deterministic construction;
|
|
87
|
+
this release does not bypass Git's object validation.
|
|
88
|
+
|
|
89
|
+
See the [machine witness](https://github.com/git-stunts/git-cas/blob/main/docs/design/0060-compound-workspace-admission/witness/compound-workspace-admission.json)
|
|
90
|
+
and [verification narrative](https://github.com/git-stunts/git-cas/blob/main/docs/design/0060-compound-workspace-admission/witness/verification.md)
|
|
91
|
+
for the exact source, environment, counts, digests, and method.
|
|
92
|
+
|
|
93
|
+
## Reachability Proof
|
|
94
|
+
|
|
95
|
+
Real-Git integration tests cover SHA-1 and SHA-256 success and refusal. They
|
|
96
|
+
verify one checked publication, zero active scoped fast-import sessions after
|
|
97
|
+
settlement, immediate-prune readability while retained, reclamation after
|
|
98
|
+
checked release, and no workspace generation after a dependent wave fails.
|
|
99
|
+
|
|
100
|
+
## Verification
|
|
101
|
+
|
|
102
|
+
Implementation review #124 merged normally as
|
|
103
|
+
`eb8d617620fa8f401fb887f5b1bbc341d4746b0a`; its exact reviewed head
|
|
104
|
+
`29ba6e88c787a5e54c95a554e9166fd21aae31c0` passed all 14 release-verifier
|
|
105
|
+
stages with 7,141 observed tests across Node, Bun, Deno, and all three real-Git
|
|
106
|
+
integration suites. Exact versioned candidate
|
|
107
|
+
`5512acd477bc5e5a11339d6027a03631d1a3544a` then passed the same 14-stage
|
|
108
|
+
method with 7,147 observed tests: 2,179 Node, 2,178 Bun, 2,169 Deno, and 207
|
|
109
|
+
integration tests in each runtime. No tag, npm artifact, or GitHub Release is
|
|
110
|
+
claimed by this candidate.
|
|
111
|
+
|
|
112
|
+
## Compatibility
|
|
113
|
+
|
|
114
|
+
This release is additive and requires no application or stored-data migration.
|
|
115
|
+
Existing repositories open in place. It introduces no new object format,
|
|
116
|
+
descriptor version, ref namespace, reader, transaction log, authority cutover,
|
|
117
|
+
or mixed-version rewrite. Applications may leave every existing workspace call
|
|
118
|
+
unchanged and adopt `workspace.batch()` only where intermediate handles remain
|
|
119
|
+
private to one bounded construction.
|
package/index.d.ts
CHANGED
|
@@ -1614,6 +1614,32 @@ export interface WorkspaceCheckpointResult {
|
|
|
1614
1614
|
readonly witnesses: ReadonlyArray<RetentionWitness>;
|
|
1615
1615
|
}
|
|
1616
1616
|
|
|
1617
|
+
export const DEFAULT_WORKSPACE_COMPOUND_OPERATIONS: 64;
|
|
1618
|
+
export const MAX_WORKSPACE_COMPOUND_OPERATIONS: 1024;
|
|
1619
|
+
|
|
1620
|
+
export interface WorkspaceCompoundScope {
|
|
1621
|
+
readonly assets: {
|
|
1622
|
+
putBatch(
|
|
1623
|
+
options: Parameters<AssetCapability['putBatch']>[0],
|
|
1624
|
+
): Promise<ReadonlyArray<AssetHandle>>;
|
|
1625
|
+
};
|
|
1626
|
+
readonly pages: {
|
|
1627
|
+
putBatch(
|
|
1628
|
+
options: Parameters<PageCapability['putBatch']>[0],
|
|
1629
|
+
): Promise<ReadonlyArray<PageHandle>>;
|
|
1630
|
+
};
|
|
1631
|
+
readonly bundles: {
|
|
1632
|
+
putOrderedBatch(
|
|
1633
|
+
options: Parameters<BundleCapability['putOrderedBatch']>[0],
|
|
1634
|
+
): Promise<ReadonlyArray<BundleHandle>>;
|
|
1635
|
+
};
|
|
1636
|
+
}
|
|
1637
|
+
|
|
1638
|
+
export interface WorkspaceCompoundResult<T> {
|
|
1639
|
+
readonly value: T;
|
|
1640
|
+
readonly retention: WorkspaceCheckpointResult;
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1617
1643
|
export interface WorkspaceReleaseResult {
|
|
1618
1644
|
readonly changed: boolean;
|
|
1619
1645
|
readonly ref: string;
|
|
@@ -1691,6 +1717,11 @@ export declare class StagingWorkspace {
|
|
|
1691
1717
|
options: Parameters<BundleCapability['putOrderedBatch']>[0],
|
|
1692
1718
|
): Promise<ReadonlyArray<WorkspaceRetainedBundle>>;
|
|
1693
1719
|
};
|
|
1720
|
+
batch<T>(options: {
|
|
1721
|
+
operation(scope: WorkspaceCompoundScope): T | Promise<T>;
|
|
1722
|
+
maxOperations?: number;
|
|
1723
|
+
retain?: (value: T) => ReadonlyArray<ApplicationHandleInput>;
|
|
1724
|
+
}): Promise<Readonly<WorkspaceCompoundResult<T>>>;
|
|
1694
1725
|
checkpoint(options: { handles: Iterable<ApplicationHandleInput> }): Promise<WorkspaceCheckpointResult>;
|
|
1695
1726
|
renew(): Promise<WorkspaceCheckpointResult>;
|
|
1696
1727
|
promoteToCache(options: {
|
package/index.js
CHANGED
|
@@ -110,6 +110,10 @@ export { default as RepositoryInspectionPort } from './src/ports/RepositoryInspe
|
|
|
110
110
|
export { default as NodeCompressionAdapter } from './src/infrastructure/adapters/NodeCompressionAdapter.js';
|
|
111
111
|
export { default as diffManifests } from './src/domain/services/ManifestDiff.js';
|
|
112
112
|
export { SCHEME_WHOLE, SCHEME_FRAMED, SCHEME_CONVERGENT } from './src/domain/encryption/schemes.js';
|
|
113
|
+
export {
|
|
114
|
+
DEFAULT_WORKSPACE_COMPOUND_OPERATIONS,
|
|
115
|
+
MAX_WORKSPACE_COMPOUND_OPERATIONS,
|
|
116
|
+
} from './src/domain/services/WorkspaceCompoundScope.js';
|
|
113
117
|
|
|
114
118
|
/**
|
|
115
119
|
* High-level facade for the Content Addressable Store library.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@git-stunts/git-cas",
|
|
3
|
-
"version": "6.5.
|
|
3
|
+
"version": "6.5.10",
|
|
4
4
|
"description": "Content-addressed storage backed by Git's object database, with optional encryption and pluggable codecs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -45,6 +45,8 @@
|
|
|
45
45
|
"docs/releases/v6.5.6.md",
|
|
46
46
|
"docs/releases/v6.5.7.md",
|
|
47
47
|
"docs/releases/v6.5.8.md",
|
|
48
|
+
"docs/releases/v6.5.9.md",
|
|
49
|
+
"docs/releases/v6.5.10.md",
|
|
48
50
|
"docs/THREAT_MODEL.md",
|
|
49
51
|
"docs/VAULT_INTERNALS.md",
|
|
50
52
|
"docs/WALKTHROUGH.md",
|
|
@@ -48,6 +48,11 @@ export default class AssetService {
|
|
|
48
48
|
);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
/** Internal batch path that joins an existing persistence write scope. */
|
|
52
|
+
async putBatchWithPersistence(options = {}, persistence) {
|
|
53
|
+
return await this.#putBatch(AssetService.#batchOptions(options), persistence);
|
|
54
|
+
}
|
|
55
|
+
|
|
51
56
|
async #putBatch(batch, scopedPersistence) {
|
|
52
57
|
const persistence = new BoundedWriteWavePersistence({
|
|
53
58
|
persistence: scopedPersistence,
|
|
@@ -103,6 +103,14 @@ export default class BundleService {
|
|
|
103
103
|
* descriptor and tree dependency waves.
|
|
104
104
|
*/
|
|
105
105
|
async putOrderedBatch(options = {}) {
|
|
106
|
+
return await withWriteScope(
|
|
107
|
+
this.#persistence,
|
|
108
|
+
async (persistence) => await this.putOrderedBatchWithPersistence(options, persistence),
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** @internal Builds a bounded bundle group through an operation-owned persistence view. */
|
|
113
|
+
async putOrderedBatchWithPersistence(options = {}, persistence) {
|
|
106
114
|
const batch = BundleService.#batchOptions(options);
|
|
107
115
|
const staging = new StagingEvidence();
|
|
108
116
|
try {
|
|
@@ -110,15 +118,7 @@ export default class BundleService {
|
|
|
110
118
|
if (admitted.length === 0) {
|
|
111
119
|
return Object.freeze([]);
|
|
112
120
|
}
|
|
113
|
-
return await
|
|
114
|
-
this.#persistence,
|
|
115
|
-
async (persistence) => await this.#writeAdmittedBatch({
|
|
116
|
-
admitted,
|
|
117
|
-
batch,
|
|
118
|
-
persistence,
|
|
119
|
-
staging,
|
|
120
|
-
}),
|
|
121
|
-
);
|
|
121
|
+
return await this.#writeAdmittedBatch({ admitted, batch, persistence, staging });
|
|
122
122
|
} catch (error) {
|
|
123
123
|
throw augmentError(error, { staging: staging.snapshot() });
|
|
124
124
|
}
|
|
@@ -56,10 +56,19 @@ export default class PageService {
|
|
|
56
56
|
* @returns {Promise<StagedPage>}
|
|
57
57
|
*/
|
|
58
58
|
async put({ source, maxBytes }) {
|
|
59
|
+
return await this.#put({ source, maxBytes }, this.#persistence);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** @internal Stores one page through an operation-owned persistence view. */
|
|
63
|
+
async putWithPersistence({ source, maxBytes }, persistence) {
|
|
64
|
+
return await this.#put({ source, maxBytes }, persistence);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async #put({ source, maxBytes }, persistence) {
|
|
59
68
|
const limit = this.#effectiveLimit(maxBytes);
|
|
60
69
|
const observedAt = this.#observedAt();
|
|
61
70
|
const bytes = await PageService.#collect(source, limit);
|
|
62
|
-
const oid = await
|
|
71
|
+
const oid = await persistence.writeBlob(bytes);
|
|
63
72
|
return recordStagedTarget(new StagedPage({
|
|
64
73
|
handle: new PageHandle({ oid }),
|
|
65
74
|
size: bytes.length,
|
|
@@ -18,6 +18,7 @@ export default class StagingWorkspace {
|
|
|
18
18
|
#assets;
|
|
19
19
|
#bundles;
|
|
20
20
|
#clock;
|
|
21
|
+
#compound;
|
|
21
22
|
#descriptorCodec;
|
|
22
23
|
#expiresAt = null;
|
|
23
24
|
#generation = null;
|
|
@@ -27,26 +28,30 @@ export default class StagingWorkspace {
|
|
|
27
28
|
#released = false;
|
|
28
29
|
#resolveHandle;
|
|
29
30
|
#rootSet;
|
|
31
|
+
#rootSetForPersistence;
|
|
30
32
|
#tail = Promise.resolve();
|
|
31
33
|
#targets = new Map();
|
|
32
34
|
#ttlMs;
|
|
33
35
|
#workspaceRef;
|
|
34
36
|
|
|
35
|
-
constructor({ workspaceRef, ttlMs, rootSet, refs, assets, pages,
|
|
36
|
-
resolveHandle, descriptorCodec, clock = DEFAULT_CLOCK }) {
|
|
37
|
+
constructor({ workspaceRef, ttlMs, rootSet, rootSetForPersistence, refs, assets, pages,
|
|
38
|
+
bundles, publications, resolveHandle, descriptorCodec, compound, clock = DEFAULT_CLOCK }) {
|
|
37
39
|
StagingWorkspace.#assertDependencies({
|
|
38
40
|
rootSet,
|
|
41
|
+
rootSetForPersistence,
|
|
39
42
|
refs,
|
|
40
43
|
assets,
|
|
41
44
|
pages,
|
|
42
45
|
bundles,
|
|
43
46
|
resolveHandle,
|
|
44
47
|
descriptorCodec,
|
|
48
|
+
compound,
|
|
45
49
|
clock,
|
|
46
50
|
});
|
|
47
51
|
this.#workspaceRef = WorkspaceRef.from(workspaceRef);
|
|
48
52
|
this.#ttlMs = ttlMs;
|
|
49
53
|
this.#rootSet = rootSet;
|
|
54
|
+
this.#rootSetForPersistence = rootSetForPersistence;
|
|
50
55
|
this.#refs = refs;
|
|
51
56
|
this.#assets = assets;
|
|
52
57
|
this.#pages = pages;
|
|
@@ -54,8 +59,13 @@ export default class StagingWorkspace {
|
|
|
54
59
|
this.#publications = publications;
|
|
55
60
|
this.#resolveHandle = resolveHandle;
|
|
56
61
|
this.#descriptorCodec = descriptorCodec;
|
|
62
|
+
this.#compound = compound;
|
|
57
63
|
this.#clock = clock;
|
|
64
|
+
this.#initializeCapabilities();
|
|
65
|
+
Object.freeze(this);
|
|
66
|
+
}
|
|
58
67
|
|
|
68
|
+
#initializeCapabilities() {
|
|
59
69
|
this.assets = Object.freeze({
|
|
60
70
|
put: (options) => this.#enqueue(() => this.#stage(this.#assets, 'put', options)),
|
|
61
71
|
putBatch: (options) => (
|
|
@@ -76,7 +86,6 @@ export default class StagingWorkspace {
|
|
|
76
86
|
this.#enqueue(() => this.#stageBatch(this.#bundles, 'putOrderedBatch', options))
|
|
77
87
|
),
|
|
78
88
|
});
|
|
79
|
-
Object.freeze(this);
|
|
80
89
|
}
|
|
81
90
|
|
|
82
91
|
get id() {
|
|
@@ -95,6 +104,18 @@ export default class StagingWorkspace {
|
|
|
95
104
|
return this.#expiresAt;
|
|
96
105
|
}
|
|
97
106
|
|
|
107
|
+
batch(options = {}) {
|
|
108
|
+
return this.#enqueue(async () => {
|
|
109
|
+
this.#assertActive();
|
|
110
|
+
return await this.#compound.admit({
|
|
111
|
+
...options,
|
|
112
|
+
install: async (staged, persistence) => (
|
|
113
|
+
await this.#retainCompound(staged, persistence)
|
|
114
|
+
),
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
98
119
|
checkpoint({ handles }) {
|
|
99
120
|
return this.#enqueue(async () => {
|
|
100
121
|
this.#assertActive();
|
|
@@ -282,7 +303,31 @@ export default class StagingWorkspace {
|
|
|
282
303
|
}));
|
|
283
304
|
}
|
|
284
305
|
|
|
285
|
-
async #
|
|
306
|
+
async #retainCompound(staged, persistence) {
|
|
307
|
+
const targets = new Map(this.#targets);
|
|
308
|
+
for (const artifact of staged) {
|
|
309
|
+
const target = stagedTargetOf(artifact) ?? await this.#resolveTarget(artifact.handle);
|
|
310
|
+
targets.set(target.handle.toString(), target);
|
|
311
|
+
}
|
|
312
|
+
try {
|
|
313
|
+
return await this.#install([...targets.values()], persistence);
|
|
314
|
+
} catch (error) {
|
|
315
|
+
if (error?.code === ErrorCodes.WORKSPACE_TTL_INVALID) {
|
|
316
|
+
throw error;
|
|
317
|
+
}
|
|
318
|
+
throw createCasError(
|
|
319
|
+
'Workspace compound admission could not establish retention',
|
|
320
|
+
ErrorCodes.WORKSPACE_RETENTION_FAILED,
|
|
321
|
+
{
|
|
322
|
+
workspaceId: this.id,
|
|
323
|
+
stagedCount: staged.length,
|
|
324
|
+
originalError: error,
|
|
325
|
+
},
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
async #install(targets, persistence = null) {
|
|
286
331
|
if (targets.length > MAX_WORKSPACE_TARGETS) {
|
|
287
332
|
throw createCasError(
|
|
288
333
|
'Workspace target count exceeds the supported maximum',
|
|
@@ -292,13 +337,10 @@ export default class StagingWorkspace {
|
|
|
292
337
|
}
|
|
293
338
|
const observedAt = this.#observedAt();
|
|
294
339
|
const expiresAt = this.#expiryFrom(observedAt);
|
|
295
|
-
const descriptor = await this.#
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
expiresAt,
|
|
300
|
-
targetCount: targets.length,
|
|
301
|
-
}),
|
|
340
|
+
const descriptor = await this.#writeDescriptor({
|
|
341
|
+
expiresAt,
|
|
342
|
+
targetCount: targets.length,
|
|
343
|
+
persistence,
|
|
302
344
|
});
|
|
303
345
|
const entries = [
|
|
304
346
|
{
|
|
@@ -309,7 +351,10 @@ export default class StagingWorkspace {
|
|
|
309
351
|
},
|
|
310
352
|
...targets.map(StagingWorkspace.#targetEntry),
|
|
311
353
|
];
|
|
312
|
-
const
|
|
354
|
+
const rootSet = persistence === null
|
|
355
|
+
? this.#rootSet
|
|
356
|
+
: this.#rootSetForPersistence(persistence);
|
|
357
|
+
const mutation = await rootSet.replaceExact({
|
|
313
358
|
entries,
|
|
314
359
|
expectedHeadOid: this.#generation,
|
|
315
360
|
});
|
|
@@ -331,6 +376,20 @@ export default class StagingWorkspace {
|
|
|
331
376
|
});
|
|
332
377
|
}
|
|
333
378
|
|
|
379
|
+
async #writeDescriptor({ expiresAt, targetCount, persistence }) {
|
|
380
|
+
const options = {
|
|
381
|
+
source: this.#descriptorCodec.encode({
|
|
382
|
+
ref: this.#workspaceRef.toString(),
|
|
383
|
+
createdAt: this.#workspaceRef.createdAt,
|
|
384
|
+
expiresAt,
|
|
385
|
+
targetCount,
|
|
386
|
+
}),
|
|
387
|
+
};
|
|
388
|
+
return persistence === null
|
|
389
|
+
? await this.#pages.put(options)
|
|
390
|
+
: await this.#pages.putWithPersistence(options, persistence);
|
|
391
|
+
}
|
|
392
|
+
|
|
334
393
|
#witness({ target, entries, observedAt }) {
|
|
335
394
|
const name = StagingWorkspace.#targetName(target.handle);
|
|
336
395
|
const index = entries.findIndex((entry) => entry.name === name);
|
|
@@ -580,16 +639,18 @@ export default class StagingWorkspace {
|
|
|
580
639
|
});
|
|
581
640
|
}
|
|
582
641
|
|
|
583
|
-
static #assertDependencies({ rootSet, refs, assets, pages, bundles,
|
|
584
|
-
descriptorCodec, clock }) {
|
|
642
|
+
static #assertDependencies({ rootSet, rootSetForPersistence, refs, assets, pages, bundles,
|
|
643
|
+
resolveHandle, descriptorCodec, compound, clock }) {
|
|
585
644
|
const missing = [
|
|
586
645
|
['rootSet', StagingWorkspace.#hasMethods(rootSet, ['replaceExact'])],
|
|
646
|
+
['rootSetForPersistence', typeof rootSetForPersistence === 'function'],
|
|
587
647
|
['refs', StagingWorkspace.#hasMethods(refs, ['deleteRef'])],
|
|
588
648
|
['assets', StagingWorkspace.#hasMethods(assets, ['put', 'adopt'])],
|
|
589
649
|
['pages', StagingWorkspace.#hasMethods(pages, ['put', 'putBatch'])],
|
|
590
650
|
['bundles', StagingWorkspace.#hasMethods(bundles, ['put', 'putOrdered'])],
|
|
591
651
|
['resolveHandle', typeof resolveHandle === 'function'],
|
|
592
652
|
['descriptorCodec', StagingWorkspace.#hasMethods(descriptorCodec, ['encode'])],
|
|
653
|
+
['compound', StagingWorkspace.#hasMethods(compound, ['admit'])],
|
|
593
654
|
['clock', StagingWorkspace.#hasMethods(clock, ['now'])],
|
|
594
655
|
].filter(([, valid]) => !valid).map(([name]) => name);
|
|
595
656
|
if (missing.length > 0) {
|
|
@@ -8,6 +8,7 @@ import RootSet from './RootSet.js';
|
|
|
8
8
|
import RootSetMetadataCodec from './RootSetMetadataCodec.js';
|
|
9
9
|
import RootSetPersistence from './RootSetPersistence.js';
|
|
10
10
|
import StagingWorkspace from './StagingWorkspace.js';
|
|
11
|
+
import WorkspaceCompoundAdmission from './WorkspaceCompoundAdmission.js';
|
|
11
12
|
import WorkspaceDescriptorCodec, {
|
|
12
13
|
WORKSPACE_DESCRIPTOR_ENTRY,
|
|
13
14
|
} from './WorkspaceDescriptorCodec.js';
|
|
@@ -37,6 +38,7 @@ export default class StagingWorkspaceRegistry {
|
|
|
37
38
|
#assets;
|
|
38
39
|
#bundles;
|
|
39
40
|
#clock;
|
|
41
|
+
#compound;
|
|
40
42
|
#crypto;
|
|
41
43
|
#descriptorCodec;
|
|
42
44
|
#pages;
|
|
@@ -68,6 +70,7 @@ export default class StagingWorkspaceRegistry {
|
|
|
68
70
|
this.#crypto = crypto;
|
|
69
71
|
this.#clock = clock;
|
|
70
72
|
this.#descriptorCodec = descriptorCodec;
|
|
73
|
+
this.#compound = new WorkspaceCompoundAdmission({ persistence, assets, pages, bundles });
|
|
71
74
|
Object.freeze(this);
|
|
72
75
|
}
|
|
73
76
|
|
|
@@ -81,6 +84,7 @@ export default class StagingWorkspaceRegistry {
|
|
|
81
84
|
workspaceRef,
|
|
82
85
|
ttlMs,
|
|
83
86
|
rootSet: this.#rootSet(workspaceRef),
|
|
87
|
+
rootSetForPersistence: (persistence) => this.#rootSet(workspaceRef, persistence),
|
|
84
88
|
refs: this.#ref,
|
|
85
89
|
assets: this.#assets,
|
|
86
90
|
pages: this.#pages,
|
|
@@ -88,6 +92,7 @@ export default class StagingWorkspaceRegistry {
|
|
|
88
92
|
publications: this.#publications,
|
|
89
93
|
resolveHandle: this.#resolveHandle,
|
|
90
94
|
descriptorCodec: this.#descriptorCodec,
|
|
95
|
+
compound: this.#compound,
|
|
91
96
|
clock: this.#clock,
|
|
92
97
|
});
|
|
93
98
|
}
|
|
@@ -271,19 +276,19 @@ export default class StagingWorkspaceRegistry {
|
|
|
271
276
|
return logicalBytes;
|
|
272
277
|
}
|
|
273
278
|
|
|
274
|
-
#rootSet(workspaceRef) {
|
|
279
|
+
#rootSet(workspaceRef, persistence = this.#persistence) {
|
|
275
280
|
const ref = WorkspaceRef.from(workspaceRef).toString();
|
|
276
281
|
const metadataCodec = new RootSetMetadataCodec({ refType: WorkspaceRef });
|
|
277
|
-
const
|
|
282
|
+
const rootSetPersistence = new RootSetPersistence({
|
|
278
283
|
rootSetRef: ref,
|
|
279
|
-
persistence
|
|
284
|
+
persistence,
|
|
280
285
|
ref: this.#ref,
|
|
281
286
|
refType: WorkspaceRef,
|
|
282
287
|
metadataCodec,
|
|
283
288
|
});
|
|
284
289
|
return new RootSet({
|
|
285
290
|
ref,
|
|
286
|
-
persistence,
|
|
291
|
+
persistence: rootSetPersistence,
|
|
287
292
|
refType: WorkspaceRef,
|
|
288
293
|
metadataCodec,
|
|
289
294
|
});
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import createCasError from '../errors/createCasError.js';
|
|
2
|
+
import { ErrorCodes } from '../errors/index.js';
|
|
3
|
+
import parseApplicationHandle from '../value-objects/ApplicationHandle.js';
|
|
4
|
+
import WorkspaceCompoundScope from './WorkspaceCompoundScope.js';
|
|
5
|
+
|
|
6
|
+
/** Executes one bounded provisional graph build before exact workspace retention. */
|
|
7
|
+
export default class WorkspaceCompoundAdmission {
|
|
8
|
+
#assets;
|
|
9
|
+
#bundles;
|
|
10
|
+
#pages;
|
|
11
|
+
#persistence;
|
|
12
|
+
|
|
13
|
+
constructor({ persistence, assets, pages, bundles }) {
|
|
14
|
+
WorkspaceCompoundAdmission.#assertDependencies({ persistence, assets, pages, bundles });
|
|
15
|
+
this.#persistence = persistence;
|
|
16
|
+
this.#assets = assets;
|
|
17
|
+
this.#pages = pages;
|
|
18
|
+
this.#bundles = bundles;
|
|
19
|
+
Object.freeze(this);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async admit({ operation, maxOperations, retain, install } = {}) {
|
|
23
|
+
if (typeof install !== 'function') {
|
|
24
|
+
throw createCasError(
|
|
25
|
+
'Workspace compound admission requires an installation callback',
|
|
26
|
+
ErrorCodes.INVALID_OPTIONS
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
return await withWriteScope(this.#persistence, async (persistence) => {
|
|
30
|
+
const scope = new WorkspaceCompoundScope({
|
|
31
|
+
assets: this.#assets,
|
|
32
|
+
pages: this.#pages,
|
|
33
|
+
bundles: this.#bundles,
|
|
34
|
+
persistence,
|
|
35
|
+
maxOperations,
|
|
36
|
+
});
|
|
37
|
+
const prepared = await scope.execute(operation);
|
|
38
|
+
const selected = retainedArtifacts(prepared, retain);
|
|
39
|
+
const retention = await install(selected, persistence);
|
|
40
|
+
return Object.freeze({ value: prepared.value, retention });
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
static #assertDependencies({ persistence, assets, pages, bundles }) {
|
|
45
|
+
const missing = [
|
|
46
|
+
['persistence', persistence === null || typeof persistence !== 'object'],
|
|
47
|
+
['assets', assets === null || typeof assets !== 'object'],
|
|
48
|
+
['pages.putBatch', typeof pages?.putBatch !== 'function'],
|
|
49
|
+
['bundles', bundles === null || typeof bundles !== 'object'],
|
|
50
|
+
]
|
|
51
|
+
.filter(([, absent]) => absent)
|
|
52
|
+
.map(([name]) => name);
|
|
53
|
+
if (missing.length > 0) {
|
|
54
|
+
throw createCasError(
|
|
55
|
+
'Workspace compound admission requires complete dependencies',
|
|
56
|
+
ErrorCodes.INVALID_OPTIONS,
|
|
57
|
+
{ missing }
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function retainedArtifacts(prepared, retain) {
|
|
64
|
+
if (retain === undefined) {
|
|
65
|
+
return prepared.staged;
|
|
66
|
+
}
|
|
67
|
+
const requested = selectedInputs(prepared, retain);
|
|
68
|
+
const staged = new Map(prepared.staged.map((artifact) => [artifact.handle.toString(), artifact]));
|
|
69
|
+
const selected = [];
|
|
70
|
+
const seen = new Set();
|
|
71
|
+
for (const input of requested) {
|
|
72
|
+
const handle = selectedHandle(input);
|
|
73
|
+
const key = handle.toString();
|
|
74
|
+
const artifact = staged.get(key);
|
|
75
|
+
if (artifact === undefined) {
|
|
76
|
+
throw createCasError(
|
|
77
|
+
'Workspace compound retention selector returned an unstaged handle',
|
|
78
|
+
ErrorCodes.INVALID_OPTIONS,
|
|
79
|
+
{ handle: key }
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
if (!seen.has(key)) {
|
|
83
|
+
selected.push(artifact);
|
|
84
|
+
seen.add(key);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return Object.freeze(selected);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function selectedInputs(prepared, retain) {
|
|
91
|
+
if (typeof retain !== 'function') {
|
|
92
|
+
throw createCasError(
|
|
93
|
+
'Workspace compound retention selector must be a function',
|
|
94
|
+
ErrorCodes.INVALID_OPTIONS
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
const requested = retain(prepared.value);
|
|
98
|
+
if (!Array.isArray(requested)) {
|
|
99
|
+
throw createCasError(
|
|
100
|
+
'Workspace compound retention selector must synchronously return an array',
|
|
101
|
+
ErrorCodes.INVALID_OPTIONS
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
if (requested.length === 0) {
|
|
105
|
+
throw createCasError(
|
|
106
|
+
'Workspace compound retention selector must choose at least one staged handle',
|
|
107
|
+
ErrorCodes.INVALID_OPTIONS
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
if (requested.length > prepared.staged.length) {
|
|
111
|
+
throw createCasError(
|
|
112
|
+
'Workspace compound retention selector exceeds the staged handle count',
|
|
113
|
+
ErrorCodes.INVALID_OPTIONS,
|
|
114
|
+
{ requestedCount: requested.length, stagedCount: prepared.staged.length }
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
return requested;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function selectedHandle(input) {
|
|
121
|
+
try {
|
|
122
|
+
return parseApplicationHandle(input);
|
|
123
|
+
} catch (error) {
|
|
124
|
+
throw createCasError(
|
|
125
|
+
'Workspace compound retention selector returned an invalid handle',
|
|
126
|
+
ErrorCodes.INVALID_OPTIONS,
|
|
127
|
+
{ originalError: error }
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
async function withWriteScope(persistence, operation) {
|
|
133
|
+
return typeof persistence.withWriteScope === 'function'
|
|
134
|
+
? await persistence.withWriteScope(operation)
|
|
135
|
+
: await operation(persistence);
|
|
136
|
+
}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import createCasError from '../errors/createCasError.js';
|
|
2
|
+
import { ErrorCodes } from '../errors/index.js';
|
|
3
|
+
|
|
4
|
+
export const DEFAULT_WORKSPACE_COMPOUND_OPERATIONS = 64;
|
|
5
|
+
export const MAX_WORKSPACE_COMPOUND_OPERATIONS = 1_024;
|
|
6
|
+
|
|
7
|
+
/** Bounded provisional asset, page, and bundle writes owned by one compound admission. */
|
|
8
|
+
export default class WorkspaceCompoundScope {
|
|
9
|
+
#active = true;
|
|
10
|
+
#assets;
|
|
11
|
+
#abortFailure;
|
|
12
|
+
#aborted = false;
|
|
13
|
+
#bundles;
|
|
14
|
+
#failed = false;
|
|
15
|
+
#failure;
|
|
16
|
+
#maxOperations;
|
|
17
|
+
#operationCount = 0;
|
|
18
|
+
#overflowFailure = null;
|
|
19
|
+
#pages;
|
|
20
|
+
#persistence;
|
|
21
|
+
#staged = [];
|
|
22
|
+
#tail = Promise.resolve();
|
|
23
|
+
|
|
24
|
+
constructor({ assets, pages, bundles, persistence, maxOperations }) {
|
|
25
|
+
WorkspaceCompoundScope.#assertDependencies({ assets, pages, bundles, persistence });
|
|
26
|
+
this.#assets = assets;
|
|
27
|
+
this.#pages = pages;
|
|
28
|
+
this.#bundles = bundles;
|
|
29
|
+
this.#persistence = persistence;
|
|
30
|
+
this.#maxOperations = WorkspaceCompoundScope.#operationLimit(maxOperations);
|
|
31
|
+
this.api = Object.freeze({
|
|
32
|
+
assets: Object.freeze({
|
|
33
|
+
putBatch: (options) =>
|
|
34
|
+
this.#enqueue('assets.putBatch', async () => await this.#putAssets(options)),
|
|
35
|
+
}),
|
|
36
|
+
pages: Object.freeze({
|
|
37
|
+
putBatch: (options) =>
|
|
38
|
+
this.#enqueue('pages.putBatch', async () => await this.#putPages(options)),
|
|
39
|
+
}),
|
|
40
|
+
bundles: Object.freeze({
|
|
41
|
+
putOrderedBatch: (options) =>
|
|
42
|
+
this.#enqueue('bundles.putOrderedBatch', async () => await this.#putBundles(options)),
|
|
43
|
+
}),
|
|
44
|
+
});
|
|
45
|
+
Object.freeze(this);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async execute(operation) {
|
|
49
|
+
if (typeof operation !== 'function') {
|
|
50
|
+
throw createCasError(
|
|
51
|
+
'Workspace compound admission requires an operation callback',
|
|
52
|
+
ErrorCodes.INVALID_OPTIONS
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
let value;
|
|
56
|
+
let callbackError;
|
|
57
|
+
let callbackFailed = false;
|
|
58
|
+
try {
|
|
59
|
+
value = await operation(this.api);
|
|
60
|
+
} catch (error) {
|
|
61
|
+
callbackFailed = true;
|
|
62
|
+
callbackError = error;
|
|
63
|
+
this.#aborted = true;
|
|
64
|
+
this.#abortFailure = error;
|
|
65
|
+
}
|
|
66
|
+
this.#active = false;
|
|
67
|
+
await this.#tail;
|
|
68
|
+
if (callbackFailed && this.#failed && callbackError !== this.#failure) {
|
|
69
|
+
throw new AggregateError(
|
|
70
|
+
[callbackError, this.#failure],
|
|
71
|
+
'Workspace compound callback and staged operation both failed'
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
if (callbackFailed) {
|
|
75
|
+
throw callbackError;
|
|
76
|
+
}
|
|
77
|
+
if (this.#failed) {
|
|
78
|
+
throw this.#failure;
|
|
79
|
+
}
|
|
80
|
+
if (this.#staged.length === 0) {
|
|
81
|
+
throw createCasError(
|
|
82
|
+
'Workspace compound admission staged no handles',
|
|
83
|
+
ErrorCodes.INVALID_OPTIONS
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
return Object.freeze({
|
|
87
|
+
value,
|
|
88
|
+
staged: Object.freeze([...this.#staged]),
|
|
89
|
+
operationCount: this.#operationCount,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
#enqueue(method, operation) {
|
|
94
|
+
if (!this.#active) {
|
|
95
|
+
return Promise.reject(
|
|
96
|
+
createCasError('Workspace compound scope is closed', ErrorCodes.WORKSPACE_STATE_INVALID, {
|
|
97
|
+
method,
|
|
98
|
+
})
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
if (this.#overflowFailure !== null) {
|
|
102
|
+
return Promise.reject(this.#overflowFailure);
|
|
103
|
+
}
|
|
104
|
+
this.#operationCount += 1;
|
|
105
|
+
if (this.#operationCount > this.#maxOperations) {
|
|
106
|
+
this.#overflowFailure = createCasError(
|
|
107
|
+
'Workspace compound operation count exceeds the configured maximum',
|
|
108
|
+
ErrorCodes.INVALID_OPTIONS,
|
|
109
|
+
{
|
|
110
|
+
operationCount: this.#operationCount,
|
|
111
|
+
maxOperations: this.#maxOperations,
|
|
112
|
+
method,
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
this.#recordFailure(this.#overflowFailure);
|
|
116
|
+
return Promise.reject(this.#overflowFailure);
|
|
117
|
+
}
|
|
118
|
+
const result = this.#tail.then(async () => {
|
|
119
|
+
if (this.#failed) {
|
|
120
|
+
throw this.#failure;
|
|
121
|
+
}
|
|
122
|
+
if (this.#aborted) {
|
|
123
|
+
throw this.#abortFailure;
|
|
124
|
+
}
|
|
125
|
+
try {
|
|
126
|
+
return await operation();
|
|
127
|
+
} catch (error) {
|
|
128
|
+
this.#recordFailure(error);
|
|
129
|
+
throw error;
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
this.#tail = result.then(
|
|
133
|
+
() => undefined,
|
|
134
|
+
() => undefined,
|
|
135
|
+
);
|
|
136
|
+
return result;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
#recordFailure(error) {
|
|
140
|
+
if (!this.#failed) {
|
|
141
|
+
this.#failed = true;
|
|
142
|
+
this.#failure = error;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
async #putAssets(options) {
|
|
147
|
+
if (typeof this.#assets?.putBatchWithPersistence !== 'function') {
|
|
148
|
+
throw createCasError(
|
|
149
|
+
'Workspace compound asset batches are unavailable',
|
|
150
|
+
ErrorCodes.INVALID_OPTIONS,
|
|
151
|
+
{ method: 'assets.putBatch' }
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
const staged = await this.#assets.putBatchWithPersistence(options, this.#persistence);
|
|
155
|
+
return this.#record(staged, 'asset');
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
async #putPages(options) {
|
|
159
|
+
const staged = await this.#pages.putBatchWithPersistence(options, this.#persistence);
|
|
160
|
+
return this.#record(staged, 'page');
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
async #putBundles(options) {
|
|
164
|
+
const staged = await this.#bundles.putOrderedBatchWithPersistence(options, this.#persistence);
|
|
165
|
+
return this.#record(staged, 'bundle');
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
#record(staged, kind) {
|
|
169
|
+
if (!Array.isArray(staged) || staged.some((artifact) => !artifact?.handle)) {
|
|
170
|
+
throw createCasError(
|
|
171
|
+
`Workspace compound ${kind} batch did not return staged handles`,
|
|
172
|
+
ErrorCodes.WORKSPACE_STATE_INVALID,
|
|
173
|
+
{ kind }
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
this.#staged.push(...staged);
|
|
177
|
+
return Object.freeze(staged.map((artifact) => artifact.handle));
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
static #operationLimit(value) {
|
|
181
|
+
const limit = value ?? DEFAULT_WORKSPACE_COMPOUND_OPERATIONS;
|
|
182
|
+
if (!Number.isSafeInteger(limit) || limit <= 0 || limit > MAX_WORKSPACE_COMPOUND_OPERATIONS) {
|
|
183
|
+
throw createCasError(
|
|
184
|
+
'Workspace compound operation limit is outside the supported range',
|
|
185
|
+
ErrorCodes.INVALID_OPTIONS,
|
|
186
|
+
{ maxOperations: value, hardMaximum: MAX_WORKSPACE_COMPOUND_OPERATIONS }
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
return limit;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
static #assertDependencies({ assets, pages, bundles, persistence }) {
|
|
193
|
+
const missing = [
|
|
194
|
+
['assets', assets === null || typeof assets !== 'object'],
|
|
195
|
+
['pages.putBatchWithPersistence', typeof pages?.putBatchWithPersistence !== 'function'],
|
|
196
|
+
[
|
|
197
|
+
'bundles.putOrderedBatchWithPersistence',
|
|
198
|
+
typeof bundles?.putOrderedBatchWithPersistence !== 'function',
|
|
199
|
+
],
|
|
200
|
+
['persistence', persistence === null || typeof persistence !== 'object'],
|
|
201
|
+
]
|
|
202
|
+
.filter(([, absent]) => absent)
|
|
203
|
+
.map(([name]) => name);
|
|
204
|
+
if (missing.length > 0) {
|
|
205
|
+
throw createCasError(
|
|
206
|
+
'Workspace compound scope requires complete dependencies',
|
|
207
|
+
ErrorCodes.INVALID_OPTIONS,
|
|
208
|
+
{ missing }
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
package/src/package-version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const PACKAGE_VERSION = '6.5.
|
|
1
|
+
export const PACKAGE_VERSION = '6.5.10';
|