Repository navigation
factory: an organization's workstreams live on its server - #2624
Merged
Merged
Conversation
santoshkumarradha
force-pushed
the
teams/g2-server-workstreams
branch
from
November 13, 2026 15:52
73f075c to
ac0631b
Compare
Every /v1/workstreams* route of the Teams wave contract: a durable store beside the go-ahead policies, visibility and write rules, rev + If-Match (412 when stale), soft delete with an operator-only purge, owner change, shares with include_linked and its preview, one-shot import of a Personal workstream, workstream.changed / workstream.removed events filtered to the people who could see the workstream, and go-ahead approval on an org workstream now needs write access to it. Team membership is read through serve.TeamMembership (TeamsOf, Members, optional HasTeam), which the teams lane fills; store.TeamOwnsWorkstream answers whether a team owns any workstream. Assisted-by: CodeAF Co-Authored-By: CodeAF <[email protected]>
santoshkumarradha
force-pushed
the
teams/g2-server-workstreams
branch
from
November 13, 2026 16:00
ac0631b to
308ab50
Compare
ZeroPoint95
pushed a commit
that referenced
this pull request
Nov 24, 2026
Every /v1/workstreams* route of the Teams wave contract: a durable store beside the go-ahead policies, visibility and write rules, rev + If-Match (412 when stale), soft delete with an operator-only purge, owner change, shares with include_linked and its preview, one-shot import of a Personal workstream, workstream.changed / workstream.removed events filtered to the people who could see the workstream, and go-ahead approval on an org workstream now needs write access to it. Team membership is read through serve.TeamMembership (TeamsOf, Members, optional HasTeam), which the teams lane fills; store.TeamOwnsWorkstream answers whether a team owns any workstream. Assisted-by: CodeAF Co-Authored-By: CodeAF <[email protected]>
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.
Teams wave, lane G2: an organization's workstreams live on its server (
codeaf factory serve).What lands
Every
/v1/workstreams*route in the wave SPEC (~/work/teams-wave/SPEC.md):factory-workstreams.jsonbeside the go-ahead policies, written under a cross-process lock with an atomic replace, the same wayfactory-policies.jsonis (store/workstreams.go). OneEditWorkstreamssave can change several workstreams, soinclude_linkedlands whole or not at all. Only the ids an edit names get theirrevcounted up.PATCHneedsIf-Match: <rev>: 428 without it, 412 when it is stale. A sent array replaces the stored one. Page bylines (updated_at/updated_by) are stamped by the server, only on pages whose words changed.DELETEsetsarchived_at. Archived workstreams leave the list (?archived=1brings them back) and refuse PATCH with 409.?purge=1is operator-only.PUT: a person handle or a known team. A share with the owning team is dropped.PUTreplaces the team list.include_linkedadds the same teams to each linked workstream the caller may govern; it never removes a share there.also_sharednames the linked workstreams that were changed. The preview (GET …/shares/preview?teams=) answers exactly that set and writes nothing.from_local_idagain by the same person returns the existing copy with 200, not a second copy.workstream.changed/workstream.removedgo into the live record with{"kind","id"}on the stream. They are filtered to anyone who could see the workstream before or after the change, so a team just taken off a share still learns to drop its row.PUT /v1/policyon aws_…group that is an org workstream needs write access to it. Every other group keeps the old rule.Workstream.go_aheadsholds the allowances of the policy stored for that id.needs_you/merged/totalcount the jobs whosePolicyGroupis the workstream id.The shape types (owner, page, decision, source) are defined once in
internal/factory/workstream.go, andapialiases them.Wired to G1 (#2622, merged first)
h.Membership(), G1'sTeamMembership. A team id is valid only if it is in G1's team store; an unknown one answers 422.Newcallsh.SetTeamOwnership(config.Store).store.TeamOwnsWorkstreamcounts archived workstreams too, soDELETE /v1/teams/{id}now answers 409 while that team owns a workstream (tested end to end).liveForViewerkeeps G1'steam.changedcase and adds the workstream case.Proof
internal/factory/serve/workstreams_test.goruns against the desk's org scene (santosh, abir, mia; Platform, Growth, Design; the four fixture workstreams) with the teams written through G1's store. It covers visibility per person and for the operator, rev/412/428 and array replace, owner and share rights, include_linked with its preview, archive then purge, one-shot import, event audience, and go-ahead write access.internal/factory/store/workstreams_test.gocovers the store.make pr-ready BASE=origin/work/teamspassed after the rebase onto factory: teams on the organization server (G1) #2622. TwoTestFactorySetup*tests that this change does not touch were flagged flaky and passed on rerun.