@git-stunts/git-cas 5.3.2 → 6.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.
Files changed (173) hide show
  1. package/ADVANCED_GUIDE.md +1006 -0
  2. package/ARCHITECTURE.md +514 -0
  3. package/CHANGELOG.md +393 -5
  4. package/CODE_OF_CONDUCT.md +33 -0
  5. package/GUIDE.md +872 -0
  6. package/README.md +219 -325
  7. package/SECURITY.md +993 -0
  8. package/SUPPORT.md +54 -0
  9. package/UPGRADING.md +299 -0
  10. package/bin/actions.js +70 -21
  11. package/bin/agent/cli.js +51 -0
  12. package/bin/agent/commands/doctor.js +99 -0
  13. package/bin/agent/commands/index.js +1489 -0
  14. package/bin/agent/input.js +619 -0
  15. package/bin/agent/passphrase-source.js +123 -0
  16. package/bin/agent/protocol.js +193 -0
  17. package/bin/build-version.js +64 -0
  18. package/bin/credentials.js +425 -0
  19. package/bin/git-cas.js +595 -449
  20. package/bin/passphrase-source.js +266 -0
  21. package/bin/restore-output-target.js +28 -0
  22. package/bin/ui/blocks/asset-card.js +109 -0
  23. package/bin/ui/blocks/health-dashboard.js +149 -0
  24. package/bin/ui/blocks/heatmap-block.js +67 -0
  25. package/bin/ui/blocks/merkle-explorer.js +163 -0
  26. package/bin/ui/blocks/operation-feed.js +176 -0
  27. package/bin/ui/blocks/wizard-block.js +168 -0
  28. package/bin/ui/components/short-sha.js +36 -0
  29. package/bin/ui/context.js +56 -1
  30. package/bin/ui/dashboard-cmds.js +1578 -13
  31. package/bin/ui/dashboard-view.js +612 -145
  32. package/bin/ui/dashboard.js +998 -214
  33. package/bin/ui/encryption-card.js +69 -26
  34. package/bin/ui/heatmap.js +26 -54
  35. package/bin/ui/history-timeline.js +51 -19
  36. package/bin/ui/manifest-view.js +115 -60
  37. package/bin/ui/merkle-dag.js +83 -0
  38. package/bin/ui/progress.js +15 -9
  39. package/bin/ui/repo-treemap.js +328 -0
  40. package/bin/ui/shaders/bak-sneppen.js +180 -0
  41. package/bin/ui/shaders/fractal-zoom.js +99 -0
  42. package/bin/ui/shaders/merkle-tree.js +142 -0
  43. package/bin/ui/shaders/organic-flow.js +96 -0
  44. package/bin/ui/shaders/phase-portrait.js +93 -0
  45. package/bin/ui/store-wizard.js +296 -0
  46. package/bin/ui/theme.js +155 -0
  47. package/bin/ui/vault-report.js +495 -0
  48. package/build-info.json +4 -0
  49. package/docs/API.md +2224 -0
  50. package/docs/ENCRYPTION_MODES.md +33 -0
  51. package/docs/EXTENDING.md +174 -0
  52. package/docs/STORE_RESTORE_PIPELINE.md +199 -0
  53. package/docs/THREAT_MODEL.md +269 -0
  54. package/docs/VAULT_INTERNALS.md +251 -0
  55. package/docs/WALKTHROUGH.md +1868 -0
  56. package/docs/demo.gif +0 -0
  57. package/docs/releases/v6.0.0.md +104 -0
  58. package/examples/README.md +260 -0
  59. package/index.d.ts +208 -65
  60. package/index.js +163 -54
  61. package/package.json +35 -6
  62. package/scripts/migrate-encryption.js +680 -0
  63. package/src/domain/bytes/ByteLayout.js +96 -0
  64. package/src/domain/encoding/base64.js +91 -0
  65. package/src/domain/encoding/hex.js +14 -0
  66. package/src/domain/encoding/utf8.js +123 -0
  67. package/src/domain/encryption/schemes.js +132 -0
  68. package/src/domain/errors/CannotRemoveLastRecipientError.js +10 -0
  69. package/src/domain/errors/CasError.d.ts +28 -0
  70. package/src/domain/errors/CasError.js +43 -6
  71. package/src/domain/errors/Codes.js +54 -0
  72. package/src/domain/errors/DekUnwrapFailedError.js +10 -0
  73. package/src/domain/errors/GitError.js +10 -0
  74. package/src/domain/errors/GitPlumbingInitializationError.js +10 -0
  75. package/src/domain/errors/IntegrityError.js +10 -0
  76. package/src/domain/errors/InvalidChunkingStrategyError.js +10 -0
  77. package/src/domain/errors/InvalidOidError.js +10 -0
  78. package/src/domain/errors/InvalidOptionsError.js +10 -0
  79. package/src/domain/errors/ManifestIntegrityError.js +10 -0
  80. package/src/domain/errors/ManifestNotFoundError.js +10 -0
  81. package/src/domain/errors/NoMatchingRecipientError.js +10 -0
  82. package/src/domain/errors/PersistenceCapabilityRequiredError.js +10 -0
  83. package/src/domain/errors/PortNotImplementedError.js +10 -0
  84. package/src/domain/errors/RecipientAlreadyExistsError.js +10 -0
  85. package/src/domain/errors/RecipientNotFoundError.js +10 -0
  86. package/src/domain/errors/RestoreTooLargeError.js +10 -0
  87. package/src/domain/errors/RotationNotSupportedError.js +10 -0
  88. package/src/domain/errors/createCasError.js +68 -0
  89. package/src/domain/errors/index.js +20 -0
  90. package/src/domain/helpers/buildKdfMetadata.js +4 -2
  91. package/src/domain/helpers/codecBytes.js +34 -0
  92. package/src/domain/helpers/gitRefErrors.js +84 -0
  93. package/src/domain/helpers/scryptMaxmem.js +22 -0
  94. package/src/domain/outcomes/RestoreFailure.js +15 -0
  95. package/src/domain/outcomes/RestoreOutcome.js +11 -0
  96. package/src/domain/outcomes/RestoreSuccess.js +34 -0
  97. package/src/domain/outcomes/StoreFailure.js +15 -0
  98. package/src/domain/outcomes/StoreOutcome.js +11 -0
  99. package/src/domain/outcomes/StoreSuccess.js +17 -0
  100. package/src/domain/schemas/ManifestSchema.d.ts +40 -9
  101. package/src/domain/schemas/ManifestSchema.js +67 -13
  102. package/src/domain/services/CasService.d.ts +123 -38
  103. package/src/domain/services/CasService.js +298 -834
  104. package/src/domain/services/ChunkRepository.js +230 -0
  105. package/src/domain/services/CompressionStreams.js +72 -0
  106. package/src/domain/services/ConvergentEncryption.js +128 -0
  107. package/src/domain/services/GitTreeBuilder.js +86 -0
  108. package/src/domain/services/IntegrityVerifier.js +199 -0
  109. package/src/domain/services/KeyResolver.js +49 -42
  110. package/src/domain/services/ManifestDiff.js +56 -0
  111. package/src/domain/services/ManifestRepository.js +286 -0
  112. package/src/domain/services/PrefetchWindow.js +48 -0
  113. package/src/domain/services/RecipientService.js +157 -0
  114. package/src/domain/services/RedactingObservability.js +169 -0
  115. package/src/domain/services/RestorePipeline.js +68 -0
  116. package/src/domain/services/StorePipeline.js +201 -0
  117. package/src/domain/services/VaultKeyVerifier.js +101 -0
  118. package/src/domain/services/VaultMetadataCodec.js +206 -0
  119. package/src/domain/services/VaultMutationRetryPolicy.js +105 -0
  120. package/src/domain/services/VaultPersistence.js +410 -0
  121. package/src/domain/services/VaultPrivacyIndex.js +191 -0
  122. package/src/domain/services/VaultService.js +749 -251
  123. package/src/domain/services/VaultStateCache.js +225 -0
  124. package/src/domain/services/VaultTreeCodec.js +121 -0
  125. package/src/domain/services/rotateVaultPassphrase.js +37 -20
  126. package/src/domain/strategies/Aad.js +39 -0
  127. package/src/domain/strategies/FramedRecordCodec.js +204 -0
  128. package/src/domain/strategies/RestoreCompressed.js +40 -0
  129. package/src/domain/strategies/RestoreConvergent.js +44 -0
  130. package/src/domain/strategies/RestoreFramed.js +55 -0
  131. package/src/domain/strategies/RestorePlain.js +37 -0
  132. package/src/domain/strategies/RestoreStrategy.js +35 -0
  133. package/src/domain/strategies/RestoreWhole.js +135 -0
  134. package/src/domain/strategies/StoreConvergent.js +28 -0
  135. package/src/domain/strategies/StoreFramed.js +39 -0
  136. package/src/domain/strategies/StorePlain.js +20 -0
  137. package/src/domain/strategies/StoreStrategy.js +61 -0
  138. package/src/domain/strategies/StoreWhole.js +34 -0
  139. package/src/domain/value-objects/Chunk.js +1 -2
  140. package/src/domain/value-objects/EncryptionMetadata.js +87 -0
  141. package/src/domain/value-objects/Manifest.d.ts +40 -4
  142. package/src/domain/value-objects/Manifest.js +61 -20
  143. package/src/domain/value-objects/Oid.js +45 -0
  144. package/src/domain/value-objects/Slug.js +124 -0
  145. package/src/domain/value-objects/StoreEncryptionConfig.js +114 -0
  146. package/src/helpers/aesGcmMeta.js +55 -0
  147. package/src/helpers/canonicalBase64.js +1 -0
  148. package/src/helpers/kdfPolicy.js +194 -0
  149. package/src/infrastructure/adapters/BunCryptoAdapter.js +124 -8
  150. package/src/infrastructure/adapters/FileIOHelper.js +178 -13
  151. package/src/infrastructure/adapters/GitPersistenceAdapter.js +235 -42
  152. package/src/infrastructure/adapters/GitPlumbingFactoryAdapter.js +62 -0
  153. package/src/infrastructure/adapters/GitRefAdapter.js +19 -6
  154. package/src/infrastructure/adapters/NodeCompressionAdapter.js +64 -0
  155. package/src/infrastructure/adapters/NodeCryptoAdapter.js +130 -10
  156. package/src/infrastructure/adapters/WebCryptoAdapter.js +187 -77
  157. package/src/infrastructure/chunkers/CdcChunker.js +53 -19
  158. package/src/infrastructure/chunkers/FixedChunker.js +15 -7
  159. package/src/infrastructure/chunkers/resolveChunker.js +3 -1
  160. package/src/infrastructure/codecs/CborCodec.js +3 -3
  161. package/src/infrastructure/codecs/JsonCodec.js +5 -5
  162. package/src/infrastructure/createGitPlumbing.js +22 -0
  163. package/src/package-version.js +1 -0
  164. package/src/ports/ChunkingPort.js +3 -3
  165. package/src/ports/CodecPort.js +4 -4
  166. package/src/ports/CompressionPort.js +57 -0
  167. package/src/ports/CryptoPort.js +138 -50
  168. package/src/ports/GitPersistencePort.js +32 -2
  169. package/src/ports/GitPlumbingFactoryPort.js +16 -0
  170. package/src/ports/GitRefPort.js +1 -1
  171. package/src/types/ambient.d.ts +10 -5
  172. package/test/CONVENTIONS.md +94 -0
  173. package/test/cycles/README.md +13 -0
@@ -0,0 +1,251 @@
1
+ # Vault Internals
2
+
3
+ This document is the maintainer map for the v6 vault implementation. Public API
4
+ details belong in [docs/API.md](./API.md); this file explains the internal
5
+ collaborators, durability boundaries, cache rules, and security invariants that
6
+ keep `VaultService` small.
7
+
8
+ ## Purpose
9
+
10
+ The vault is a GC-safe slug index rooted at `refs/cas/vault`. Each vault commit
11
+ points to a Git tree containing:
12
+
13
+ - `.vault.json` metadata
14
+ - zero or more slug-to-asset tree entries
15
+ - `.privacy-index` when privacy mode is enabled
16
+
17
+ `VaultService` is the use-case orchestrator. It validates inputs, chooses the
18
+ plain or privacy path, coordinates vault-key verification, asks collaborators to
19
+ read or write durable state, and emits observability events. It must not become
20
+ the owner of Git tree formatting, metadata parsing, retry timing, or cache
21
+ policy.
22
+
23
+ ## Collaborators
24
+
25
+ `VaultPersistence`
26
+
27
+ Owns the Git/ref substrate behind the vault. It resolves the vault head, reads
28
+ tree entries, streams entries when the adapter supports it, writes metadata and
29
+ privacy-index blobs, creates the next commit, and performs the compare-and-swap
30
+ ref update against `refs/cas/vault`. It is intentionally stateless: it does not
31
+ cache commit OIDs, tree OIDs, or parsed state.
32
+
33
+ The default `GitRefAdapter` translates known Git missing-ref stderr into
34
+ `GIT_REF_NOT_FOUND` at the adapter boundary. `VaultPersistence` still keeps a
35
+ narrow stderr fallback for third-party ref ports, but the normal path is
36
+ structured and does not depend on parsing English text in the domain service.
37
+ That fallback is documented in source as C/English-locale best effort, requires
38
+ the vault ref name, and is not the primary compatibility contract.
39
+ When only metadata is needed, targeted tree-entry reads and iterator reads
40
+ return `snapshot: null` because they intentionally avoid materializing the full
41
+ tree and therefore cannot seed a complete `VaultStateCache` entry.
42
+ `VaultService` constructor injection is exclusive: callers either provide the
43
+ cohesive `vaultPersistence` collaborator or the legacy `persistence` and `ref`
44
+ pair used to build it, never both.
45
+
46
+ `VaultStateCache`
47
+
48
+ Owns parse-stable memoization keyed by immutable tree OID. The tree snapshot
49
+ cache is bounded by a validated LRU capacity so long-running agent or TUI
50
+ processes do not retain every historical vault tree forever. Cached snapshots
51
+ keep raw tree entries, cloned metadata, parsed plain entries, privacy entries by
52
+ encryption-key object identity, and verified vault keys. Public state returned
53
+ to callers is defensively copied so a caller cannot mutate cached state. Keyed
54
+ memoization stores a byte snapshot beside the key object, so mutating a reused
55
+ `Uint8Array` key cannot reuse stale privacy or verifier cache entries.
56
+ Concurrent privacy reads for the same cached tree and key object share one
57
+ in-flight `.privacy-index` resolution.
58
+
59
+ `VaultMetadataCodec`
60
+
61
+ Owns the `.vault.json` boundary format. It encodes and decodes bytes, validates
62
+ metadata version, AES-256-GCM cipher selection, KDF policy, verifier metadata,
63
+ and encryption counters. If the `encryption` field is present, it must be a
64
+ complete object; falsy placeholder values are invalid metadata rather than an
65
+ unencrypted vault signal. It is pure: it does not read Git, write Git, derive
66
+ keys, or perform vault mutations.
67
+
68
+ `VaultTreeCodec`
69
+
70
+ Owns persisted tree records. Plain vault slugs use `Slug.toTreePath()` for the
71
+ Git tree entry name, and decode through `Slug.decode()`. Privacy-enabled vaults
72
+ use HMAC tree names and keep the slug mapping in `.privacy-index`. The codec is
73
+ pure and must not perform I/O.
74
+
75
+ `VaultPrivacyIndex`
76
+
77
+ Owns privacy-mode persisted names and the encrypted slug-to-HMAC index. It
78
+ derives a privacy key from the vault encryption key, computes HMAC-SHA256 names,
79
+ encrypts the index blob, decrypts it on read, and validates both slugs and HMAC
80
+ names before returning a map. Full-state reads and listings must fail closed with
81
+ `VAULT_PRIVACY_INDEX_INVALID` when raw HMAC tree entries are not covered by the
82
+ decrypted index; returning a partial privacy listing can hide vault corruption.
83
+
84
+ `VaultKeyVerifier`
85
+
86
+ Owns encrypted vault-key verifier metadata. New encrypted vaults store a small
87
+ AES-GCM verifier in `.vault.json`; reads and keyed writes use it to reject a
88
+ wrong vault key before accepting empty-vault mutations. Verifier plaintext is
89
+ compared with a constant-time byte comparison. Once `readState()` verifies a key
90
+ for a cached tree OID, targeted list, resolve, and follow-on mutation writes for
91
+ that same tree reuse the cached verifier proof instead of decrypting the
92
+ verifier again.
93
+
94
+ `VaultMutationRetryPolicy`
95
+
96
+ Owns optimistic contention policy. It decides whether an error is retryable and
97
+ computes exponential backoff with jitter between attempts. `VaultService`
98
+ receives the policy through dependency injection so CLIs, TUIs, and long-running
99
+ agents can tune contention behavior without changing vault use-case logic. The
100
+ policy validates injected timing hooks during construction and freezes the
101
+ instance after initialization.
102
+
103
+ ## Read Paths
104
+
105
+ `getVaultMetadata()`
106
+
107
+ Resolves the current vault head and reads `.vault.json` directly when the
108
+ persistence adapter supports targeted tree lookups. It only falls back to full
109
+ tree reads when the adapter cannot resolve a single entry.
110
+
111
+ `resolveVaultEntry({ slug })`
112
+
113
+ Validates the slug through `Slug`, then resolves only the relevant persisted
114
+ name when the vault is plain. Privacy mode must decrypt `.privacy-index` because
115
+ the persisted name is derived from the caller-provided encryption key.
116
+
117
+ `listVault()`
118
+
119
+ Returns a sorted array for API compatibility. Internally it delegates to
120
+ `iterateVault()`, which streams tree entries when the persistence adapter can do
121
+ so instead of materializing the whole vault as the default read primitive.
122
+
123
+ `readState()`
124
+
125
+ Returns a defensive copy of the current entries, metadata, and parent commit
126
+ OID. Use it when the caller needs a full state snapshot. Do not route targeted
127
+ reads through `readState()` unless the full snapshot is actually required.
128
+
129
+ `rotateVaultPassphrase()`
130
+
131
+ Reads `.vault.json` first through `getVaultMetadata()` so privacy-enabled vaults
132
+ can derive and verify the old key before decrypting `.privacy-index`. Only after
133
+ the old key is available should rotation call `readState({ encryptionKey })`.
134
+ This preserves privacy-mode slug resolution while rebuilding the privacy index
135
+ under the new vault key.
136
+
137
+ `git cas doctor`
138
+
139
+ Treats `refs/cas/vault` as unhealthy when the vault head exists but `.vault.json`
140
+ metadata is missing or invalid. In that case doctor reports
141
+ `VAULT_METADATA_INVALID` before scanning entry manifests, because the vault
142
+ boundary metadata is the authority for encryption, privacy, and verifier state.
143
+ If the vault ref exists but cannot be read, or its commit cannot resolve to a
144
+ tree, `VaultPersistence` reports `VAULT_HEAD_INVALID` instead of treating the
145
+ vault as absent.
146
+ For privacy-enabled vaults, doctor must receive the same vault encryption key
147
+ surface as list/resolve flows. Human CLI and agent command entrypoints resolve
148
+ `--key-file`, `--vault-passphrase*`, or OS-keychain input and pass the derived
149
+ key into `inspectVaultHealth()`, which forwards it to `readState()`. The TUI
150
+ operations doctor forwards the already-unlocked vault key from the dashboard
151
+ model. Agent diagnostics warn and ignore passphrase input when the vault is
152
+ plaintext instead of failing the health check; encrypted diagnostics require the
153
+ agent passphrase resolver dependency whenever a structured passphrase source is
154
+ present.
155
+
156
+ Privacy index coverage failures are vault-level failures. A missing
157
+ `.privacy-index` reports `VAULT_PRIVACY_INDEX_MISSING`; a present index that
158
+ does not cover every raw HMAC tree entry reports `VAULT_PRIVACY_INDEX_INVALID`.
159
+ Privacy metadata must also include `privacy.indexMeta`; missing index metadata
160
+ is treated as `VAULT_PRIVACY_INDEX_INVALID` before decrypting or resolving
161
+ privacy-mode entries.
162
+ When manifests can be read, doctor reports both chunk-reference dedupe and
163
+ byte-level efficiency (`totalChunkBytes / uniqueChunkBytes`) so operators can
164
+ see whether repeated stored chunks reduce chunk bytes without conflating that
165
+ signal with compression.
166
+
167
+ ## Write Path
168
+
169
+ Vault mutations follow one draft-based loop:
170
+
171
+ 1. Resolve the current vault head.
172
+ 2. Read enough state for the mutation.
173
+ 3. Build a draft entries map and metadata object.
174
+ 4. Verify or create vault-key verifier metadata when encryption is configured.
175
+ 5. Build privacy persisted names and `.privacy-index` bytes when privacy mode is enabled.
176
+ 6. Ask `VaultPersistence.writeCommit()` to write blobs, tree, commit, and CAS-update the ref.
177
+ 7. Retry through `VaultMutationRetryPolicy` when the CAS update reports `VAULT_CONFLICT`.
178
+
179
+ `VaultPersistence` only classifies structured expected-vs-actual OID mismatches,
180
+ or Git `update-ref` CAS mismatch stderr, as `VAULT_CONFLICT`. Other ref update
181
+ failures report `VAULT_REF_UPDATE_FAILED` so callers do not retry permission,
182
+ I/O, or policy failures as optimistic-concurrency contention.
183
+
184
+ The service talks in domain terms: vault head, entries, metadata, privacy index,
185
+ and vault key. Git terms such as refs, mktree records, commit creation, and
186
+ compare-and-swap updates stay inside `VaultPersistence` and `VaultTreeCodec`.
187
+
188
+ ## Cache Rules
189
+
190
+ Tree OIDs are immutable, so a tree-OID keyed cache is safe. Commit refs are
191
+ mutable, so ref resolution must not be cached by `VaultStateCache` or
192
+ `VaultPersistence`. The cache evicts least-recently-used tree snapshots once its
193
+ capacity is exceeded; the default capacity is intentionally a memory bound, not
194
+ a durability or correctness boundary.
195
+
196
+ Missing vault refs are normalized before `VaultService` sees them. Git adapters
197
+ must treat both English stderr forms and stdout-only `rev-parse <ref>` misses as
198
+ an absent vault ref; corrupt or unreadable refs still fail closed as
199
+ `VAULT_HEAD_INVALID`.
200
+
201
+ Cache entries may contain:
202
+
203
+ - raw immutable tree entries copied from persistence
204
+ - cloned `.vault.json` metadata
205
+ - parsed plain entries
206
+ - privacy entries keyed by the exact `Uint8Array` encryption-key object
207
+ - a verified-key set keyed by the exact `Uint8Array` encryption-key object
208
+
209
+ Returned state must always be copied. A caller mutating a returned `Map` or
210
+ metadata object must not mutate the cache. Collaborator-level cache accessors
211
+ also return copied entry maps, so callers that bypass `readState()` cannot mutate
212
+ the cached plain or privacy entry map. Verifier memoization is tree-local:
213
+ mutations that advance the vault head must resolve and verify the new tree state
214
+ before its cached proof is reused.
215
+
216
+ ## Boundary Compatibility
217
+
218
+ The durable vault format is compatibility-sensitive:
219
+
220
+ - `refs/cas/vault` remains the vault head ref.
221
+ - `.vault.json` remains the metadata entry.
222
+ - `.privacy-index` remains the encrypted privacy-mode index entry.
223
+ - Plain slugs are encoded only through `Slug.toTreePath()`.
224
+ - Plain slugs are decoded only through `Slug.decode()`.
225
+ - `VaultMetadataCodec` and `VaultTreeCodec` must stay pure.
226
+
227
+ Changing plain tree-entry encoding is a data migration, not an internal refactor:
228
+ any drift would make existing vault entries unreachable by their public slug.
229
+
230
+ ## Testing Posture
231
+
232
+ Vault tests should assert behavior rather than collaborator shape:
233
+
234
+ - plain and privacy vault round trips preserve slug-to-tree mappings
235
+ - wrong vault keys fail before empty-vault writes
236
+ - verifier migration occurs on the next keyed write for older metadata
237
+ - verifier-cache regression tests exercise cross-operation reuse, such as
238
+ `readState({ encryptionKey })` followed by a keyed mutation on the same tree
239
+ - security-sensitive error assertions use `ErrorCodes` constants so tests fail
240
+ on intentional error-code changes instead of drifting behind string literals
241
+ - targeted resolve and streaming list paths work when the adapter exposes them
242
+ - CAS conflicts are retried through the policy
243
+ - codecs reject malformed bytes and remain I/O-free
244
+
245
+ Do not add source-layout tests that assert import ordering, file headers, or
246
+ other non-behavioral structure. Those checks make refactors brittle without
247
+ protecting the vault contract.
248
+
249
+ Use injected memory adapters for domain behavior where possible. Git-backed
250
+ integration tests remain valuable for verifying the actual ref, tree, blob, and
251
+ commit substrate.