Skip to content

Commit 3789c9b

Browse files
committed
feat: add working-set overlay writes
1 parent 004d54a commit 3789c9b

18 files changed

Lines changed: 541 additions & 48 deletions

ARCHITECTURE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ git-warp now also includes a separate **working-set** substrate family. It is in
5050
The v1 model is deliberately narrow:
5151

5252
- a working set pins an explicit frontier snapshot plus an optional Lamport ceiling
53-
- the overlay identity exists, but remains empty in v1
53+
- overlay writes live in a separate working-set patch-log ref
5454
- materialized state is derived/cache only
5555
- no Git worktree assumption leaks into the API
5656

@@ -159,7 +159,7 @@ src/
159159
| | +-- BitmapNeighborProvider.js # Bitmap-backed neighbor provider
160160
| | +-- HealthCheckService.js # K8s-style probes
161161
| | +-- GitLogParser.js # Binary stream parsing
162-
| | +-- WorkingSetService.js # Pinned coordinate descriptors
162+
| | +-- WorkingSetService.js # Pinned coordinates + working-set overlays
163163
| +-- errors/ # Domain-specific errors
164164
| | +-- IndexError.js
165165
| | +-- ShardLoadError.js

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [14.6.0] — 2026-03-16
11+
12+
### Added
13+
14+
- **Working-set overlay write API** — Added `WarpGraph.createWorkingSetPatch()` and `WarpGraph.patchWorkingSet()` so a pinned working set can diverge through its own overlay patch-log while reusing the standard patch builder and mutation kernel.
15+
16+
### Changed
17+
18+
- **Working-set materialization now replays base plus overlay**`materializeWorkingSet()` now reduces the pinned base observation together with the current overlay patch-log, and `getWorkingSet()` / `listWorkingSets()` reconcile overlay metadata from the overlay ref so callers see the current head and patch count.
19+
- **Working-set documentation now reflects real overlay behavior** — Updated `README.md`, `ARCHITECTURE.md`, `docs/WORKING_SETS.md`, `docs/GUIDE.md`, `docs/TTD.md`, and `docs/CLI_GUIDE.md` so the docs describe overlay patch logs, the library-first write API, and the CLI boundary accurately instead of talking about permanently empty overlays.
20+
21+
### Fixed
22+
23+
- **Dropping a working set now removes its overlay ref too**`dropWorkingSet()` now cleans up both the descriptor ref and the overlay patch-log ref, preventing orphaned overlay heads from remaining reachable after a working set is deleted.
24+
1025
## [14.5.0] — 2026-03-16
1126

1227
### Added

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
<img src="docs/images/hero.gif" alt="git-warp CLI demo" width="600">
1212
</p>
1313

14-
## What's New in v14.5.0
14+
## What's New in v14.6.0
1515

16-
- **Working-set foundation is now part of the substrate**`WarpGraph` now exposes explicit coordinate materialization plus durable working-set descriptors through `materializeCoordinate()`, `createWorkingSet()`, `getWorkingSet()`, `listWorkingSets()`, `dropWorkingSet()`, and `materializeWorkingSet()`. Working sets pin a frontier plus optional Lamport ceiling without assuming a Git worktree or making cached materializations authoritative.
17-
- **The main CLI now has a top-level `working-set` family**`git warp working-set create|list|show|materialize|drop` manages pinned working-set descriptors directly from the main package, with no extra package to version or keep in sync.
18-
- **TTD stays read-only and architecture stays hex-clean**the debugger remains a thin inspection family (`debug ...` + `seek`), while durable coordinate management lives beside it as a separate substrate family. This keeps “debug” from becoming a side-effecting mutation channel.
19-
- **Working-set docs are now first-class**[docs/WORKING_SETS.md](docs/WORKING_SETS.md), [ARCHITECTURE.md](ARCHITECTURE.md), [docs/GUIDE.md](docs/GUIDE.md), and [docs/CLI_GUIDE.md](docs/CLI_GUIDE.md) now document the pinned-coordinate model, the non-authoritative cache boundary, and the CLI/API contract together.
16+
- **Working sets can now diverge through overlay patch logs**`WarpGraph` now exposes `createWorkingSetPatch()` and `patchWorkingSet()` so a working set can continue from its pinned base observation through a separate overlay ref, while live writer refs stay untouched.
17+
- **Working-set materialization now replays base plus overlay**`materializeWorkingSet()` and `getWorkingSet()` now reflect the current overlay patch-log head and replay the full working-set view instead of treating overlays as empty identity only.
18+
- **The working-set architecture stays hex-clean**overlay writes reuse the existing patch builder and mutation kernel rather than introducing a second ad hoc working-set mutation engine.
19+
- **Docs now describe the real substrate boundary**[docs/WORKING_SETS.md](docs/WORKING_SETS.md), [ARCHITECTURE.md](ARCHITECTURE.md), [docs/GUIDE.md](docs/GUIDE.md), and [docs/CLI_GUIDE.md](docs/CLI_GUIDE.md) now explain the split between descriptor lifecycle in the CLI and overlay writes in the library API.
2020

2121
See the [full changelog](CHANGELOG.md) for complete release details.
2222

@@ -72,7 +72,7 @@ If you are new to git-warp, start with the **[Guide](docs/GUIDE.md)**. For deepe
7272
- **[Architecture](ARCHITECTURE.md)**: Deep dive into the hexagonal "Ports and Adapters" design.
7373
- **[CLI Guide](docs/CLI_GUIDE.md)**: Command-by-command reference with examples, flags, and output formats.
7474
- **[Time Travel Debugger](docs/TTD.md)**: Architecture and scope of the thin debugger CLI surface.
75-
- **[Working Sets](docs/WORKING_SETS.md)**: Pinned observation coordinates, empty-overlay v1 semantics, and the working-set API/CLI surface.
75+
- **[Working Sets](docs/WORKING_SETS.md)**: Pinned observation coordinates, overlay patch-log semantics, and the working-set API/CLI surface.
7676
- **[Protocol Specs](docs/specs/)**: Binary formats for Audit Receipts, Content Attachments, and BTRs.
7777
- **[ADR Registry](adr/)**: Architectural Decision Records (e.g., edge-property internal canonicalization).
7878
- **[Cookbook](examples/)**: Functional examples of Event Sourcing, Pathfinding, and Multi-Writer setups.

docs/CLI_GUIDE.md

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ The `working-set` family creates and manages durable descriptors for explicit ob
707707
- the current frontier snapshot
708708
- an optional Lamport ceiling
709709
- optional owner/scope/lease metadata
710-
- an empty overlay identity for future evolution
710+
- an overlay identity and patch-log ref for future divergent writes
711711

712712
This is **not** part of the read-only Time Travel Debugger family. `working-set` creates durable descriptor refs, while TTD only inspects substrate facts.
713713

@@ -752,19 +752,19 @@ git warp working-set show --repo ./team-repo review-auth
752752
git warp working-set show --repo ./team-repo review-auth --json
753753
```
754754

755-
Use this to inspect the pinned frontier, Lamport ceiling, metadata, and overlay identity without materializing state.
755+
Use this to inspect the pinned frontier, Lamport ceiling, metadata, and current overlay patch-log head without materializing state.
756756

757757
### `working-set materialize <id>` — Replay the pinned coordinate
758758

759759
```bash
760-
# Materialize the pinned base observation
760+
# Materialize the pinned coordinate
761761
git warp working-set materialize --repo ./team-repo review-auth
762762

763763
# Include reducer receipts
764764
git warp working-set materialize --repo ./team-repo review-auth --receipts --json
765765
```
766766

767-
This always replays the pinned coordinate, even if the live frontier has advanced since the descriptor was created.
767+
This always replays the pinned coordinate plus any overlay patches already committed through the library API, even if the live frontier has advanced since the descriptor was created.
768768

769769
| Flag | Type | Default | Description |
770770
|------|------|---------|-------------|
@@ -778,6 +778,22 @@ git warp working-set drop --repo ./team-repo review-auth
778778

779779
This removes the descriptor ref. It does not mutate patch history.
780780

781+
### Overlay writes stay in the library API
782+
783+
The CLI deliberately does **not** grow a second patch DSL for working-set overlay writes.
784+
785+
```javascript
786+
const builder = await graph.createWorkingSetPatch('review-auth');
787+
builder.setProperty('task:oauth', 'status', 'needs-review');
788+
await builder.commit();
789+
790+
await graph.patchWorkingSet('review-auth', (p) => {
791+
p.setProperty('task:oauth', 'owner', 'alice');
792+
});
793+
```
794+
795+
That keeps the CLI thin and keeps overlay writes on the same mutation kernel as normal graph patches.
796+
781797
### Complete flag reference for `working-set`
782798

783799
| Subcommand | Flags |

docs/GUIDE.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,13 +1171,13 @@ git warp seek --no-persistent-cache --tick 5
11711171
11721172
### Working Sets
11731173
1174-
Working sets pin an explicit observation coordinate for later reuse without creating a Git worktree. In v1, a working set records:
1174+
Working sets pin an explicit observation coordinate for later reuse without creating a Git worktree. A working set records:
11751175
11761176
- the graph name
11771177
- a pinned frontier snapshot
11781178
- an optional Lamport ceiling
11791179
- optional owner/scope/lease metadata
1180-
- an empty overlay identity for future evolution
1180+
- an overlay identity and patch-log ref for future divergent writes
11811181
11821182
Materialized state remains derived/cache only. The descriptor is the durable part.
11831183
@@ -1208,6 +1208,10 @@ const workingSet = await graph.createWorkingSet({
12081208
});
12091209

12101210
const state = await graph.materializeWorkingSet(workingSet.workingSetId);
1211+
1212+
await graph.patchWorkingSet(workingSet.workingSetId, (p) => {
1213+
p.setProperty('task:oauth', 'status', 'needs-review');
1214+
});
12111215
```
12121216
12131217
Use [docs/WORKING_SETS.md](WORKING_SETS.md) for the dedicated working-set model and [docs/CLI_GUIDE.md](CLI_GUIDE.md) for the full CLI flags.

docs/TTD.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,5 +166,5 @@ Likely future TTD-adjacent extensions:
166166
- additional debug topics once their substrate facts are stable
167167
- entity-local slice inspection at historical coordinates once substrate support exists
168168
- richer provenance drilldown over conflict anchors
169-
- overlay-aware working-set/worldline coordinates once overlay writes exist
169+
- overlay-aware working-set/worldline debugger views over the new overlay patch-log substrate
170170
- higher-level debugger panels in XYPH, not in git-warp

docs/WORKING_SETS.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Working Sets
22

3-
**Status:** v1 foundation active.
3+
**Status:** v1 substrate active.
44

55
Working sets give git-warp a durable way to pin explicit observation coordinates without assuming a Git worktree, a browser UI, or higher-level XYPH semantics.
66

@@ -13,23 +13,23 @@ A working set is a durable descriptor that records:
1313
- pinned frontier snapshot
1414
- optional Lamport ceiling
1515
- optional owner/scope/lease metadata
16-
- overlay identity for future evolution
16+
- overlay identity plus a patch-log ref for divergent writes
1717

18-
In v1, the overlay exists only as identity:
18+
A newly created working set still starts with an empty overlay:
1919

2020
- `overlay.kind = patch-log`
2121
- `overlay.headPatchSha = null`
2222
- `overlay.patchCount = 0`
2323

24-
That means a newly created working set reads exactly like its base observation.
24+
That means a newly created working set reads exactly like its base observation until an overlay patch is committed.
2525

2626
## Truth Boundary
2727

2828
The authoritative pieces are:
2929

3030
- the working-set descriptor
3131
- the pinned base observation coordinate
32-
- the future overlay identity
32+
- the overlay patch-log ref and its patch chain
3333

3434
Materialized state is **derived only**:
3535

@@ -67,6 +67,15 @@ const ws = await graph.createWorkingSet({
6767
const descriptor = await graph.getWorkingSet('review-auth');
6868
const all = await graph.listWorkingSets();
6969
const state = await graph.materializeWorkingSet('review-auth');
70+
71+
await graph.patchWorkingSet('review-auth', (p) => {
72+
p.setProperty('task:oauth', 'status', 'needs-review');
73+
});
74+
75+
const builder = await graph.createWorkingSetPatch('review-auth');
76+
builder.setProperty('task:oauth', 'owner', 'alice');
77+
await builder.commit();
78+
7079
await graph.dropWorkingSet('review-auth');
7180
```
7281

@@ -91,22 +100,23 @@ git warp working-set materialize review-auth --receipts
91100
git warp working-set drop review-auth
92101
```
93102

103+
The CLI manages descriptor lifecycle and replay. Overlay writes are available through the library API, not through a separate working-set patch DSL in the CLI.
104+
94105
`working-set` is intentionally a top-level family rather than a `debug` subcommand because it creates durable descriptor refs.
95106

96107
## Relationship to TTD
97108

98109
The Time Travel Debugger stays read-only:
99110

100111
- `seek` and `debug ...` inspect substrate facts
101-
- `working-set ...` pins reusable coordinates
112+
- `working-set ...` manages durable coordinates and overlay patch logs
102113

103-
That boundary keeps the debugger from turning into a mutation channel.
114+
That boundary keeps the debugger from turning into a mutation channel while still letting higher layers build real fork/worldline behavior on top of working sets.
104115

105116
## Deferred from v1
106117

107-
Not part of this foundation slice:
118+
Deferred from this slice:
108119

109-
- overlay writes
110120
- collapse/merge semantics
111121
- worldline governance
112122
- arbitrary higher-level meaning

index.d.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2055,8 +2055,8 @@ export default class WarpGraph {
20552055
* Creates a durable working-set descriptor pinned to the current frontier
20562056
* plus an optional Lamport ceiling.
20572057
*
2058-
* Working sets do not duplicate the graph. In v1 they record a pinned base
2059-
* observation plus empty overlay identity for future divergent writes.
2058+
* Working sets do not duplicate the graph. They record a pinned base
2059+
* observation plus overlay identity for future divergent writes.
20602060
*/
20612061
createWorkingSet(options?: WorkingSetCreateOptions): Promise<WorkingSetDescriptor>;
20622062

@@ -2071,13 +2071,16 @@ export default class WarpGraph {
20712071

20722072
/**
20732073
* Materializes a working set's pinned base observation plus overlay.
2074-
*
2075-
* In v1 the overlay remains empty, so this replays only the pinned base
2076-
* coordinate.
20772074
*/
20782075
materializeWorkingSet(workingSetId: string, options: { receipts: true }): Promise<{ state: WarpStateV5; receipts: TickReceipt[] }>;
20792076
materializeWorkingSet(workingSetId: string, options?: { receipts?: false }): Promise<WarpStateV5>;
20802077

2078+
/** Creates a patch builder that writes into a working set's overlay patch-log. */
2079+
createWorkingSetPatch(workingSetId: string): Promise<PatchBuilderV2>;
2080+
2081+
/** Convenience wrapper that creates and commits a working-set overlay patch. */
2082+
patchWorkingSet(workingSetId: string, build: (p: PatchBuilderV2) => void | Promise<void>): Promise<string>;
2083+
20812084
/**
20822085
* The provenance index mapping entities to contributing patches.
20832086
* Available after materialize() has been called.

jsr.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@git-stunts/git-warp",
3-
"version": "14.5.0",
3+
"version": "14.6.0",
44
"imports": {
55
"roaring": "npm:roaring@^2.7.0"
66
},

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)