Skip to content

factory: an organization's members make jobs on its repositories without GitHub (film D10) - #2660

Merged
santoshkumarradha merged 2 commits into
work/teamsfrom
d10/org-repos
Nov 16, 2026
Merged

santoshkumarradha merged 2 commits into
work/teamsfrom
d10/org-repos

Conversation

@santoshkumarradha

@santoshkumarradha santoshkumarradha commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Fixes film D10: an organization whose people sign in only with a password or passkey can now make a Factory job. Desk half: Agent-Field/codeaf-desk#462.

What was true, and what is true now

  • Before: repoAccess filtered a signed-in person's repositories through their own GitHub token, and a profile with no token saw nothing. The server's own grant (factorygithub.ReadTokenAt, GH_TOKEN) fed only its poll. Add job had no repositories to offer, and Create job stayed disabled.
  • Now: the repositories the operator turns on in Repos (the server's watched list) are the organization's. Every signed-in member reads them, with or without GitHub. A member's own token is still asked exactly as before, and the organization's list only adds to what it reads (internal/factory/serve/org_repos.go, visibility.go repoSight).
  • The operator also reads the server grant's last discovery (available-repos.json). That lets a password operator see and turn repositories on in Repos. Turning a repository on or off stays operator-only (unchanged: requireOperator in repos_v2.go).
  • Creating a job needs edit on a workstream. POST /v1/jobs and factory.job_create take workstream. The caller must be able to edit it: 403 if they can't, 404 if they can't see it, 409 if it is archived. The job joins the workstream in the same request through the shared joinWorkstreamJob, which PUT /v1/workstreams/{id}/jobs/{job} now also uses. A job on a repository the caller reads only through the organization is refused 403 without a workstream: "Make this job in a workstream you can edit: this repository is the organization's." So a view-only member sees jobs but cannot create them. The operator, and anyone whose own token reads the repo, are never asked for a workstream.
  • The join gate is unchanged. A GitHub stranger joining through a link (the trial session in device.go) is still judged by their own token only. The organization's repositories never admit anyone.
  • Manual: internal/manual/chat/factory.md gains "make a job without a GitHub account …". Its "people, each signed in with their own GitHub" now says password, passkey or GitHub. Two new probes added.
  • docs/design/app-v3/PROTOCOL.md documents factory.job_create {workstream}. ~/work/teams-wave/WAVE2.md §4.7 was edited in place; that file is outside the repo.
  • Change entry: docs/changes/unreleased/2660-org-repositories-for-every-member.md.

Security note

What a password member can now reach. Every repository the operator turned on in Repos, read through the server. That covers its place in the job picker, its jobs, their steps, briefs, activity, and the pull requests the factory opened. Workstream sight still applies on top: a job in a workstream you cannot view stays a 404.

What it does not give. A member gets no GitHub credential, no write to GitHub as anyone, and no repository the operator did not turn on. Repositories the server's grant can reach but nobody turned on stay operator-only. A member can make a job on an org repository only inside a workstream they can edit. GitHub members lose nothing and their own-token checks are unchanged.

Why this is the admin's explicit choice. A repository becomes the organization's only when the operator turns it on in Repos. That is the same operator-only, audited act (repos.changed … as operator in the record) that already makes the server poll and run it. Turning it off removes it for every member at once.

Changed by design: a GitHub member whose own token cannot read a repository that is turned on now sees it. Two older tests pinned the opposite and were updated to the new rule: TestQueueListsVisibleWatchedRepositoriesWithoutJobs and TestRepositoryIdentityContractAndViewerFiltering. TestPersonOwnsWatchedRepositoryWithNoJobs now watches only the repository it reads.

Tests

New tests in internal/factory/serve/org_repos_test.go, on a password-only org with real token files and sign-ups:

  • TestAPasswordMemberMakesAJobOnAnOrganizationRepository: abir (edit, no GitHub) is offered acme/api once it is on and creates a job in the workstream. The job is in the workstream, kim (view) reads it, and acme/web (off) is still refused.
  • TestAViewOnlyMemberCannotMakeAJobOnAnOrganizationRepository: kim gets 403 inside the workstream and 403 outside it, abir without a workstream gets 403, and no job is left behind. The operator succeeds.
  • TestOnlyTheOperatorTurnsAnOrganizationRepositoryOn: the password operator sees the grant's list. abir gets 403 on both turn-on doors and on turn-off, and sees nothing until a repo is on.
  • TestAPersonsOwnTokenStillFiltersAndTheOrganizationOnlyAdds: mia's GitHub token is still asked per repository. mia reads her own repo and the org's, never acme/secret, and still creates without a workstream on a repo her token reads.
  • internal/appwire: TestFactoryJobCreateTakesAWorkstreamID.

Gate: BASE=$(git rev-parse origin/work/teams) make pr-ready is green on base 3dc626ece. The touched legs were cmd/codeaf (8 shards), appwire, factory/api, factory/serve and manual. The known base reds were not hit.

santoshkumarradha and others added 2 commits November 16, 2026 09:41
…out GitHub (film D10)

A person who signed in to an organization with a password or a passkey read
no repository at all, because a signed-in person's repositories were only
what their own GitHub token reached, so Add job had nothing to offer and
Create job stayed off. The server's own GitHub grant fed only its poll.

The repositories the operator turns on in Repos are now the organization's:
every signed-in member reads them, beside whatever their own token reads,
which is asked exactly as before. The operator also reads what the server's
grant last discovered, so a password operator can choose from it in Repos.
Only the operator turns one on or off, as before. A link's join check still
judges a GitHub stranger by their own token alone.

POST /v1/jobs (factory.job_create) takes workstream: the caller must be able
to edit it, and the job joins it in the same request. A job on a repository
the caller reads only through the organization must name one, so a view-only
member reads jobs and makes none. The manual says how to make a job without
a GitHub account and who turns repositories on.

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>
@santoshkumarradha
santoshkumarradha merged commit bb08a7c into work/teams Nov 16, 2026
1 check passed
@santoshkumarradha
santoshkumarradha deleted the d10/org-repos branch November 16, 2026 14:51
ZeroPoint95 pushed a commit that referenced this pull request Nov 24, 2026
…out GitHub (film D10) (#2660)

* factory: an organization's members make jobs on its repositories without GitHub (film D10)

A person who signed in to an organization with a password or a passkey read
no repository at all, because a signed-in person's repositories were only
what their own GitHub token reached, so Add job had nothing to offer and
Create job stayed off. The server's own GitHub grant fed only its poll.

The repositories the operator turns on in Repos are now the organization's:
every signed-in member reads them, beside whatever their own token reads,
which is asked exactly as before. The operator also reads what the server's
grant last discovered, so a password operator can choose from it in Repos.
Only the operator turns one on or off, as before. A link's join check still
judges a GitHub stranger by their own token alone.

POST /v1/jobs (factory.job_create) takes workstream: the caller must be able
to edit it, and the job joins it in the same request. A job on a repository
the caller reads only through the organization must name one, so a view-only
member reads jobs and makes none. The manual says how to make a job without
a GitHub account and who turns repositories on.

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>

* docs: the change entry for the organization's repositories (film D10)

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>

---------

Co-authored-by: CodeAF <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant