@git-stunts/git-cas 6.5.9 → 6.5.11

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 CHANGED
@@ -185,11 +185,13 @@ The facade is orchestration glue. It is not the storage engine itself.
185
185
  - **`StagingWorkspaceRegistry` and `StagingWorkspace`** — own renewable
186
186
  temporary RootSet generations for multi-step application construction.
187
187
  `WorkspaceCompoundAdmission` and `WorkspaceCompoundScope` serialize an
188
- explicitly bounded sequence of provisional page and bundle batches through
189
- one operation-owned persistence view, then install the union of prior and new
190
- targets in one exact generation. Existing workspace methods retain each
191
- result independently and remain the boundary when a handle leaves private
192
- construction code before later writes begin.
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.
193
195
 
194
196
  - **`RetentionService` and `PublicationService`** — validate complete handle
195
197
  graphs, then either retain them in a RootSet with generation-scoped evidence
package/CHANGELOG.md CHANGED
@@ -7,6 +7,40 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [6.5.11] — 2026-10-02
11
+
12
+ ### Fixed
13
+
14
+ - Require published Plumbing 3.3.2 so stale mktree transports after external Git GC enter the existing single fresh-process retry for single and batch tree writes. Producer and unrelated transport errors retain their identity; retry remains bounded at two attempts.
15
+
16
+ - CI and release Node unit checks and examples run through COPY-based Docker. Tests and benchmarks refuse host execution before loading test modules, including forged Docker and CI environment flags.
17
+
18
+ - Replace the host BATS platform launcher with sequential COPY-based Docker orchestration; a failed runtime stops the platform command.
19
+
20
+ ## [6.5.10] — 2026-08-24
21
+
22
+ ### Added
23
+
24
+ - **Compound asset admission and exact terminal roots** -
25
+ `workspace.batch()` now exposes bounded `scope.assets.putBatch()` alongside
26
+ page and ordered-bundle waves. An optional synchronous `retain(value)`
27
+ selector can retain a nonempty, canonical, deduplicated subset of handles
28
+ staged by that exact call while preserving every prior workspace root.
29
+ Malformed, asynchronous, empty, oversized, lookalike, and
30
+ valid-but-unstaged selections fail before ref movement. Omitting the selector
31
+ preserves v6.5.9 retain-all behavior.
32
+
33
+ ### Performance
34
+
35
+ - **One admission for payload-to-terminal graphs** - replay and provenance
36
+ assets can share the compound persistence scope and final workspace
37
+ installation with their support bundles, descriptor, and terminal bundle.
38
+ In the downstream controlled 65-node/65-patch git-warp prototype, cold Git
39
+ commands fell from 139 to 50 and median wall time from 2.823 s to 1.329 s;
40
+ incremental commands fell from 149 to 60 and median wall time from 3.040 s to
41
+ 1.387 s. Semantic fingerprints, cache posture, replay counts, storage
42
+ formats, handles, and the 25-command warm read path remained unchanged.
43
+
10
44
  ## [6.5.9] — 2026-08-24
11
45
 
12
46
  ### Added
package/GUIDE.md CHANGED
@@ -207,25 +207,30 @@ intermediate handles inside one compound staging-workspace operation:
207
207
 
208
208
  ```js
209
209
  const admitted = await workspace.batch({
210
- maxOperations: 3,
210
+ maxOperations: 4,
211
211
  operation: async (scope) => {
212
+ const assets = await scope.assets.putBatch({ assets: assetRequests });
212
213
  const pages = await scope.pages.putBatch({ pages: pageRequests });
213
214
  const leaves = await scope.bundles.putOrderedBatch({
214
- bundles: leafRequests(pages),
215
+ bundles: leafRequests(assets, pages),
215
216
  });
216
217
  return (await scope.bundles.putOrderedBatch({
217
218
  bundles: [rootRequest(leaves)],
218
219
  }))[0];
219
220
  },
221
+ retain: (terminal) => [terminal],
220
222
  });
221
223
  ```
222
224
 
223
225
  `admitted.value` becomes caller-visible only with `admitted.retention`, after
224
- one exact workspace generation anchors every staged handle. The default
225
- operation ceiling is 64 and the hard ceiling is 1,024; each scope call also
226
- preserves its ordinary page or bundle batch bounds. Use the existing
227
- independently retained workspace methods when intermediate handles must leave
228
- the private callback.
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.
229
234
 
230
235
  Repeated `pages.get()` calls reuse immutable payload reads within the store's
231
236
  bounded page cache. The defaults retain at most 128 payloads and 8 MiB; use
package/README.md CHANGED
@@ -41,8 +41,9 @@ 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. `workspace.batch()` can compose dependent page and bundle waves in
45
- one private persistence scope and retain their union under one exact final
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
46
47
  generation without changing content identity.
47
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.
48
49
  - **Runtime-Adaptive**: A single core supports Node.js 22+, Bun, and Deno through a strict hexagonal port architecture with runtime-specific crypto adapters.
@@ -52,7 +53,9 @@ Unlike traditional LFS which moves files to external servers, `git-cas` treats t
52
53
  Existing v5 users should read [UPGRADING.md](./UPGRADING.md) and run
53
54
  `npm run upgrade` in dry-run mode before restoring old encrypted vault entries.
54
55
  For the release overview, see the
55
- [v6.5.9 Release Notes](./docs/releases/v6.5.9.md).
56
+ [v6.5.10 Release Notes](./docs/releases/v6.5.10.md).
57
+
58
+ The v6.5.11 candidate adopts published Plumbing 3.3.2 for bounded recovery from closed mktree transports after external Git GC. It preserves producer error identity and existing object formats; see [v6.5.11 Release Notes](./docs/releases/v6.5.11.md). Registry publication is pending release verification and merge.
56
59
 
57
60
  ### 1. CLI Usage
58
61
 
@@ -158,7 +161,8 @@ Core capabilities:
158
161
  compare-and-swap refs, and immutable lifecycle evidence.
159
162
  - **Scoped staging workspaces**: `workspaces.open()` mirrors application writes
160
163
  behind one renewable temporary RootSet, supports one-generation bounded
161
- asset/page/bundle batches plus compound dependent page/bundle admission,
164
+ asset/page/bundle batches plus compound dependent asset/page/bundle admission
165
+ with exact newly staged terminal-root selection,
162
166
  returns only after each public result is anchored, promotes destination-first,
163
167
  and exposes bounded age, expiry, logical-content, and direct-root diagnostics
164
168
  with opaque cleanup pagination.
@@ -240,6 +244,8 @@ All three runtimes are tested in CI on every push. The hexagonal architecture is
240
244
  write waves, one-generation workspace batches, and reusable ref sessions.
241
245
  - **[v6.5.9 Release Notes](./docs/releases/v6.5.9.md)**: Compound dependent
242
246
  write waves retained under one exact staging-workspace generation.
247
+ - **[v6.5.10 Release Notes](./docs/releases/v6.5.10.md)**: Compound asset,
248
+ page, and bundle admission with exact selected terminal roots.
243
249
  - **[Upgrading](./UPGRADING.md)**: Migration guide for v5 → v6.
244
250
  - **[Changelog](./CHANGELOG.md)**: Version history and migration notes.
245
251
 
package/UPGRADING.md CHANGED
@@ -2,6 +2,42 @@
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
+
5
41
  ## v6.5.8 To v6.5.9
6
42
 
7
43
  v6.5.9 adds `workspace.batch()` and requires no application or stored-data
@@ -20,9 +56,11 @@ const admitted = await workspace.batch({
20
56
  const leaves = await scope.bundles.putOrderedBatch({
21
57
  bundles: buildLeafRequests(pages),
22
58
  });
23
- return (await scope.bundles.putOrderedBatch({
24
- bundles: [buildRootRequest(leaves)],
25
- }))[0];
59
+ return (
60
+ await scope.bundles.putOrderedBatch({
61
+ bundles: [buildRootRequest(leaves)],
62
+ })
63
+ )[0];
26
64
  },
27
65
  });
28
66
 
@@ -687,3 +725,7 @@ The manifest blob was corrupted or tampered with after storage. The original dat
687
725
  ### Constructor throws "chunker is required"
688
726
 
689
727
  You're using `CasService` directly. Either switch to the `ContentAddressableStore` facade (recommended) or inject a `chunker` and `compressionAdapter` manually. See [API Changes](#casservice-constructor-library-users).
728
+
729
+ ## v6.5.10 To v6.5.11
730
+
731
+ Update the package normally. The Plumbing minimum becomes 3.3.2 to recover closed mktree transports with the existing one-retry bound. No stored-data or application migration is required; unrelated and producer errors remain unchanged.
package/build-info.json CHANGED
@@ -1,4 +1,4 @@
1
1
  {
2
- "sha": "a16e31a",
3
- "timestamp": "2026-08-24T19:12:20.728Z"
2
+ "sha": "1bcd631",
3
+ "timestamp": "2026-10-02T12:47:21.894Z"
4
4
  }
@@ -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,15 @@
1
+ # git-cas v6.5.11 Release Notes
2
+
3
+ This patch release adopts published Plumbing 3.3.2 so a stale mktree process closed by external Git repacking enters the existing bounded immutable-object recovery. Single-tree and batched-tree writes reopen a failed process once. Two failed attempts stop with GitProtocolError; unrelated transport errors and producer errors retain their original identity.
4
+
5
+ ## Compatibility
6
+
7
+ No API, handle, stored object, descriptor, ref namespace, encryption, or reader format changes. No application or stored-data migration is required. Mutable-ref retry and publication rules remain unchanged.
8
+
9
+ ## Test Isolation
10
+
11
+ All tests and benchmarks require a physical Docker marker before test modules load. Environment flags do not authorize host execution. CI/release Node unit gates and maintained examples use COPY-based Docker without repository or Git-directory mounts.
12
+
13
+ ## Evidence And Delivery
14
+
15
+ Issue [#131](https://github.com/git-stunts/git-cas/issues/131) and PR [#132](https://github.com/git-stunts/git-cas/pull/132) own delivery. [Preparatory evidence](../design/0062-mktree-transport-recovery/witness/preparation.md) pins candidate behavior separately from registry delivery. The six recovery checks fail in four cases against Plumbing 3.3.0 and pass against published Plumbing 3.3.2. Full release verification, merge, signed tag, npm publication and registry consumer evidence remain required; this candidate document claims no published 6.5.11 artifact.
package/index.d.ts CHANGED
@@ -1618,6 +1618,11 @@ export const DEFAULT_WORKSPACE_COMPOUND_OPERATIONS: 64;
1618
1618
  export const MAX_WORKSPACE_COMPOUND_OPERATIONS: 1024;
1619
1619
 
1620
1620
  export interface WorkspaceCompoundScope {
1621
+ readonly assets: {
1622
+ putBatch(
1623
+ options: Parameters<AssetCapability['putBatch']>[0],
1624
+ ): Promise<ReadonlyArray<AssetHandle>>;
1625
+ };
1621
1626
  readonly pages: {
1622
1627
  putBatch(
1623
1628
  options: Parameters<PageCapability['putBatch']>[0],
@@ -1715,6 +1720,7 @@ export declare class StagingWorkspace {
1715
1720
  batch<T>(options: {
1716
1721
  operation(scope: WorkspaceCompoundScope): T | Promise<T>;
1717
1722
  maxOperations?: number;
1723
+ retain?: (value: T) => ReadonlyArray<ApplicationHandleInput>;
1718
1724
  }): Promise<Readonly<WorkspaceCompoundResult<T>>>;
1719
1725
  checkpoint(options: { handles: Iterable<ApplicationHandleInput> }): Promise<WorkspaceCheckpointResult>;
1720
1726
  renew(): Promise<WorkspaceCheckpointResult>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@git-stunts/git-cas",
3
- "version": "6.5.9",
3
+ "version": "6.5.11",
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",
@@ -46,6 +46,7 @@
46
46
  "docs/releases/v6.5.7.md",
47
47
  "docs/releases/v6.5.8.md",
48
48
  "docs/releases/v6.5.9.md",
49
+ "docs/releases/v6.5.10.md",
49
50
  "docs/THREAT_MODEL.md",
50
51
  "docs/VAULT_INTERNALS.md",
51
52
  "docs/WALKTHROUGH.md",
@@ -54,7 +55,8 @@
54
55
  "test/CONVENTIONS.md",
55
56
  "test/cycles/README.md",
56
57
  "LICENSE",
57
- "CHANGELOG.md"
58
+ "CHANGELOG.md",
59
+ "docs/releases/v6.5.11.md"
58
60
  ],
59
61
  "engines": {
60
62
  "node": ">=22.0.0"
@@ -85,17 +87,17 @@
85
87
  "provenance": true
86
88
  },
87
89
  "scripts": {
88
- "test": "vitest run test/unit",
90
+ "test": "docker compose run --build --rm test-node",
89
91
  "test:local": "vitest run test/unit",
90
92
  "test:node": "docker compose run --build --rm test-node",
91
93
  "test:bun": "docker compose run --build --rm test-bun",
92
94
  "test:deno": "docker compose run --build --rm test-deno",
93
- "test:integration": "vitest run test/integration --no-file-parallelism",
95
+ "test:integration": "docker compose run --build --rm test-node pnpm vitest run test/integration --no-file-parallelism",
94
96
  "test:integration:node": "docker compose run --build --rm test-node npx vitest run test/integration --no-file-parallelism",
95
97
  "test:integration:bun": "docker compose run --build --rm test-bun bunx vitest run test/integration --no-file-parallelism",
96
98
  "test:integration:deno": "docker compose run --build --rm test-deno deno run -A npm:vitest run test/integration --no-file-parallelism",
97
- "test:platforms": "bats --jobs 3 test/platform/runtimes.bats",
98
- "benchmark": "vitest bench test/benchmark",
99
+ "test:platforms": "docker compose run --build --rm test-node && docker compose run --build --rm test-bun && docker compose run --build --rm test-deno",
100
+ "benchmark": "docker compose run --build --rm test-node pnpm vitest bench test/benchmark",
99
101
  "benchmark:local": "vitest bench test/benchmark",
100
102
  "release:verify": "node scripts/release/verify.js",
101
103
  "stamp": "node scripts/stamp-build.js",
@@ -111,7 +113,7 @@
111
113
  "@flyingrobots/bijou-tui": "^7.2.0",
112
114
  "@flyingrobots/bijou-tui-app": "^7.2.0",
113
115
  "@git-stunts/alfred": "^0.10.0",
114
- "@git-stunts/plumbing": "^3.3.0",
116
+ "@git-stunts/plumbing": "^3.3.2",
115
117
  "@git-stunts/vault": "^1.0.1",
116
118
  "cbor-x": "^1.6.0",
117
119
  "commander": "14.0.3",
@@ -130,6 +132,7 @@
130
132
  "fast-check": "^4.6.0",
131
133
  "jsr": "^0.14.2",
132
134
  "prettier": "^3.4.2",
133
- "vitest": "^2.1.8"
135
+ "vitest": "^2.1.8",
136
+ "@git-stunts/docker-guard": "^0.1.0"
134
137
  }
135
138
  }
@@ -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,
@@ -70,7 +70,7 @@ export default class StagingWorkspaceRegistry {
70
70
  this.#crypto = crypto;
71
71
  this.#clock = clock;
72
72
  this.#descriptorCodec = descriptorCodec;
73
- this.#compound = new WorkspaceCompoundAdmission({ persistence, pages, bundles });
73
+ this.#compound = new WorkspaceCompoundAdmission({ persistence, assets, pages, bundles });
74
74
  Object.freeze(this);
75
75
  }
76
76
 
@@ -1,22 +1,25 @@
1
1
  import createCasError from '../errors/createCasError.js';
2
2
  import { ErrorCodes } from '../errors/index.js';
3
+ import parseApplicationHandle from '../value-objects/ApplicationHandle.js';
3
4
  import WorkspaceCompoundScope from './WorkspaceCompoundScope.js';
4
5
 
5
6
  /** Executes one bounded provisional graph build before exact workspace retention. */
6
7
  export default class WorkspaceCompoundAdmission {
8
+ #assets;
7
9
  #bundles;
8
10
  #pages;
9
11
  #persistence;
10
12
 
11
- constructor({ persistence, pages, bundles }) {
12
- WorkspaceCompoundAdmission.#assertDependencies({ persistence, pages, bundles });
13
+ constructor({ persistence, assets, pages, bundles }) {
14
+ WorkspaceCompoundAdmission.#assertDependencies({ persistence, assets, pages, bundles });
13
15
  this.#persistence = persistence;
16
+ this.#assets = assets;
14
17
  this.#pages = pages;
15
18
  this.#bundles = bundles;
16
19
  Object.freeze(this);
17
20
  }
18
21
 
19
- async admit({ operation, maxOperations, install } = {}) {
22
+ async admit({ operation, maxOperations, retain, install } = {}) {
20
23
  if (typeof install !== 'function') {
21
24
  throw createCasError(
22
25
  'Workspace compound admission requires an installation callback',
@@ -25,20 +28,23 @@ export default class WorkspaceCompoundAdmission {
25
28
  }
26
29
  return await withWriteScope(this.#persistence, async (persistence) => {
27
30
  const scope = new WorkspaceCompoundScope({
31
+ assets: this.#assets,
28
32
  pages: this.#pages,
29
33
  bundles: this.#bundles,
30
34
  persistence,
31
35
  maxOperations,
32
36
  });
33
37
  const prepared = await scope.execute(operation);
34
- const retention = await install(prepared.staged, persistence);
38
+ const selected = retainedArtifacts(prepared, retain);
39
+ const retention = await install(selected, persistence);
35
40
  return Object.freeze({ value: prepared.value, retention });
36
41
  });
37
42
  }
38
43
 
39
- static #assertDependencies({ persistence, pages, bundles }) {
44
+ static #assertDependencies({ persistence, assets, pages, bundles }) {
40
45
  const missing = [
41
46
  ['persistence', persistence === null || typeof persistence !== 'object'],
47
+ ['assets', assets === null || typeof assets !== 'object'],
42
48
  ['pages.putBatch', typeof pages?.putBatch !== 'function'],
43
49
  ['bundles', bundles === null || typeof bundles !== 'object'],
44
50
  ]
@@ -54,6 +60,75 @@ export default class WorkspaceCompoundAdmission {
54
60
  }
55
61
  }
56
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
+
57
132
  async function withWriteScope(persistence, operation) {
58
133
  return typeof persistence.withWriteScope === 'function'
59
134
  ? await persistence.withWriteScope(operation)
@@ -4,9 +4,10 @@ import { ErrorCodes } from '../errors/index.js';
4
4
  export const DEFAULT_WORKSPACE_COMPOUND_OPERATIONS = 64;
5
5
  export const MAX_WORKSPACE_COMPOUND_OPERATIONS = 1_024;
6
6
 
7
- /** Bounded provisional page and bundle writes owned by one compound admission. */
7
+ /** Bounded provisional asset, page, and bundle writes owned by one compound admission. */
8
8
  export default class WorkspaceCompoundScope {
9
9
  #active = true;
10
+ #assets;
10
11
  #abortFailure;
11
12
  #aborted = false;
12
13
  #bundles;
@@ -20,13 +21,18 @@ export default class WorkspaceCompoundScope {
20
21
  #staged = [];
21
22
  #tail = Promise.resolve();
22
23
 
23
- constructor({ pages, bundles, persistence, maxOperations }) {
24
- WorkspaceCompoundScope.#assertDependencies({ pages, bundles, persistence });
24
+ constructor({ assets, pages, bundles, persistence, maxOperations }) {
25
+ WorkspaceCompoundScope.#assertDependencies({ assets, pages, bundles, persistence });
26
+ this.#assets = assets;
25
27
  this.#pages = pages;
26
28
  this.#bundles = bundles;
27
29
  this.#persistence = persistence;
28
30
  this.#maxOperations = WorkspaceCompoundScope.#operationLimit(maxOperations);
29
31
  this.api = Object.freeze({
32
+ assets: Object.freeze({
33
+ putBatch: (options) =>
34
+ this.#enqueue('assets.putBatch', async () => await this.#putAssets(options)),
35
+ }),
30
36
  pages: Object.freeze({
31
37
  putBatch: (options) =>
32
38
  this.#enqueue('pages.putBatch', async () => await this.#putPages(options)),
@@ -137,6 +143,18 @@ export default class WorkspaceCompoundScope {
137
143
  }
138
144
  }
139
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
+
140
158
  async #putPages(options) {
141
159
  const staged = await this.#pages.putBatchWithPersistence(options, this.#persistence);
142
160
  return this.#record(staged, 'page');
@@ -171,8 +189,9 @@ export default class WorkspaceCompoundScope {
171
189
  return limit;
172
190
  }
173
191
 
174
- static #assertDependencies({ pages, bundles, persistence }) {
192
+ static #assertDependencies({ assets, pages, bundles, persistence }) {
175
193
  const missing = [
194
+ ['assets', assets === null || typeof assets !== 'object'],
176
195
  ['pages.putBatchWithPersistence', typeof pages?.putBatchWithPersistence !== 'function'],
177
196
  [
178
197
  'bundles.putOrderedBatchWithPersistence',
@@ -1 +1 @@
1
- export const PACKAGE_VERSION = '6.5.9';
1
+ export const PACKAGE_VERSION = '6.5.11';
@@ -66,11 +66,9 @@ sorted output semantics instead of assuming first-seen insertion order.
66
66
  If insertion order matters, assert it at the lower-level boundary that builds
67
67
  the tree entries before they are handed to Git.
68
68
 
69
- ## Integration Runtime Policy
69
+ ## Test Runtime Policy
70
70
 
71
- **Integration suites are Docker-only.** The integration tests intentionally
72
- refuse to run on the host and require `GIT_STUNTS_DOCKER=1` so Git, Bun, and
73
- Deno run in a consistent environment.
71
+ **All tests and benchmarks are Docker-only.** Vitest setup uses `@git-stunts/docker-guard` with a physical Docker marker before test modules load. Environment flags do not authorize host execution. Use COPY-based Docker Compose services without repository or Git-directory mounts. `npm test` routes to the Node service; `test:local` is an in-container command.
74
72
 
75
73
  **Integration files run with `fileParallelism: false`.** These tests spawn real
76
74
  Git and CLI subprocesses, so the integration workspace is intentionally kept to