@git-stunts/git-cas 6.0.1 → 6.1.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 +12 -3
- package/CHANGELOG.md +20 -1
- package/README.md +10 -1
- package/UPGRADING.md +28 -1
- package/build-info.json +2 -2
- package/docs/API.md +199 -7
- package/docs/WALKTHROUGH.md +46 -0
- package/docs/releases/v6.1.0.md +75 -0
- package/index.d.ts +96 -0
- package/index.js +28 -0
- package/package.json +6 -5
- package/src/domain/errors/Codes.js +13 -0
- package/src/domain/services/CasService.d.ts +1 -0
- package/src/domain/services/RootSet.js +277 -0
- package/src/domain/services/RootSetMetadataCodec.js +253 -0
- package/src/domain/services/RootSetPersistence.js +334 -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/value-objects/RootSetRef.js +88 -0
- package/src/infrastructure/adapters/GitPersistenceAdapter.js +29 -0
- package/src/infrastructure/adapters/GitRefAdapter.js +20 -0
- package/src/package-version.js +1 -1
- package/src/ports/GitPersistencePort.js +9 -0
- package/src/ports/GitRefPort.js +9 -0
package/ARCHITECTURE.md
CHANGED
|
@@ -116,6 +116,7 @@ The public entrypoint is [index.js](./index.js).
|
|
|
116
116
|
- wires persistence, ref, codec, crypto, chunking, compression, and
|
|
117
117
|
observability adapters
|
|
118
118
|
- exposes convenience methods like `storeFile()` and `restoreFile()`
|
|
119
|
+
- exposes `rootSets.open()` for mutable current-generation Git reachability
|
|
119
120
|
|
|
120
121
|
The facade is orchestration glue. It is not the storage engine itself.
|
|
121
122
|
|
|
@@ -138,6 +139,12 @@ The facade is orchestration glue. It is not the storage engine itself.
|
|
|
138
139
|
`VaultPrivacyIndex`, vault-key verification to `VaultKeyVerifier`, retry timing
|
|
139
140
|
to `VaultMutationRetryPolicy`, and slug validation to `Slug`.
|
|
140
141
|
|
|
142
|
+
- **`RootSetRegistry` and `RootSet`** — open and mutate caller-owned refs under
|
|
143
|
+
`refs/cas/rootsets/*`. Root-set mutations retain only the current generation,
|
|
144
|
+
validate target existence and type, and use bounded compare-and-swap retries.
|
|
145
|
+
`RootSetPersistence`, `RootSetMetadataCodec`, and `RootSetTreeCodec` own the
|
|
146
|
+
ref, metadata, and real Git reachability boundaries.
|
|
147
|
+
|
|
141
148
|
- **`KeyResolver`** — resolves key sources: passphrase-derived keys via KDF,
|
|
142
149
|
envelope recipient DEK wrapping and unwrapping. `CasService` delegates all key
|
|
143
150
|
material resolution through `this.keyResolver`.
|
|
@@ -190,7 +197,9 @@ The facade is orchestration glue. It is not the storage engine itself.
|
|
|
190
197
|
|
|
191
198
|
- **`Manifest`** — immutable representation of stored asset metadata.
|
|
192
199
|
- **`Chunk`** — immutable representation of one manifest chunk entry.
|
|
193
|
-
- **`Oid`** — immutable Git object identifier value with 40-hex
|
|
200
|
+
- **`Oid`** — immutable Git object identifier value with 40- or 64-hex
|
|
201
|
+
validation.
|
|
202
|
+
- **`RootSetRef`** — immutable validated ref below `refs/cas/rootsets/`.
|
|
194
203
|
- **`Slug`** — immutable vault slug representation. It enforces vault slug
|
|
195
204
|
limits and exposes `.toTreePath()` for the percent-encoded Git tree-entry name
|
|
196
205
|
used by plain vault trees.
|
|
@@ -232,8 +241,8 @@ with methods that throw "not implemented" by default.
|
|
|
232
241
|
mode.
|
|
233
242
|
- **`GitPersistencePort`** — blob read/write, tree read/write, and
|
|
234
243
|
`readBlobStream` for streaming chunk retrieval.
|
|
235
|
-
- **`GitRefPort`** — ref resolution, commit creation, and
|
|
236
|
-
updates.
|
|
244
|
+
- **`GitRefPort`** — ref/tree/parent resolution, commit creation, and
|
|
245
|
+
compare-and-swap ref updates.
|
|
237
246
|
- **`ChunkingPort`** — strategy interface for fixed-size and content-defined
|
|
238
247
|
chunking.
|
|
239
248
|
- **`CodecPort`** — manifest serialization and deserialization.
|
package/CHANGELOG.md
CHANGED
|
@@ -7,14 +7,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [6.1.0] — 2026-07-11
|
|
11
|
+
|
|
10
12
|
### Added
|
|
11
13
|
|
|
14
|
+
- **Mutable GC-safe root sets** — `cas.rootSets.open()` now anchors named blob
|
|
15
|
+
and tree OIDs under `refs/cas/rootsets/*` while entries are live. Root-set
|
|
16
|
+
generations use parentless commits so removed targets can become prunable
|
|
17
|
+
instead of remaining reachable through storage history.
|
|
18
|
+
- **Root-set doctor and repair** — root sets validate ref, metadata, tree-edge,
|
|
19
|
+
target-existence, and target-type truth; report retention policy separately
|
|
20
|
+
from Git reachability; and can rebuild a malformed head from an authoritative
|
|
21
|
+
live-entry list.
|
|
22
|
+
- **Root-set compare-and-swap mutations** — `put()`, `remove()`, `replace()`,
|
|
23
|
+
and `mutate()` use bounded conflict retries without silently losing
|
|
24
|
+
concurrent updates.
|
|
12
25
|
- **GitHub tracker templates** — added issue forms for goalposts, slices, bugs,
|
|
13
26
|
debt, and ideas, plus a pull request template that links issues, design proof,
|
|
14
27
|
validation, and release impact.
|
|
15
28
|
|
|
16
29
|
### Changed
|
|
17
30
|
|
|
31
|
+
- **Git object type port** — `GitPersistencePort.readObjectType()` and the Git
|
|
32
|
+
adapter now inspect target type without materializing object content.
|
|
18
33
|
- **GitHub Issues as canonical tracker** — release milestones, goalposts, slices,
|
|
19
34
|
and follow-on work now live in GitHub Issues and Milestones. Repo Markdown
|
|
20
35
|
carries design docs, witnesses, release history, public docs, and archived
|
|
@@ -23,8 +38,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
23
38
|
version-neutral, `STATUS.md` records the latest docs validation snapshot,
|
|
24
39
|
`CLAUDE.md` delegates to `AGENTS.md`, and the stale root `GRAVEYARD.md` file
|
|
25
40
|
has been removed.
|
|
41
|
+
- **6.1.0 release verification** — `npm run release:verify -- --skip-jsr`
|
|
42
|
+
passed 12/12 steps with 5,521 observed tests across Node, Bun, Deno, and all
|
|
43
|
+
three integration runtimes. JSR remains intentionally skipped behind the
|
|
44
|
+
documented upstream toolchain gate.
|
|
26
45
|
|
|
27
|
-
## [6.0.1] — 2026-
|
|
46
|
+
## [6.0.1] — 2026-06-13
|
|
28
47
|
|
|
29
48
|
### Added
|
|
30
49
|
|
package/README.md
CHANGED
|
@@ -20,6 +20,9 @@ Unlike traditional LFS which moves files to external servers, `git-cas` treats t
|
|
|
20
20
|
- **Deduplication by Default**: Content-defined chunking (CDC) with Buzhash rolling hash identifies repeated patterns across files and versions, minimizing repository growth.
|
|
21
21
|
- **Cryptographic Trust**: Every chunk is verified against a SHA-256 digest. Optional AES-256-GCM encryption with multi-recipient envelope support ensures privacy at rest, and `framed` binds per-frame AAD to prevent cross-manifest blob swaps.
|
|
22
22
|
- **GC-Safe Vault**: Named assets are indexed through a stable ref (`refs/cas/vault`) with optimistic concurrency, preventing Git garbage collection from reclaiming referenced blobs.
|
|
23
|
+
- **Mutable Root Sets**: Cache and derived-state trees can be anchored under
|
|
24
|
+
`refs/cas/rootsets/*` while live, then become collectible after eviction,
|
|
25
|
+
without vault history retaining every prior generation.
|
|
23
26
|
- **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.
|
|
24
27
|
- **Runtime-Adaptive**: A single core supports Node.js 22+, Bun, and Deno through a strict hexagonal port architecture with runtime-specific crypto adapters.
|
|
25
28
|
|
|
@@ -28,7 +31,7 @@ Unlike traditional LFS which moves files to external servers, `git-cas` treats t
|
|
|
28
31
|
Existing v5 users should read [UPGRADING.md](./UPGRADING.md) and run
|
|
29
32
|
`npm run upgrade` in dry-run mode before restoring old encrypted vault entries.
|
|
30
33
|
For the release overview, see the
|
|
31
|
-
[v6.
|
|
34
|
+
[v6.1.0 Release Notes](./docs/releases/v6.1.0.md).
|
|
32
35
|
|
|
33
36
|
### 1. CLI Usage
|
|
34
37
|
|
|
@@ -70,6 +73,7 @@ The README is the front door. Detailed mechanics live in the guide set:
|
|
|
70
73
|
| Encryption scheme selection | [Encryption Modes](./docs/ENCRYPTION_MODES.md) |
|
|
71
74
|
| CDC internals, Merkle manifests, KDF policy, and tuning | [Advanced Guide](./ADVANCED_GUIDE.md) |
|
|
72
75
|
| Ports, adapters, and collaborator boundaries | [Architecture](./ARCHITECTURE.md) |
|
|
76
|
+
| GC retention for caches and derived state | [Root Sets](./docs/API.md#root-sets) |
|
|
73
77
|
| v5 to v6 migration | [Upgrading](./UPGRADING.md) |
|
|
74
78
|
|
|
75
79
|
Core capabilities:
|
|
@@ -84,6 +88,9 @@ Core capabilities:
|
|
|
84
88
|
deduplication.
|
|
85
89
|
- **Vault indexing**: named assets live under `refs/cas/vault` so Git garbage
|
|
86
90
|
collection does not reclaim referenced blobs.
|
|
91
|
+
- **Root-set retention**: current cache entries live under caller-owned
|
|
92
|
+
`refs/cas/rootsets/*` refs. Entries are Git-reachable while present, and old
|
|
93
|
+
set generations are not retained as commit history.
|
|
87
94
|
- **Envelope recipients**: multi-recipient key wrapping and recipient rotation
|
|
88
95
|
avoid re-encrypting data blobs.
|
|
89
96
|
- **Operational diagnostics**: `git-cas doctor` validates vault health and
|
|
@@ -130,6 +137,8 @@ All three runtimes are tested in CI on every push. The hexagonal architecture is
|
|
|
130
137
|
- **[Workflow](https://github.com/git-stunts/git-cas/blob/main/WORKFLOW.md)**: Repo work doctrine, cycles, and invariants.
|
|
131
138
|
- **[Contributing](https://github.com/git-stunts/git-cas/blob/main/CONTRIBUTING.md)**, **[Code of Conduct](./CODE_OF_CONDUCT.md)**, and **[Support](./SUPPORT.md)**: Project participation and help paths.
|
|
132
139
|
- **[v6.0.0 Release Notes](./docs/releases/v6.0.0.md)**: Major-release summary, upgrade call-to-action, and publication notes.
|
|
140
|
+
- **[v6.1.0 Release Notes](./docs/releases/v6.1.0.md)**: Root-set retention,
|
|
141
|
+
doctor/repair, and GC-policy guidance.
|
|
133
142
|
- **[Upgrading](./UPGRADING.md)**: Migration guide for v5 → v6.
|
|
134
143
|
- **[Changelog](./CHANGELOG.md)**: Version history and migration notes.
|
|
135
144
|
|
package/UPGRADING.md
CHANGED
|
@@ -1,7 +1,34 @@
|
|
|
1
|
-
# Upgrading
|
|
1
|
+
# Upgrading git-cas
|
|
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.0.1 To v6.1.0
|
|
6
|
+
|
|
7
|
+
v6.1.0 is API-additive and does not require stored-data migration. It adds root
|
|
8
|
+
sets for mutable, GC-safe retention of cache and derived-state objects.
|
|
9
|
+
|
|
10
|
+
Applications that persisted tree OIDs only inside JSON should adopt every
|
|
11
|
+
still-live OID before running destructive Git cleanup:
|
|
12
|
+
|
|
13
|
+
```javascript
|
|
14
|
+
const rootSet = await cas.rootSets.open({
|
|
15
|
+
ref: 'refs/cas/rootsets/my-application/cache',
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
await rootSet.repair({
|
|
19
|
+
entries: liveRecords.map((record) => ({
|
|
20
|
+
name: record.id,
|
|
21
|
+
oid: record.treeOid,
|
|
22
|
+
type: 'tree',
|
|
23
|
+
retention: 'evictable',
|
|
24
|
+
})),
|
|
25
|
+
});
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Repair cannot recover objects that Git already pruned. Verify
|
|
29
|
+
`(await rootSet.doctor()).healthy` before garbage collection. Existing vault
|
|
30
|
+
entries and ordinary branch/tag references need no change.
|
|
31
|
+
|
|
5
32
|
## Quick Start
|
|
6
33
|
|
|
7
34
|
If you have an existing vault with encrypted assets:
|
package/build-info.json
CHANGED
package/docs/API.md
CHANGED
|
@@ -15,13 +15,14 @@ should treat restored data, chunker output, codec output, and keys as
|
|
|
15
15
|
## Table of Contents
|
|
16
16
|
|
|
17
17
|
1. [ContentAddressableStore](#contentaddressablestore)
|
|
18
|
-
2. [
|
|
19
|
-
3. [
|
|
20
|
-
4. [
|
|
21
|
-
5. [
|
|
22
|
-
6. [
|
|
23
|
-
7. [
|
|
24
|
-
8. [
|
|
18
|
+
2. [Root Sets](#root-sets)
|
|
19
|
+
3. [Vault](#vault)
|
|
20
|
+
4. [CasService](#casservice)
|
|
21
|
+
5. [Events](#events)
|
|
22
|
+
6. [Value Objects](#value-objects)
|
|
23
|
+
7. [Ports](#ports)
|
|
24
|
+
8. [Codecs](#codecs)
|
|
25
|
+
9. [Error Codes](#error-codes)
|
|
25
26
|
|
|
26
27
|
## ContentAddressableStore
|
|
27
28
|
|
|
@@ -904,6 +905,170 @@ Returns the configured chunk size in bytes.
|
|
|
904
905
|
console.log(cas.chunkSize); // 262144
|
|
905
906
|
```
|
|
906
907
|
|
|
908
|
+
## Root Sets
|
|
909
|
+
|
|
910
|
+
Root sets retain a mutable current set of Git blobs or trees. They are intended
|
|
911
|
+
for caches, indexes, checkpoints, and other derived state that must survive Git
|
|
912
|
+
garbage collection while live but should become collectible after eviction.
|
|
913
|
+
|
|
914
|
+
| Surface | Git state after write | History policy | Removal behavior | Typical use |
|
|
915
|
+
| --- | --- | --- | --- | --- |
|
|
916
|
+
| `createTree()` / plumbing | orphaned unless another ref reaches it | none | already prune-eligible after Git's grace period | immediate composition |
|
|
917
|
+
| Root set | anchored while present | current generation only | becomes orphaned when no other ref reaches it | cache and derived state |
|
|
918
|
+
| Vault | anchored | commit history retained | old generations remain reachable through vault history | durable named assets |
|
|
919
|
+
|
|
920
|
+
The `pinned` and `evictable` entry values are application retention policy.
|
|
921
|
+
Both are Git-anchored while present in a root set. `pinned` does not create a
|
|
922
|
+
pack `.keep` file and does not make an object immune to explicit ref deletion.
|
|
923
|
+
|
|
924
|
+
### Storage Structure
|
|
925
|
+
|
|
926
|
+
```text
|
|
927
|
+
refs/cas/rootsets/warp/state-cache -> parentless commit -> tree
|
|
928
|
+
|-- .rootset.json
|
|
929
|
+
|-- root-00000000 -> tree/blob
|
|
930
|
+
`-- root-00000001 -> tree/blob
|
|
931
|
+
```
|
|
932
|
+
|
|
933
|
+
Every generation commit is parentless by default. Updating the ref therefore
|
|
934
|
+
releases the previous generation instead of retaining it as history. OIDs in
|
|
935
|
+
`.rootset.json` are descriptive; the Git tree entries are what make targets
|
|
936
|
+
reachable.
|
|
937
|
+
|
|
938
|
+
### Open A Root Set
|
|
939
|
+
|
|
940
|
+
```javascript
|
|
941
|
+
const rootSet = await cas.rootSets.open({
|
|
942
|
+
ref: 'refs/cas/rootsets/warp/state-cache',
|
|
943
|
+
});
|
|
944
|
+
```
|
|
945
|
+
|
|
946
|
+
Root-set refs must be below `refs/cas/rootsets/`. Invalid or unsafe ref names
|
|
947
|
+
fail with `ROOT_SET_REF_INVALID`.
|
|
948
|
+
|
|
949
|
+
### put
|
|
950
|
+
|
|
951
|
+
```javascript
|
|
952
|
+
await rootSet.put({
|
|
953
|
+
name: snapshotId,
|
|
954
|
+
oid: payloadTreeOid,
|
|
955
|
+
type: 'tree',
|
|
956
|
+
retention: 'evictable',
|
|
957
|
+
});
|
|
958
|
+
```
|
|
959
|
+
|
|
960
|
+
Adds or replaces one named entry. `type` must be `blob` or `tree` and must
|
|
961
|
+
match the actual Git object type. `retention` defaults to `pinned` and may be
|
|
962
|
+
`pinned` or `evictable`.
|
|
963
|
+
|
|
964
|
+
The target is checked before metadata is written. Missing targets fail with
|
|
965
|
+
`ROOT_SET_TARGET_MISSING`; type mismatches fail with
|
|
966
|
+
`ROOT_SET_TARGET_TYPE_MISMATCH`.
|
|
967
|
+
|
|
968
|
+
### list And contains
|
|
969
|
+
|
|
970
|
+
```javascript
|
|
971
|
+
const entries = await rootSet.list();
|
|
972
|
+
const retained = await rootSet.contains(snapshotId);
|
|
973
|
+
```
|
|
974
|
+
|
|
975
|
+
`list()` returns canonical name-sorted entries. `contains(name)` checks the
|
|
976
|
+
current snapshot.
|
|
977
|
+
|
|
978
|
+
### remove
|
|
979
|
+
|
|
980
|
+
```javascript
|
|
981
|
+
const { removed } = await rootSet.remove({ name: snapshotId });
|
|
982
|
+
```
|
|
983
|
+
|
|
984
|
+
Removes one entry. When no other ref reaches its target, that target becomes
|
|
985
|
+
orphaned and follows normal Git expiration and pruning rules. Removal is a
|
|
986
|
+
no-op when the name is absent.
|
|
987
|
+
|
|
988
|
+
### replace
|
|
989
|
+
|
|
990
|
+
```javascript
|
|
991
|
+
await rootSet.replace({
|
|
992
|
+
expectedHeadOid: (await rootSet.read()).headOid,
|
|
993
|
+
entries: liveSnapshots.map(({ id, payloadRef }) => ({
|
|
994
|
+
name: id,
|
|
995
|
+
oid: payloadRef,
|
|
996
|
+
type: 'tree',
|
|
997
|
+
retention: 'evictable',
|
|
998
|
+
})),
|
|
999
|
+
});
|
|
1000
|
+
```
|
|
1001
|
+
|
|
1002
|
+
Atomically replaces the current set. This is the preferred integration for an
|
|
1003
|
+
application that already has an authoritative live-entry index. Pass
|
|
1004
|
+
`expectedHeadOid` (including `null` for a set that must not exist yet) when the
|
|
1005
|
+
replacement was derived from a particular generation. A stale expectation
|
|
1006
|
+
fails with `ROOT_SET_CONFLICT` instead of overwriting newer state.
|
|
1007
|
+
|
|
1008
|
+
### mutate
|
|
1009
|
+
|
|
1010
|
+
```javascript
|
|
1011
|
+
const { headOid } = await rootSet.read();
|
|
1012
|
+
await rootSet.mutate(
|
|
1013
|
+
(entries) => entries.filter((entry) => shouldKeep(entry)),
|
|
1014
|
+
{ expectedHeadOid: headOid },
|
|
1015
|
+
);
|
|
1016
|
+
```
|
|
1017
|
+
|
|
1018
|
+
Runs a compare-and-swap read/modify/write operation. The callback receives a
|
|
1019
|
+
frozen snapshot and returns the next iterable of entries. Without
|
|
1020
|
+
`expectedHeadOid`, conflicts are retried against a fresh snapshot. With an
|
|
1021
|
+
expected head, the callback is guarded to that generation and any stale read
|
|
1022
|
+
or write conflict is returned to the caller without retrying.
|
|
1023
|
+
|
|
1024
|
+
### doctor
|
|
1025
|
+
|
|
1026
|
+
```javascript
|
|
1027
|
+
const report = await rootSet.doctor();
|
|
1028
|
+
```
|
|
1029
|
+
|
|
1030
|
+
Returns a non-mutating report with:
|
|
1031
|
+
|
|
1032
|
+
- `healthy`, `ref`, `headOid`, `treeOid`, and `entryCount`
|
|
1033
|
+
- `policyCounts` for `pinned` and `evictable`
|
|
1034
|
+
- `reachabilityCounts` for `anchored`, `missing`, `unknown`, `orphaned`, and
|
|
1035
|
+
`volatile`
|
|
1036
|
+
- per-target existence and actual Git object type
|
|
1037
|
+
- stable issue codes for missing or mismatched targets
|
|
1038
|
+
|
|
1039
|
+
Current members are `anchored`. `orphaned` and `volatile` describe objects
|
|
1040
|
+
outside the current root set and are reported as zero by a single-set doctor;
|
|
1041
|
+
repository-wide classification remains a Git maintenance concern.
|
|
1042
|
+
|
|
1043
|
+
### repair
|
|
1044
|
+
|
|
1045
|
+
```javascript
|
|
1046
|
+
await rootSet.repair({ entries: authoritativeLiveEntries });
|
|
1047
|
+
```
|
|
1048
|
+
|
|
1049
|
+
Replaces a missing or malformed root-set head from an authoritative entry
|
|
1050
|
+
list, without trusting the current metadata. Repair can only adopt objects that
|
|
1051
|
+
still exist. Run repair before destructive cleanup:
|
|
1052
|
+
|
|
1053
|
+
1. Read the application's authoritative live OIDs.
|
|
1054
|
+
2. Call `doctor()` and compare the application index with `list()`.
|
|
1055
|
+
3. Call `repair({ entries })` to anchor every known-live object.
|
|
1056
|
+
4. Re-run `doctor()` and require `healthy: true`.
|
|
1057
|
+
5. Only then run a Git prune dry-run or garbage collection.
|
|
1058
|
+
|
|
1059
|
+
### Direct Services
|
|
1060
|
+
|
|
1061
|
+
`RootSet` and `RootSetRegistry` are exported from the package root. Normal
|
|
1062
|
+
callers should use `cas.rootSets.open(...)`; `getRootSetRegistry()` exposes the
|
|
1063
|
+
shared registry for advanced composition.
|
|
1064
|
+
|
|
1065
|
+
Custom persistence implementations that support root sets must implement
|
|
1066
|
+
`readObjectType(oid)`, and custom ref adapters must implement
|
|
1067
|
+
`resolveParents(commitOid)`. The default Git adapters use `git cat-file -t`
|
|
1068
|
+
and `git rev-list --parents` so missing targets, repository read failures, and
|
|
1069
|
+
parentful heads remain distinct doctor findings. Existing store, restore, and
|
|
1070
|
+
vault paths do not call these methods.
|
|
1071
|
+
|
|
907
1072
|
## Vault
|
|
908
1073
|
|
|
909
1074
|
The vault provides GC-safe storage by maintaining a single Git ref (`refs/cas/vault`) pointing to a commit chain. The commit's tree indexes all stored assets by slug. This prevents `git gc` from garbage-collecting stored data.
|
|
@@ -1751,6 +1916,19 @@ Reads a Git tree object.
|
|
|
1751
1916
|
|
|
1752
1917
|
**Returns:** `Promise<Array<{ mode: string, type: string, oid: string, name: string }>>`
|
|
1753
1918
|
|
|
1919
|
+
##### readObjectType
|
|
1920
|
+
|
|
1921
|
+
```javascript
|
|
1922
|
+
await port.readObjectType(oid);
|
|
1923
|
+
```
|
|
1924
|
+
|
|
1925
|
+
Reads an object's Git type without materializing its content. Root sets use
|
|
1926
|
+
this capability to reject missing targets and type mismatches before changing
|
|
1927
|
+
a ref.
|
|
1928
|
+
|
|
1929
|
+
**Returns:** `Promise<string>` - Git object type such as `blob`, `tree`, or
|
|
1930
|
+
`commit`
|
|
1931
|
+
|
|
1754
1932
|
**Example Implementation:**
|
|
1755
1933
|
|
|
1756
1934
|
```javascript
|
|
@@ -1774,6 +1952,10 @@ class CustomGitAdapter {
|
|
|
1774
1952
|
async readTree(treeOid) {
|
|
1775
1953
|
// Implementation
|
|
1776
1954
|
}
|
|
1955
|
+
|
|
1956
|
+
async readObjectType(oid) {
|
|
1957
|
+
// Implementation
|
|
1958
|
+
}
|
|
1777
1959
|
}
|
|
1778
1960
|
```
|
|
1779
1961
|
|
|
@@ -2153,6 +2335,16 @@ new CasError({ message, code, meta, documentationUrl });
|
|
|
2153
2335
|
| `GIT_REF_NOT_FOUND` | Git ref lookup found no ref; vault reads normalize this to empty state | `GitRefAdapter`, `VaultPersistence` |
|
|
2154
2336
|
| `INVALID_OPTIONS` | Mutually exclusive options provided or unsupported option value | `store()`, `restore()` |
|
|
2155
2337
|
| `INVALID_SLUG` | Slug fails validation (empty, control chars, `..` segments, etc.) | `addToVault()` |
|
|
2338
|
+
| `ROOT_SET_REF_INVALID` | Ref is outside `refs/cas/rootsets/*` or is not a safe Git ref | `rootSets.open()` |
|
|
2339
|
+
| `ROOT_SET_ENTRY_INVALID` | Entry name, OID, type, retention, or duplicate-name validation failed | `put()`, `replace()`, `mutate()`, `repair()` |
|
|
2340
|
+
| `ROOT_SET_TARGET_MISSING` | A requested target OID does not exist | `put()`, `replace()`, `mutate()`, `repair()` |
|
|
2341
|
+
| `ROOT_SET_TARGET_UNREADABLE` | Git could not inspect a target, but did not prove that it was missing | Root-set mutation and doctor |
|
|
2342
|
+
| `ROOT_SET_TARGET_TYPE_MISMATCH` | Declared blob/tree type does not match the Git object | `put()`, `replace()`, `mutate()`, `repair()` |
|
|
2343
|
+
| `ROOT_SET_CONFLICT` | Concurrent root-set update exhausted bounded compare-and-swap retries | Root-set mutations and repair |
|
|
2344
|
+
| `ROOT_SET_HEAD_INVALID` | Root-set ref cannot resolve to a readable commit tree | `read()`, `list()`, `doctor()` |
|
|
2345
|
+
| `ROOT_SET_METADATA_INVALID` | `.rootset.json` is malformed, non-canonical, or belongs to another ref | `read()`, `list()`, `doctor()` |
|
|
2346
|
+
| `ROOT_SET_TREE_INVALID` | Metadata and the Git tree's actual reachability edges disagree | `read()`, `list()`, `doctor()` |
|
|
2347
|
+
| `ROOT_SET_REF_UPDATE_FAILED` | Root-set ref update failed for a non-conflict reason | Root-set mutations and repair |
|
|
2156
2348
|
| `VAULT_ENTRY_NOT_FOUND` | Slug does not exist in vault | `removeFromVault()`, `resolveVaultEntry()` |
|
|
2157
2349
|
| `VAULT_ENTRY_EXISTS` | Slug already exists (use `force` to overwrite) | `addToVault()` |
|
|
2158
2350
|
| `VAULT_CONFLICT` | Concurrent vault update detected (CAS failure after retries) | `addToVault()`, `removeFromVault()`, `initVault()`, `rotateVaultPassphrase()` |
|
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.
|