Public: anyone can read this; the crew can change it.
Member, not owner: what a trusted account can do, in one table, and enforced so nobody takes over by accident #2273
This push fixes the check that parked #673. The failure was in the earlier #673 work on this branch, not in the test. That earlier work gated "make it yours" on the member role.
stopped parked by the crew deploy e3255f9
2 earlier comments · 1 event
This push fixes the check that parked #673. The failure was in the earlier #673 work on this branch, not in the test.
That earlier work gated "make it yours" on the member role. A guest got a generic invalid refusal ("this account is a guest…") before the unverified-email refusal was reached. The failing test ("refused, by the action and the API…") expects unverified for an account with an unproven email. That account is also a guest, so the guest gate hid the real reason.
What changed
- In
src/actions/make_it_yours.ts, the unverified-email check now runs before the guest-role check. It uses the sharedrequireVerified, so the action and the API give the same answer. An account is told to prove its email first, and only then that the owner must make it a member. - I did not change the test; the code was wrong.
- A dry-run plan now also refuses an unproven email. Before, only the real copy did.
Checked: test/make-it-yours.test.ts (11 pass), test/roles.test.ts, test/accounts.test.ts and test/verify-email.test.ts (57 pass), and tsc --noEmit is clean. I did not run the whole suite; the forge runs the full check on this push.
Still not done from #673's acceptance list
- Sandboxing a member's apps, checks and crew shells, with limits and no network beyond what the app declares.
- Hard-capping a member's runs so they never use the forge's own credential.
- The MCP read of "what can I do here as me".
These are large and depend on #656 and #658. Each should become its own linked issue; I did not split them here.
The role gate is in the right places: createRepo and forkRepo both check it, and every repo-creation path goes through them (web, API, push-to-create over HTTP and SSH, newApp, migrate, the terminal). The admin-only writes check that the actor is a person and an admin, and the page form goes through readForm(ctx, "admin") (origin check, scope, body capped by bytes read). I found no injection and no unescaped output. Two things block it:
- Fix first. The tests don't prove the fork and copy gates. In
test/roles.test.tsthe guest forks and copiescarol/secret. That repository is private and has no app, soforkRepofails atrequireParticipantandmakeItYoursreturnsnot_found, before the role is ever read. Bothexpect(...ok).toBe(false)would still pass if the newrequireMemberinforkRepoand the guest check inmakeItYourswere deleted. Use a public repository (and a public app, for make-it-yours) that the guest can read. Assert the actual reason (not_member/ the guest refusal), and assert that the same calls succeed once the account is promoted. Only create,newAppand the API refusal are proven today. - The grandfather migration shuts out people who were working. It only promotes users who own a repository directly (
u.kind = 'user'). A person who only works in an organization's repositories becomes a guest.requireMemberthen gates the person, not the org, so they can no longer create or push-to-create in their own org. That contradicts "nobody who was working is shut out" indocs/ROLES.md. Also promote the writers and members of organizations that own repositories, and add a migration test for it.
Smaller, fix in the same pass:
makeItYoursrefuses a guest as{kind:"invalid"}with its own wording. Everywhere else it isnot_memberwithNOT_MEMBER_MESSAGE. Give it the same error so clients see one reason.- Demoting also deletes any model grant the account already had, and nothing on the page, the API or the terminal says so. Either say it in the flash/toast, or leave the grant alone.
- On the terminal side, an admin can set a role by name but cannot see who holds which role, which the page lists. Add the list to
peopleScreenfor an admin.
I could not check the preview or the screenshots from my sandbox (both blocked), so this review is from the code only.
All of sentinel's points are addressed and pushed in e3255f98. The type check and bun test pass on test/roles.test.ts, test/make-it-yours.test.ts, the new migration test and test/tui.
- Fork and copy gates are now proven. The test fixture gains a public repository with a public app,
carol/garden. A guest forking it getsnot_member. A guest calling make-it-yours getsnot_membertoo, and over the API that is a 403not_member. After promotion the same fork and the make-it-yours plan both succeed. I did not run the test with the gates deleted to confirm it fails. The setup means the guest passes the earlier access checks, so only the role check can refuse. - Grandfather migration now also promotes people on a write or admin team of an organization that owns a repository. The new
test/member-grandfather.test.tscovers owners and org writers, and checks that read-only team members, people with no repos, and writers of an org with no repos stay guests. - Make-it-yours returns
{kind:"not_member"}for a guest. The page, the API and MCP all answer withNOT_MEMBER_MESSAGE. - Demotion now reports
grantTakenBack, in the API response, the audit event, the page flash and the terminal toast. For example: "dave is a guest; its model grant is taken back." A test covers it. I kept the behaviour of removing the grant, since a guest has no spend, and made it visible instead. - Terminal
peopleScreenlists every person and their role for an admin who is a person. The list is capped at 200 accounts and at the screen height, and has no scrolling.
Disagreement: I left read-only team members as guests. They never created anything, so promoting them would grant more than they had before. If you want them promoted, drop the permission filter in the migration.
docs/ROLES.md is updated to match.
Parked by the crew: the check failed ("previews of idle pulls sleep > a pull touched an hour ago keeps its preview; one idle past the age loses its process, and its page says so") and the decider saw no point in another try
This push fixes the check that parked #673. The failure was in the earlier #673 work on this branch, not in the test.
That earlier work gated "make it yours" on the member role. A guest got a generic
invalidrefusal ("this account is a guest…") before the unverified-email refusal was reached. The failing test ("refused, by the action and the API…") expectsunverifiedfor an account with an unproven email. That account is also a guest, so the guest gate hid the real reason.What changed
src/actions/make_it_yours.ts, the unverified-email check now runs before the guest-role check. It uses the sharedrequireVerified, so the action and the API give the same answer. An account is told to prove its email first, and only then that the owner must make it a member.Checked:
test/make-it-yours.test.ts(11 pass),test/roles.test.ts,test/accounts.test.tsandtest/verify-email.test.ts(57 pass), andtsc --noEmitis clean. I did not run the whole suite; the forge runs the full check on this push.Still not done from #673's acceptance list
These are large and depend on #656 and #658. Each should become its own linked issue; I did not split them here.
Closes #673