Skip to content

Commit 40b303b

Browse files
committed
docs: Resolve teardown self-review findings
1 parent 82aa746 commit 40b303b

1 file changed

Lines changed: 59 additions & 61 deletions

File tree

TECHNICAL_TEARDOWN.md

Lines changed: 59 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,16 @@ This document provides an exhaustive, end-to-end technical explanation of the `@
44

55
## Table of Contents
66

7-
```text
8-
git-warp Overview ......................................... 27
9-
Domain Dictionary ......................................... 50
10-
The Big Idea .............................................. 101
11-
The Source of Truth ....................................... 115
12-
In Git Objects .......................................... 118
13-
In Git Refs ............................................. 124
14-
In Memory ............................................... 130
15-
Core Concepts ............................................. 136
16-
Bootstrapping vs Runtime ................................ 138
17-
Entry Point: From Package Import To openWarpGraph() ..... 144
18-
Hexagonal Architecture .................................. 176
19-
Public API Surface ...................................... 207
20-
Core Workflows: The Golden Paths .......................... 248
21-
Writing to the Graph .................................... 250
22-
Reading from the Graph .................................. 256
23-
Distributed Operations .................................. 262
24-
Design and Implementation ................................. 268
25-
Architectural Trade-offs ................................ 270
26-
How To Read The Codebase Next ........................... 284
27-
A Look Inside a git-warp Repository ..................... 310
28-
Summary ................................................... 333
29-
```
7+
- [`git-warp` Overview](#git-warp-overview)
8+
- [Domain Dictionary](#domain-dictionary)
9+
- [The Big Idea](#the-big-idea)
10+
- [The Source of Truth](#the-source-of-truth)
11+
- [Core Concepts](#core-concepts)
12+
- [Core Workflows: The Golden Paths](#core-workflows-the-golden-paths)
13+
- [Architectural Trade-offs](#architectural-trade-offs)
14+
- [How To Read The Codebase Next](#how-to-read-the-codebase-next)
15+
- [A Look Inside a `git-warp` Repository](#a-look-inside-a-git-warp-repository)
16+
- [Summary](#summary)
3017

3118
## `git-warp` Overview
3219

@@ -112,7 +99,9 @@ This approach has several key advantages. First, it allows for **multi-writer, c
11299
In `git-warp`, the source of truth is not a single database file, but rather the collection of objects and refs in the underlying Git repository. This is a fundamental concept that underpins the entire system.
113100

114101
### In Git Objects
115-
The immutable history of the graph is stored in Git's object database.
102+
103+
The immutable history of the graph is stored in Git's object database.
104+
116105
- **Patch Commits**: Each change to the graph is stored as a Git commit. The commit message contains metadata, and the patch payload itself is often stored in a separate blob.
117106
- **Content Blobs**: Binary content attached to nodes or edges is stored in Git blobs, referenced by the graph data.
118107

@@ -208,45 +197,56 @@ The `WarpGraph` object returned by `openWarpGraph` is a frozen capability bag. I
208197
classDiagram
209198
class WarpGraph {
210199
<<interface>>
211-
+info: GraphInfo
212-
+patches: CommitmentSurface
200+
+graphName: string
201+
+writerId: string
202+
+commitment: CommitmentSurface
213203
+folding: FoldingSurface
214-
+query: RevelationSurface
204+
+revelation: RevelationSurface
215205
+governance: GovernanceSurface
206+
+query: QueryCapability
207+
+patches: PatchCapability
208+
+sync: SyncCapability
209+
+strands: StrandCapability
210+
+checkpoint: CheckpointCapability
211+
+provenance: ProvenanceCapability
212+
+comparison: ComparisonCapability
213+
+subscriptions: SubscriptionCapability
216214
}
217215
218216
class CommitmentSurface {
219217
<<interface>>
220-
+createPatch() PatchBuilder
221-
+patch() Promise~string~
218+
+patches: PatchCapability
219+
+strands: StrandCapability
220+
+comparison: ComparisonCapability
222221
}
223222
224223
class FoldingSurface {
225224
<<interface>>
226-
+join() WarpState
227-
+reduce() WarpState
225+
+checkpoint: CheckpointCapability
228226
}
229227
230228
class RevelationSurface {
231229
<<interface>>
232-
+hasNode() Promise~bool~
233-
+getNodeProps() Promise~object~
234-
+worldline() Worldline
235-
+observer() Observer
230+
+query: QueryCapability
231+
+subscriptions: SubscriptionCapability
232+
+provenance: ProvenanceCapability
236233
}
237234
238235
class GovernanceSurface {
239236
<<interface>>
240-
+syncWith() Promise~SyncWithResult~
241-
+createCheckpoint() Promise~string~
237+
+sync: SyncCapability
242238
}
243239
244-
WarpGraph o-- CommitmentSurface
245-
WarpGraph o-- FoldingSurface
246-
WarpGraph o-- RevelationSurface
247-
WarpGraph o-- GovernanceSurface
240+
WarpGraph o-- CommitmentSurface : commitment
241+
WarpGraph o-- FoldingSurface : folding
242+
WarpGraph o-- RevelationSurface : revelation
243+
WarpGraph o-- GovernanceSurface : governance
248244
```
249245

246+
The architectural surfaces are the primary shape. The flat aliases
247+
(`graph.query`, `graph.patches`, `graph.sync`, and related capabilities) exist
248+
for ergonomic access to the same underlying capability namespaces.
249+
250250
## Core Workflows: The Golden Paths
251251

252252
This section details the primary workflows, or "golden paths", that a user or developer will follow when interacting with `git-warp`.
@@ -285,7 +285,7 @@ Your goal is to use `git-warp` to build an application. You should focus on the
285285
### For the Data Analyst / Auditor
286286
Your goal is to understand the history of the data and verify its integrity.
287287
1. **Understand the Commit Structure**: Look at the "A Look Inside a `git-warp` Repository" section to see how patches are stored in Git.
288-
2. **Learn about Provenance**: Read "Golden Path 9" to understand how `git-warp` enables you to trace data lineage.
288+
2. **Learn about Provenance**: Read the provenance entry in the Domain Dictionary and inspect the patch trailers in the repository example to see how `git-warp` enables data-lineage tracing.
289289
3. **Explore the `JoinReducer`**: The tests in `test/unit/domain/services/JoinReducer.test.ts` will show you how the final state is derived from the history.
290290

291291
### For the Core Contributor
@@ -296,46 +296,44 @@ Your goal is to understand the internals of `git-warp` to fix bugs or add new fe
296296

297297
## A Look Inside a `git-warp` Repository
298298

299-
The concepts of writer refs and patch commits can feel abstract. To make them more concrete, we can examine the `git-warp` repository itself, which uses its own technology to store internal data.
299+
The concepts of writer refs and patch commits can feel abstract. A fixture-style example makes the storage shape concrete without depending on one developer workstation's local refs.
300300

301-
By running `git for-each-ref refs/warp/`, we can see the `git-warp` graphs stored within the repository:
301+
Running `git for-each-ref refs/warp/` in a repository that stores graph data might produce output shaped like this:
302302

303303
```text
304-
ac5882317de52fd207b6035cb9e5a98543b965ab commit refs/warp/demo/writers/alice
305-
c8f867b97e797ddf629c5ad209ce8f8841b0ad58 commit refs/warp/demo/writers/writer-1
306-
6cbc8bf6dce4be512174c1ffe51b8a5e94e3907b commit refs/warp/graft-ast/checkpoints/head
307-
fecdb406087402fcc0e464ef1aaebfa57fe9c14f commit refs/warp/graft-ast/writers/graft
308-
a44156c0870f3aca2002c563b58693fd841c4e1d commit refs/warp/think/writers/local.jamess-macbook-pro-2.local.cli
304+
1111111111111111111111111111111111111111 commit refs/warp/example-graph/writers/alice
305+
2222222222222222222222222222222222222222 commit refs/warp/example-graph/writers/bob
306+
3333333333333333333333333333333333333333 commit refs/warp/example-graph/checkpoints/head
309307
```
310308

311-
This reveals several internal graphs, but the most interesting is `graft-ast`. This graph is used to store the Abstract Syntax Tree (AST) of a project. Let's look at the history of the `graft` writer in this graph:
309+
This reveals the per-writer heads and optional checkpoint head for a graph. Looking at the history of one writer head shows that each patch is represented by a structured commit:
312310

313311
```text
314-
$ git log -n 1 refs/warp/graft-ast/writers/graft
312+
$ git log -n 1 refs/warp/example-graph/writers/alice
315313
316-
commit fecdb406087402fcc0e464ef1aaebfa57fe9c14f
317-
Author: James Ross <james@Jamess-MacBook-Pro-2.local>
314+
commit 1111111111111111111111111111111111111111
315+
Author: Example Operator <operator@example.invalid>
318316
Date: Mon May 25 08:19:53 2026 -0700
319317
320318
warp:patch
321-
319+
322320
eg-kind: patch
323-
eg-graph: graft-ast
324-
eg-writer: graft
321+
eg-graph: example-graph
322+
eg-writer: alice
325323
eg-lamport: 224
326-
eg-patch-oid: 9ef88aaeca1bb42aa8414ce55ade63210f5b5bc3
324+
eg-patch-oid: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
327325
eg-schema: 2
328326
```
329327

330328
This log output shows a single patch commit. The commit message is highly structured, using trailers to store metadata:
331-
- `eg-graph`: The name of the graph (`graft-ast`).
332-
- `eg-writer`: The ID of the writer (`graft`).
329+
- `eg-graph`: The name of the graph (`example-graph`).
330+
- `eg-writer`: The ID of the writer (`alice`).
333331
- `eg-lamport`: The Lamport timestamp of the patch.
334332
- `eg-patch-oid`: The SHA of a Git blob that contains the actual patch payload.
335333

336-
The commit itself is just a metadata container. The actual operations are in the blob with SHA `9ef88aaeca1bb42aa8414ce55ade63210f5b5bc3`. If we inspect the type of this object:
334+
The commit itself is just a metadata container. The actual operations are in the blob with SHA `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`. If we inspect the type of this object:
337335
```console
338-
$ git cat-file -t 9ef88aaeca1bb42aa8414ce55ade63210f5b5bc3
336+
$ git cat-file -t aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
339337
blob
340338
```
341339
This confirms it's a blob. The content of this blob is a binary CBOR-encoded representation of the patch operations.

0 commit comments

Comments
 (0)