@git-stunts/git-cas 6.1.0 → 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.
Files changed (64) hide show
  1. package/ARCHITECTURE.md +108 -3
  2. package/CHANGELOG.md +80 -2
  3. package/GUIDE.md +114 -13
  4. package/README.md +51 -4
  5. package/UPGRADING.md +43 -0
  6. package/build-info.json +2 -2
  7. package/docs/API.md +751 -16
  8. package/docs/releases/v6.2.0.md +131 -0
  9. package/index.d.ts +879 -2
  10. package/index.js +326 -1
  11. package/package.json +3 -2
  12. package/src/domain/errors/Codes.js +35 -0
  13. package/src/domain/helpers/assertCanonicalTimestamp.js +15 -0
  14. package/src/domain/helpers/handleTarget.js +48 -0
  15. package/src/domain/helpers/isCanonicalCollectionKey.js +35 -0
  16. package/src/domain/services/AssetService.js +213 -0
  17. package/src/domain/services/BundleDescriptorCodec.js +286 -0
  18. package/src/domain/services/BundleFanoutBuilder.js +247 -0
  19. package/src/domain/services/BundleService.js +848 -0
  20. package/src/domain/services/CacheCandidateHeap.js +71 -0
  21. package/src/domain/services/CacheIndex.js +362 -0
  22. package/src/domain/services/CacheMetadataCodec.js +164 -0
  23. package/src/domain/services/CachePolicyEnforcer.js +144 -0
  24. package/src/domain/services/CacheSet.js +703 -0
  25. package/src/domain/services/CacheSetRegistry.js +88 -0
  26. package/src/domain/services/CasService.d.ts +2 -1
  27. package/src/domain/services/ExpiringSet.js +496 -0
  28. package/src/domain/services/ExpiringSetIndex.js +254 -0
  29. package/src/domain/services/ExpiringSetMetadataCodec.js +160 -0
  30. package/src/domain/services/ExpiringSetRegistry.js +101 -0
  31. package/src/domain/services/PageService.js +175 -0
  32. package/src/domain/services/PublicationService.js +315 -0
  33. package/src/domain/services/RepositoryDoctor.js +649 -0
  34. package/src/domain/services/RetentionService.js +120 -0
  35. package/src/domain/services/RootSet.js +10 -6
  36. package/src/domain/services/RootSetMetadataCodec.js +8 -2
  37. package/src/domain/services/RootSetPersistence.js +3 -2
  38. package/src/domain/services/StagingEvidence.js +39 -0
  39. package/src/domain/value-objects/ApplicationHandle.js +40 -0
  40. package/src/domain/value-objects/AssetHandle.js +163 -0
  41. package/src/domain/value-objects/BundleHandle.js +32 -0
  42. package/src/domain/value-objects/BundleLimits.js +80 -0
  43. package/src/domain/value-objects/BundlePath.js +78 -0
  44. package/src/domain/value-objects/CacheHit.js +93 -0
  45. package/src/domain/value-objects/CacheKey.js +32 -0
  46. package/src/domain/value-objects/CachePolicy.js +59 -0
  47. package/src/domain/value-objects/CacheSetRef.js +40 -0
  48. package/src/domain/value-objects/CollectionNamespace.js +54 -0
  49. package/src/domain/value-objects/ExpiringMarker.js +81 -0
  50. package/src/domain/value-objects/ExpiringSetKey.js +28 -0
  51. package/src/domain/value-objects/ExpiringSetRef.js +42 -0
  52. package/src/domain/value-objects/OpaqueHandle.js +171 -0
  53. package/src/domain/value-objects/PageHandle.js +34 -0
  54. package/src/domain/value-objects/RetentionWitness.js +101 -0
  55. package/src/domain/value-objects/StagedAsset.js +63 -0
  56. package/src/domain/value-objects/StagedBundle.js +66 -0
  57. package/src/domain/value-objects/StagedPage.js +47 -0
  58. package/src/infrastructure/adapters/GitPersistenceAdapter.js +48 -20
  59. package/src/infrastructure/adapters/GitRefAdapter.js +6 -5
  60. package/src/infrastructure/adapters/GitRepositoryInspectionAdapter.js +164 -0
  61. package/src/package-version.js +1 -1
  62. package/src/ports/GitPersistencePort.js +11 -1
  63. package/src/ports/GitRefPort.js +1 -0
  64. package/src/ports/RepositoryInspectionPort.js +33 -0
@@ -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.