Experimental AT protocol email hosting
sovrn WORKSPACE.md
5.1 kB 118 lines
Markdown
at main

Working on several features at once #

Each feature gets its own jj workspace: a sibling checkout (../sovrn-NAME) with its own data/dev and its own dev stack (Stalwart, VersityGW, vlpds, sovrnd). The stacks run side by side because each workspace has a port slot (1-9, picked for you; the default workspace is 0). Every dev port is its usual value + 100 × slot, so slot 1 has Stalwart on :8180, vlpds on :3100 and sovrnd on :8181. The slot lives in the workspace's gitignored devenv.local.nix, and the shell exports it as $DEVKIT_WORKSPACE_SLOT. Workspaces are made and removed with devkit's workspace command, the same in every project.

All workspaces share one repo: a commit made in one is visible in every other straight away.

Set up #

From the default workspace:

workspace add feat-x             # ../sovrn-feat-x on the lowest free slot
cd ../sovrn-feat-x
devenv shell                     # sets SOVRN_DEV_*_PORT for its slot
just dev                         # prints e.g.: sovrnd (slot 1): http://127.0.0.1:8181
claude                           # in another `devenv shell` in the same dir

Always start claude (and go test) inside devenv shell. Outside it, the integration tests fall back to slot 0's ports and hit the default workspace's Stalwart.

Forgot which workspace is where? just workspaces lists each one with its slot, its sovrnd URL and whether its stack is up. just dev refuses to start if another workspace has the same slot (only possible by editing devenv.local.nix by hand), or if this one has none (workspace add --no-slot, for a checkout that runs no stack).

workspace add also links the new workspace's Claude memory to the default workspace's, so every Claude shares your saved rules.

bug works from any workspace: it finds the issues in the default workspace's repository. workspace add creates the workspace with jj workspace add --no-colocate, because a git worktree would enable extensions.relativeWorktrees in the shared .git/config, and bug can't open a repository with that extension. So the feature workspace has no .git; use jj there, not git.

The new workspace starts from the parent of the default workspace's current change. To start from main instead: workspace add feat-x --from main.

Work #

As usual, in the feature workspace:

jj commit -m "feat(...): ..."    # repeat; @ is left as an empty change on top
just review                      # local code review for this workspace (Ctrl-C stops)

If another workspace rewrites a commit this one sits on, jj reports the working copy as stale. Fix: jj workspace update-stale.

Merge #

From the default workspace. feat-x@ means feat-x's working-copy commit, so feat-x@- is its last real commit.

jj log -r 'main..feat-x@'                  # what is about to land
jj rebase -b feat-x@ -d main               # put the feature on top of main
just test                                  # or `just integration` with the stack up
jj bookmark set main -r feat-x@-           # move main to the feature's last commit
jj git push -b main

Then bring any other in-flight workspaces up to date: jj rebase -b other@ -d main.

Tear down #

From the default workspace, once the feature is merged:

workspace remove feat-x

It refuses while feat-x has work nothing else holds: uncommitted edits, or commits that no bookmark (such as main after the merge above) or other workspace reaches. Otherwise it stops the workspace's stack (Stalwart, VersityGW, vlpds), forgets it in jj and deletes ../sovrn-feat-x with its data/dev. To throw a feature away instead: workspace remove feat-x --abandon.

Optionally also remove Claude's per-directory folder (transcripts plus the memory link): rm -rf ~/.claude/projects/-home-btburke-projects-sovrn-feat-x.

The slot is free again once the directory is gone.

airlock alongside sovrn (go.work) #

sovrn's spaces (the edge's inbound spaces, shared folders, views) are served by airlock (tangled.org/rtw.run/airlock), developed in its own repo. With a checkout at ../airlock, the devenv shell writes a gitignored go.work (use . ../airlock), so sovrn builds against your airlock working copy and a change there is visible here at once. Every jj workspace gets one too, since ../sovrn-NAME/../airlock is the same checkout. go test tangled.org/rtw.run/airlock/... runs airlock's tests from here.

In workspace mode Go picks one version of each dependency for both modules, so sovrn builds with airlock's indigo when it's newer.

Until airlock is published, sovrn can import it without a require line, but go mod tidy (which ignores go.work) can't fetch it. Once it's pushed: require tangled.org/rtw.run/airlock <version> in go.mod, go 1.27, and the nix build (nix/pkgs/go-commands.nix) on buildGo127Module with a new vendorHash; the nix build never sees go.work. To build against the published module locally, delete go.work (and move ../airlock aside, or the next shell recreates it).