@git-stunts/git-cas 6.5.12 → 7.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.
Files changed (57) hide show
  1. package/ARCHITECTURE.md +15 -0
  2. package/CHANGELOG.md +74 -0
  3. package/README.md +14 -4
  4. package/UPGRADING.md +90 -27
  5. package/build-info.json +2 -2
  6. package/docs/API.md +111 -0
  7. package/docs/releases/v7.0.0.md +27 -0
  8. package/docs/releases/v7.1.0.md +27 -0
  9. package/index.d.ts +15 -0
  10. package/index.js +30 -0
  11. package/package.json +7 -5
  12. package/src/domain/errors/Codes.js +1 -0
  13. package/src/domain/errors/ReservationStorageError.js +9 -0
  14. package/src/domain/schemas/ManifestSchema.d.ts +4 -4
  15. package/src/domain/services/ReservationCustodyObjects.js +171 -0
  16. package/src/domain/services/ReservationCustodyStore.js +149 -0
  17. package/src/domain/services/ReservationIndex.js +169 -0
  18. package/src/domain/services/ReservationIndexNode.js +75 -0
  19. package/src/domain/services/ReservationLedger.js +326 -0
  20. package/src/domain/services/ReservationLedgerStore.js +141 -0
  21. package/src/domain/services/ReservationListing.js +40 -0
  22. package/src/domain/services/ReservationNamespace.d.ts +135 -0
  23. package/src/domain/services/ReservationNamespace.js +51 -0
  24. package/src/domain/services/ReservationNamespaceRegistry.js +89 -0
  25. package/src/domain/services/ReservationRecord.js +166 -0
  26. package/src/domain/services/ReservationScan.js +49 -0
  27. package/src/domain/value-objects/ReservationCursor.d.ts +11 -0
  28. package/src/domain/value-objects/ReservationCursor.js +31 -0
  29. package/src/domain/value-objects/ReservationCustodyDescriptor.js +47 -0
  30. package/src/domain/value-objects/ReservationCustodySnapshot.js +16 -0
  31. package/src/domain/value-objects/ReservationEvidence.js +26 -0
  32. package/src/domain/value-objects/ReservationEvidenceRead.js +22 -0
  33. package/src/domain/value-objects/ReservationEvidenceRoots.js +72 -0
  34. package/src/domain/value-objects/ReservationIndeterminate.js +17 -0
  35. package/src/domain/value-objects/ReservationInspection.js +21 -0
  36. package/src/domain/value-objects/ReservationKey.js +26 -0
  37. package/src/domain/value-objects/ReservationLedgerHeader.js +15 -0
  38. package/src/domain/value-objects/ReservationLedgerRefusal.js +21 -0
  39. package/src/domain/value-objects/ReservationLedgerSnapshot.js +27 -0
  40. package/src/domain/value-objects/ReservationListRequest.js +35 -0
  41. package/src/domain/value-objects/ReservationListUnavailable.js +17 -0
  42. package/src/domain/value-objects/ReservationOpenIndeterminate.js +15 -0
  43. package/src/domain/value-objects/ReservationOpenRefusal.js +14 -0
  44. package/src/domain/value-objects/ReservationPage.js +27 -0
  45. package/src/domain/value-objects/ReservationPolicy.js +24 -0
  46. package/src/domain/value-objects/ReservationRefusal.js +23 -0
  47. package/src/domain/value-objects/ReservationResult.js +27 -0
  48. package/src/domain/value-objects/ReservationSupport.js +22 -0
  49. package/src/infrastructure/adapters/GitRefAdapter.js +7 -0
  50. package/src/infrastructure/codecs/ReservationCustodyCodec.js +54 -0
  51. package/src/infrastructure/codecs/ReservationLedgerCodec.js +48 -0
  52. package/src/infrastructure/codecs/ReservationRecordCodec.js +54 -0
  53. package/src/package-version.js +1 -1
  54. package/src/ports/GitRefPort.js +11 -0
  55. package/src/ports/ReservationCustodyCodecPort.js +14 -0
  56. package/src/ports/ReservationLedgerCodecPort.js +14 -0
  57. package/src/ports/ReservationRecordCodecPort.js +14 -0
package/ARCHITECTURE.md CHANGED
@@ -143,6 +143,8 @@ The public entrypoint is [index.js](./index.js).
143
143
  observability adapters
144
144
  - exposes convenience methods like `storeFile()` and `restoreFile()`
145
145
  - exposes `rootSets.open()` for mutable current-generation Git reachability
146
+ - exposes the v7.1.0 `reservations.open()` hard record-slot authority,
147
+ ordered custody, reconciliation and bounded snapshot inspection
146
148
  - exposes opaque `assets`, `pages`, and `bundles` capability groups
147
149
  - exposes `retention`, `publications`, `caches`, and `expiringSets` for explicit
148
150
  reachability and lifecycle policy
@@ -474,6 +476,19 @@ make objects Git-reachable, but they encode different lifecycle contracts:
474
476
  | ExpiringSet | `refs/cas/expiring/*` | Expiry-only replay protection |
475
477
  | Publication | Caller-allowlisted ref | Application-controlled causal history |
476
478
  | Vault | `refs/cas/vault` | History-preserving named assets |
479
+ | Reservation ledger | `refs/cas/reservations/*` | Fixed policy, charged attempts and terminal tombstones |
480
+ | Reservation custody | `refs/cas/reservation-custody/*` | Original/final evidence retained through real Git edges |
481
+
482
+ The reservation namespace is installed at open, even with zero attempts.
483
+ `ReservationLedger` owns all lifecycle decisions; the facade supplies validated
484
+ evidence and never executes application effects. `ReservationListing` traverses
485
+ one immutable ledger with a bounded index-node budget, independent of admission.
486
+ Its cursor is a position, not a pin: GC may make an older snapshot unavailable.
487
+ Point inspection observes ledger and custody separately; it makes no multi-ref
488
+ snapshot claim. See the [public contract](docs/API.md#durable-reservations)
489
+ and [cycle0063 design](https://github.com/git-stunts/git-cas/blob/4782052214269c72acc95f63191e89897059bb56/docs/design/0063-durable-reservations/durable-reservations.md).
490
+ The implementation is merged; [#162](https://github.com/git-stunts/git-cas/issues/162)
491
+ tracks release publication separately.
477
492
 
478
493
  High-level retention, CacheSet, cache acquisition, ExpiringSet, and application
479
494
  publication operations return generation-scoped retention evidence. Replacing
package/CHANGELOG.md CHANGED
@@ -7,6 +7,80 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [7.1.0] — 2026-11-02
11
+
12
+ Release candidate: publication is tracked in [#162](https://github.com/git-stunts/git-cas/issues/162).
13
+
14
+ ### Added
15
+
16
+ - Add the `cas.reservations.open()` capability with durable record-slot
17
+ policy, lifecycle operations, exact original/final page retrieval and bounded
18
+ snapshot listing. Reconciliation finishes installed storage phases or cleans
19
+ cancelled residue; it never arms or executes an application effect. Cursors
20
+ bind namespace, snapshot and phase filter; unavailable snapshots do not
21
+ silently restart. Native fault/race/GC and finite cost/residency witnesses
22
+ accompany the implementation. Record-slot limits are not physical-byte
23
+ quotas, and CAS never executes or retries application effects.
24
+
25
+ ### Internal
26
+
27
+ - Define the durable retention reservation protocol for #157. The private
28
+ transition core and its tests were the first implementation checkpoint.
29
+ - Add the private reservation point index and canonical record codec. Lookups
30
+ and updates follow one bounded 64-digit path; corrupt tree names cannot
31
+ masquerade as absent attempts. Native SHA-1/SHA-256 fixtures verify tree
32
+ persistence through reopen and GC under explicit harness roots.
33
+ - Add private durable record-slot admission: immutable namespace policy and
34
+ charged count publish with the attempt index through one checked parentless
35
+ ledger ref. Exact retries recover at capacity; response loss stays uncertain
36
+ unless the same attempt is observed installed. Add exact direct/symbolic ref
37
+ inspection to the ref port and native adapter. Separate native processes
38
+ verify capacity-one contention, exact retries, lost acknowledgements and
39
+ reopen/GC in both object formats.
40
+ - Add private ordered evidence custody and lifecycle publication. Preparation
41
+ pins actual page/support/history edges before its ledger acknowledgement;
42
+ settlement retains preparation as a commit parent. Only a freshly
43
+ acknowledged armed transition permits an external effect. Cancellation
44
+ first publishes its terminal tombstone and refund, then deletes its exact
45
+ pin; failed cleanup leaves retryable residue. Recovery verifies required
46
+ custody rather than trusting an armed record alone. Native races, GC and
47
+ before/after faults at every durable ref boundary cover both object formats.
48
+ The public facade now composes this protocol without a second lifecycle.
49
+
50
+ ### Fixed
51
+
52
+ - Install the Deno CI image from the existing frozen pnpm dependency graph and
53
+ run Deno in manual `node_modules` mode across CI and release verification.
54
+ Fresh Deno resolution no longer selects
55
+ unrelated newer transitive releases before the runtime tests can start (#159).
56
+
57
+ ## [7.0.0] — 2026-11-01
58
+
59
+ ### Breaking Changes
60
+
61
+ - Upgrade `zod` from 3 to 4 (`^4.6.7`). The public
62
+ `@git-stunts/git-cas/schema` exports now use Zod 4 objects and generic types.
63
+ Consumers composing these schemas must use Zod 4 and update annotations that
64
+ depend on Zod 3 generics. Parse-only callers do not need to compose schemas.
65
+ - Integer validation now rejects values above `Number.MAX_SAFE_INTEGER`,
66
+ including manifest/chunk sizes, indices, chunking and KDF parameters, key
67
+ versions, frame sizes, and sub-manifest counts and offsets. Existing stored
68
+ metadata outside that bound can no longer be read; there is no fallback.
69
+ See [UPGRADING.md](UPGRADING.md) for affected callers and fields.
70
+ - Validation text changes where no custom message is set. The
71
+ `Invalid manifest data:` and `Invalid chunk data:` prefixes remain, but a
72
+ matching encryption scheme with a fractional or infinite integer field can
73
+ now report `Invalid input` instead of a specific integer diagnostic.
74
+ Unmatched schemes already reported `Invalid input` with Zod 3.
75
+
76
+ ### Changed
77
+
78
+ - Schema source rules and custom messages are unchanged. Default validation
79
+ messages now follow Zod 4 and any application configuration of the shared
80
+ Zod 4 instance, such as `z.config(...)` locale or error customization.
81
+ - Require published Plumbing `^3.3.3`, which also uses Zod 4. The locked
82
+ production dependency tree no longer contains Zod 3.
83
+
10
84
  ## [6.5.12] — 2026-10-20
11
85
 
12
86
  ### Fixed
package/README.md CHANGED
@@ -52,10 +52,20 @@ Unlike traditional LFS which moves files to external servers, `git-cas` treats t
52
52
 
53
53
  Existing v5 users should read [UPGRADING.md](./UPGRADING.md) and run
54
54
  `npm run upgrade` in dry-run mode before restoring old encrypted vault entries.
55
- For the release overview, see the
56
- [v6.5.12 Release Notes](./docs/releases/v6.5.12.md).
57
-
58
- The v6.5.12 candidate bounds object-metadata requests so root sets with more than 1000 targets (936 for SHA-256) validate within Plumbing's cat-file request limits. Admission still rejects missing and mismatched targets before publication; see [v6.5.12 Release Notes](./docs/releases/v6.5.12.md). Registry publication is pending release verification and merge.
55
+ The published v7.0.0 release changes the public schema dependency to Zod 4.
56
+ Before upgrading, read the [migration guidance](./UPGRADING.md#v6512-to-v700-candidate)
57
+ and [release notes](./docs/releases/v7.0.0.md). This release requires
58
+ published Plumbing 3.3.3. [Release and registry evidence](https://github.com/git-stunts/git-cas/issues/154)
59
+ records its publication.
60
+
61
+ The v7.1.0 release candidate adds [durable reservations](./docs/API.md#durable-reservations):
62
+ hard record-slot admission before an application effect, pinned evidence and
63
+ bounded recovery/inspection. It is not in the published v7.0.0 package.
64
+ The implementation is merged; [release notes](./docs/releases/v7.1.0.md) describe
65
+ the contract and [#162](https://github.com/git-stunts/git-cas/issues/162)
66
+ tracks publication and fresh registry-consumer verification.
67
+
68
+ The published v6.5.12 release bounds object-metadata requests so root sets with more than 1000 targets (936 for SHA-256) validate within Plumbing's cat-file request limits. Admission still rejects missing and mismatched targets before publication; see [v6.5.12 Release Notes](./docs/releases/v6.5.12.md).
59
69
 
60
70
  ### 1. CLI Usage
61
71
 
package/UPGRADING.md CHANGED
@@ -1,6 +1,62 @@
1
1
  # Upgrading git-cas
2
2
 
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.
3
+ This guide covers breaking changes and migration steps for git-cas releases.
4
+
5
+ ## v6.5.12 To v7.0.0 (candidate)
6
+
7
+ This is a breaking migration because the
8
+ public schema objects and their generic types change, accepted integer values
9
+ narrow, and validation diagnostics change.
10
+
11
+ | Your usage | What to check or change |
12
+ | --- | --- |
13
+ | Main API, without importing schemas | No Zod composition change is needed. Check stored metadata and error-message handling as described below. |
14
+ | `./schema` with `.parse()` or `.safeParse()` only | The methods remain available. Check integer values, diagnostics, and any code inspecting Zod error details. |
15
+ | Compose exported schemas into your own schemas | Use Zod 4 in your application. Zod 3 schemas cannot contain these Zod 4 objects. |
16
+ | Annotate schema types with Zod generic classes | Update Zod 3 annotations. `ZodEnum` takes an object map; `ZodDiscriminatedUnion` takes options before its discriminator. |
17
+
18
+ ### Stored integer metadata
19
+
20
+ Zod 4 integer checks reject values above `Number.MAX_SAFE_INTEGER`
21
+ (9,007,199,254,740,991). Existing positivity and field-specific bounds still
22
+ apply. Check these fields in stored or externally supplied metadata:
23
+
24
+ - Manifest `size`; chunk `index` and `size`.
25
+ - Chunking `params.chunkSize`, `target`, `min`, and `max`.
26
+ - Encryption `frameBytes` and `keyVersion`; recipient `keyVersion`.
27
+ - KDF `iterations`, `cost`, `blockSize`, `parallelization`, and `keyLength`.
28
+ - Sub-manifest `chunkCount` and `startIndex`.
29
+
30
+ Manifest `version` remains restricted to 1 or 2. Metadata that was accepted
31
+ under Zod 3 but exceeds the new safe-integer bound is rejected on read as well
32
+ as write. There is no legacy parsing fallback or automatic migration. Audit
33
+ existing data before upgrading; do not round a size, index, or cryptographic
34
+ parameter merely to make validation pass.
35
+
36
+ ### Validation diagnostics
37
+
38
+ Custom schema messages and the `Invalid manifest data:` / `Invalid chunk data:`
39
+ prefixes remain. Uncustomized messages use Zod 4 wording, for example
40
+ `Invalid input: expected number, received string`.
41
+
42
+ For a matching encryption scheme, a fractional or infinite integer field such
43
+ as `frameBytes` can now collapse the union error to `Invalid input`. Previously
44
+ it could preserve a specific integer diagnostic. An unmatched scheme already
45
+ produced `Invalid input`; that is not a new failure mode. The value-object error
46
+ text already omitted field paths before this upgrade.
47
+
48
+ Code that branches on exact error strings or inspects Zod issue structures
49
+ needs review. Application calls to `z.config(...)` can change default messages
50
+ when they configure the same Zod 4 instance used by git-cas. Git-cas does not
51
+ isolate that global configuration; explicit schema messages still take priority.
52
+
53
+ ### Dependency boundary
54
+
55
+ Zod is a regular dependency. Applications that compose the public schemas
56
+ should declare their own Zod 4 dependency. This release requires published
57
+ Plumbing `^3.3.3`; the locked production tree uses Zod 4 throughout. The
58
+ production audit has zero findings. This does not claim a clean developer
59
+ dependency audit.
4
60
 
5
61
  ## v6.5.9 To v6.5.10
6
62
 
@@ -430,7 +486,14 @@ Repair cannot recover objects that Git already pruned. Verify
430
486
  `(await rootSet.doctor()).healthy` before garbage collection. Existing vault
431
487
  entries and ordinary branch/tag references need no change.
432
488
 
433
- ## Quick Start
489
+ ## v5.x To v6.0.0
490
+
491
+ The following quick start, breaking changes, API changes, and troubleshooting
492
+ apply to the v5-to-v6.0.0 upgrade. The encrypted-vault migration converts legacy
493
+ v5 encryption metadata. An installation already on v6.5.12 does not need to run
494
+ these commands for the Zod 4 upgrade.
495
+
496
+ ### Quick Start
434
497
 
435
498
  If you have an existing vault with encrypted assets:
436
499
 
@@ -446,9 +509,9 @@ If you only use the library API (no vault), skip to [API Changes](#api-changes).
446
509
 
447
510
  ---
448
511
 
449
- ## Critical Breaking Changes
512
+ ### Critical Breaking Changes
450
513
 
451
- ### `restoreFile()` Requires `baseDirectory`
514
+ #### `restoreFile()` Requires `baseDirectory`
452
515
 
453
516
  `restoreFile()` now requires an explicit directory boundary. This prevents a
454
517
  repository-controlled output path from writing outside the directory your
@@ -476,9 +539,9 @@ for example a job workspace or tenant-scoped artifact directory.
476
539
 
477
540
  ---
478
541
 
479
- ## Encryption Scheme Simplification
542
+ ### Encryption Scheme Simplification
480
543
 
481
- ### What Changed
544
+ #### What Changed
482
545
 
483
546
  v5 had 5 encryption scheme identifiers. v6 has 3:
484
547
 
@@ -490,11 +553,11 @@ v5 had 5 encryption scheme identifiers. v6 has 3:
490
553
  | `framed-v2` | `framed` | Rename only (already had AAD) |
491
554
  | `convergent-v1` | `convergent` | Rename only |
492
555
 
493
- ### Why
556
+ #### Why
494
557
 
495
558
  Version suffixes on scheme names were compatibility cruft. AAD (Additional Authenticated Data) binding is now unconditional — every `whole` and `framed` manifest binds the slug to the ciphertext, preventing cross-manifest blob substitution attacks.
496
559
 
497
- ### What Happens if You Don't Migrate
560
+ #### What Happens if You Don't Migrate
498
561
 
499
562
  Any call to `readManifest()`, `restore()`, `restoreFile()`, or `restoreStream()` on a v5 manifest will throw:
500
563
 
@@ -504,7 +567,7 @@ Run scripts/migrate-encryption.js to upgrade this manifest.
504
567
  [code: LEGACY_SCHEME]
505
568
  ```
506
569
 
507
- ### How to Migrate
570
+ #### How to Migrate
508
571
 
509
572
  ```bash
510
573
  # Dry-run: see what needs migration
@@ -543,7 +606,7 @@ recipient key.
543
606
 
544
607
  Original blobs are never deleted — Git's garbage collection only removes unreferenced objects after `git gc`.
545
608
 
546
- ### Vault Passphrase Verifier Migration
609
+ #### Vault Passphrase Verifier Migration
547
610
 
548
611
  New encrypted vaults write `encryption.verifier` into `.vault.json`. The
549
612
  verifier lets `git-cas` reject a wrong vault passphrase even when the encrypted
@@ -565,9 +628,9 @@ verifier and the next keyed vault write will add it.
565
628
 
566
629
  ---
567
630
 
568
- ## Default Scheme Changes
631
+ ### Default Scheme Changes
569
632
 
570
- ### What Changed
633
+ #### What Changed
571
634
 
572
635
  | Scenario | v5 Default | v6 Default |
573
636
  | --------------------------- | ----------- | ------------ |
@@ -575,7 +638,7 @@ verifier and the next keyed vault write will add it.
575
638
  | Fixed chunking + encryption | `framed-v1` | `framed` |
576
639
  | Explicit `whole` | `whole-v1` | `whole` |
577
640
 
578
- ### What This Means
641
+ #### What This Means
579
642
 
580
643
  - **Convergent encryption** is now the default when using CDC chunking with encryption. This means deduplication works even with encrypted content — identical plaintext chunks produce identical ciphertext.
581
644
  - If you were explicitly passing `encryption: { scheme: 'framed-v1' }`, change to `encryption: { scheme: 'framed' }`.
@@ -583,9 +646,9 @@ verifier and the next keyed vault write will add it.
583
646
 
584
647
  ---
585
648
 
586
- ## API Changes
649
+ ### API Changes
587
650
 
588
- ### Byte Types
651
+ #### Byte Types
589
652
 
590
653
  Public byte-oriented APIs now use `Uint8Array` instead of Node-specific
591
654
  `Buffer` types:
@@ -601,7 +664,7 @@ Node callers can still pass `Buffer` values because `Buffer` is a
601
664
  should compare with `Buffer.from(buffer).equals(...)` or use a runtime-neutral
602
665
  byte comparison helper.
603
666
 
604
- ### CasService Constructor (Library Users)
667
+ #### CasService Constructor (Library Users)
605
668
 
606
669
  **If you use `ContentAddressableStore` (the facade):** No changes needed. The facade handles all defaults.
607
670
 
@@ -623,7 +686,7 @@ byte comparison helper.
623
686
 
624
687
  `chunker` and `compressionAdapter` are now **required**. They were previously optional with internal defaults — the defaults moved to the facade layer to keep the domain service free of infrastructure imports.
625
688
 
626
- ### New CryptoPort Methods
689
+ #### New CryptoPort Methods
627
690
 
628
691
  If you implement a custom `CryptoPort`, you must add these methods:
629
692
 
@@ -638,16 +701,16 @@ decryptBufferWithNonceTag(buffer, key, nonce, tag) { /* return Uint8Array */ }
638
701
 
639
702
  The shipped adapters (`NodeCryptoAdapter`, `BunCryptoAdapter`, `WebCryptoAdapter`) already implement these.
640
703
 
641
- ### Encryption Metadata Schema
704
+ #### Encryption Metadata Schema
642
705
 
643
706
  Encrypted manifests now **require** the `scheme` field. Pre-v5.2 manifests that omitted `scheme` will fail schema validation. The migration script handles this.
644
707
 
645
- ### New Manifest Fields
708
+ #### New Manifest Fields
646
709
 
647
710
  - **`formatVersion`**: Semver string (e.g., `"6.0.0"`) stamped into new manifests. Identifies which library version wrote the manifest. Optional on read — old manifests without it still parse.
648
711
  - **`manifestHash`**: SHA-256 of the codec-encoded manifest content. Verified on read. Catches corruption. Optional on read.
649
712
 
650
- ### New Exports
713
+ #### New Exports
651
714
 
652
715
  ```js
653
716
  // Standalone manifest diffing
@@ -664,7 +727,7 @@ import { CompressionPort, NodeCompressionAdapter } from '@git-stunts/git-cas';
664
727
  import { SCHEME_WHOLE, SCHEME_FRAMED, SCHEME_CONVERGENT } from '@git-stunts/git-cas';
665
728
  ```
666
729
 
667
- ### Behavioral Changes
730
+ #### Behavioral Changes
668
731
 
669
732
  | Change | Impact |
670
733
  | ---------------------------------------- | ------------------------------------------------------------------------------------- |
@@ -677,7 +740,7 @@ import { SCHEME_WHOLE, SCHEME_FRAMED, SCHEME_CONVERGENT } from '@git-stunts/git-
677
740
 
678
741
  ---
679
742
 
680
- ## New Features (Non-Breaking)
743
+ ### New Features (Non-Breaking)
681
744
 
682
745
  These are new capabilities that don't require migration:
683
746
 
@@ -694,9 +757,9 @@ These are new capabilities that don't require migration:
694
757
 
695
758
  ---
696
759
 
697
- ## Troubleshooting
760
+ ### Troubleshooting
698
761
 
699
- ### `LEGACY_SCHEME` error on restore
762
+ #### `LEGACY_SCHEME` error on restore
700
763
 
701
764
  ```
702
765
  CasError: Legacy encryption scheme "whole-v1" is no longer supported.
@@ -706,7 +769,7 @@ Run `printf '%s\n' '<pass>' | npm run upgrade -- --execute --passphrase-file -`
706
769
  or
707
770
  `npm run upgrade -- --execute --key-file <path>` to migrate.
708
771
 
709
- ### `KDF_POLICY_VIOLATION` on deriveKey
772
+ #### `KDF_POLICY_VIOLATION` on deriveKey
710
773
 
711
774
  ```
712
775
  CasError: deriveKey KDF field "iterations" must be between 100000 and 2000000
@@ -714,7 +777,7 @@ CasError: deriveKey KDF field "iterations" must be between 100000 and 2000000
714
777
 
715
778
  v6 enforces minimum KDF parameters. Increase iterations to at least 100,000 (PBKDF2) or cost to at least 16,384 (scrypt).
716
779
 
717
- ### `MANIFEST_INTEGRITY_ERROR` on readManifest
780
+ #### `MANIFEST_INTEGRITY_ERROR` on readManifest
718
781
 
719
782
  ```
720
783
  CasError: Manifest integrity check failed: hash mismatch
@@ -722,7 +785,7 @@ CasError: Manifest integrity check failed: hash mismatch
722
785
 
723
786
  The manifest blob was corrupted or tampered with after storage. The original data may still be recoverable from Git's object database if the corruption was in the tree, not the blob.
724
787
 
725
- ### Constructor throws "chunker is required"
788
+ #### Constructor throws "chunker is required"
726
789
 
727
790
  You're using `CasService` directly. Either switch to the `ContentAddressableStore` facade (recommended) or inject a `chunker` and `compressionAdapter` manually. See [API Changes](#casservice-constructor-library-users).
728
791
 
package/build-info.json CHANGED
@@ -1,4 +1,4 @@
1
1
  {
2
- "sha": "25609d6",
3
- "timestamp": "2026-10-20T03:56:15.258Z"
2
+ "sha": "18f87dd",
3
+ "timestamp": "2026-11-02T16:45:35.044Z"
4
4
  }
package/docs/API.md CHANGED
@@ -3645,3 +3645,114 @@ Different error codes include different metadata:
3645
3645
  originalError: <Error>
3646
3646
  }
3647
3647
  ```
3648
+
3649
+
3650
+ ## Durable Reservations
3651
+
3652
+ This API is part of the merged v7.1.0 release candidate. It is absent from
3653
+ published v7.0.0. [Issue #162](https://github.com/git-stunts/git-cas/issues/162)
3654
+ tracks publication and fresh registry-consumer verification.
3655
+
3656
+ `cas.reservations.open({ namespace, capacity: { unit: 'record-slot', limit } })`
3657
+ installs or verifies an immutable namespace policy, including an empty ledger
3658
+ before the first attempt. The limit is a positive safe integer. Record slots
3659
+ are logical permanent-record capacity, not physical-byte quotas. Open returns:
3660
+
3661
+ - `opened`: a frozen `ReservationNamespace` with operations below, `policy` and
3662
+ `openedRevision` (the ledger observed by open).
3663
+ - `refused`: `policy-mismatch` or `contention`, plus the requested policy.
3664
+ - `indeterminate`: the requested policy and an `Error` cause. Retry the same
3665
+ namespace/policy; do not treat an unavailable observation as absence.
3666
+
3667
+ Each attempt uses `{ key, binding }`: a printable ASCII key of 1–128 bytes and a
3668
+ canonical lowercase SHA-256 request binding. The application computes and owns
3669
+ that binding's meaning. Exact-key retries recover the same attempt; different
3670
+ bindings refuse. Cancelled keys remain terminal tombstones.
3671
+
3672
+ | Method | Meaning |
3673
+ | --- | --- |
3674
+ | `reserve(identity)` | Atomically charge one slot, or recover the exact existing attempt |
3675
+ | `prepare({ ...identity, evidence })` | Pin original evidence, then acknowledge preparation |
3676
+ | `arm(identity)` | Verify preparation and compete for the one fresh effect permission |
3677
+ | `settle({ ...identity, evidence })` | Pin final evidence while retaining the original, then acknowledge settlement |
3678
+ | `cancel(identity)` | Cancel only an unarmed/unsettled attempt; publish refund before exact pin cleanup |
3679
+ | `reconcile(identity)` | Complete supported storage transitions or cancelled cleanup without application execution |
3680
+ | `inspect(identity)` | Observe ledger metadata and current custody separately |
3681
+ | `readEvidence({ ...identity, stage })` | Read acknowledged `preparation` or `settlement` page/support metadata |
3682
+ | `list({ cursor, phase, limit, nodeBudget })` | Traverse ledger claims at one immutable snapshot |
3683
+
3684
+ Lifecycle outcomes have `status`, a validated `record` and the ledger `revision`.
3685
+ Success statuses are `admitted`, `prepared`, fresh `armed`, `settled`, `cancelled`
3686
+ or `recovered`. Expected failures are `refused` values with the attempted key,
3687
+ binding and finite reason. Operational uncertainty is `indeterminate`, with the
3688
+ same identity and its retained `Error` cause. Invalid inputs throw typed CAS
3689
+ errors. A recovered armed record is not a new `armed` acknowledgement.
3690
+
3691
+ ```javascript
3692
+ const opened = await cas.reservations.open({
3693
+ namespace: 'application/observations',
3694
+ capacity: { unit: 'record-slot', limit: 1000 },
3695
+ });
3696
+
3697
+ if (opened.status === 'opened') {
3698
+ // attempt is the application's stable { key, binding } for this operation.
3699
+ const admission = await opened.reserve(attempt);
3700
+ if (admission.status === 'admitted' || admission.status === 'recovered') {
3701
+ const prepared = await opened.prepare({ ...attempt, evidence: originalEvidence });
3702
+ if (prepared.status === 'prepared' || prepared.status === 'recovered') {
3703
+ const permission = await opened.arm(attempt);
3704
+ if (permission.status === 'armed') {
3705
+ // Only this branch may perform the application's irreversible effect.
3706
+ // The application records its own effect outcome and calls settle.
3707
+ }
3708
+ }
3709
+ }
3710
+ }
3711
+ ```
3712
+
3713
+ The snippet names caller-supplied `attempt` and `originalEvidence`; CAS never
3714
+ executes the application operation. A lost arming response can leave an armed
3715
+ charge even if the effect never ran. Retry/inspection returns already-armed or
3716
+ recovered evidence, never a second permission. Time, process death and local
3717
+ resource closure do not release that charge. A prepared read may settle
3718
+ without arming; its settlement competes with cancellation.
3719
+
3720
+ `evidence` contains `record: Uint8Array`, optional `supports: [{ type, oid }]`
3721
+ for blob/tree targets, and optional `parents: [commitOid]`. The page is copied
3722
+ and limited to 16 MiB; there are at most 64 supports and 63 external parents.
3723
+ All OIDs must be canonical and refer to the declared object types. The final
3724
+ custody commit also retains preparation as its first parent. These are storage
3725
+ boundary inputs; CAS does not validate application receipt semantics or walk
3726
+ every descendant of a support tree.
3727
+
3728
+ `readEvidence` returns `read` with the attempt, ledger/custody revisions, stage
3729
+ and an `evidence` value. Its `record` getter returns a new byte copy each time;
3730
+ `roots` describes the supports and external parents. An unacknowledged phase
3731
+ returns `not-prepared`/`not-settled`; cancelled attempts refuse. Missing required
3732
+ custody is indeterminate. Reading preparation does not create a new retention
3733
+ promise if another caller cancels concurrently.
3734
+
3735
+ `inspect` returns `inspected`, the ledger record/revision, policy, charged count
3736
+ and `custody` (a validated generation or null). It does not load page bytes.
3737
+ Ledger and pin are sequential observations, not an atomic multi-ref snapshot.
3738
+ A cancelled record may still have pin residue. `reconcile` can remove that
3739
+ residue without a second refund, or finish a valid installed preparation/final
3740
+ pin's ledger transition. It never arms, replaces evidence, releases an armed
3741
+ charge or decides what happened in an external application.
3742
+
3743
+ Listing returns `page` with snapshot policy/count/revision, frozen `records`,
3744
+ `visitedNodes` and `next`. The limit is 1–100 records (default 100); the budget
3745
+ is 129–8192 index objects (default 1024). Every traversed tree or record, including
3746
+ cursor seeking, spends this budget. Ledger/header validation is fixed extra
3747
+ bounded work. The traversal stack is at most 64 bounded nodes, with at most 100
3748
+ output records. A phase filter can produce an empty page with a continuation;
3749
+ there is no hidden scan to fill it.
3750
+
3751
+ A cursor binds namespace, ledger revision, last visited route and phase filter.
3752
+ Its fields can be serialized and supplied to another process. It is a position,
3753
+ not an authorization token or retention pin. Concurrent writes do not change
3754
+ its snapshot. If GC removes the snapshot, listing returns `unavailable` with
3755
+ that cursor and the cause, without partial records or a silent restart. Start a
3756
+ new listing explicitly when a fresh snapshot is appropriate. Listing verifies
3757
+ ledger claims along visited paths; use point inspection for live custody.
3758
+ Unvisited subtrees are not audited, and metadata/tombstones can grow with work.
@@ -0,0 +1,27 @@
1
+ # git-cas v7.0.0 Security Release Candidate
2
+
3
+ This candidate migrates the public schema entrypoint to Zod 4. It is a major release because consumers composing exported schemas must use Zod 4, schema generic annotations change, and integer validation rejects values above the JavaScript safe-integer limit. See [UPGRADING.md](../../UPGRADING.md#v6512-to-v700-candidate) before adopting it.
4
+
5
+ ## Observable changes
6
+
7
+ The `@git-stunts/git-cas/schema` entrypoint retains its exported schema names. Its schema objects and generic declarations now belong to Zod 4. The new strict schema fixture checks the declarations without skipping dependency diagnostics and distinguishes defaulted output fields from optional inputs.
8
+
9
+ Stored or externally supplied metadata above `Number.MAX_SAFE_INTEGER` is refused on read and write. There is no automatic migration or legacy parsing fallback. Custom schema messages remain, while default Zod diagnostics and union error text can change. A shared application `z.config(...)` can affect default messages. The migration guide identifies affected fields and callers.
10
+
11
+ ## Scope
12
+
13
+ No package split, CLI relocation, stored object-format rewrite, ref rename, or encryption algorithm change is included. The unfinished Cleave workspace split remains a separate [v8.0.0 release plan](https://github.com/git-stunts/git-cas/milestone/6). Compatible metadata and existing application handles keep their established encoding and identity; unsafe integer metadata is the explicit compatibility exception.
14
+
15
+ ## Manifest version metadata
16
+
17
+ New manifests carry `formatVersion: "7.0.0"` through the existing package-version stamp. This field records the producing package version; it is separate from the manifest schema's `version` field, which remains 1 or 2. The existing parser accepts three numeric components and does not dispatch on the package major version. A prerelease suffix is rejected, so this release uses a stable version rather than changing stored-format validation to accommodate a prerelease.
18
+
19
+ A bounded real-Git witness installed published 6.5.12 and the packed v7 candidate separately, then stored, read, restored and verified a 3,840-byte plaintext file in both directions. Each reader preserved the producer's formatVersion and returned identical payload bytes. This supports ordinary plaintext compatibility; it does not establish every encryption or retention scenario, nor acceptance of unsafe integer metadata.
20
+
21
+ ## Dependency and verification gates
22
+
23
+ This candidate requires published Plumbing `^3.3.3`. The refreshed lockfile contains Zod 4 throughout the production dependency tree, and its production audit reports zero findings. The final release must pass the documented Node, Bun-launcher and Deno checks, both public type fixtures, maintained examples, package checks and JSR dry-run under the repository's bounded Docker workflow. The developer dependency audit is a separate boundary.
24
+
25
+ Issue [#151](https://github.com/git-stunts/git-cas/issues/151) and PR [#152](https://github.com/git-stunts/git-cas/pull/152) own the migration. [#154](https://github.com/git-stunts/git-cas/issues/154) owns dependency adoption, release verification, publication and a fresh registry consumer. The unrelated full-public-declaration export repair remains [#153](https://github.com/git-stunts/git-cas/issues/153).
26
+
27
+ This candidate document claims no published 7.0.0 artifact. Merge approval, an immutable tag, successful publication and registry-consumer evidence remain required. Candidate preparation does not establish that downstream git-warp has adopted this release.
@@ -0,0 +1,27 @@
1
+ # git-cas v7.1.0: durable reservation admission
2
+
3
+ This release candidate adds `cas.reservations.open()` for applications that must reserve permanent record capacity before an irreversible effect. The implementation merged in [PR #158](https://github.com/git-stunts/git-cas/pull/158). [Issue #162](https://github.com/git-stunts/git-cas/issues/162) records release gates, publication and fresh public-registry consumer verification. Candidate metadata alone does not establish publication.
4
+
5
+ This candidate document claims no published 7.1.0 artifact.
6
+
7
+ ## Contract
8
+
9
+ A namespace has an immutable, positive safe-integer record-slot limit. `reserve()` charges one slot for an exact key and request binding. An identical retry recovers that attempt even at capacity; a different binding refuses. `prepare()` pins original evidence before acknowledging preparation. Only a freshly acknowledged `arm()` transition permits the application to execute its effect. Recovery of an armed attempt never issues a second permit.
10
+
11
+ `settle()` pins final evidence while retaining the original preparation. `cancel()` refunds only an unarmed, unsettled attempt, first recording its terminal tombstone and then removing its exact custody pin. Failed cleanup remains retryable residue. `reconcile()` repairs installed storage phases without executing or replaying application effects. `readEvidence()` returns exact original or final pages; bounded listing binds its cursor to one immutable ledger snapshot and phase filter.
12
+
13
+ Record-slot capacity is not a physical-byte quota. Evidence pages are at most 16 MiB, with at most 64 blob/tree support roots and 63 caller-supplied commit parents. Listing returns at most 100 records and visits at most 8,192 index nodes per call. A cursor is not a retention pin; GC can make an old listing snapshot unavailable. No cross-ref atomic snapshot, TTL reclamation, application authorization or physical power-loss guarantee is supplied.
14
+
15
+ ## Compatibility
16
+
17
+ The API is additive to v7.0.0. Existing assets, caches, encryption, handles and refs keep their contracts. New reservation namespaces use `refs/cas/reservations/*` and `refs/cas/reservation-custody/*`. New content manifests carry producing-package `formatVersion: "7.1.0"`; this remains separate from the manifest schema version. Zod 4 and published Plumbing `^3.3.3` remain required.
18
+
19
+ Deno CI and release commands now install the frozen pnpm project graph and execute with `--node-modules-dir=manual`. This removes fresh Deno transitive resolution from those paths without changing dependency ranges. The separate unlocked Bun image-install follow-up remains [#161](https://github.com/git-stunts/git-cas/issues/161).
20
+
21
+ ## Evidence and limits
22
+
23
+ The [implementation witnesses](https://github.com/git-stunts/git-cas/blob/4782052214269c72acc95f63191e89897059bb56/docs/design/0063-durable-reservations/witness/README.md) separate state-machine tests, selected corruption, native multi-process races, injected write-boundary failures, process death, reopen and real Git GC in SHA-1 and SHA-256 stores. The [finite cost witness](https://github.com/git-stunts/git-cas/blob/4782052214269c72acc95f63191e89897059bb56/docs/design/0063-durable-reservations/witness/native-cost.md) measures stores of 1, 17 and 129 attempts using 4 KiB pages. It does not claim universal constant memory or performance parity across runtimes.
24
+
25
+ PR #158's current-head hosted lint, unit and Node/Bun/Deno jobs passed. The maintainer explicitly authorized an admin merge after reviewer quota and file-count limits prevented independent approval. The [cycle retrospective](https://github.com/git-stunts/git-cas/blob/028c7fee56a8c4fa1c1ac1221fb7efb23289c8bf/docs/method/retro/0063-durable-reservations/durable-reservations.md) preserves that distinction. Full release-source validation, artifact identities and fresh registry-consumer evidence belong to #162.
26
+
27
+ git-warp must install the published artifact before claiming adoption. WARP authorization, observation receipts, Coordinates and shared custody integration remain outside this storage release.
package/index.d.ts CHANGED
@@ -16,6 +16,17 @@ import type {
16
16
  import Chunk from './src/domain/value-objects/Chunk.js';
17
17
  import CasService from './src/domain/services/CasService.js';
18
18
  import CasError from './src/domain/errors/CasError.js';
19
+ import type { ReservationCapability } from './src/domain/services/ReservationNamespace.js';
20
+ export { default as ReservationNamespace } from './src/domain/services/ReservationNamespace.js';
21
+ export { default as ReservationCursor } from './src/domain/value-objects/ReservationCursor.js';
22
+ export type {
23
+ ReservationPhase, ReservationIdentity, ReservationCapacity, ReservationPolicy,
24
+ ReservationRecordView, ReservationEvidenceInput, ReservationRoots, ReservationCustodyView,
25
+ ReservationRefusalReason, ReservationRefused, ReservationIndeterminate, ReservationAcknowledgement, ReservationAcknowledgedStatus,
26
+ ReservationOutcome, ReservationInspection, ReservationEvidenceRead, ReservationCursorData,
27
+ ReservationListOptions, ReservationPage, ReservationListUnavailable, ReservationOpenRefusal,
28
+ ReservationOpenIndeterminate, ReservationOpenOutcome, ReservationCapability,
29
+ } from './src/domain/services/ReservationNamespace.js';
19
30
  import type {
20
31
  CryptoPort,
21
32
  CodecPort,
@@ -543,6 +554,8 @@ export declare class GitPersistencePortBase {
543
554
 
544
555
  /** Abstract port for Git ref and commit operations. */
545
556
  export declare class GitRefPortBase {
557
+ /** Exact direct/symbolic posture; a dangling symbolic ref is not absent. */
558
+ inspectRef?(ref: string): Promise<{ oid: string | null; symref: string | null }>;
546
559
  resolveRef(ref: string): Promise<string>;
547
560
  resolveTree(commitOid: string): Promise<string>;
548
561
  resolveParents(commitOid: string): Promise<string[]>;
@@ -600,6 +613,7 @@ export declare class GitPersistenceAdapter extends GitPersistencePortBase {
600
613
  /** Git-backed implementation of the ref port. */
601
614
  export declare class GitRefAdapter extends GitRefPortBase {
602
615
  constructor(options: { plumbing: unknown; policy?: unknown });
616
+ inspectRef(ref: string): Promise<{ oid: string | null; symref: string | null }>;
603
617
  anchorRef(options: {
604
618
  sourceRef: string;
605
619
  expectedSourceOid: string;
@@ -1804,6 +1818,7 @@ export default class ContentAddressableStore {
1804
1818
  };
1805
1819
 
1806
1820
  readonly caches: CacheCapability;
1821
+ readonly reservations: ReservationCapability;
1807
1822
  readonly expiringSets: ExpiringSetCapability;
1808
1823
  readonly workspaces: WorkspaceCapability;
1809
1824
  readonly diagnostics: DiagnosticsCapability;