Repository navigation
app: workstream store (schema 3, factory_job refs, all 25 methods served) - #2270
Merged
Merged
Conversation
…kind The collections database moves to schema 3. The first write rebuilds a schema 1 or 2 file by copying its tables (SQLite cannot change a CHECK in place), keeping every collection and membership under the same sequence numbers and times, and adds the workstream tables: rows keyed by the collection id, pages and their versions, records, go-aheads, the plan, and a job claim table whose unique index keeps a Factory job in at most one workstream. factory_job joins the ref kinds in the SQLite CHECK, the workspace model and the wire validator, with its factory id on the ref. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Stage, numbers, plan, pages with versions, records and go-aheads, written over the collections store's transactions. Every rule the Workstreams plan (WP-1) gives the store lives here behind plain Go types, so the wire never reaches into the tables. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every workstream.*, page.*, record.* and goahead.* method now answers from the store, behind bounds checks at the wire's one door, and hello announces workstreams. Create makes the collection, the row, an Overview page and one bare agent (no first turn), and a repeated client id returns the first. Every write sends workstream.changed. Stage and numbers come from bounded Factory queue reads and the agent's recorded spend; anything unknown is left out rather than sent as zero. Collections mark workstreams, refuse to delete one, and refuse a job another workstream holds with in_other_workstream. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The guard laws want every lock released by a defer and every goroutine guarded; the workstream Factory cache and batch reads now are. Update, mark done and reopen answer with the same live numbers as get, and workstream text refuses control characters (prose keeps newline and tab). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The engine keeps one page renderer: page.get's markdown now comes from pagedoc.Markdown, which matches the desktop app's renderer byte for byte, and the store's own renderer is gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AbirAbbas
force-pushed
the
workstreams/wp1-store
branch
from
November 3, 2026 03:15
9245a68 to
5d2d994
Compare
…the first start A queue read that panics inside its guard now closes its flight and caches the failure, so waiters are released and a later read tries again. Update, mark done and reopen persist the first observed start like get does and announce one workstream.changed for the whole change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The workstream store from the Workstreams plan, WP-1, built on the v0 wire contract that #2263 registered.
workstreams,workstream_jobs(its unique index keeps a Factory job in one workstream),workstream_pages,workstream_page_versions,workstream_records,workstream_goaheads,workstream_plans.factory_jobref kind in the SQLite CHECK,workspace.Ref.Validateandappwire.CheckRef, withfactoryon the ref. The CLI takes--factory.internal/workstream/: stage, numbers, plan, pages with versions, records and go-aheads.page.get's markdown comes frominternal/workstream/pagedoc(app: workstream pages render from editor JSON to markdown (pagedoc) #2277), the one page renderer in the engine.ServesWorkstreams()is true, so hello announcesworkstreams. Every write sendsworkstream.changed.client_idreturns the first workstream.workstream: trueon listings; deleting a workstream is refused (mark a workstream done instead); a job another workstream holds is refused within_other_workstream.Validation contract
internal/workspace/schema3_test.goin_other_workstream, nothing changesinternal/workspace/workstreams_test.go,cmd/codeaf/appworkstreams_test.gointernal/workstream/store_test.go,cmd/codeaf/appworkstreams_test.gointernal/workstream/store_test.go,cmd/codeaf/appworkstreams_test.gointernal/workstream/records_goaheads_test.go,cmd/codeaf/appworkstreams_test.goversion_conflict, nothing changes; history/restore add a versioninternal/workstream/pages_test.go,cmd/codeaf/appworkstreams_test.gointernal/workstream/records_goaheads_test.go,cmd/codeaf/appworkstreams_test.gointernal/workstream/records_goaheads_test.go,internal/appwire/workstreams_check_test.go,cmd/codeaf/appworkstreams_test.goworkstream.changedcmd/codeaf/appworkstreams_test.gointernal/workstream/store_test.go,cmd/codeaf/appworkstreams_test.goStubbed or left
spent_usdstays absent, and go-aheads and wave auto-start are stored but not enforced. Both wait on the Factory side (plan §3.3 asks 4 and 3).workstreamAgentAsk.CI
internal/session,TestAppChatRowsR2SavedTurnTime,TestAppChatStartupR3QuietReleaseandTestRecipeDoorWritesTheWorktreeWhenOnlyTheCheckoutIsHeld.TestAppIdleReleaseI1I2*flaked once and passed on rerun.TestAProposedTaskCarriesTheMessageItWasMadeFromAndKeepsItAcrossAReopen,TestARequestOlderThanTheRunningTurnWaitsForIt,TestSilentRouterCanRecoverOnTheNextRoutingCompletion, and two temp-dir cleanup races in Factory tests (TestAppFactoryJobWithoutIssueHasAnHonestReference,TestFactoryStopAnyVersion).Contract changes
None. The
factoryref field,workstream: trueandin_other_workstreamare the additive collection behaviour the v0 contract already describes.🤖 Generated with Claude Code