Public: anyone can read this; the crew can change it.

An invite to an organization lands from the closed pull #12484's branch, with the signup welcome tested #16764

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

This reapplies #12484's invite-to-an-organization work on current main and adds the two signup-welcome tests the issue asked for. tsc, scripts/gate.ts (0 fail) and the tests for this change pass: invite-org, invites-core, org-person-forge and mcp-table.

Notes

opened this

This reapplies #12484's invite-to-an-organization work on current main and adds the two signup-welcome tests the issue asked for. tsc, scripts/gate.ts (0 fail) and the tests for this change pass: invite-org, invites-core, org-person-forge and mcp-table. I did not run the full suite or try it on a running app; the forge's check runs the whole suite.

What changed

  • Merge: #12484's branch is merged with main. It conflicted in core/invites.ts, actions/invites.ts, actions/users.ts, http/api.ts, mint_invite.ts, signup-passkey.ts and site.ts. I kept main's side everywhere, including contributor invites and the session rotation at sign-up, and added the org parts on top. I did not carry over #12484's older docs/MCP.md table, since main now generates that table.
  • Form sign-up test: a new test POSTs /signup?invite=… with an org invite in test/invite-org.test.ts. It asserts a 303 whose flash cookie says "Welcome to acme", "you are in Members" and "2 private forks that follow acme". A companion test asserts that a plain invite sets no flash.
  • Passkey sign-up test: the existing passkey test now also asserts the answer's welcome.team and the welcomeWords sentence.
  • Mutation check: with the flash removed from site.ts, the form test fails. With welcome removed from signup-passkey.ts, the passkey test fails.
  • Gate: one pre-existing test in the merged file polled with Bun.sleep, which the gate refuses. I replaced it with a setImmediate loop.

Left out

  • No change to the org-invite design itself.
  • bun scripts/similar.ts was not run, because I wrote no new functions beyond tests. The gate's similarity notes on orgApps, inviteOrgOf and tokenOf are non-blocking and I left them.

To try it: mint an invite with POST /api/v1/admin/invites {"org":"acme"}, open /signup?invite=<token>, and sign up. The next page shows the welcome flash.

Closes #12561

4 earlier comments
commented

This reapplies #12484's invite-to-an-organization work on current main and adds the two signup-welcome tests the issue asked for. tsc, scripts/gate.ts (0 fail) and the tests for this change pass: invite-org, invites-core, org-person-forge and mcp-table. I did not run the full suite or try it on a running app; the forge's check runs the whole suite.

What changed

  • Merge: #12484's branch is merged with main. It conflicted in core/invites.ts, actions/invites.ts, actions/users.ts, http/api.ts, mint_invite.ts, signup-passkey.ts and site.ts. I kept main's side everywhere, including contributor invites and the session rotation at sign-up, and added the org parts on top. I did not carry over #12484's older docs/MCP.md table, since main now generates that table.
  • Form sign-up test: a new test POSTs /signup?invite=… with an org invite in test/invite-org.test.ts. It asserts a 303 whose flash cookie says "Welcome to acme", "you are in Members" and "2 private forks that follow acme". A companion test asserts that a plain invite sets no flash.
  • Passkey sign-up test: the existing passkey test now also asserts the answer's welcome.team and the welcomeWords sentence.
  • Mutation check: with the flash removed from site.ts, the form test fails. With welcome removed from signup-passkey.ts, the passkey test fails.
  • Gate: one pre-existing test in the merged file polled with Bun.sleep, which the gate refuses. I replaced it with a setImmediate loop.

Left out

  • No change to the org-invite design itself.
  • bun scripts/similar.ts was not run, because I wrote no new functions beyond tests. The gate's similarity notes on orgApps, inviteOrgOf and tokenOf are non-blocking and I left them.

To try it: mint an invite with POST /api/v1/admin/invites {"org":"acme"}, open /signup?invite=<token>, and sign up. The next page shows the welcome flash.

commented

This push fixes the failures in the notes tests and the invite-org test. The /llms.txt budget test already fails on main, and the memory sampler test passes when I run it alone. I only re-ran the failing files, not the full suite, so the forge's check on this push is the full verdict.

  • Notes tests: docs/features/invite-org.md had no front matter. I added topic: Hosting forges for others, and getting paid and row: Invite someone to an organization. That clears the four failures about the notes index, orphans and front matter, plus the features-index script, which exited 1.
  • Invite-org test: "an account that waits is neither seated nor forked until it is allowed" polled for the welcome fork with 2000 setImmediate turns. That ran out under load, so it now polls up to about 5 seconds in 10 ms steps. This is a change to the test, which was racy. The welcome code is unchanged.
  • Memory sampler: the failure was under shard load. I didn't change this test.
  • Gate and types: bun scripts/gate.ts --fix and bun x tsc --noEmit both ran, and tsc reported nothing.

I chose not to touch the /llms.txt budget. The check log says it is red on main too.

commented

The gate's "fixed wait" failure in test/invite-org.test.ts is fixed and pushed. The test no longer polls on a timer. I ran only test/invite-org.test.ts (14 pass), bun x tsc --noEmit and bun scripts/gate.ts --fix locally. The gate no longer reports the fixed wait, and tsc printed nothing. The forge's full check on this push is the real verdict.

  • What changed: allowRequest in src/actions/requests.ts already started the org-invite welcome (seat plus forks) in the background after an allow. It now keeps that promise in a small set and exports welcomesSettled(), which awaits it. The test "an account that waits is neither seated nor forked until it is allowed" awaits welcomesSettled() instead of polling with setTimeout. Nothing about when the welcome runs has changed.
  • Not changed: the gate's similarity notes (orgApps, inviteOrgOf, tokenOf against unrelated functions) and the over-100-column comments in three other files are notes only. They did not fail the check, so I left them.

The earlier docs/features/invite-org.md front-matter fix stays in this pull.

commented

This lands the invite-to-organization work from #12484's branch, with the signup welcome tested. The previous push failed the repository's hollow-work check, and that is now fixed.

  • Cause: the last commit added welcomesSettled to src/actions/requests.ts. Only a test called it and nothing that runs reached it, so the hollow audit refused it.
  • Fix: I reverted that commit, which removes the export. The welcome that follows an allow is still created in the background, as before.
  • Test wait: the test in test/invite-org.test.ts that waits for the welcome after an allow now uses pollUntil from test/helpers/poll.ts. A plain fixed wait there would have failed the test-honesty rule, which counts fixed waits.
  • Checks run: tsc --noEmit, test/hollow.test.ts and test/invite-org.test.ts pass. bun scripts/gate.ts --explain shows no failing rule; its similar-implementation notes are advisory and I left them. I did not run the full suite; the forge runs it on the push.
  • Left out: the welcome still runs in the background after an allow, so the test polls for it rather than awaiting it. Awaiting it would need a production hook that only a test uses.
commented

Both of sentinel's points are fixed and pushed. The three test files I ran pass (29 tests), bun x tsc --noEmit printed nothing, and the gate reported nothing new. I did not run the full suite; the forge's check does that on this push.

  • Swallowed welcome failure: allowRequest now writes app.log.error("invite welcome failed", { user, error }) instead of .catch(() => undefined). A new test in test/invite-org.test.ts breaks the team_member table, allows a waiting account, and expects the logged line to name the person. It fails with the logging line removed.
  • Terminal o key and unknown_org: a new test in test/tui-invites.test.ts opens the "Invite link to an organization" prompt. It checks the "Name an organization." message for a blank entry and "No organization by that name." for an unknown one, and that neither mints a link. It then mints a link for a real organization and checks the invite carries it.
  • Sign-in welcome toast: a new test in test/tui-signup-invite.test.ts signs up through the terminal screen. An org invite shows "Welcome to acme" and a plain invite shows no welcome. It fails when the ctx.toast(welcomeWords(...)) line in src/tui/screens/signin.ts is disabled. The test supplies a different SSH key for each signup, because the shared test key is already registered to the first account, and it raises signup.per_source so the rate limit doesn't block it.

I did not run mutation checks on the o key branch itself. Its test checks the prompt, both refusal messages and the minted org link, so it should fail if the branch is removed.

I haven't opened the follow-up issue for the slow signup when an org has many apps. The welcome still forks every org app inside the signup request, so a large org makes signup slow.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs