Skip to content

feat(workspace): work in progress under refs/chant/wip/<branch>, replicated under a box's replicate policy - #3408

Merged
lex00 merged 7 commits into
mainfrom
ws-3172-wip-refs
Oct 4, 2026
Merged

lex00 merged 7 commits into
mainfrom
ws-3172-wip-refs

Conversation

@lex00

@lex00 lex00 commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Work in progress on a box (uncommitted records, work branches under chant/work/, kept attempts under refs/chant/kept/) lived only on the box's disk until someone committed and pushed. This gives chant one ref namespace for it and a replication policy in the spec, as lex00 decided (E4): refs/chant/wip/, owned by chant, which hud's turn checkpoints (hud#137) and studio's checkpoints and push-work-off-the-box (studio#53, studio#289) use instead of refs/hud/checkpoints and refs/chaff/checkpoints.

The ref layout. refs/chant/wip/ is a chain of snapshot commits. Each snapshot's tree is the whole working tree (staged, unstaged and untracked; ignored files left out), written through a temporary index so the checkout's index, HEAD and branch never move. Its first parent is the previous snapshot and its last parent is HEAD, so pushing the ref carries the branch's commits. Chant-Wip-Branch, -Head, -Kind (save or pre-restore), -Label and -By trailers carry the metadata. The branch already separates worktrees and tabs, so there is no identity path segment; who took a snapshot is a trailer. What reached a remote is recorded under refs/chant/replica//, so reads report replication without fetching.

The policy. A box block takes replicate { remote, refs, on, every }: the git remote by name (origin by default; the host adds a mirror with its credential, since a box holds none), which refs go (work, kept, wip, ledger; all by default), when chant pushes on its own (after wip save, after a work lease release; both by default), and an interval for the host's own scheduler. At most one box block declares it. Pushes are per ref under the same name, never forced, with no pre-push hook and no prompt. A record write never pushes, because chant's record writes never run git (ws-074).

Commands. chant workspace wip [--branch] --json lists snapshots and replication state (new read-contract document wip.schema.json, added to READ_CONTRACT_COMMANDS). wip save [--label] [--by], wip restore [] [--by], wip push and wip fetch print wip-write.schema.json. restore takes a pre-restore snapshot first, so a restore is undoable, and resets the index to HEAD so everything restored reads as uncommitted. status --json prints the policy under each member's box and a top-level replication with replicated and ahead per ref. work release and an executor's lease release push when the policy says so. Seven new reason codes (wip-*). The writer conformance script gains wip save and wip restore steps, with readWip for facts and read-back.

Decision record ws-085 records the namespace and policy. Docs: a new cli/workspace-wip page, the declaration's Replicate section, the read contract, writer conformance, the status page and the boundary roster.

Shared files touched: declaration.ts and declaration.schema.json (box.replicate), status.ts and status.schema.json, reason-codes.ts, cli/main.ts and registry.ts, conformance/index.ts and writer.ts, op/work-lease-run.ts and work-cli.ts (push on release), docs/data/boundary.yaml and boundary.mdx, decisions README, the prose-lint baseline.

Verified with core tsc, targeted unit tests (wip.test.ts covers a box destroyed mid-work: a fresh clone runs wip fetch, checks out the work branch and wip restore brings back the uncommitted record, the edited file and the kept attempt), the boundary roster, reason-code and CLI parse tests, the docs prose lint and docs-check. The unit suite and the conformance e2e run in CI.

Closes #3172

@lex00 lex00 added design Design or research note, no deliverable yet area:workspace chant workspace epic (#2525) boundaries Epic: boundaries between chant, hud, studio, behold and fountain labels Oct 3, 2026
@lex00
lex00 merged commit 96d87f2 into main Oct 4, 2026
12 checks passed
@lex00
lex00 deleted the ws-3172-wip-refs branch October 4, 2026 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:workspace chant workspace epic (#2525) boundaries Epic: boundaries between chant, hud, studio, behold and fountain design Design or research note, no deliverable yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

workspace: work in progress survives the box: replicate work branches, kept attempts and uncommitted records

1 participant