@git-stunts/git-cas 6.3.0 → 6.5.0
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 +2 -0
- package/CHANGELOG.md +57 -0
- package/README.md +29 -20
- package/UPGRADING.md +106 -19
- package/build-info.json +2 -2
- package/docs/API.md +204 -17
- package/docs/releases/v6.4.0.md +128 -0
- package/docs/releases/v6.5.0.md +140 -0
- package/index.d.ts +205 -2
- package/index.js +38 -0
- package/package.json +3 -1
- package/src/domain/errors/Codes.js +10 -0
- package/src/domain/services/BundleService.js +32 -3
- package/src/domain/services/RepositoryDoctor.js +97 -2
- package/src/domain/services/RootSetPersistence.js +89 -9
- package/src/domain/services/StagingWorkspace.js +530 -0
- package/src/domain/services/StagingWorkspaceRegistry.js +545 -0
- package/src/domain/services/WorkspaceDescriptorCodec.js +144 -0
- package/src/domain/value-objects/WorkspaceRef.js +151 -0
- package/src/helpers/boundedPromiseCache.js +108 -0
- package/src/infrastructure/adapters/GitPersistenceAdapter.js +58 -27
- package/src/infrastructure/adapters/GitRefAdapter.js +56 -14
- package/src/package-version.js +1 -1
- package/src/ports/GitRefPort.js +1 -0
package/ARCHITECTURE.md
CHANGED
|
@@ -374,6 +374,8 @@ Pure utility functions with no domain or infrastructure coupling:
|
|
|
374
374
|
- **`kdfPolicy.js`** — KDF parameter validation and sensible defaults.
|
|
375
375
|
- **`aesGcmMeta.js`** — AES-GCM metadata validation (IV length, tag length).
|
|
376
376
|
- **`canonicalBase64.js`** — base64 encoding round-trip integrity check.
|
|
377
|
+
- **`boundedPromiseCache.js`** — fixed-residency LRU coalescing for immutable
|
|
378
|
+
async reads; rejected work is never retained.
|
|
377
379
|
|
|
378
380
|
## Storage Model
|
|
379
381
|
|
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,63 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [6.5.0] — 2026-07-18
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **Direct bundle references** - `bundles.getMemberReference()` and
|
|
15
|
+
`bundles.iterateMemberReferences()` validate bundle structure, canonical
|
|
16
|
+
descriptors, direct Git edges, and direct target object types without
|
|
17
|
+
recursively resolving each member's support graph. Existing member and root
|
|
18
|
+
methods retain complete-validation semantics.
|
|
19
|
+
|
|
20
|
+
### Performance
|
|
21
|
+
|
|
22
|
+
- **Bounded immutable Git metadata coalescing** - repeated exact tree-entry and
|
|
23
|
+
object-info reads now share successful in-flight and completed work through a
|
|
24
|
+
fixed-residency LRU. BundleService separately retains only structural
|
|
25
|
+
descriptor bytes under both entry and byte bounds. Rejected work is evicted,
|
|
26
|
+
mutable records are cloned for callers, and no application payloads or ref
|
|
27
|
+
state enter either cache.
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
|
|
31
|
+
- **Observed RootSet compare-and-swap races** - exact failed
|
|
32
|
+
`update-ref --no-deref` commands with an independently observed head advance
|
|
33
|
+
now normalize to `ROOT_SET_CONFLICT` even when Git emits no diagnostic text.
|
|
34
|
+
OIDs are compared canonically so case-only differences do not create false
|
|
35
|
+
conflicts.
|
|
36
|
+
- **Bounded cache settlement** - rejected work is removed before its returned
|
|
37
|
+
promise settles, and a resolved value larger than its weight budget is
|
|
38
|
+
discarded before eviction runs, preserving retryability and unrelated
|
|
39
|
+
residents.
|
|
40
|
+
|
|
41
|
+
## [6.4.0] — 2026-07-17
|
|
42
|
+
|
|
43
|
+
### Added
|
|
44
|
+
|
|
45
|
+
- **Scoped staging workspaces** — `cas.workspaces.open()` now provides a
|
|
46
|
+
renewable, RootSet-backed lifetime for intermediate asset, page, and bundle
|
|
47
|
+
writes. Staging returns only after its typed handle is reachable from the
|
|
48
|
+
exact workspace generation; checkpoint compaction, witness-checked
|
|
49
|
+
destination-first cache or publication promotion, idempotent checked
|
|
50
|
+
release, and serialized mutations preserve explicit ownership under
|
|
51
|
+
concurrency. Expiry is
|
|
52
|
+
observable posture rather than automatic revocation. Namespace-bounded
|
|
53
|
+
inspection and checked sweep expose root count, age, expiry, logical content
|
|
54
|
+
bytes, unique direct-root object bytes, invalid state, conflicts, and
|
|
55
|
+
truncation. Repository doctor includes the same workspace inventory without
|
|
56
|
+
claiming deduplicated or packed physical-byte attribution. Workspace
|
|
57
|
+
witnesses reuse the existing `root-set` kind, and workspace-detail truncation
|
|
58
|
+
uses a dedicated code without widening closed public discriminant unions.
|
|
59
|
+
|
|
60
|
+
### Fixed
|
|
61
|
+
|
|
62
|
+
- **RootSet structured lock retries** — exact managed `update-ref --no-deref`
|
|
63
|
+
lock races surfaced as `GIT_REPOSITORY_LOCKED` now normalize to
|
|
64
|
+
`ROOT_SET_CONFLICT`, allowing the existing bounded retry policy to run.
|
|
65
|
+
Structured lock failures for other refs remain terminal.
|
|
66
|
+
|
|
10
67
|
## [6.3.0] — 2026-07-17
|
|
11
68
|
|
|
12
69
|
### Added
|
package/README.md
CHANGED
|
@@ -44,7 +44,7 @@ Unlike traditional LFS which moves files to external servers, `git-cas` treats t
|
|
|
44
44
|
Existing v5 users should read [UPGRADING.md](./UPGRADING.md) and run
|
|
45
45
|
`npm run upgrade` in dry-run mode before restoring old encrypted vault entries.
|
|
46
46
|
For the release overview, see the
|
|
47
|
-
[v6.
|
|
47
|
+
[v6.5.0 Release Notes](./docs/releases/v6.5.0.md).
|
|
48
48
|
|
|
49
49
|
### 1. CLI Usage
|
|
50
50
|
|
|
@@ -94,20 +94,21 @@ the asset reachable.
|
|
|
94
94
|
|
|
95
95
|
The README is the front door. Detailed mechanics live in the guide set:
|
|
96
96
|
|
|
97
|
-
| Need | Start Here
|
|
98
|
-
| ------------------------------------------------------- |
|
|
99
|
-
| Productive library and CLI workflows | [Developer Guide](./GUIDE.md)
|
|
100
|
-
| Restore memory behavior | [Streaming and restore matrix](./GUIDE.md#streaming-surface)
|
|
101
|
-
| Encryption scheme selection | [Encryption Modes](./docs/ENCRYPTION_MODES.md)
|
|
102
|
-
| CDC internals, Merkle manifests, KDF policy, and tuning | [Advanced Guide](./ADVANCED_GUIDE.md)
|
|
103
|
-
| Ports, adapters, and collaborator boundaries | [Architecture](./ARCHITECTURE.md)
|
|
104
|
-
| Assets, pages, bundles, retention, and publication | [Application storage](./docs/API.md#application-storage)
|
|
105
|
-
|
|
|
106
|
-
|
|
|
107
|
-
|
|
|
108
|
-
|
|
|
109
|
-
|
|
|
110
|
-
|
|
|
97
|
+
| Need | Start Here |
|
|
98
|
+
| ------------------------------------------------------- | -------------------------------------------------------------------- |
|
|
99
|
+
| Productive library and CLI workflows | [Developer Guide](./GUIDE.md) |
|
|
100
|
+
| Restore memory behavior | [Streaming and restore matrix](./GUIDE.md#streaming-surface) |
|
|
101
|
+
| Encryption scheme selection | [Encryption Modes](./docs/ENCRYPTION_MODES.md) |
|
|
102
|
+
| CDC internals, Merkle manifests, KDF policy, and tuning | [Advanced Guide](./ADVANCED_GUIDE.md) |
|
|
103
|
+
| Ports, adapters, and collaborator boundaries | [Architecture](./ARCHITECTURE.md) |
|
|
104
|
+
| Assets, pages, bundles, retention, and publication | [Application storage](./docs/API.md#application-storage) |
|
|
105
|
+
| Temporary retention during multi-step composition | [Scoped staging workspaces](./docs/API.md#scoped-staging-workspaces) |
|
|
106
|
+
| GC retention for caches and derived state | [Root Sets](./docs/API.md#root-sets) |
|
|
107
|
+
| Managed TTL and capacity caches | [Cache Sets](./docs/API.md#cache-sets) |
|
|
108
|
+
| Scoped protection while consuming a cache hit | [Cache acquisitions](./docs/API.md#acquire-and-release) |
|
|
109
|
+
| Durable replay markers with expiry-only release | [Expiring Sets](./docs/API.md#expiring-sets) |
|
|
110
|
+
| Repository reachability and git-cas usage evidence | [Repository Diagnostics](./docs/API.md#repository-diagnostics) |
|
|
111
|
+
| v5 to v6 migration | [Upgrading](./UPGRADING.md) |
|
|
111
112
|
|
|
112
113
|
Core capabilities:
|
|
113
114
|
|
|
@@ -137,15 +138,19 @@ Core capabilities:
|
|
|
137
138
|
read-only, and `sweep()` can release only markers whose expiry has passed.
|
|
138
139
|
- **Application storage**: `assets`, `pages`, `bundles`, `retention`, and
|
|
139
140
|
`publications` compose streaming CAS writes, bounded structured
|
|
140
|
-
materializations,
|
|
141
|
-
compare-and-swap refs, and immutable lifecycle evidence.
|
|
141
|
+
materializations, direct-reference or complete-validation member reads,
|
|
142
|
+
reachability roots, compare-and-swap refs, and immutable lifecycle evidence.
|
|
143
|
+
- **Scoped staging workspaces**: `workspaces.open()` mirrors application writes
|
|
144
|
+
behind one renewable temporary RootSet, returns only after each handle is
|
|
145
|
+
anchored, promotes destination-first, and exposes bounded age, expiry,
|
|
146
|
+
logical-content, and direct-root diagnostics with opaque cleanup pagination.
|
|
142
147
|
- **Envelope recipients**: multi-recipient key wrapping and recipient rotation
|
|
143
148
|
avoid re-encrypting data blobs.
|
|
144
149
|
- **Operational diagnostics**: `cas.diagnostics.doctor()` streams repository
|
|
145
150
|
object/ref evidence, classifies anchored, orphaned, and volatile objects,
|
|
146
|
-
and summarizes cache acquisitions, CacheSet, RootSet,
|
|
147
|
-
usage without mutating Git. The `git-cas doctor` CLI
|
|
148
|
-
vault health.
|
|
151
|
+
and summarizes workspaces, cache acquisitions, CacheSet, RootSet,
|
|
152
|
+
ExpiringSet, and Vault usage without mutating Git. The `git-cas doctor` CLI
|
|
153
|
+
continues to validate vault health.
|
|
149
154
|
|
|
150
155
|
## Safety Snapshot
|
|
151
156
|
|
|
@@ -195,6 +200,10 @@ All three runtimes are tested in CI on every push. The hexagonal architecture is
|
|
|
195
200
|
repository diagnostics.
|
|
196
201
|
- **[v6.3.0 Release Notes](./docs/releases/v6.3.0.md)**: Lifetime-safe,
|
|
197
202
|
reference-only cache acquisitions with explicit release and doctor evidence.
|
|
203
|
+
- **[v6.4.0 Release Notes](./docs/releases/v6.4.0.md)**: Scoped staging
|
|
204
|
+
workspaces for temporary multi-object reachability, promotion, and cleanup.
|
|
205
|
+
- **[v6.5.0 Release Notes](./docs/releases/v6.5.0.md)**: Bounded direct bundle
|
|
206
|
+
references, immutable metadata reuse, and corrected concurrency settlement.
|
|
198
207
|
- **[Upgrading](./UPGRADING.md)**: Migration guide for v5 → v6.
|
|
199
208
|
- **[Changelog](./CHANGELOG.md)**: Version history and migration notes.
|
|
200
209
|
|
package/UPGRADING.md
CHANGED
|
@@ -2,6 +2,93 @@
|
|
|
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.4.0 To v6.5.0
|
|
6
|
+
|
|
7
|
+
v6.5.0 is API-additive and does not require stored-data migration. It adds
|
|
8
|
+
bounded reference reads for callers that need a member handle without
|
|
9
|
+
recursively resolving that member's complete support graph.
|
|
10
|
+
|
|
11
|
+
Use `getMemberReference()` for one exact path:
|
|
12
|
+
|
|
13
|
+
```javascript
|
|
14
|
+
const reference = await cas.bundles.getMemberReference({
|
|
15
|
+
handle: materializationBundle,
|
|
16
|
+
path: 'nodes/user-alice.cbor',
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
if (reference) {
|
|
20
|
+
await consumeRetainedHandle(reference.handle);
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Use `iterateMemberReferences()` for a streaming structural scan:
|
|
25
|
+
|
|
26
|
+
```javascript
|
|
27
|
+
for await (const reference of cas.bundles.iterateMemberReferences({
|
|
28
|
+
handle: materializationBundle,
|
|
29
|
+
})) {
|
|
30
|
+
await indexReference(reference);
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
These APIs validate the bundle root, every traversed descriptor summary, the
|
|
35
|
+
selected or enumerated Git tree edges, and each direct target object type. They
|
|
36
|
+
do not recursively validate nested page, asset, or bundle support graphs. Keep
|
|
37
|
+
using `getMember()` or `iterateMembers()` when the operation requires complete
|
|
38
|
+
recursive validation and computed `logicalBytes`.
|
|
39
|
+
|
|
40
|
+
Reference results are observations, not retention claims. Keep the containing
|
|
41
|
+
bundle reachable through a workspace, cache acquisition, RootSet, or other
|
|
42
|
+
documented lifetime while consuming them. The immutable metadata and
|
|
43
|
+
descriptor caches introduced in v6.5.0 are bounded internal implementation
|
|
44
|
+
details; callers do not manage or invalidate them.
|
|
45
|
+
|
|
46
|
+
See [v6.5.0 Release Notes](./docs/releases/v6.5.0.md) and
|
|
47
|
+
[Application Storage](./docs/API.md#application-storage) for the
|
|
48
|
+
complete integrity and lifetime contract.
|
|
49
|
+
|
|
50
|
+
## v6.3.0 To v6.4.0
|
|
51
|
+
|
|
52
|
+
v6.4.0 is API-additive and does not require stored-data migration. It adds
|
|
53
|
+
scoped staging workspaces for applications that construct one durable result
|
|
54
|
+
from many intermediate assets, pages, or bundles.
|
|
55
|
+
|
|
56
|
+
Do not use a CacheSet as temporary construction storage. Open one workspace,
|
|
57
|
+
stage the intermediate values through it, compact the retained roots after an
|
|
58
|
+
aggregate becomes transitively complete, and promote only the terminal handle:
|
|
59
|
+
|
|
60
|
+
```javascript
|
|
61
|
+
const workspace = await cas.workspaces.open({
|
|
62
|
+
namespace: 'my-application/materializations',
|
|
63
|
+
ttlMs: 2 * 60 * 60 * 1000,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
try {
|
|
67
|
+
const page = await workspace.pages.put({ source: encodedPage });
|
|
68
|
+
const bundle = await workspace.bundles.putOrdered({
|
|
69
|
+
members: [['pages/result.cbor', page.handle]],
|
|
70
|
+
});
|
|
71
|
+
await workspace.checkpoint({ handles: [bundle.handle] });
|
|
72
|
+
await workspace.promoteToCache({ cache, key, handle: bundle.handle });
|
|
73
|
+
} finally {
|
|
74
|
+
await workspace.release();
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Every returned staged value is anchored by an exact workspace generation.
|
|
79
|
+
Promotion requires matching destination retention evidence before source
|
|
80
|
+
release. Expiry is diagnostic posture, not automatic deletion; abandoned
|
|
81
|
+
workspaces remain reachable until a caller traverses bounded `inspect()` or
|
|
82
|
+
`sweep()` pages using `nextCursor`.
|
|
83
|
+
|
|
84
|
+
The interval between writing an object and publishing the workspace ref still
|
|
85
|
+
depends on Git's ordinary unreachable-object grace period. Concurrent
|
|
86
|
+
immediate-expiry pruning inside that interval is unsupported.
|
|
87
|
+
|
|
88
|
+
See [v6.4.0 Release Notes](./docs/releases/v6.4.0.md) and
|
|
89
|
+
[Scoped Staging Workspaces](./docs/API.md#scoped-staging-workspaces) for the
|
|
90
|
+
complete retention, promotion, and recovery contract.
|
|
91
|
+
|
|
5
92
|
## v6.2.0 To v6.3.0
|
|
6
93
|
|
|
7
94
|
v6.3.0 is API-additive and does not require stored-data migration. It adds
|
|
@@ -156,13 +243,13 @@ for example a job workspace or tenant-scoped artifact directory.
|
|
|
156
243
|
|
|
157
244
|
v5 had 5 encryption scheme identifiers. v6 has 3:
|
|
158
245
|
|
|
159
|
-
| v5 Scheme
|
|
160
|
-
|
|
161
|
-
| `whole-v1`
|
|
162
|
-
| `whole-v2`
|
|
163
|
-
| `framed-v1`
|
|
164
|
-
| `framed-v2`
|
|
165
|
-
| `convergent-v1` | `convergent` | Rename only
|
|
246
|
+
| v5 Scheme | v6 Scheme | Migration |
|
|
247
|
+
| --------------- | ------------ | ------------------------------------------ |
|
|
248
|
+
| `whole-v1` | `whole` | **Re-encryption required** (v1 had no AAD) |
|
|
249
|
+
| `whole-v2` | `whole` | Rename only (already had AAD) |
|
|
250
|
+
| `framed-v1` | `framed` | **Re-encryption required** (v1 had no AAD) |
|
|
251
|
+
| `framed-v2` | `framed` | Rename only (already had AAD) |
|
|
252
|
+
| `convergent-v1` | `convergent` | Rename only |
|
|
166
253
|
|
|
167
254
|
### Why
|
|
168
255
|
|
|
@@ -243,11 +330,11 @@ verifier and the next keyed vault write will add it.
|
|
|
243
330
|
|
|
244
331
|
### What Changed
|
|
245
332
|
|
|
246
|
-
| Scenario
|
|
247
|
-
|
|
248
|
-
| CDC chunking + encryption
|
|
249
|
-
| Fixed chunking + encryption | `framed-v1` | `framed`
|
|
250
|
-
| Explicit `whole`
|
|
333
|
+
| Scenario | v5 Default | v6 Default |
|
|
334
|
+
| --------------------------- | ----------- | ------------ |
|
|
335
|
+
| CDC chunking + encryption | `framed-v1` | `convergent` |
|
|
336
|
+
| Fixed chunking + encryption | `framed-v1` | `framed` |
|
|
337
|
+
| Explicit `whole` | `whole-v1` | `whole` |
|
|
251
338
|
|
|
252
339
|
### What This Means
|
|
253
340
|
|
|
@@ -340,14 +427,14 @@ import { SCHEME_WHOLE, SCHEME_FRAMED, SCHEME_CONVERGENT } from '@git-stunts/git-
|
|
|
340
427
|
|
|
341
428
|
### Behavioral Changes
|
|
342
429
|
|
|
343
|
-
| Change
|
|
344
|
-
|
|
345
|
-
| Plaintext + gzip restore now streams
|
|
346
|
-
| AAD always on for `whole` and `framed`
|
|
430
|
+
| Change | Impact |
|
|
431
|
+
| ---------------------------------------- | ------------------------------------------------------------------------------------- |
|
|
432
|
+
| Plaintext + gzip restore now streams | This lowers memory usage and should be transparent. |
|
|
433
|
+
| AAD always on for `whole` and `framed` | Cannot opt out. v1-style no-AAD is gone. |
|
|
347
434
|
| Manifest integrity hash verified on read | Corrupted manifests that previously loaded will now throw `MANIFEST_INTEGRITY_ERROR`. |
|
|
348
|
-
| KDF policy enforced in `deriveKey()`
|
|
349
|
-
| Concurrency capped at 64
|
|
350
|
-
| frameBytes capped at 64 MiB
|
|
435
|
+
| KDF policy enforced in `deriveKey()` | Dangerously weak params (e.g., 1 PBKDF2 iteration) now throw `KDF_POLICY_VIOLATION`. |
|
|
436
|
+
| Concurrency capped at 64 | Was unbounded. Unlikely to affect real usage. |
|
|
437
|
+
| frameBytes capped at 64 MiB | Was unbounded. Unlikely to affect real usage. |
|
|
351
438
|
|
|
352
439
|
---
|
|
353
440
|
|
package/build-info.json
CHANGED
package/docs/API.md
CHANGED
|
@@ -16,17 +16,18 @@ should treat restored data, chunker output, codec output, and keys as
|
|
|
16
16
|
|
|
17
17
|
1. [ContentAddressableStore](#contentaddressablestore)
|
|
18
18
|
2. [Application Storage](#application-storage)
|
|
19
|
-
3. [
|
|
20
|
-
4. [
|
|
21
|
-
5. [
|
|
22
|
-
6. [
|
|
23
|
-
7. [
|
|
24
|
-
8. [
|
|
25
|
-
9. [
|
|
26
|
-
10. [
|
|
27
|
-
11. [
|
|
28
|
-
12. [
|
|
29
|
-
13. [
|
|
19
|
+
3. [Scoped Staging Workspaces](#scoped-staging-workspaces)
|
|
20
|
+
4. [Root Sets](#root-sets)
|
|
21
|
+
5. [Cache Sets](#cache-sets)
|
|
22
|
+
6. [Expiring Sets](#expiring-sets)
|
|
23
|
+
7. [Repository Diagnostics](#repository-diagnostics)
|
|
24
|
+
8. [Vault](#vault)
|
|
25
|
+
9. [CasService](#casservice)
|
|
26
|
+
10. [Events](#events)
|
|
27
|
+
11. [Value Objects](#value-objects)
|
|
28
|
+
12. [Ports](#ports)
|
|
29
|
+
13. [Codecs](#codecs)
|
|
30
|
+
14. [Error Codes](#error-codes)
|
|
30
31
|
|
|
31
32
|
## ContentAddressableStore
|
|
32
33
|
|
|
@@ -1076,6 +1077,47 @@ The canonical bundle token is:
|
|
|
1076
1077
|
git-cas:1:bundle:fanout-tree:<codec>:<sha1|sha256>:<oid>
|
|
1077
1078
|
```
|
|
1078
1079
|
|
|
1080
|
+
### Direct bundle references
|
|
1081
|
+
|
|
1082
|
+
```javascript
|
|
1083
|
+
const reference = await cas.bundles.getMemberReference({
|
|
1084
|
+
handle: materializationHandle,
|
|
1085
|
+
path: 'nodes/root',
|
|
1086
|
+
});
|
|
1087
|
+
|
|
1088
|
+
for await (const reference of cas.bundles.iterateMemberReferences({
|
|
1089
|
+
handle: materializationHandle,
|
|
1090
|
+
})) {
|
|
1091
|
+
indexHandle(reference.path, reference.handle);
|
|
1092
|
+
}
|
|
1093
|
+
```
|
|
1094
|
+
|
|
1095
|
+
`getMemberReference()` and `iterateMemberReferences()` are the explicit lazy
|
|
1096
|
+
integrity surfaces. They validate the bundle root, persisted limits, fanout
|
|
1097
|
+
summaries, canonical member descriptor, direct Git tree edge, and direct target
|
|
1098
|
+
object type. They do not recursively resolve the referenced member's complete
|
|
1099
|
+
support graph. Use them for indexes and manifests that dereference only selected
|
|
1100
|
+
members.
|
|
1101
|
+
|
|
1102
|
+
Each immutable `BundleMemberReference` contains `version`, `path`, `handle`,
|
|
1103
|
+
`type`, and declared `size`. Missing paths return `null`; malformed bundle
|
|
1104
|
+
structure, mismatched edges, and missing or mistyped direct targets fail closed.
|
|
1105
|
+
Completing reference iteration still validates root and fanout summaries.
|
|
1106
|
+
|
|
1107
|
+
The Git persistence adapter coalesces successful exact tree-entry and
|
|
1108
|
+
object-info reads in one process-local LRU with a fixed 2,048-entry default.
|
|
1109
|
+
Bundle traversal separately retains immutable structural descriptor bytes under
|
|
1110
|
+
a 1,024-entry and 16 MiB total bound. Rejected work is removed, returned
|
|
1111
|
+
tree-entry records are cloned, and application payloads, refs, and collection
|
|
1112
|
+
state are never cached. Advanced direct adapter construction may set
|
|
1113
|
+
`metadataCacheEntries` to another positive safe integer.
|
|
1114
|
+
|
|
1115
|
+
Object identity is immutable, but external pruning can change whether an
|
|
1116
|
+
unretained object remains available. Keep roots retained for the adapter's
|
|
1117
|
+
operation lifetime and do not race active reads with destructive repository
|
|
1118
|
+
maintenance. Payload access performs authoritative Git I/O if availability
|
|
1119
|
+
changes despite that precondition.
|
|
1120
|
+
|
|
1079
1121
|
### `bundles.getMember()`, `bundles.iterateMembers()`, and `bundles.openMember()`
|
|
1080
1122
|
|
|
1081
1123
|
```javascript
|
|
@@ -1239,6 +1281,137 @@ generation later.
|
|
|
1239
1281
|
`toJSON()` serializes `handle` to its canonical token and copies the root
|
|
1240
1282
|
evidence fields.
|
|
1241
1283
|
|
|
1284
|
+
## Scoped Staging Workspaces
|
|
1285
|
+
|
|
1286
|
+
Scoped staging workspaces retain intermediate application handles while a
|
|
1287
|
+
caller builds a larger asset or bundle. They are the high-level temporary
|
|
1288
|
+
reachability API. Use them instead of managing Git refs, raw CAS objects, or a
|
|
1289
|
+
general CacheSet as a build scratchpad.
|
|
1290
|
+
|
|
1291
|
+
```javascript
|
|
1292
|
+
const workspace = await cas.workspaces.open({
|
|
1293
|
+
namespace: 'git-warp/materializations',
|
|
1294
|
+
ttlMs: 2 * 60 * 60 * 1000,
|
|
1295
|
+
});
|
|
1296
|
+
|
|
1297
|
+
try {
|
|
1298
|
+
const first = await workspace.pages.put({ source: firstShard });
|
|
1299
|
+
const second = await workspace.pages.put({ source: secondShard });
|
|
1300
|
+
const bundle = await workspace.bundles.putOrdered({
|
|
1301
|
+
members: [
|
|
1302
|
+
['shards/first.cbor', first.handle],
|
|
1303
|
+
['shards/second.cbor', second.handle],
|
|
1304
|
+
],
|
|
1305
|
+
});
|
|
1306
|
+
|
|
1307
|
+
await workspace.checkpoint({ handles: [bundle.handle] });
|
|
1308
|
+
return await workspace.promoteToCache({
|
|
1309
|
+
cache,
|
|
1310
|
+
key: materializationKey,
|
|
1311
|
+
handle: bundle.handle,
|
|
1312
|
+
options: { retention: 'evictable' },
|
|
1313
|
+
});
|
|
1314
|
+
} finally {
|
|
1315
|
+
await workspace.release();
|
|
1316
|
+
}
|
|
1317
|
+
```
|
|
1318
|
+
|
|
1319
|
+
`cas.workspaces.open({ namespace, ttlMs })` creates an in-memory workspace. It
|
|
1320
|
+
does not create a Git ref until the first successful stage or checkpoint. The
|
|
1321
|
+
default TTL is two hours; the maximum is seven days. `ttlMs` must be a positive
|
|
1322
|
+
safe integer.
|
|
1323
|
+
|
|
1324
|
+
The workspace mirrors only application-storage writes:
|
|
1325
|
+
|
|
1326
|
+
```javascript
|
|
1327
|
+
await workspace.assets.put(options);
|
|
1328
|
+
await workspace.assets.adopt(options);
|
|
1329
|
+
await workspace.pages.put(options);
|
|
1330
|
+
await workspace.bundles.put(options);
|
|
1331
|
+
await workspace.bundles.putOrdered(options);
|
|
1332
|
+
```
|
|
1333
|
+
|
|
1334
|
+
Each method returns only after a direct workspace generation reaches the
|
|
1335
|
+
returned typed handle. The result is otherwise the ordinary staged result plus
|
|
1336
|
+
a workspace `RetentionWitness`. Calls on one workspace serialize their ref
|
|
1337
|
+
mutations so concurrent staging cannot silently lose an accumulated root.
|
|
1338
|
+
|
|
1339
|
+
This guarantee starts when the method returns. Like all Git object composition,
|
|
1340
|
+
the object-write-to-ref-update interval still relies on Git's ordinary
|
|
1341
|
+
unreachable-object grace period. Running immediate-expiry prune concurrently
|
|
1342
|
+
inside that interval is unsupported.
|
|
1343
|
+
|
|
1344
|
+
### Checkpoint, renew, promote, and release
|
|
1345
|
+
|
|
1346
|
+
`checkpoint({ handles })` replaces the active roots with the unique supplied
|
|
1347
|
+
handles. Use it after an aggregate bundle transitively reaches its components.
|
|
1348
|
+
An empty checkpoint removes active targets and installs a descriptor-only lease
|
|
1349
|
+
generation, leaving the workspace available for later staging.
|
|
1350
|
+
|
|
1351
|
+
`renew()` preserves the current target set and advances its lease descriptor.
|
|
1352
|
+
Successful staging, checkpoint, and promotion preparation also renew the
|
|
1353
|
+
workspace.
|
|
1354
|
+
|
|
1355
|
+
`promoteToCache({ cache, key, handle, options })` and
|
|
1356
|
+
`promoteToPublication({ handle, commit, ref })` establish destination
|
|
1357
|
+
retention before releasing the workspace. The promoted handle must belong to
|
|
1358
|
+
the active generation. The destination must return an anchored witness for the
|
|
1359
|
+
exact handle, ref, and generation. Rejection, missing evidence, or destination
|
|
1360
|
+
failure leaves the workspace intact and reports
|
|
1361
|
+
`WORKSPACE_PROMOTION_NOT_RETAINED` where applicable. If destination retention
|
|
1362
|
+
succeeds but workspace cleanup conflicts, the operation fails with
|
|
1363
|
+
`WORKSPACE_PROMOTION_CLEANUP_PENDING`; its metadata distinguishes retained
|
|
1364
|
+
destination state from pending temporary cleanup.
|
|
1365
|
+
|
|
1366
|
+
`release()` is idempotent for one workspace object and deletes only its exact
|
|
1367
|
+
observed direct-ref generation. A conflicting generation or symbolic ref fails
|
|
1368
|
+
closed. Calling any staging, checkpoint, renewal, or promotion method after a
|
|
1369
|
+
successful release fails with `WORKSPACE_RELEASED`.
|
|
1370
|
+
|
|
1371
|
+
### Inspect and sweep
|
|
1372
|
+
|
|
1373
|
+
Workspace expiry is operational posture, not automatic revocation. An expired
|
|
1374
|
+
workspace remains Git-reachable until an explicit checked sweep removes it.
|
|
1375
|
+
|
|
1376
|
+
```javascript
|
|
1377
|
+
const inspection = await cas.workspaces.inspect({
|
|
1378
|
+
namespace: 'git-warp/materializations',
|
|
1379
|
+
limit: 100,
|
|
1380
|
+
});
|
|
1381
|
+
|
|
1382
|
+
let cursor = null;
|
|
1383
|
+
do {
|
|
1384
|
+
const cleanup = await cas.workspaces.sweep({
|
|
1385
|
+
namespace: 'git-warp/materializations',
|
|
1386
|
+
limit: 100,
|
|
1387
|
+
cursor,
|
|
1388
|
+
});
|
|
1389
|
+
cursor = cleanup.nextCursor;
|
|
1390
|
+
} while (cursor !== null);
|
|
1391
|
+
```
|
|
1392
|
+
|
|
1393
|
+
Inspection is namespace-scoped and bounded. Each record reports identity,
|
|
1394
|
+
generation, direct-root count, creation time, age, expiry, posture, and two
|
|
1395
|
+
different byte measures:
|
|
1396
|
+
|
|
1397
|
+
- `logicalBytes` sums the validated semantic content size reported by each
|
|
1398
|
+
retained typed handle. Overlapping handles can describe overlapping content.
|
|
1399
|
+
- `rootObjectBytes` sums each unique direct Git root object's loose logical
|
|
1400
|
+
size. It excludes transitive support, deduplication attribution, pack
|
|
1401
|
+
compression, and filesystem overhead.
|
|
1402
|
+
|
|
1403
|
+
Inspection validates the canonical target name, typed handle, OID, Git object
|
|
1404
|
+
type, and complete application handle graph. Invalid persisted state produces
|
|
1405
|
+
`posture: 'invalid'` with structured issue evidence instead of a guessed byte
|
|
1406
|
+
count.
|
|
1407
|
+
|
|
1408
|
+
`sweep()` deletes only records observed as expired, direct, and still at the
|
|
1409
|
+
same generation. Inspection and sweep return an opaque `nextCursor` whenever
|
|
1410
|
+
`truncated` is true; pass that cursor to the next call so active or invalid
|
|
1411
|
+
records cannot starve later expired workspaces. The sweep result reports
|
|
1412
|
+
inspected, changed, conflicted, missing, and truncated counts. Sweep never
|
|
1413
|
+
removes active or invalid records.
|
|
1414
|
+
|
|
1242
1415
|
## Root Sets
|
|
1243
1416
|
|
|
1244
1417
|
Root sets retain a mutable current set of Git blobs or trees. They are intended
|
|
@@ -1786,14 +1959,15 @@ const report = await cas.diagnostics.doctor({
|
|
|
1786
1959
|
console.log(report.repository.objects);
|
|
1787
1960
|
console.log(report.usage.acquisitions);
|
|
1788
1961
|
console.log(report.usage.caches);
|
|
1962
|
+
console.log(report.usage.workspaces);
|
|
1789
1963
|
console.log(report.limitations);
|
|
1790
1964
|
```
|
|
1791
1965
|
|
|
1792
1966
|
Pass either `gracePeriodMs` or an exact canonical `expiresBefore` UTC timestamp,
|
|
1793
1967
|
not both. The default grace period is 14 days. `maxCollectionsPerKind` bounds
|
|
1794
|
-
detailed cache-acquisition, CacheSet, RootSet, and
|
|
1795
|
-
through 1000; its default is 100. Every managed collection or
|
|
1796
|
-
still inspected sequentially and included in `totals`. Coverage reports
|
|
1968
|
+
detailed cache-acquisition, CacheSet, RootSet, ExpiringSet, and workspace rows
|
|
1969
|
+
from 1 through 1000; its default is 100. Every managed collection or
|
|
1970
|
+
acquisition is still inspected sequentially and included in `totals`. Coverage reports
|
|
1797
1971
|
`observed`, `inspected`, `detailed`, and `complete`, so detail truncation is
|
|
1798
1972
|
visible instead of silently dropping managed refs or undercounting repository
|
|
1799
1973
|
usage.
|
|
@@ -1831,9 +2005,12 @@ retention ref remains healthy, `ageMs` is `null`, and the entry reports
|
|
|
1831
2005
|
`maxAgeMs` is `null` when any active acquisition age is incomparable. Cache
|
|
1832
2006
|
summaries report entry count, deterministic logical bytes, age,
|
|
1833
2007
|
expiry, capacity policy, and pinned/evictable counts. RootSet policy counts and
|
|
1834
|
-
Vault entry counts are reported independently from reachability.
|
|
1835
|
-
|
|
1836
|
-
|
|
2008
|
+
Vault entry counts are reported independently from reachability. Workspace
|
|
2009
|
+
summaries report active and expired counts, validated logical bytes, and unique
|
|
2010
|
+
direct-root object bytes; detailed rows carry creation age, exact expiry, and
|
|
2011
|
+
invalid-state evidence. Neither workspace byte field is physical residency. A
|
|
2012
|
+
privacy-mode vault remains healthy but reports `entryCount: null` because
|
|
2013
|
+
repository doctor does not request or retain vault key material.
|
|
1837
2014
|
|
|
1838
2015
|
Git's `for-each-ref` does not enumerate dangling symbolic refs. Repository
|
|
1839
2016
|
doctor therefore reports symbolic acquisition refs that Git returns, but does
|
|
@@ -3195,6 +3372,16 @@ new CasError({ message, code, meta, documentationUrl });
|
|
|
3195
3372
|
| `ROOT_SET_METADATA_INVALID` | `.rootset.json` is malformed, non-canonical, or belongs to another ref | `read()`, `list()`, `doctor()` |
|
|
3196
3373
|
| `ROOT_SET_TREE_INVALID` | Metadata and the Git tree's actual reachability edges disagree | `read()`, `list()`, `doctor()` |
|
|
3197
3374
|
| `ROOT_SET_REF_UPDATE_FAILED` | Root-set ref update failed for a non-conflict reason | Root-set mutations and repair |
|
|
3375
|
+
| `WORKSPACE_REF_INVALID` | Workspace ref namespace, identity, epoch, or canonical encoding is invalid | Workspace creation, inspection, and cleanup |
|
|
3376
|
+
| `WORKSPACE_DESCRIPTOR_INVALID` | Workspace lease descriptor is malformed, non-canonical, inconsistent, or outside bounds | Workspace renewal, inspection, and cleanup |
|
|
3377
|
+
| `WORKSPACE_STATE_INVALID` | Retained target names, handles, OIDs, types, counts, or byte evidence disagree | Workspace staging, checkpoint, inspection, and doctor |
|
|
3378
|
+
| `WORKSPACE_TTL_INVALID` | Workspace TTL or computed expiry is outside supported bounds | `workspaces.open()`, staging, checkpoint, and renewal |
|
|
3379
|
+
| `WORKSPACE_CONFLICT` | Workspace generation changed during a checked operation | Workspace inspection and sweep |
|
|
3380
|
+
| `WORKSPACE_RELEASED` | A mutating operation targeted an already released workspace | Workspace staging, checkpoint, renewal, and promotion |
|
|
3381
|
+
| `WORKSPACE_RETENTION_FAILED` | A low-level stage succeeded but its handle could not be proven in a workspace generation; metadata carries the staged receipt | Workspace asset, page, and bundle staging |
|
|
3382
|
+
| `WORKSPACE_HANDLE_NOT_RETAINED` | Promotion requested a handle absent from the active workspace generation | `promoteToCache()`, `promoteToPublication()` |
|
|
3383
|
+
| `WORKSPACE_PROMOTION_NOT_RETAINED` | Destination did not return exact anchored retention evidence, so the workspace remains active | `promoteToCache()`, `promoteToPublication()` |
|
|
3384
|
+
| `WORKSPACE_PROMOTION_CLEANUP_PENDING` | Destination retention succeeded but checked workspace release failed | `promoteToCache()`, `promoteToPublication()` |
|
|
3198
3385
|
| `REPOSITORY_INSPECTION_INVALID` | Repository doctor options, Git output, dependencies, or safe-integer totals are invalid | `cas.diagnostics.doctor()`, repository inspection adapter |
|
|
3199
3386
|
| `VAULT_ENTRY_NOT_FOUND` | Slug does not exist in vault | `removeFromVault()`, `resolveVaultEntry()` |
|
|
3200
3387
|
| `VAULT_ENTRY_EXISTS` | Slug already exists (use `force` to overwrite) | `addToVault()` |
|