@git-stunts/git-cas 6.0.1 → 6.2.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 +120 -6
- package/CHANGELOG.md +98 -1
- package/GUIDE.md +114 -13
- package/README.md +60 -4
- package/UPGRADING.md +71 -1
- package/build-info.json +2 -2
- package/docs/API.md +934 -7
- package/docs/WALKTHROUGH.md +46 -0
- package/docs/releases/v6.1.0.md +75 -0
- package/docs/releases/v6.2.0.md +131 -0
- package/index.d.ts +974 -1
- package/index.js +354 -1
- package/package.json +8 -6
- package/src/domain/errors/Codes.js +48 -0
- package/src/domain/helpers/assertCanonicalTimestamp.js +15 -0
- package/src/domain/helpers/handleTarget.js +48 -0
- package/src/domain/helpers/isCanonicalCollectionKey.js +35 -0
- package/src/domain/services/AssetService.js +213 -0
- package/src/domain/services/BundleDescriptorCodec.js +286 -0
- package/src/domain/services/BundleFanoutBuilder.js +247 -0
- package/src/domain/services/BundleService.js +848 -0
- package/src/domain/services/CacheCandidateHeap.js +71 -0
- package/src/domain/services/CacheIndex.js +362 -0
- package/src/domain/services/CacheMetadataCodec.js +164 -0
- package/src/domain/services/CachePolicyEnforcer.js +144 -0
- package/src/domain/services/CacheSet.js +703 -0
- package/src/domain/services/CacheSetRegistry.js +88 -0
- package/src/domain/services/CasService.d.ts +3 -1
- package/src/domain/services/ExpiringSet.js +496 -0
- package/src/domain/services/ExpiringSetIndex.js +254 -0
- package/src/domain/services/ExpiringSetMetadataCodec.js +160 -0
- package/src/domain/services/ExpiringSetRegistry.js +101 -0
- package/src/domain/services/PageService.js +175 -0
- package/src/domain/services/PublicationService.js +315 -0
- package/src/domain/services/RepositoryDoctor.js +649 -0
- package/src/domain/services/RetentionService.js +120 -0
- package/src/domain/services/RootSet.js +281 -0
- package/src/domain/services/RootSetMetadataCodec.js +259 -0
- package/src/domain/services/RootSetPersistence.js +335 -0
- package/src/domain/services/RootSetRegistry.js +44 -0
- package/src/domain/services/RootSetRetryPolicy.js +87 -0
- package/src/domain/services/RootSetTreeCodec.js +95 -0
- package/src/domain/services/StagingEvidence.js +39 -0
- package/src/domain/value-objects/ApplicationHandle.js +40 -0
- package/src/domain/value-objects/AssetHandle.js +163 -0
- package/src/domain/value-objects/BundleHandle.js +32 -0
- package/src/domain/value-objects/BundleLimits.js +80 -0
- package/src/domain/value-objects/BundlePath.js +78 -0
- package/src/domain/value-objects/CacheHit.js +93 -0
- package/src/domain/value-objects/CacheKey.js +32 -0
- package/src/domain/value-objects/CachePolicy.js +59 -0
- package/src/domain/value-objects/CacheSetRef.js +40 -0
- package/src/domain/value-objects/CollectionNamespace.js +54 -0
- package/src/domain/value-objects/ExpiringMarker.js +81 -0
- package/src/domain/value-objects/ExpiringSetKey.js +28 -0
- package/src/domain/value-objects/ExpiringSetRef.js +42 -0
- package/src/domain/value-objects/OpaqueHandle.js +171 -0
- package/src/domain/value-objects/PageHandle.js +34 -0
- package/src/domain/value-objects/RetentionWitness.js +101 -0
- package/src/domain/value-objects/RootSetRef.js +88 -0
- package/src/domain/value-objects/StagedAsset.js +63 -0
- package/src/domain/value-objects/StagedBundle.js +66 -0
- package/src/domain/value-objects/StagedPage.js +47 -0
- package/src/infrastructure/adapters/GitPersistenceAdapter.js +57 -0
- package/src/infrastructure/adapters/GitRefAdapter.js +26 -5
- package/src/infrastructure/adapters/GitRepositoryInspectionAdapter.js +164 -0
- package/src/package-version.js +1 -1
- package/src/ports/GitPersistencePort.js +20 -1
- package/src/ports/GitRefPort.js +10 -0
- package/src/ports/RepositoryInspectionPort.js +33 -0
package/docs/WALKTHROUGH.md
CHANGED
|
@@ -28,6 +28,7 @@ and [THREAT_MODEL.md](./THREAT_MODEL.md).
|
|
|
28
28
|
11b. [Multi-Recipient Encryption & Key Rotation](#11b-multi-recipient-encryption--key-rotation)
|
|
29
29
|
12. [Merkle Manifests](#12-merkle-manifests)
|
|
30
30
|
13. [Vault](#13-vault)
|
|
31
|
+
13b. [Root Sets](#13b-root-sets)
|
|
31
32
|
14. [Architecture](#14-architecture)
|
|
32
33
|
15. [Codec System](#15-codec-system)
|
|
33
34
|
16. [Error Handling](#16-error-handling)
|
|
@@ -213,6 +214,11 @@ The tree contains one entry for the manifest file (named `manifest.json` or
|
|
|
213
214
|
its SHA-256 digest. This tree OID is a standard Git object -- you can commit
|
|
214
215
|
it, tag it, push it, or embed it in a larger tree.
|
|
215
216
|
|
|
217
|
+
The returned OID is not durable by itself. Use a branch or tag for ordinary Git
|
|
218
|
+
history, the vault for durable named history, or a root set for a mutable
|
|
219
|
+
current-generation cache. A JSON field containing the OID does not make Git
|
|
220
|
+
consider the object reachable.
|
|
221
|
+
|
|
216
222
|
### Codecs
|
|
217
223
|
|
|
218
224
|
The codec controls how the manifest is serialized before being written to
|
|
@@ -1379,6 +1385,46 @@ Invalid slugs throw `INVALID_SLUG`.
|
|
|
1379
1385
|
|
|
1380
1386
|
---
|
|
1381
1387
|
|
|
1388
|
+
## 13b. Root Sets
|
|
1389
|
+
|
|
1390
|
+
Root sets are the GC-safe surface for caches and derived state. Unlike the
|
|
1391
|
+
vault, they retain only the current generation by default.
|
|
1392
|
+
|
|
1393
|
+
```javascript
|
|
1394
|
+
const snapshots = await cas.rootSets.open({
|
|
1395
|
+
ref: 'refs/cas/rootsets/warp/state-cache',
|
|
1396
|
+
});
|
|
1397
|
+
|
|
1398
|
+
await snapshots.put({
|
|
1399
|
+
name: snapshotId,
|
|
1400
|
+
oid: payloadTreeOid,
|
|
1401
|
+
type: 'tree',
|
|
1402
|
+
retention: 'evictable',
|
|
1403
|
+
});
|
|
1404
|
+
```
|
|
1405
|
+
|
|
1406
|
+
While the entry is present, the root-set ref reaches the target tree and its
|
|
1407
|
+
payload blobs. After `remove({ name })`, the target follows normal Git grace
|
|
1408
|
+
period and pruning rules if no other ref reaches it.
|
|
1409
|
+
|
|
1410
|
+
For an existing application index, adopt all still-live OIDs before cleanup:
|
|
1411
|
+
|
|
1412
|
+
```javascript
|
|
1413
|
+
const report = await snapshots.doctor();
|
|
1414
|
+
if (!report.healthy) {
|
|
1415
|
+
await snapshots.repair({ entries: authoritativeLiveEntries });
|
|
1416
|
+
}
|
|
1417
|
+
```
|
|
1418
|
+
|
|
1419
|
+
`pinned` and `evictable` are application policy labels. Both entries are
|
|
1420
|
+
anchored while present. Root sets do not create pack `.keep` files, encrypt
|
|
1421
|
+
entry names, or preserve mutation history.
|
|
1422
|
+
|
|
1423
|
+
See [API Reference: Root Sets](./API.md#root-sets) for the full mutation,
|
|
1424
|
+
doctor, repair, and error contracts.
|
|
1425
|
+
|
|
1426
|
+
---
|
|
1427
|
+
|
|
1382
1428
|
## 14. Architecture
|
|
1383
1429
|
|
|
1384
1430
|
`git-cas` follows a hexagonal (ports and adapters) architecture. The domain
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# git-cas v6.1.0 Release Notes
|
|
2
|
+
|
|
3
|
+
`v6.1.0` adds a middle retention surface between unrooted CAS plumbing and the
|
|
4
|
+
history-preserving vault.
|
|
5
|
+
|
|
6
|
+
## Root Sets
|
|
7
|
+
|
|
8
|
+
Applications can now retain the current generation of cache, checkpoint,
|
|
9
|
+
index, or derived-state objects under a caller-owned ref:
|
|
10
|
+
|
|
11
|
+
```javascript
|
|
12
|
+
const cas = await ContentAddressableStore.open({ cwd: '.' });
|
|
13
|
+
const rootSet = await cas.rootSets.open({
|
|
14
|
+
ref: 'refs/cas/rootsets/my-application/cache',
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
await rootSet.put({
|
|
18
|
+
name: cacheKey,
|
|
19
|
+
oid: payloadTreeOid,
|
|
20
|
+
type: 'tree',
|
|
21
|
+
retention: 'evictable',
|
|
22
|
+
});
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Entries are Git-reachable while present. Each update writes a parentless
|
|
26
|
+
current-generation commit, so removing an entry releases it from root-set
|
|
27
|
+
history. If no other branch, tag, reflog, vault, or root set reaches the target,
|
|
28
|
+
it follows normal Git grace-period and pruning rules.
|
|
29
|
+
|
|
30
|
+
## Retention Vocabulary
|
|
31
|
+
|
|
32
|
+
- `pinned` and `evictable` describe application retention policy.
|
|
33
|
+
- `anchored`, `orphaned`, and `volatile` describe Git reachability state.
|
|
34
|
+
- Root-set `pinned` does not create pack `.keep` files.
|
|
35
|
+
- The vault still preserves mutation history and remains the durable named
|
|
36
|
+
asset surface.
|
|
37
|
+
|
|
38
|
+
## Doctor And Repair
|
|
39
|
+
|
|
40
|
+
`rootSet.doctor()` checks ref, commit, metadata, reachability edges, target
|
|
41
|
+
existence, and target type. `rootSet.repair({ entries })` rebuilds a missing or
|
|
42
|
+
malformed current head from an authoritative list without trusting existing
|
|
43
|
+
metadata.
|
|
44
|
+
|
|
45
|
+
Applications upgrading from JSON-only OID indexes should adopt every still-live
|
|
46
|
+
object into a root set before any destructive cleanup. Objects already pruned
|
|
47
|
+
by Git cannot be recovered by this API.
|
|
48
|
+
|
|
49
|
+
## Compatibility
|
|
50
|
+
|
|
51
|
+
This release is API-additive. Existing manifests, vaults, branches, tags, and
|
|
52
|
+
`createTree()` behavior are unchanged. `createTree()` remains low-level and
|
|
53
|
+
unrooted until a caller anchors its returned OID.
|
|
54
|
+
|
|
55
|
+
Custom persistence implementations that support root sets must add
|
|
56
|
+
`readObjectType(oid)`, and custom ref adapters must add
|
|
57
|
+
`resolveParents(commitOid)`. Existing CAS store/restore paths do not call those
|
|
58
|
+
methods.
|
|
59
|
+
|
|
60
|
+
## Proof
|
|
61
|
+
|
|
62
|
+
The release includes a real-Git integration test using
|
|
63
|
+
`git prune -n --expire=now`:
|
|
64
|
+
|
|
65
|
+
- a target tree is not reported while present in a root set
|
|
66
|
+
- the same tree is reported after removal when no other ref reaches it
|
|
67
|
+
- root-set commits have no parent
|
|
68
|
+
- missing and mismatched targets are rejected before the ref changes
|
|
69
|
+
|
|
70
|
+
See [API Reference: Root Sets](../API.md#root-sets) and
|
|
71
|
+
[UPGRADING.md](../../UPGRADING.md#v601-to-v610).
|
|
72
|
+
|
|
73
|
+
The release verifier passed 12/12 steps with 5,521 observed tests across Node,
|
|
74
|
+
Bun, Deno, and all three integration runtimes. The JSR publish dry-run remains
|
|
75
|
+
intentionally skipped under the documented upstream toolchain gate.
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# git-cas v6.2.0 Release Notes
|
|
2
|
+
|
|
3
|
+
`v6.2.0` makes `git-cas` the storage and cache lifecycle owner for application
|
|
4
|
+
packages. Applications can define domain keys, payload schemas, causal
|
|
5
|
+
publication rules, and retention intent without constructing Git trees,
|
|
6
|
+
persisting naked object IDs, or maintaining a second cache protocol.
|
|
7
|
+
|
|
8
|
+
## The Contract
|
|
9
|
+
|
|
10
|
+
> A handle is not a durability claim.
|
|
11
|
+
|
|
12
|
+
`cas.assets`, `cas.pages`, and `cas.bundles` return immutable opaque handles.
|
|
13
|
+
The staged result explicitly reports that no root was created. A caller then
|
|
14
|
+
chooses how the handle graph should live:
|
|
15
|
+
|
|
16
|
+
| Policy surface | Intended lifecycle | Git reachability behavior |
|
|
17
|
+
| --- | --- | --- |
|
|
18
|
+
| `cas.retention` / RootSet | Caller-managed current set | Anchored while present |
|
|
19
|
+
| `cas.caches` | TTL/capacity/approximate-LRU cache | Anchored until managed eviction |
|
|
20
|
+
| `cas.expiringSets` | Security replay window | Anchored until expiry; no early eviction |
|
|
21
|
+
| `cas.publications` | Application causal history | Anchored by the allowlisted application ref |
|
|
22
|
+
| Vault | History-preserving named assets | Anchored by `refs/cas/vault` history |
|
|
23
|
+
|
|
24
|
+
Successful retention and publication operations return a `RetentionWitness`
|
|
25
|
+
that identifies the exact ref generation and tree edge that established
|
|
26
|
+
reachability.
|
|
27
|
+
|
|
28
|
+
## Application Storage
|
|
29
|
+
|
|
30
|
+
```javascript
|
|
31
|
+
const staged = await cas.assets.put({
|
|
32
|
+
source,
|
|
33
|
+
slug: 'warp/materialization',
|
|
34
|
+
filename: 'materialization.bin',
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const retained = await cas.retention.retain({
|
|
38
|
+
handle: staged.handle,
|
|
39
|
+
root: {
|
|
40
|
+
ref: 'refs/cas/rootsets/git-warp/materializations',
|
|
41
|
+
name: materializationKey,
|
|
42
|
+
},
|
|
43
|
+
policy: 'evictable',
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
console.log(retained.witness.root.generation);
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
- Asset writes stream through the existing chunking, deduplication,
|
|
50
|
+
compression, encryption, manifest, and tree pipeline.
|
|
51
|
+
- Pages store bounded immutable blobs and expose targeted streams.
|
|
52
|
+
- Bundles build deterministic bounded-fanout trees from named streams or
|
|
53
|
+
nested handles.
|
|
54
|
+
- `bundles.iterateMembers()` streams descriptors, while `getMember()` and
|
|
55
|
+
`openMember()` traverse only the requested descriptor path and payload.
|
|
56
|
+
- `cas.publications.commit()` validates an entire handle graph, ordered commit
|
|
57
|
+
parents, an explicit ref allowlist, and expected-head compare-and-swap state
|
|
58
|
+
before changing a ref.
|
|
59
|
+
|
|
60
|
+
Handles contain no repository path and support canonical SHA-1 and SHA-256
|
|
61
|
+
object IDs. Importing a handle validates that its graph exists and has the
|
|
62
|
+
expected Git object and codec shape.
|
|
63
|
+
|
|
64
|
+
## Managed Cache And Replay Lifecycles
|
|
65
|
+
|
|
66
|
+
`cas.caches.open()` owns immutable cache indexes under `refs/cas/caches/*`.
|
|
67
|
+
CacheSet handles TTL, entry and logical-byte limits, approximate-LRU sweeps,
|
|
68
|
+
coalesced touches, retention witnesses, bounded inspection, doctor, and repair.
|
|
69
|
+
A cache miss is read-only.
|
|
70
|
+
|
|
71
|
+
`cas.expiringSets.open()` owns digest-only replay markers under
|
|
72
|
+
`refs/cas/expiring/*`. `addIfAbsent()` is atomic across writers, `contains()` is
|
|
73
|
+
read-only, and `sweep()` can release only entries whose expiry has passed. The
|
|
74
|
+
surface intentionally has no remove, repair, capacity, or recency eviction
|
|
75
|
+
operation that could shorten a security acceptance window.
|
|
76
|
+
|
|
77
|
+
Both services publish parentless current-generation commits. Superseded
|
|
78
|
+
generations do not remain reachable through their own storage history.
|
|
79
|
+
|
|
80
|
+
## Repository Diagnostics
|
|
81
|
+
|
|
82
|
+
```javascript
|
|
83
|
+
const report = await cas.diagnostics.doctor({
|
|
84
|
+
gracePeriodMs: 14 * 24 * 60 * 60 * 1000,
|
|
85
|
+
});
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
The report streams Git object, ref, and reflog-reachability inventories;
|
|
89
|
+
classifies anchored, orphaned, grace-expired volatile, and total unreachable
|
|
90
|
+
objects; and summarizes CacheSet, RootSet, ExpiringSet, and Vault usage. It
|
|
91
|
+
fails closed if concurrent writes make derived arithmetic inconsistent.
|
|
92
|
+
|
|
93
|
+
Diagnostics use plumbing's exact prune dry-run contract for volatile objects.
|
|
94
|
+
The doctor does not run `git gc` or destructive prune and exposes no object or
|
|
95
|
+
ref mutation operation. Shared deduplicated bytes, packed-object age, reflog
|
|
96
|
+
entry count, alternate-store attribution, and pack metadata overhead remain
|
|
97
|
+
explicitly reported limitations rather than guessed values.
|
|
98
|
+
|
|
99
|
+
## Compatibility And Upgrade
|
|
100
|
+
|
|
101
|
+
This release is API-additive. Existing CAS manifests, RootSets, Vaults, refs,
|
|
102
|
+
and low-level `createTree()` callers remain compatible; no stored-data
|
|
103
|
+
migration is required. Repository diagnostics require
|
|
104
|
+
`@git-stunts/plumbing` 3.1.0 or newer.
|
|
105
|
+
|
|
106
|
+
Applications that currently store tree or blob IDs only in JSON should adopt
|
|
107
|
+
every still-live object into a RootSet or rebuild it through the matching
|
|
108
|
+
high-level capability before destructive Git cleanup. An object that Git
|
|
109
|
+
already pruned cannot be recovered by doctor or repair.
|
|
110
|
+
|
|
111
|
+
See [UPGRADING.md](../../UPGRADING.md) for the adoption sequence,
|
|
112
|
+
[Application Storage](../API.md#application-storage) for API contracts, and
|
|
113
|
+
[Repository Diagnostics](../API.md#repository-diagnostics) for report fields
|
|
114
|
+
and limitations.
|
|
115
|
+
|
|
116
|
+
## Verification
|
|
117
|
+
|
|
118
|
+
`pnpm run release:verify` passed 13/13 steps with 6,124 observed tests:
|
|
119
|
+
|
|
120
|
+
| Suite | Tests |
|
|
121
|
+
| --- | ---: |
|
|
122
|
+
| Node unit | 1,871 |
|
|
123
|
+
| Bun unit | 1,870 |
|
|
124
|
+
| Deno unit | 1,861 |
|
|
125
|
+
| Node integration | 174 |
|
|
126
|
+
| Bun integration | 174 |
|
|
127
|
+
| Deno integration | 174 |
|
|
128
|
+
|
|
129
|
+
The same run passed ESLint, all three runnable examples, build metadata
|
|
130
|
+
stamping, npm package-content inspection, and a JSR publish dry-run. GitHub CI,
|
|
131
|
+
self-review, and Code Lawyer review remain mandatory before tagging.
|