@git-stunts/git-cas 6.5.11 → 7.0.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/CHANGELOG.md CHANGED
@@ -7,6 +7,39 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [7.0.0] — 2026-11-01
11
+
12
+ ### Breaking Changes
13
+
14
+ - Upgrade `zod` from 3 to 4 (`^4.6.7`). The public
15
+ `@git-stunts/git-cas/schema` exports now use Zod 4 objects and generic types.
16
+ Consumers composing these schemas must use Zod 4 and update annotations that
17
+ depend on Zod 3 generics. Parse-only callers do not need to compose schemas.
18
+ - Integer validation now rejects values above `Number.MAX_SAFE_INTEGER`,
19
+ including manifest/chunk sizes, indices, chunking and KDF parameters, key
20
+ versions, frame sizes, and sub-manifest counts and offsets. Existing stored
21
+ metadata outside that bound can no longer be read; there is no fallback.
22
+ See [UPGRADING.md](UPGRADING.md) for affected callers and fields.
23
+ - Validation text changes where no custom message is set. The
24
+ `Invalid manifest data:` and `Invalid chunk data:` prefixes remain, but a
25
+ matching encryption scheme with a fractional or infinite integer field can
26
+ now report `Invalid input` instead of a specific integer diagnostic.
27
+ Unmatched schemes already reported `Invalid input` with Zod 3.
28
+
29
+ ### Changed
30
+
31
+ - Schema source rules and custom messages are unchanged. Default validation
32
+ messages now follow Zod 4 and any application configuration of the shared
33
+ Zod 4 instance, such as `z.config(...)` locale or error customization.
34
+ - Require published Plumbing `^3.3.3`, which also uses Zod 4. The locked
35
+ production dependency tree no longer contains Zod 3.
36
+
37
+ ## [6.5.12] — 2026-10-20
38
+
39
+ ### Fixed
40
+
41
+ - Object-metadata reads split uncached targets into ordered request windows of at most 1000 objects and 64 KiB of encoded cat-file commands, including SHA-256 object names. Root-set admission validates targets in bounded windows before writing. Root sets with more than 1000 targets (or more than 936 SHA-256 targets) no longer fail with `ROOT_SET_TARGET_UNREADABLE` caused by the Plumbing batch limit. Request order, duplicate results, cached entries, and per-target failures are preserved; a missing or mismatched target in any window still blocks publication.
42
+
10
43
  ## [6.5.11] — 2026-10-02
11
44
 
12
45
  ### Fixed
package/README.md CHANGED
@@ -52,10 +52,13 @@ 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.10 Release Notes](./docs/releases/v6.5.10.md).
55
+ The v7.0.0 security candidate changes the public schema dependency to Zod 4.
56
+ Before upgrading, read the [migration guidance](./UPGRADING.md#v6512-to-v700-candidate)
57
+ and [candidate release notes](./docs/releases/v7.0.0.md). This candidate requires
58
+ published Plumbing 3.3.3. Publication and registry verification remain tracked in
59
+ [#154](https://github.com/git-stunts/git-cas/issues/154).
57
60
 
58
- The v6.5.11 candidate adopts published Plumbing 3.3.2 for bounded recovery from closed mktree transports after external Git GC. It preserves producer error identity and existing object formats; see [v6.5.11 Release Notes](./docs/releases/v6.5.11.md). Registry publication is pending release verification and merge.
61
+ 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
62
 
60
63
  ### 1. CLI Usage
61
64
 
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,10 +785,14 @@ 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
 
729
792
  ## v6.5.10 To v6.5.11
730
793
 
731
794
  Update the package normally. The Plumbing minimum becomes 3.3.2 to recover closed mktree transports with the existing one-retry bound. No stored-data or application migration is required; unrelated and producer errors remain unchanged.
795
+
796
+ ## v6.5.11 To v6.5.12
797
+
798
+ Update the package normally. Object-metadata reads and root-set admission now run in bounded request windows, so large root sets no longer fail with `ROOT_SET_TARGET_UNREADABLE`. No API, stored-data, or application migration is required; missing and mismatched targets fail exactly as before.
package/build-info.json CHANGED
@@ -1,4 +1,4 @@
1
1
  {
2
- "sha": "1bcd631",
3
- "timestamp": "2026-10-02T12:47:21.894Z"
2
+ "sha": "ae3a81c",
3
+ "timestamp": "2026-11-01T23:22:13.038Z"
4
4
  }
@@ -12,4 +12,4 @@ All tests and benchmarks require a physical Docker marker before test modules lo
12
12
 
13
13
  ## Evidence And Delivery
14
14
 
15
- Issue [#131](https://github.com/git-stunts/git-cas/issues/131) and PR [#132](https://github.com/git-stunts/git-cas/pull/132) own delivery. [Preparatory evidence](../design/0062-mktree-transport-recovery/witness/preparation.md) pins candidate behavior separately from registry delivery. The six recovery checks fail in four cases against Plumbing 3.3.0 and pass against published Plumbing 3.3.2. Full release verification, merge, signed tag, npm publication and registry consumer evidence remain required; this candidate document claims no published 6.5.11 artifact.
15
+ Issue [#131](https://github.com/git-stunts/git-cas/issues/131) and PR [#132](https://github.com/git-stunts/git-cas/pull/132) own delivery. [Preparatory evidence](https://github.com/git-stunts/git-cas/blob/243592ce1b72865ce4f1fd552f504e9488780246/docs/design/0062-mktree-transport-recovery/witness/preparation.md) pins candidate behavior separately from registry delivery. The six recovery checks fail in four cases against Plumbing 3.3.0 and pass against published Plumbing 3.3.2. The reviewed merge passed all 14 release gates; signed tag, trusted npm/GitHub publication and independent public-consumer verification are recorded in the [publication witness](https://github.com/git-stunts/git-cas/pull/132). JSR dry-run passed; JSR publication is not part of the release workflow.
@@ -0,0 +1,13 @@
1
+ # git-cas v6.5.12 Release Notes
2
+
3
+ This patch release bounds object-metadata requests. `readObjectInfos` splits uncached targets into ordered windows of at most 1000 objects and 64 KiB of encoded cat-file commands, including SHA-256 object names, for both the persistent cat-file session and the command fallback. Root-set admission validates targets in bounded windows before any root-set object is written.
4
+
5
+ Root sets with more than 1000 targets (936 for SHA-256) previously failed admission with `ROOT_SET_TARGET_UNREADABLE`, caused by Plumbing's cat-file batch limit. Downstream, git-warp checkpoints failed with "Workspace staged an object but could not establish retention" near 1600 live nodes ([git-warp#958](https://github.com/git-stunts/git-warp/issues/958)).
6
+
7
+ ## Compatibility
8
+
9
+ No API, handle, stored object, descriptor, ref namespace, encryption, or reader format changes. Plumbing's request limits are unchanged and target validation is not bypassed. Request order, duplicate results, cache hits, and per-target failures are preserved; a missing or mismatched target in any window still blocks publication.
10
+
11
+ ## Evidence And Delivery
12
+
13
+ Issue [#147](https://github.com/git-stunts/git-cas/issues/147) and PR [#148](https://github.com/git-stunts/git-cas/pull/148) own delivery. The window witnesses fail 18 cases against v6.5.11, including real SHA-256 repositories at 999 targets, and pass on the candidate across Node, Bun, and Deno. Full release verification, merge, tag, npm publication and registry consumer evidence remain required; this candidate document claims no published 6.5.12 artifact.
@@ -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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@git-stunts/git-cas",
3
- "version": "6.5.11",
3
+ "version": "7.0.0",
4
4
  "description": "Content-addressed storage backed by Git's object database, with optional encryption and pluggable codecs",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -56,7 +56,9 @@
56
56
  "test/cycles/README.md",
57
57
  "LICENSE",
58
58
  "CHANGELOG.md",
59
- "docs/releases/v6.5.11.md"
59
+ "docs/releases/v6.5.11.md",
60
+ "docs/releases/v6.5.12.md",
61
+ "docs/releases/v7.0.0.md"
60
62
  ],
61
63
  "engines": {
62
64
  "node": ">=22.0.0"
@@ -113,11 +115,11 @@
113
115
  "@flyingrobots/bijou-tui": "^7.2.0",
114
116
  "@flyingrobots/bijou-tui-app": "^7.2.0",
115
117
  "@git-stunts/alfred": "^0.10.0",
116
- "@git-stunts/plumbing": "^3.3.2",
118
+ "@git-stunts/plumbing": "^3.3.3",
117
119
  "@git-stunts/vault": "^1.0.1",
118
120
  "cbor-x": "^1.6.0",
119
121
  "commander": "14.0.3",
120
- "zod": "^3.24.1"
122
+ "zod": "^4.6.7"
121
123
  },
122
124
  "pnpm": {
123
125
  "onlyBuiltDependencies": [
@@ -15,7 +15,7 @@ export declare const ChunkSchema: z.ZodObject<{
15
15
 
16
16
  /** Validates KDF parameters stored alongside encryption metadata. */
17
17
  export declare const KdfSchema: z.ZodObject<{
18
- algorithm: z.ZodEnum<["pbkdf2", "scrypt"]>;
18
+ algorithm: z.ZodEnum<{ pbkdf2: "pbkdf2"; scrypt: "scrypt" }>;
19
19
  salt: z.ZodString;
20
20
  iterations: z.ZodOptional<z.ZodNumber>;
21
21
  cost: z.ZodOptional<z.ZodNumber>;
@@ -75,7 +75,7 @@ export declare const EncryptionSchema: z.ZodUnion<
75
75
 
76
76
  /** Validates compression metadata. */
77
77
  export declare const CompressionSchema: z.ZodObject<{
78
- algorithm: z.ZodEnum<["gzip"]>;
78
+ algorithm: z.ZodEnum<{ gzip: "gzip" }>;
79
79
  }>;
80
80
 
81
81
  /** Validates fixed-size chunking parameters. */
@@ -99,8 +99,8 @@ export declare const CdcChunkingSchema: z.ZodObject<{
99
99
 
100
100
  /** Validates chunking metadata (fixed or CDC). */
101
101
  export declare const ChunkingSchema: z.ZodDiscriminatedUnion<
102
- "strategy",
103
- [typeof FixedChunkingSchema, typeof CdcChunkingSchema]
102
+ [typeof FixedChunkingSchema, typeof CdcChunkingSchema],
103
+ "strategy"
104
104
  >;
105
105
 
106
106
  /** Validates a sub-manifest reference in a v2 Merkle manifest. */
@@ -13,6 +13,8 @@ const UPDATE_REF_CONFLICT_MARKERS = Object.freeze({
13
13
  });
14
14
  const GIT_REPOSITORY_LOCKED = 'GIT_REPOSITORY_LOCKED';
15
15
  const GIT_FATAL_EXIT_CODE = 128;
16
+ /** Targets validated per metadata request; bounds buffered admission evidence. */
17
+ const TARGET_ADMISSION_WINDOW = 1000;
16
18
 
17
19
  function hasExactUpdateRefArgs(err, {
18
20
  rootSetRef,
@@ -395,7 +397,19 @@ export default class RootSetPersistence {
395
397
  }
396
398
  }
397
399
 
400
+ /**
401
+ * Validates targets in bounded admission windows, in entry order, before
402
+ * any root-set object is written. Only one window of metadata is buffered
403
+ * at a time; a window that reports a missing object is re-inspected per
404
+ * target so the first failing entry is named exactly.
405
+ */
398
406
  async #assertTargets(entries) {
407
+ for (let start = 0; start < entries.length; start += TARGET_ADMISSION_WINDOW) {
408
+ await this.#assertTargetWindow(entries.slice(start, start + TARGET_ADMISSION_WINDOW));
409
+ }
410
+ }
411
+
412
+ async #assertTargetWindow(entries) {
399
413
  if (typeof this.persistence.readObjectInfos === 'function') {
400
414
  try {
401
415
  const infos = await this.persistence.readObjectInfos(entries.map((entry) => entry.oid));
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Splits object-metadata requests into windows that every Git metadata
3
+ * transport accepts.
4
+ *
5
+ * Plumbing's persistent cat-file session refuses a request with more than
6
+ * 1000 objects or more than 64 KiB of encoded `info <oid>\n` commands. The
7
+ * command fallback writes shorter `<oid>\n` lines, so the session bound also
8
+ * bounds its stdin. Windows preserve the caller's order exactly.
9
+ */
10
+
11
+ export const MAX_METADATA_WINDOW_OBJECTS = 1000;
12
+ export const MAX_METADATA_WINDOW_COMMAND_BYTES = 64 * 1024;
13
+
14
+ const COMMAND_PREFIX = 'info ';
15
+ const COMMAND_TERMINATOR = '\n';
16
+ const ENCODER = new globalThis.TextEncoder();
17
+
18
+ /**
19
+ * @param {string} objectName
20
+ * @returns {number} Encoded bytes of one cat-file info command.
21
+ */
22
+ function commandBytes(objectName) {
23
+ return ENCODER.encode(`${COMMAND_PREFIX}${objectName}${COMMAND_TERMINATOR}`).length;
24
+ }
25
+
26
+ /**
27
+ * @param {ReadonlyArray<string>} objectNames - Object names in request order.
28
+ * @returns {Array<Array<string>>} Ordered, non-empty request windows.
29
+ */
30
+ export function metadataRequestWindows(objectNames) {
31
+ const windows = [];
32
+ let current = [];
33
+ let currentBytes = 0;
34
+ for (const objectName of objectNames) {
35
+ const bytes = commandBytes(objectName);
36
+ if (
37
+ current.length > 0 &&
38
+ (current.length >= MAX_METADATA_WINDOW_OBJECTS ||
39
+ currentBytes + bytes > MAX_METADATA_WINDOW_COMMAND_BYTES)
40
+ ) {
41
+ windows.push(current);
42
+ current = [];
43
+ currentBytes = 0;
44
+ }
45
+ current.push(objectName);
46
+ currentBytes += bytes;
47
+ }
48
+ if (current.length > 0) {
49
+ windows.push(current);
50
+ }
51
+ return windows;
52
+ }
@@ -8,6 +8,7 @@ import { CasError, createCasError, ErrorCodes } from '../../domain/errors/index.
8
8
  import BoundedPromiseCache from '../../helpers/boundedPromiseCache.js';
9
9
  import GitTreeObjectCodec from '../codecs/GitTreeObjectCodec.js';
10
10
  import GitObjectSessionPool from './GitObjectSessionPool.js';
11
+ import { metadataRequestWindows } from './GitMetadataRequestWindows.js';
11
12
  import GitPersistenceWriteScope from './GitPersistenceWriteScope.js';
12
13
 
13
14
  /**
@@ -31,6 +32,7 @@ const MIN_METADATA_CACHE_ENTRIES = 1;
31
32
  const MAX_BLOB_SIZE_LIMIT = Number.MAX_SAFE_INTEGER;
32
33
  const OBJECT_INFO_ARGUMENT = '--batch-check=%(objectname) %(objecttype) %(objectsize)';
33
34
  const GIT_OBJECT_TYPES = new Set(['blob', 'tree', 'commit', 'tag']);
35
+ const SETTLED = () => undefined;
34
36
 
35
37
  /**
36
38
  * {@link GitPersistencePort} implementation backed by `@git-stunts/plumbing`.
@@ -467,28 +469,38 @@ export default class GitPersistenceAdapter extends GitPersistencePort {
467
469
  missing.push(oid);
468
470
  }
469
471
  }
470
- const byOid = this.#cacheObjectInfoBatch(missing);
472
+ const { byOid, settled } = this.#cacheObjectInfoBatch(missing);
471
473
  for (let index = 0; index < objectNames.length; index += 1) {
472
474
  pending[index] ??= byOid.get(objectNames[index]);
473
475
  }
474
- return await Promise.all(pending);
476
+ const results = Promise.all(pending);
477
+ results.catch(SETTLED);
478
+ await settled;
479
+ return await results;
475
480
  });
476
481
  }
477
482
 
483
+ /**
484
+ * Caches uncached metadata as bounded request windows. Windows run one at a
485
+ * time so a large target set never holds more than one backend request; a
486
+ * failed window rejects only its own targets. `settled` resolves once every
487
+ * window has finished, so no request outlives the owning operation.
488
+ */
478
489
  #cacheObjectInfoBatch(objectNames) {
479
490
  const byOid = new Map();
480
- if (objectNames.length === 0) {
481
- return byOid;
482
- }
483
- const batch = this.#readObjectInfosUncached(objectNames);
484
- for (let index = 0; index < objectNames.length; index += 1) {
485
- const oid = objectNames[index];
486
- byOid.set(
487
- oid,
488
- this.#metadataCache.getOrCreate(`object\0${oid}`, async () => (await batch)[index])
489
- );
491
+ let previous = Promise.resolve();
492
+ for (const window of metadataRequestWindows(objectNames)) {
493
+ const batch = previous.then(() => this.#readObjectInfosUncached(window));
494
+ previous = batch.then(SETTLED, SETTLED);
495
+ for (let index = 0; index < window.length; index += 1) {
496
+ const oid = window[index];
497
+ byOid.set(
498
+ oid,
499
+ this.#metadataCache.getOrCreate(`object\0${oid}`, async () => (await batch)[index])
500
+ );
501
+ }
490
502
  }
491
- return byOid;
503
+ return { byOid, settled: previous };
492
504
  }
493
505
 
494
506
  async #readObjectInfosUncached(objectNames) {
@@ -1 +1 @@
1
- export const PACKAGE_VERSION = '6.5.11';
1
+ export const PACKAGE_VERSION = '7.0.0';