Skip to content

fix(platform): hold New project until its teams read answers - #5075

Closed
tale-code-bot wants to merge 1 commit into
mainfrom
fix/project-create-audience-read-state
Closed

tale-code-bot wants to merge 1 commit into
mainfrom
fix/project-create-audience-read-state

Conversation

@tale-code-bot

@tale-code-bot tale-code-bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Until now the New project dialog rendered Who can see it only after the assignable teams had loaded and turned out non-empty, and it sent teamIds only when some were picked. While the GET /teams read was pending, or after it failed, the field was missing and Create project made the project organization-wide without the creator ever seeing the choice (#4836).

Create now waits for that read. The dialog reuses the shared CatalogLoadError and Skeletonize, plus the read state useOrgTeams() already returns:

  • Pending: a skeleton holds the field's place and Create stays disabled.
  • Failed: a failed read, or a refresh that failed, shows Couldn't load teams. with Try again in the field's place. Nothing is created, even on a direct form submit.
  • Recovery: the picker comes back with the focus on it and the picked teams kept.
  • Answered and empty: only then is the field left out and the project created organization-wide.

Task: Tale TALE-173. Plan, as posted on the task before the first edit:

  • Root cause: project-create-dialog.tsx read only teams from useOrgTeams(), so it treated "not answered" the same as "no teams".
  • Fix: gate the submit on the read state (isValid={audienceReady} plus a guard in onSubmit) and render each state in the field's place. No new concept, no new i18n keys.

Closes #4836

Checklist

  • bun run check: not run as one command. Every part except the full test:ui suite passed at c9cd29ffe:

    • in this PR's CI (Checks run 40913005794): Format, Lint, Type check, Knip and every Unit job;
    • in the authoring worker: lint:conflicts, lint:links, and the affected platform UI tests and docs tests (see Test plan).

    The full test:ui suite has not run at this head. It runs only in the merge queue, so it runs before this lands.

  • bun run lint:sast: passed in this PR's CI at c9cd29ffe. The Opengrep job of SAST run 40913006022 runs the same bash tools/opengrep/run.sh. It wasn't run in the authoring worker, where Opengrep v1.22.0 isn't cached.

  • Translations: N/A. No key was added or changed; the dialog reuses projects.sharing.teamsLoadError, projects.create.audienceLabel and the shared Try again, which exist in en/de/fr, with de-CH falling back to de. A test proves this in all four locales.

  • Docs updated in docs/{en,de,fr}/platform/projects/concepts.md ("Check who can open it"): one sentence each saying that Create waits for the teams and that a failed read offers Try again.

  • README.md / README.de.md / README.fr.md: N/A, since no install, configuration, environment variable or CLI change.

Test plan

Regression. The new test file project-create-dialog.team-reads.test.tsx uses the real useOrgTeams against a controlled backendFetch('/teams') that fails with a 503 and makes 4 read attempts.

Dialog version Result
main's dialog (9be5cadac) 7 failed, 2 passed
This change 9 of 9 passed

On main, only the two cases main already handles pass: picked teams are sent, and an answered empty list creates organization-wide. The 9 cases:

  • a failed read creates nothing, on a click or on Enter; the failure is announced and passes axe; Try again is busy, then the picker returns focused;
  • Create is held while the read is pending;
  • picked teams ride the create;
  • a failed refresh holds Create and keeps the pick for the read that answers;
  • an answered empty list creates organization-wide;
  • the failure is named in en, de, fr and de-CH.

Commands, run at the head c9cd29ffe with a clean tree. Platform commands ran in services/platform.

Command Result
bunx vitest --run --config vitest.ui.config.ts on project-create-dialog.team-reads.test.tsx, project-create-dialog.test.tsx, project-sharing-section.team-reads.test.tsx, projects-table.test.tsx and dashboard-lazy-failures.test.tsx 5 files, 44 tests passed
Consumers: projects-table.test.tsx, dashboard-lazy-failures.test.tsx and home-panel.test.tsx 3 files, 72 tests passed
bun run --filter @tale/docs test 38 files, 716 tests passed
bun run lint:manual ok, 1849 boxes
bun run lint:links ok
bun run lint:conflicts exit 0
oxfmt --check on the changed paths exit 0
bunx oxlint --type-aware --type-check on the 3 changed TypeScript files exit 0. A probe file with a deliberate type error made the same command report TS2322 and exit 1, so the pass isn't vacuous

CI at c9cd29ffe, checked once on 2026-10-29 at 16:43Z: no check failed or was pending.

  • Passed: Format, Lint, Type check, Knip and Unit (workspaces, platform 1/2, platform 2/2) in Checks run 40913005794; Opengrep in SAST run 40913006022; Lint commits in Commitlint run 40913005830.
  • Skipped on a PR, because they run only in the merge queue: UI, Browser, Build, E2E and Backend integration.

Not run:

  • the full test:ui suite (the merge queue runs it);
  • a real browser and the live backend.

Manual: the new box PROJ-B32 in services/platform/tests/manual/suites/projects.md covers this, and reference/automation.md has a row for the new spec. To try it:

  1. As an Editor in a team, block */api/app/teams?* in DevTools and open New project.
  2. While the read retries, the field holds its place and Create is disabled; Enter creates nothing.
  3. After the retries, Couldn't load teams. with Try again stands in the field's place.
  4. Unblock, Tab to Try again and press Enter: the picker returns focused. Pick your team and create; the project's General tab lists that team under Audience.
  5. Repeat the failed state in German and French.

The New project dialog rendered "Who can see it" only once the
assignable teams had loaded and were non-empty, and sent teamIds only
when some were picked. While the teams read was pending, or after it
failed, the field was missing and Create made the project
organization-wide without the creator ever seeing the choice.

Create now waits for the read: a pending read holds the field's place
as a skeleton with Create disabled; a failed read, or a refresh that
failed, is named in the field's place with Try again (the shared
CatalogLoadError) and creates nothing, also against a direct form
submit. Recovery returns the picker with the focus on it and keeps the
picked teams. Only an answered, empty list leaves the field out and
creates organization-wide.

Closes #4836

@tale-review-bot tale-review-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved at c9cd29ffe4aa4e2a1dcadae4844417174679c48c (Reviewer, TALE-173, review-merge slice 2 of 2).

What I checked at this head

  • Scope: the change does what #4836 and the task's plan asked, and nothing else. In project-create-dialog.tsx, Create waits for the listOrgTeams read:
    • Pending: Skeletonize masks the picker and Create is disabled.
    • Failed, or a refresh that failed: CatalogLoadError stands in the field's place.
    • Answered and empty: only then is the project created organization-wide.
    • The submit is gated twice: isValid, plus the guard in onSubmit. Docs (en/de/fr), PROJ-B32 and the automation row are updated. There are no new i18n keys.
  • Correctness: I followed useOrgTeams → readStateOf → useBackendQuery and the /api/app/teams route.
    • That route answers any org member (requireOrgMember), so the new gate can't lock out a role that is allowed to create.
    • CatalogLoadError's focus handoff resolves the Radix dialog root case, and focusAudience targets the MultiSelect trigger's id.
    • Both mounts (projects-table.tsx, home-projects.tsx) keep their props.
  • Contract: commit and PR title follow commitlint, the branch name is fix/…, Closes #4836 is there, and the sweep (docs, manual box, automation register) is complete.

What I ran (credentials removed; frozen lockfile install):

  • vitest --config vitest.ui.config.ts on the new project-create-dialog.team-reads.test.tsx, project-create-dialog.test.tsx, project-sharing-section.team-reads.test.tsx, projects-table.test.tsx and dashboard-lazy-failures.test.tsx: 5 files, 44/44 passed.
  • Regression: the same new test file with the dialog swapped back to main's version (9be5cadac): 7 failed, 2 passed. The first failure is createProject called with no teamIds, the bug in #4836. I restored the tree afterwards.
  • bun run lint:manual: ok, 1849 boxes. bun run lint:conflicts: exit 0.

CI at this head: all 7 required checks passed:

  • CI ready (Checks) in run 40913005794;
  • CI ready (SAST) in run 40913006022;
  • CI ready (Commitlint) in run 40913005830;
  • CI ready (Security) in run 40913005717;
  • CI ready (Build) in run 40913005887;
  • CI ready (CLI) in run 40913006242;
  • CI ready (E2E) in run 40913005932.

Not run: the queue-only tier (full test:ui, Browser, E2E, Build, Backend integration), a real browser and the live backend. The merge queue runs the first set before this lands.

Non-blocking note: with no $id in the route, the teams read is skipped and Create would stay held behind the skeleton. Both mounts sit under /dashboard/$id, so this can't happen today. The Coder flagged it on the task too.

@tale-review-bot
tale-review-bot added this pull request to the merge queue Oct 29, 2026
@tale-review-bot

Copy link
Copy Markdown
Collaborator

Queued through the merge queue at the approved head c9cd29ffe4aa4e2a1dcadae4844417174679c48c (--match-head-commit), 17:09:40Z.

Note for the maintainers: #4836 will close with this PR, but its addendum is not covered. The addendum is the 2026-10-12 comment on #4836 by Review A (TALE-358). This PR fixes the issue body: the New project dialog. The addendum describes two more defects, both in services/platform/app/features/projects/components/projects-table.tsx. Neither is part of this change (TALE-173 was scoped to the dialog), and both still stand on main at 9be5cadacb5f59cd6b2cc67c7840e3c0101bdde2. That file last changed on 2026-10-05.

  1. "Unknown team" for real teams. The table keeps only teams, nameOf and isLoading from useTeamNames(), so after a failed directory read the Sharing column says Unknown team, with no Try again.
  2. An active ?teams= filter can't be seen. The Teams filter is built only while the directory has teams, so after a failed directory read an active filter is invisible and can't be cleared.

When this lands, Closes #4836 closes the issue. That includes the addendum unless someone reopens #4836 or files the addendum as an issue of its own.

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 29, 2026
@tale-review-bot
tale-review-bot added this pull request to the merge queue Oct 29, 2026
@tale-review-bot

Copy link
Copy Markdown
Collaborator

Merge queue: the first group for this PR failed a required check, and the PR was re-queued. (Reviewer tale-review-bot, run 0abfbeb4, read at 17:40 UTC.)

  • First group failed. Group 254907f5772152fda77d4e99c2110462f47df104 was main 9be5cadac plus this PR's approved head c9cd29ffe4aa4e2a1dcadae4844417174679c48c. It failed the required CI ready (Checks) (job 123615816423) because Backend integration failed in Checks run 40918679627 (job 123605778079). The failing lane: FAIL harness: checkRestProjectAgents runs to completion — RUN TRUNCATED at lane 104 of 287 (checkRestProjectAgents) — 183 later lane(s) never ran; threw AssertionError. Every other check in that group passed: Browser, E2E, the UI shards, Build, SAST, Security, CLI and Commitlint.
  • Removed, then re-queued. The queue removed the PR at 17:28:18Z (failed_checks). tale-review-bot re-added it at 17:35:29Z, at the same approved head, from another Reviewer run (not this one) and without a comment. The new group fd78f63358c3a2b9292506af5df71f76588c3101 is at position 1, waiting for checks.
  • Likely unrelated, not proved. This PR changes only the New project dialog, its tests, docs and a manual box, with no backend code. A flake in that lane is plausible, but I did not establish whether it is a flake or a real break.
  • Next. I leave the PR in the queue: nothing lands unless every required check passes on the new group. If it fails again, verify-close sends TALE-173 back for repair.

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 29, 2026
@tale-review-bot

Copy link
Copy Markdown
Collaborator

Merge queue: the second group failed too. I have not re-queued it; verify-close takes it from here. (tale-review-bot, Reviewer run 82592cbd, read at 18:12 UTC.)

  • Removed: group fd78f63358c3a2b9292506af5df71f76588c3101 (main 9be5cadac plus the approved head c9cd29ffe4aa4e2a1dcadae4844417174679c48c) was removed at 18:11:35Z (failed_checks).
  • What failed: the required CI ready (Build) (job 123639567907), in Build run 40922839143.
    • Three image scans failed: Scan db (job 123628081933), Scan sandbox-egress (job 123628081913) and Scan sandbox-buildkitd (job 123628081904). The scans I read end in Trivy FATAL … image scan error … context deadline exceeded, a scanner timeout.
    • The rest of that run was cancelled.
    • Backend integration (Checks run 40922838907) was still running when the group was dropped.
  • Not this PR's code: fix(platform): hold New project until its teams read answers #5075 changes only the New project dialog, its tests, docs and a manual box. It touches none of the scanned images.
  • Why no second re-queue: the first group (254907f57…, Backend integration flake) already used the one re-queue that the Reviewer's rule allows, at 17:35:29Z. A second failure is recorded and handed to verify-close.
  • The PR, its approval and its head are unchanged.

@tale-review-bot

Copy link
Copy Markdown
Collaborator

Merge queue: this PR was dropped a second time (Reviewer tale-review-bot, run 0f613fd2, 18:16 UTC). It is now out of the queue.

  • The failure. The second group fd78f63358c3a2b9292506af5df71f76588c3101 failed the required CI ready (Build) (job 123639567907, 18:11:12Z) in Build run 40922839143. The image scans failed:
    • Scan db (job 123628081933): image scan error … context deadline exceeded, a scanner timeout, not a finding;
    • Scan sandbox-buildkitd (123628081904) and Scan sandbox-egress (123628081913) failed as well, and the rest of the run was cancelled.
  • Removed. The queue removed the PR at 18:11:35Z (failed_checks).
  • Not this PR's code. It changes only the New project dialog, its tests, docs and a manual box. Both group failures (Backend integration in the first, image-scan timeouts in this one) fall in code it does not touch, while CI runners were saturated.
  • Next. The single re-queue the process allows was already used (17:35:29Z), so I am not queueing it again. Verify-close takes it from here; it will most likely need a re-queue once the runners recover.

@yannickmonney

Copy link
Copy Markdown
Contributor

Landed on train as 18405b6: squashed at the approved head after the fast gate (formatting, typecheck, build). It reaches main with the merge train's pull request, so this pull request closes without merging.

yannickmonney pushed a commit that referenced this pull request Oct 30, 2026
Reviewed and approved in pull request #5075 at c9cd29f.

Closes #4836
Task: TALE-173
@yannickmonney
yannickmonney deleted the fix/project-create-audience-read-state branch October 30, 2026 10:32
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.

bug(platform): New project drops "Who can see it" on a pending or failed team read and creates the project organization-wide

3 participants