@git-stunts/git-cas 6.5.7 → 6.5.8

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.
Files changed (32) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/GUIDE.md +29 -0
  3. package/README.md +11 -7
  4. package/UPGRADING.md +29 -0
  5. package/build-info.json +2 -2
  6. package/docs/API.md +66 -12
  7. package/docs/releases/v6.5.8.md +89 -0
  8. package/index.d.ts +50 -0
  9. package/index.js +15 -1
  10. package/package.json +3 -2
  11. package/src/domain/services/AssetService.js +201 -10
  12. package/src/domain/services/BoundedWriteWavePersistence.js +235 -0
  13. package/src/domain/services/BundleBatchPlanner.js +349 -0
  14. package/src/domain/services/BundleService.js +225 -2
  15. package/src/domain/services/CasService.d.ts +16 -0
  16. package/src/domain/services/CasService.js +9 -18
  17. package/src/domain/services/ManifestRepository.js +129 -50
  18. package/src/domain/services/ManifestTreeService.js +47 -0
  19. package/src/domain/services/PageService.js +26 -9
  20. package/src/domain/services/RootSet.js +32 -0
  21. package/src/domain/services/RootSetPersistence.js +58 -1
  22. package/src/domain/services/StagedTarget.js +19 -0
  23. package/src/domain/services/StagingWorkspace.js +21 -7
  24. package/src/domain/services/forkCasPersistence.js +20 -0
  25. package/src/infrastructure/adapters/GitObjectSessionPool.js +47 -5
  26. package/src/infrastructure/adapters/GitPersistenceAdapter.js +169 -0
  27. package/src/infrastructure/adapters/GitPersistenceWriteScope.js +154 -0
  28. package/src/infrastructure/adapters/GitRefAdapter.js +38 -3
  29. package/src/infrastructure/adapters/GitUpdateRefSessionPool.js +115 -0
  30. package/src/package-version.js +1 -1
  31. package/src/ports/GitPersistencePort.js +43 -0
  32. package/src/ports/GitRefPort.js +8 -0
package/CHANGELOG.md CHANGED
@@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [6.5.8] — 2026-08-23
11
+
12
+ ### Added
13
+
14
+ - **Bounded application write waves** - `assets.putBatch()` and
15
+ `bundles.putOrderedBatch()` accept explicit count, object, and byte limits,
16
+ preserve input-order results, and are mirrored by scoped staging workspaces.
17
+ A successful workspace batch anchors every returned handle in one exact
18
+ generation.
19
+
20
+ ### Performance
21
+
22
+ - **Pipelined Git object and ref protocols** - bounded asset and bundle writes
23
+ pipeline blob, manifest-tree, descriptor-tree, and target-metadata waves;
24
+ checked ref updates reuse one typed `update-ref --stdin` process. Existing
25
+ single-write and older-Plumbing fallbacks remain available.
26
+
10
27
  ## [6.5.7] — 2026-08-23
11
28
 
12
29
  ### Performance
package/GUIDE.md CHANGED
@@ -173,6 +173,35 @@ order, and uses one scoped Git write session when the plumbing adapter supports
173
173
  it. Use individual `pages.put()` calls when inputs should not share one bounded
174
174
  memory envelope.
175
175
 
176
+ Independent assets and ordered bundles have equivalent bounded write-wave
177
+ surfaces:
178
+
179
+ ```js
180
+ const stagedAssets = await cas.assets.putBatch({
181
+ assets: assetRequests,
182
+ maxBatchAssets: 4,
183
+ maxBatchObjects: 4096,
184
+ maxBatchBytes: 256 * 1024 * 1024,
185
+ });
186
+
187
+ const stagedBundles = await cas.bundles.putOrderedBatch({
188
+ bundles: orderedBundleRequests,
189
+ maxBatchBundles: 64,
190
+ maxBatchMembers: 8192,
191
+ maxBatchObjects: 256,
192
+ maxBatchBytes: 64 * 1024 * 1024,
193
+ });
194
+ ```
195
+
196
+ Asset batching keeps at most `maxBatchAssets` source pipelines active, shares
197
+ bounded blob phases, and emits complete manifest trees in one final dependency
198
+ wave. Bundle batching collects only the explicitly bounded request array,
199
+ preplans its deterministic descriptor graph, and writes each bottom-up tree
200
+ depth as one bounded wave. Both methods preserve input-order output and return
201
+ no partial result array on failure. Higher `maxBatchAssets` values can reduce
202
+ protocol round trips when the caller can afford more simultaneously live
203
+ source pipelines; the default remains four.
204
+
176
205
  Repeated `pages.get()` calls reuse immutable payload reads within the store's
177
206
  bounded page cache. The defaults retain at most 128 payloads and 8 MiB; use
178
207
  `pageCacheEntries` and `pageCacheBytes` to tune that ceiling. Every result is a
package/README.md CHANGED
@@ -40,7 +40,9 @@ Unlike traditional LFS which moves files to external servers, `git-cas` treats t
40
40
  typed Git sessions behind the adapter. On session-capable adapters, streaming
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
- bounded page batches amortize writes without changing content identity.
43
+ bounded page, asset, and ordered-bundle batches pipeline independent Git
44
+ writes and retain each successful workspace batch under one exact generation
45
+ without changing content identity.
44
46
  - **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.
45
47
  - **Runtime-Adaptive**: A single core supports Node.js 22+, Bun, and Deno through a strict hexagonal port architecture with runtime-specific crypto adapters.
46
48
 
@@ -49,7 +51,7 @@ Unlike traditional LFS which moves files to external servers, `git-cas` treats t
49
51
  Existing v5 users should read [UPGRADING.md](./UPGRADING.md) and run
50
52
  `npm run upgrade` in dry-run mode before restoring old encrypted vault entries.
51
53
  For the release overview, see the
52
- [v6.5.7 Release Notes](./docs/releases/v6.5.7.md).
54
+ [v6.5.8 Release Notes](./docs/releases/v6.5.8.md).
53
55
 
54
56
  ### 1. CLI Usage
55
57
 
@@ -150,12 +152,12 @@ Core capabilities:
150
152
  read-only, and `sweep()` can release only markers whose expiry has passed.
151
153
  - **Application storage**: `assets`, `pages`, `bundles`, `retention`, and
152
154
  `publications` compose streaming CAS writes, bounded structured
153
- materializations, explicitly bounded page batches, direct-reference or
154
- complete-validation member reads, reachability roots, compare-and-swap refs,
155
- and immutable lifecycle evidence.
155
+ materializations, explicitly bounded asset/page/bundle batches,
156
+ direct-reference or complete-validation member reads, reachability roots,
157
+ compare-and-swap refs, and immutable lifecycle evidence.
156
158
  - **Scoped staging workspaces**: `workspaces.open()` mirrors application writes
157
- behind one renewable temporary RootSet, supports one-generation bounded page
158
- batches, returns only after each handle is anchored, promotes
159
+ behind one renewable temporary RootSet, supports one-generation bounded
160
+ asset/page/bundle batches, returns only after each handle is anchored, promotes
159
161
  destination-first, and exposes bounded age, expiry, logical-content, and
160
162
  direct-root diagnostics with opaque cleanup pagination.
161
163
  - **Envelope recipients**: multi-recipient key wrapping and recipient rotation
@@ -232,6 +234,8 @@ All three runtimes are tested in CI on every push. The hexagonal architecture is
232
234
  cockpit ownership and deterministic checked-ref conflict classification.
233
235
  - **[v6.5.7 Release Notes](./docs/releases/v6.5.7.md)**: Bounded persistent
234
236
  sessions for small streaming blob reads while large payloads remain streamed.
237
+ - **[v6.5.8 Release Notes](./docs/releases/v6.5.8.md)**: Bounded application
238
+ write waves, one-generation workspace batches, and reusable ref sessions.
235
239
  - **[Upgrading](./UPGRADING.md)**: Migration guide for v5 → v6.
236
240
  - **[Changelog](./CHANGELOG.md)**: Version history and migration notes.
237
241
 
package/UPGRADING.md CHANGED
@@ -2,6 +2,35 @@
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.7 To v6.5.8
6
+
7
+ v6.5.8 adds bounded application-write batches and requires no application or
8
+ stored-data migration. Existing single-write methods, handles, object bytes,
9
+ refs, retention evidence, and custom persistence fallbacks remain compatible.
10
+
11
+ Callers with independent assets or ordered bundles can opt into the new
12
+ input-ordered APIs:
13
+
14
+ ```js
15
+ const assets = await cas.assets.putBatch({ assets: assetRequests });
16
+ const bundles = await cas.bundles.putOrderedBatch({ bundles: bundleRequests });
17
+ ```
18
+
19
+ The same methods are available under scoped staging workspaces. Every result
20
+ from a successful workspace batch carries the same exact retained generation.
21
+ Count, planned-object, aggregate-member, and byte bounds reject oversized
22
+ admission before success is returned; partial immutable object creation remains
23
+ possible on failure, as with repeated single writes.
24
+
25
+ The default asset batch admits four active source pipelines with a 4,096-object
26
+ and 256 MiB envelope. Ordered-bundle batches default to 64 bundles, 8,192
27
+ members, 256 planned objects, and 64 MiB of admitted descriptor material.
28
+ Tune these only when the caller owns the corresponding source and memory
29
+ budget.
30
+
31
+ See [v6.5.8 Release Notes](./docs/releases/v6.5.8.md) for the exact identity,
32
+ process-topology, fallback, and publication-boundary evidence.
33
+
5
34
  ## v6.5.6 To v6.5.7
6
35
 
7
36
  v6.5.7 changes no public API, package export, object identity, manifest, ref,
package/build-info.json CHANGED
@@ -1,4 +1,4 @@
1
1
  {
2
- "sha": "eebc6e3",
3
- "timestamp": "2026-08-23T12:01:03.041Z"
2
+ "sha": "57b4055",
3
+ "timestamp": "2026-08-24T04:37:19.926Z"
4
4
  }
package/docs/API.md CHANGED
@@ -939,7 +939,7 @@ explicit lifecycle operations. It composes the lower-level store, manifest,
939
939
  tree, RootSet, commit, and ref operations without requiring callers to manage
940
940
  payload OIDs.
941
941
 
942
- ### `assets.put()`
942
+ ### `assets.put()` and `assets.putBatch()`
943
943
 
944
944
  ```javascript
945
945
  const staged = await cas.assets.put({
@@ -955,6 +955,13 @@ const staged = await cas.assets.put({
955
955
  merkleThreshold,
956
956
  chunking,
957
957
  });
958
+
959
+ const stagedBatch = await cas.assets.putBatch({
960
+ assets: [firstAssetOptions, secondAssetOptions],
961
+ maxBatchAssets: 4,
962
+ maxBatchObjects: 4096,
963
+ maxBatchBytes: 256 * 1024 * 1024,
964
+ });
958
965
  ```
959
966
 
960
967
  Streams an `AsyncIterable<Uint8Array>` through the existing CAS pipeline,
@@ -966,7 +973,26 @@ limits documented in the streaming matrix.
966
973
  `filename` defaults to `slug`. All other storage options have the same meaning
967
974
  as `store()`.
968
975
 
969
- **Returns:** `Promise<StagedAsset>`
976
+ `putBatch()` requires an explicit array of ordinary asset options and returns
977
+ an immutable result array in the same order. It keeps at most
978
+ `maxBatchAssets` source pipelines active, pipelines immutable blob and manifest
979
+ writes through bounded Git protocol waves, and writes all complete manifest
980
+ trees in one final dependency phase. Defaults are four active assets, 4,096
981
+ aggregate written objects, and 256 MiB of aggregate written bytes. Supported
982
+ upper bounds are 64 active assets, 100,000 objects, and 1 GiB. Plumbing protocol
983
+ requests remain internally capped at 256 objects and 64 MiB per request.
984
+
985
+ A failed source, bound, persistence operation, or result-cardinality check
986
+ rejects the whole call; it never returns a partial array as a complete batch.
987
+ The error metadata includes bounded staging counts for immutable objects that
988
+ may have been written before failure. `maxBatchAssets` is a resource/performance
989
+ choice: raising it can reduce protocol rounds while increasing the number of
990
+ simultaneously live caller streams.
991
+
992
+ **`assets.put()` returns:** `Promise<StagedAsset>`
993
+
994
+ **`assets.putBatch()` returns:** `Promise<ReadonlyArray<StagedAsset>>`, ordered
995
+ one-for-one with the input `assets` array.
970
996
 
971
997
  ```javascript
972
998
  {
@@ -1078,7 +1104,7 @@ The canonical page token is:
1078
1104
  git-cas:1:page:blob:raw:<sha1|sha256>:<oid>
1079
1105
  ```
1080
1106
 
1081
- ### `bundles.put()` and `bundles.putOrdered()`
1107
+ ### `bundles.put()`, `bundles.putOrdered()`, and `bundles.putOrderedBatch()`
1082
1108
 
1083
1109
  ```javascript
1084
1110
  const staged = await cas.bundles.put({
@@ -1093,6 +1119,17 @@ const staged = await cas.bundles.put({
1093
1119
  const streamed = await cas.bundles.putOrdered({
1094
1120
  members: orderedAsyncMemberPairs,
1095
1121
  });
1122
+
1123
+ const stagedBatch = await cas.bundles.putOrderedBatch({
1124
+ bundles: [
1125
+ { members: firstOrderedMemberPairs },
1126
+ { members: secondOrderedMemberPairs },
1127
+ ],
1128
+ maxBatchBundles: 64,
1129
+ maxBatchMembers: 8192,
1130
+ maxBatchObjects: 256,
1131
+ maxBatchBytes: 64 * 1024 * 1024,
1132
+ });
1096
1133
  ```
1097
1134
 
1098
1135
  Members are named application handles, byte sources, or `{ source, maxBytes }`
@@ -1103,6 +1140,20 @@ to every member handle. `put()` sorts an in-memory object, `Map`, or pair array.
1103
1140
  out-of-order canonical paths, enabling construction with bounded resident
1104
1141
  state.
1105
1142
 
1143
+ `putOrderedBatch()` requires an explicit array of ordered-bundle requests,
1144
+ collects only that declared group, and returns an immutable input-ordered array.
1145
+ It defaults to at most 64 bundles, 8,192 aggregate members, 256 planned objects,
1146
+ and 64 MiB across inline pages, descriptors, and trees. Callers may lower any
1147
+ limit; supported maxima are 256 bundles, 100,000 aggregate members, 256 objects,
1148
+ and 64 MiB. Per-bundle repository limits still apply independently.
1149
+
1150
+ After admission, the batch validates shared immutable handles once, writes
1151
+ inline pages together, writes all descriptor blobs in bounded windows, and
1152
+ writes independent tree nodes bottom-up by depth. Grouping changes scheduling,
1153
+ not descriptor bytes, tree entries, handles, or member order. A failure returns
1154
+ no complete result array and carries bounded staging evidence for immutable
1155
+ objects already written.
1156
+
1106
1157
  Repository defaults, which an operation may only lower, are:
1107
1158
 
1108
1159
  | Limit | Default |
@@ -1376,11 +1427,13 @@ The workspace mirrors only application-storage writes:
1376
1427
 
1377
1428
  ```javascript
1378
1429
  await workspace.assets.put(options);
1430
+ await workspace.assets.putBatch(options);
1379
1431
  await workspace.assets.adopt(options);
1380
1432
  await workspace.pages.put(options);
1381
1433
  await workspace.pages.putBatch(options);
1382
1434
  await workspace.bundles.put(options);
1383
1435
  await workspace.bundles.putOrdered(options);
1436
+ await workspace.bundles.putOrderedBatch(options);
1384
1437
  ```
1385
1438
 
1386
1439
  Each method returns only after a direct workspace generation reaches the
@@ -1388,11 +1441,12 @@ returned typed handle. The result is otherwise the ordinary staged result plus
1388
1441
  a workspace `RetentionWitness`. Calls on one workspace serialize their ref
1389
1442
  mutations so concurrent staging cannot silently lose an accumulated root.
1390
1443
 
1391
- `workspace.pages.putBatch()` accepts the same `pages`, `maxBatchBytes`, and
1392
- `maxBatchPages` bounds as `cas.pages.putBatch()`. It returns one retained result
1393
- per input in input order, while all results from the batch name the same exact
1394
- workspace generation. Duplicate page content preserves ordered results but is
1395
- retained only once in that generation.
1444
+ The three workspace batch methods accept the same options as their top-level
1445
+ counterparts. Each returns one retained result per input in input order, while
1446
+ all results from that batch name the same exact workspace generation. Duplicate
1447
+ content preserves ordered results but is retained only once in that generation.
1448
+ Batch construction and the one-generation installation remain serialized with
1449
+ all other mutations on that workspace.
1396
1450
 
1397
1451
  This guarantee starts when the method returns. Like all Git object composition,
1398
1452
  the object-write-to-ref-update interval still relies on Git's ordinary
@@ -3384,7 +3438,7 @@ new CasError({ message, code, meta, documentationUrl });
3384
3438
  | `MANIFEST_NOT_FOUND` | No manifest entry found in the Git tree | `readManifest()`, `inspectAsset()`, `collectReferencedChunks()` |
3385
3439
  | `GIT_ERROR` | Underlying Git plumbing command failed | `readManifest()`, `inspectAsset()`, `collectReferencedChunks()` |
3386
3440
  | `GIT_REF_NOT_FOUND` | Git ref lookup found no ref; vault reads normalize this to empty state | `GitRefAdapter`, `VaultPersistence` |
3387
- | `INVALID_OPTIONS` | Mutually exclusive options provided or unsupported option value | `store()`, `restore()` |
3441
+ | `INVALID_OPTIONS` | Mutually exclusive options, malformed batch input, or unsupported option value | `store()`, `restore()`, asset and bundle batches |
3388
3442
  | `RESOURCE_CLOSED` | A facade or persistence adapter operation began while or after closure was in progress | `ContentAddressableStore`, `GitPersistenceAdapter` |
3389
3443
  | `HANDLE_INVALID` | Handle object, canonical token, or staged result is malformed or unsupported | Application handles and staged results |
3390
3444
  | `HANDLE_KIND_MISMATCH` | A handle has a valid envelope but the wrong content kind | Handle parsing and application storage |
@@ -3395,14 +3449,14 @@ new CasError({ message, code, meta, documentationUrl });
3395
3449
  | `PAGE_BATCH_LIMIT` | Page batch count or aggregate bytes exceed the explicit batch policy | `pages.putBatch()` |
3396
3450
  | `BUNDLE_CORRUPT` | Persisted bundle descriptors, edges, ranges, or target summaries disagree | Bundle reads, retention, publication |
3397
3451
  | `BUNDLE_DESCRIPTOR_LIMIT` | Bundle descriptor bytes exceed admission or repository read policy | Bundle construction and validation |
3398
- | `BUNDLE_DUPLICATE_PATH` | Two ordered bundle members use the same canonical path | `bundles.putOrdered()` |
3452
+ | `BUNDLE_DUPLICATE_PATH` | Two ordered bundle members use the same canonical path | `bundles.putOrdered()`, `bundles.putOrderedBatch()` |
3399
3453
  | `BUNDLE_FANOUT_LIMIT` | Bundle tree width, depth, or nesting exceeds policy | Bundle construction and validation |
3400
3454
  | `BUNDLE_LIMIT_INVALID` | Configured or per-operation bundle limits are malformed or attempt to raise repository policy | Facade construction, bundle writes |
3401
3455
  | `BUNDLE_MEMBER_INVALID` | Bundle member input or resolved handle target is invalid | Bundle construction |
3402
- | `BUNDLE_MEMBER_LIMIT` | Bundle member count exceeds admission or repository read policy | Bundle construction and validation |
3456
+ | `BUNDLE_MEMBER_LIMIT` | Bundle or aggregate batch member count exceeds admission or repository read policy | Bundle construction and validation |
3403
3457
  | `BUNDLE_MEMBER_NOT_FOUND` | Requested bundle member path is absent | `bundles.openMember()` |
3404
3458
  | `BUNDLE_MEMBER_NOT_STREAMABLE` | Requested member is a nested structured bundle rather than bytes | `bundles.openMember()` |
3405
- | `BUNDLE_MEMBER_ORDER` | Ordered bundle input is not strictly increasing by canonical path | `bundles.putOrdered()` |
3459
+ | `BUNDLE_MEMBER_ORDER` | Ordered bundle input is not strictly increasing by canonical path | `bundles.putOrdered()`, `bundles.putOrderedBatch()` |
3406
3460
  | `BUNDLE_PATH_INVALID` | Bundle member path is empty, unsafe, or non-canonical | Bundle writes and reads |
3407
3461
  | `BUNDLE_PATH_LIMIT` | Bundle member path exceeds its UTF-8 byte bound | Bundle construction and validation |
3408
3462
  | `COLLECTION_NAMESPACE_INVALID` | Managed collection namespace or cache ref is not canonical | `caches.open()` |
@@ -0,0 +1,89 @@
1
+ # git-cas v6.5.8 Release Notes
2
+
3
+ v6.5.8 removes process-per-artifact write amplification for bounded groups of
4
+ independent assets and ordered bundles. It adds input-ordered batch APIs and
5
+ one-generation workspace retention without changing existing object bytes,
6
+ handles, refs, single-write behavior, or stored-data formats.
7
+
8
+ ## Bounded Application Write Waves
9
+
10
+ `assets.putBatch()` admits a caller-supplied array under explicit active-asset,
11
+ planned-object, and aggregate-byte limits. Each asset retains the same store,
12
+ chunking, encryption, compression, manifest, and handle semantics as
13
+ `assets.put()`. Independent chunk and manifest blobs are submitted in bounded
14
+ waves, followed by the manifest trees that depend on them. Results preserve
15
+ input order, including repeated content.
16
+
17
+ `bundles.putOrderedBatch()` validates and preplans a bounded array of the
18
+ existing deterministic ordered-bundle graphs. Descriptor blobs are written
19
+ together, and tree layers are written bottom-up. The batch is limited by bundle
20
+ count, aggregate members, planned object count, and admitted bytes. Serialized
21
+ descriptors, fanout topology, tree entries, and returned handles remain
22
+ identical to repeated `bundles.putOrdered()` calls.
23
+
24
+ Scoped staging workspaces mirror both APIs. A successful batch installs one
25
+ exact RootSet generation and every returned retention witness names that same
26
+ generation. The authoritative ref write remains checked and no-dereference;
27
+ concurrent head movement returns the existing conflict instead of being
28
+ retried or hidden.
29
+
30
+ ## Session and Compatibility Behavior
31
+
32
+ On Plumbing 3.3.0, git-cas pipelines blob, tree, and metadata groups through
33
+ typed sessions and reuses one `update-ref --stdin` child across successful
34
+ checked mutations. A failed update-ref transaction is discarded and closed;
35
+ later semantic work may open a fresh session. Adapter closure drains every
36
+ owned child.
37
+
38
+ Existing single methods remain supported. Persistence adapters without the
39
+ new optional batch methods retain ordered per-item fallbacks. A blob above the
40
+ 64 MiB fast-import ceiling deliberately uses the existing one-shot writer
41
+ while eligible members remain batched. No unbounded source is collected merely
42
+ because its operation participates in a batch.
43
+
44
+ ## Process-Topology Witness
45
+
46
+ The committed five-sample witness uses the published
47
+ `@git-stunts/plumbing@3.3.0` artifact in temporary SHA-1 and SHA-256 bare
48
+ repositories. Before-and-after semantic digests match in every sample.
49
+
50
+ | Operation | Git children | Typed interactions | Median wall reduction |
51
+ | ---------------------------- | -----------: | -----------------: | --------------------: |
52
+ | 16 SHA-1 assets | 49 -> 2 | 64 -> 19 | 87.137% |
53
+ | 16 SHA-256 assets | 49 -> 2 | 64 -> 19 | 86.673% |
54
+ | 16 SHA-1 workspace bundles | 147 -> 8 | 224 -> 13 | 91.047% |
55
+ | 16 SHA-256 workspace bundles | 147 -> 8 | 224 -> 13 | 90.930% |
56
+
57
+ Process and interaction counts plus semantic identity are the deterministic
58
+ acceptance evidence. Wall time and worker CPU are host observations, not
59
+ universal speed guarantees. The residual children preserve Git authority for
60
+ tree construction, commit identity, ref containment checks, and checked
61
+ publication.
62
+
63
+ ## Failure and Reachability
64
+
65
+ Wrong batch result cardinality rejects the entire semantic batch. Source
66
+ failure records its input index and bounded staging evidence, closes admitted
67
+ sibling iterators at their next chunk boundary, and never starts later queued
68
+ sources. Immutable objects written before a failure may remain unreachable;
69
+ no partial result array is presented as success.
70
+
71
+ Real-Git tests stage asset and bundle batches, prune immediately, verify all
72
+ retained content, release the workspace, prune again, and observe released
73
+ bundle roots become collectible. SHA-1 and SHA-256 identity tests compare the
74
+ complete returned handle sequence against repeated singles.
75
+
76
+ ## Verification
77
+
78
+ The release candidate passed the repository's complete 14-step verifier with
79
+ 7,057 observed tests across Node, Bun, and Deno. The matrix includes public
80
+ type compatibility, executable examples, 203 real-Git integration tests on
81
+ each runtime, build stamping, npm packing, and JSR publication dry-runs.
82
+
83
+ ## Compatibility
84
+
85
+ This release requires no application or stored-data migration. Applications
86
+ may keep every existing single-write call unchanged. Batch adoption is
87
+ explicit and additive; custom adapters and older Plumbing implementations keep
88
+ their established fallback paths. JSR metadata remains validation-only because
89
+ the release workflow publishes npm plus the GitHub Release.
package/index.d.ts CHANGED
@@ -515,6 +515,7 @@ export declare class GitPersistencePortBase {
515
515
  writeBlob(content: Uint8Array): Promise<string>;
516
516
  writeBlobs?(contents: Iterable<Uint8Array>): Promise<string[]>;
517
517
  writeTree(entries: string[]): Promise<string>;
518
+ writeTrees?(trees: Iterable<string[]>): Promise<string[]>;
518
519
  readBlob(oid: string, maxBytes?: number): Promise<Uint8Array>;
519
520
  readBlobStream(oid: string): Promise<AsyncIterable<Uint8Array>>;
520
521
  readTree(
@@ -529,6 +530,12 @@ export declare class GitPersistencePortBase {
529
530
  ): AsyncIterable<{ mode: string; type: string; oid: string; name: string }>;
530
531
  readObjectType(oid: string): Promise<string>;
531
532
  readObjectSize(oid: string): Promise<number>;
533
+ readObjectInfos?(
534
+ oids: Iterable<string>
535
+ ): Promise<Array<{ oid: string; type: string; size: number }>>;
536
+ withWriteScope?<T>(
537
+ operation: (persistence: GitPersistencePortBase) => Promise<T>
538
+ ): Promise<T>;
532
539
  setMaxBlobSize?(maxBlobSize: number): void;
533
540
  close?(): Promise<void>;
534
541
  [Symbol.asyncDispose]?(): Promise<void>;
@@ -563,6 +570,8 @@ export declare class GitRefPortBase {
563
570
  after?: string | null;
564
571
  limit: number;
565
572
  }): AsyncIterable<{ ref: string; oid: string; symref: string | null }>;
573
+ close?(): Promise<void>;
574
+ [Symbol.asyncDispose]?(): Promise<void>;
566
575
  }
567
576
 
568
577
  /** Git-backed implementation of the persistence port. */
@@ -576,6 +585,13 @@ export declare class GitPersistenceAdapter extends GitPersistencePortBase {
576
585
  treeCacheBytes?: number;
577
586
  });
578
587
  writeBlobs(contents: Iterable<Uint8Array>): Promise<string[]>;
588
+ writeTrees(trees: Iterable<string[]>): Promise<string[]>;
589
+ readObjectInfos(
590
+ oids: Iterable<string>
591
+ ): Promise<Array<{ oid: string; type: string; size: number }>>;
592
+ withWriteScope<T>(
593
+ operation: (persistence: GitPersistencePortBase) => Promise<T>
594
+ ): Promise<T>;
579
595
  setMaxBlobSize(maxBlobSize: number): void;
580
596
  close(): Promise<void>;
581
597
  [Symbol.asyncDispose](): Promise<void>;
@@ -596,6 +612,8 @@ export declare class GitRefAdapter extends GitRefPortBase {
596
612
  after?: string | null;
597
613
  limit: number;
598
614
  }): AsyncIterable<{ ref: string; oid: string; symref: string | null }>;
615
+ close(): Promise<void>;
616
+ [Symbol.asyncDispose](): Promise<void>;
599
617
  }
600
618
 
601
619
  export type RepositoryObjectType = 'blob' | 'tree' | 'commit' | 'tag';
@@ -816,6 +834,10 @@ export declare class RootSet {
816
834
  entries: Iterable<RootSetEntry>;
817
835
  expectedHeadOid?: string | null;
818
836
  }): Promise<RootSetMutationResult>;
837
+ replaceExact(options: {
838
+ entries: Iterable<RootSetEntry>;
839
+ expectedHeadOid: string | null;
840
+ }): Promise<RootSetMutationResult>;
819
841
  mutate(
820
842
  mutator: (
821
843
  entries: ReadonlyArray<Readonly<RootSetEntry>>,
@@ -1449,6 +1471,12 @@ export interface AssetPutOptions {
1449
1471
 
1450
1472
  export interface AssetCapability {
1451
1473
  put(options: AssetPutOptions): Promise<StagedAsset>;
1474
+ putBatch(options: {
1475
+ assets: AssetPutOptions[];
1476
+ maxBatchAssets?: number;
1477
+ maxBatchObjects?: number;
1478
+ maxBatchBytes?: number;
1479
+ }): Promise<ReadonlyArray<StagedAsset>>;
1452
1480
  adopt(options: { treeOid: string }): Promise<StagedAsset>;
1453
1481
  open(options: {
1454
1482
  handle: AssetHandleInput;
@@ -1504,6 +1532,18 @@ export interface BundleCapability {
1504
1532
  | AsyncIterable<[string, BundleMemberInput]>;
1505
1533
  limits?: Partial<BundleLimits>;
1506
1534
  }): Promise<StagedBundle>;
1535
+ putOrderedBatch(options: {
1536
+ bundles: Array<{
1537
+ members:
1538
+ | Iterable<[string, BundleMemberInput]>
1539
+ | AsyncIterable<[string, BundleMemberInput]>;
1540
+ limits?: Partial<BundleLimits>;
1541
+ }>;
1542
+ maxBatchBundles?: number;
1543
+ maxBatchMembers?: number;
1544
+ maxBatchObjects?: number;
1545
+ maxBatchBytes?: number;
1546
+ }): Promise<ReadonlyArray<StagedBundle>>;
1507
1547
  getMember(options: {
1508
1548
  handle: BundleHandleInput;
1509
1549
  path: string;
@@ -1633,6 +1673,9 @@ export declare class StagingWorkspace {
1633
1673
  readonly expiresAt: string | null;
1634
1674
  readonly assets: {
1635
1675
  put(options: AssetPutOptions): Promise<WorkspaceRetainedAsset>;
1676
+ putBatch(
1677
+ options: Parameters<AssetCapability['putBatch']>[0],
1678
+ ): Promise<ReadonlyArray<WorkspaceRetainedAsset>>;
1636
1679
  adopt(options: { treeOid: string }): Promise<WorkspaceRetainedAsset>;
1637
1680
  };
1638
1681
  readonly pages: {
@@ -1644,6 +1687,9 @@ export declare class StagingWorkspace {
1644
1687
  readonly bundles: {
1645
1688
  put(options: Parameters<BundleCapability['put']>[0]): Promise<WorkspaceRetainedBundle>;
1646
1689
  putOrdered(options: Parameters<BundleCapability['putOrdered']>[0]): Promise<WorkspaceRetainedBundle>;
1690
+ putOrderedBatch(
1691
+ options: Parameters<BundleCapability['putOrderedBatch']>[0],
1692
+ ): Promise<ReadonlyArray<WorkspaceRetainedBundle>>;
1647
1693
  };
1648
1694
  checkpoint(options: { handles: Iterable<ApplicationHandleInput> }): Promise<WorkspaceCheckpointResult>;
1649
1695
  renew(): Promise<WorkspaceCheckpointResult>;
@@ -1813,6 +1859,10 @@ export default class ContentAddressableStore {
1813
1859
 
1814
1860
  createTree(options: { manifest: Manifest; merkleThreshold?: number }): Promise<string>;
1815
1861
 
1862
+ createTrees(
1863
+ requests: Array<{ manifest: Manifest; merkleThreshold?: number }>,
1864
+ ): Promise<string[]>;
1865
+
1816
1866
  verifyIntegrity(manifest: Manifest, options?: VerifyIntegrityOptions): Promise<boolean>;
1817
1867
 
1818
1868
  readManifest(options: { treeOid: string }): Promise<Manifest>;
package/index.js CHANGED
@@ -210,6 +210,7 @@ export default class ContentAddressableStore {
210
210
  });
211
211
  this.assets = Object.freeze({
212
212
  put: async (options) => (await this.#getAssetService()).put(options),
213
+ putBatch: async (options) => (await this.#getAssetService()).putBatch(options),
213
214
  adopt: async (options) => (await this.#getAssetService()).adopt(options),
214
215
  open: (options) => this.#openAsset(options),
215
216
  });
@@ -222,6 +223,7 @@ export default class ContentAddressableStore {
222
223
  this.bundles = Object.freeze({
223
224
  put: async (options) => (await this.#getBundleService()).put(options),
224
225
  putOrdered: async (options) => (await this.#getBundleService()).putOrdered(options),
226
+ putOrderedBatch: async (options) => (await this.#getBundleService()).putOrderedBatch(options),
225
227
  getMember: async (options) => (await this.#getBundleService()).getMember(options),
226
228
  getMemberReference: async (options) => (
227
229
  await this.#getBundleService()
@@ -262,6 +264,8 @@ export default class ContentAddressableStore {
262
264
  #stagingWorkspaceRegistry = null;
263
265
  /** @type {RepositoryDoctor|null} */
264
266
  #repositoryDoctor = null;
267
+ /** @type {GitRefAdapter|null} */
268
+ #ref = null;
265
269
  #closePromise = null;
266
270
  #closed = false;
267
271
  #servicePromise = null;
@@ -314,6 +318,7 @@ export default class ContentAddressableStore {
314
318
  plumbing: cfg.plumbing,
315
319
  policy: cfg.policy,
316
320
  });
321
+ this.#ref = ref;
317
322
  this.#vault = new VaultService({
318
323
  persistence,
319
324
  ref,
@@ -627,7 +632,16 @@ export default class ContentAddressableStore {
627
632
  return;
628
633
  }
629
634
  const service = await this.#servicePromise;
630
- await service.persistence.close();
635
+ const results = await Promise.allSettled([
636
+ service.persistence.close(),
637
+ this.#ref?.close(),
638
+ ]);
639
+ const failures = results
640
+ .filter((result) => result.status === 'rejected')
641
+ .map((result) => result.reason);
642
+ if (failures.length > 0) {
643
+ throw new AggregateError(failures, 'Content-addressable store failed to close cleanly');
644
+ }
631
645
  })();
632
646
  return await this.#closePromise;
633
647
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@git-stunts/git-cas",
3
- "version": "6.5.7",
3
+ "version": "6.5.8",
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",
@@ -44,6 +44,7 @@
44
44
  "docs/releases/v6.5.5.md",
45
45
  "docs/releases/v6.5.6.md",
46
46
  "docs/releases/v6.5.7.md",
47
+ "docs/releases/v6.5.8.md",
47
48
  "docs/THREAT_MODEL.md",
48
49
  "docs/VAULT_INTERNALS.md",
49
50
  "docs/WALKTHROUGH.md",
@@ -109,7 +110,7 @@
109
110
  "@flyingrobots/bijou-tui": "^7.2.0",
110
111
  "@flyingrobots/bijou-tui-app": "^7.2.0",
111
112
  "@git-stunts/alfred": "^0.10.0",
112
- "@git-stunts/plumbing": "^3.2.0",
113
+ "@git-stunts/plumbing": "^3.3.0",
113
114
  "@git-stunts/vault": "^1.0.1",
114
115
  "cbor-x": "^1.6.0",
115
116
  "commander": "14.0.3",