Skip to content

fix(platform): keep Automations to owners, admins and developers - #3983

Merged
yannickmonney merged 4 commits into
mainfrom
fix/automations-developer-only
Sep 30, 2026
Merged

yannickmonney merged 4 commits into
mainfrom
fix/automations-developer-only

Conversation

@yannickmonney

@yannickmonney yannickmonney commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Automations is now only for Owners, Admins and Developers. Members and Editors no longer get the rail and phone tab-bar entry or a project's Automations tab, whatever the organization runs. A typed or bookmarked automation URL shows Access denied, and task and notification links into Automations are gone for them. This reverses the reader visibility #3779 added a day earlier.

What changed

  • One rule. features/automations/lib/access.ts (canUseAutomations: the developerSettings ability, the client side of the server's author gate) and useCanUseAutomations.
  • Navigation.
    • The rail and the phone tab bar show Automations only under that rule.
    • A project's Automations tab, and its listing read, exist only for the same roles.
    • useAutomationsAvailability, reader-listing and the reader empty state (automations.list.emptyReader.*) are gone. The list is back to its pre-feat(platform): show readers live automation navigation #3779 form.
  • Pages.
    • New layout routes, automations/route.tsx (org) and projects/$projectId/automations/route.tsx, wrap every automation page in AutomationsAccessGate, which shows accessDenied.automations.
    • An author keeps the page while the role refetches, so an open editor never unmounts.
    • routeTree.gen.ts is regenerated.
  • Document title. loadAutomationName and loaderAbility keep the tab title from naming an automation for a denied viewer, cold deep links included.
  • Tasks. The timeline's View automation and the run dialog's Open the full run are hidden for other roles. The run's name, steps, questions and approvals stay on the task.
  • Home. The Home tile never remembers or reopens a project automation page for someone who can't open it.
  • Notifications.
    • A linkless system org alert, which every member sees, now lands on the org home instead of Automations.
    • An agent's question from a project run with no task can only be answered on its run page, so it now notifies only Owners, Admins and Developers who can see the project. Task-bound questions still reach everyone on the project; they answer on the task.
  • Docs and manual boxes. Docs updated in EN/DE/FR. Manual boxes NAV-F43 and AUTO-F53 are rewritten, keeping their IDs.

Left as is, on purpose

  • Server reads. Reads, test (mock) runs, run cancel and ask answers stay open to every member, because tasks and the Inbox rely on them. Authoring and live runs were already limited to Owners, Admins and Developers (backend/domains/automations/routes.ts).
  • Org switcher. Switching organization keeps an automations/… path. Someone who is only a Member in the target org lands on Access denied, which is how the role-gated Settings pages already behave.
  • Refetch error edge. While a member-context refetch errors, a Member on an automation URL sees an empty content area instead of the denial, because the dashboard counts an error as loading.

Checklist

  • bun run check: not run in full on this shared host. The scoped gates below ran instead, and CI runs the full check.
    • Platform tsc --noEmit.
    • Type-aware oxlint and oxfmt --check on every changed file.
    • knip, lint:manual, lint:conflicts, and check-guide.ts on the two suites.
    • Full platform test:ui (550 files, 4841 tests) and the server and pii suites. That run exposed one failure: the reserved-segments scanner now skips layout and test files.
    • After the review fixes and a rebase onto main: 175 UI files (1490 tests) and 47 server files (613 tests) in the affected areas.
  • bun run lint:sast passes: full run, 467 rules, 0 findings.
  • Translations: accessDenied.automations added and automations.list.emptyReader.* removed in messages/{en,de,fr}.yml. No de-CH override is needed (no ß).
  • Docs updated in docs/{en,de,fr}/: platform index, member overview, members and roles, automations catalog, execution logs, approval concepts, approvals in workflows, projects overview and task automation.
  • README.md / README.de.md / README.fr.md: N/A, no README-level change.

Test plan

  • Automated.
    • The 15 new Member/Editor tests fail on main and pass here: nav entry, tab bar, project tab, the two task links, Home memory and the system-notification fallback.
    • New tests cover the gate through both layout routes, loaderAbility, loadAutomationName, and the question-notification recipients.
  • Manual. NAV-F43 covers the rail and tab bar by role, plus the direct URL. AUTO-F53 covers the pages, the project tab, the task links and Home as a Member or Editor.
  • Verified live in Chromium on a fresh local stack, with an org-wide deployed automation plus a deployed automation bound to the starter project. That is exactly the state in which feat(platform): show readers live automation navigation #3779 showed readers the entry.
    • Member and Editor. The rail shows Home and Knowledge; the phone tab bar shows Home, Knowledge and Settings.
      • /automations, an automation's /runs and /general, and the project's /automations all show Access denied inside the shell.
      • The project tab strip has no Automations tab.
      • A cold deep link titles the tab "Automation", never the automation's name.
      • After opening the project's Automations URL, the Home tile still returns to the task board.
    • Developer. The Automations entry, tab and pages are all there, and the cold-link title names "Triage GitHub issues".
    • Owner. The rail shows Automations.
    • Not checked live: the two task links, which need a run on a task. Their component tests cover them.

Automations is a builder's section. Only Owners, Admins and Developers
(the server's author gate, the client's `developerSettings` ability) now
get any of it; Members and Editors get none, whatever the organization
runs. This reverses the reader visibility #3779 added a day earlier.

- The rail and phone tab-bar entry show only for that rule
  (`features/automations/lib/access.ts`, `useCanUseAutomations`); the
  live-automation availability read and the reader-only list filter and
  empty state are gone.
- A project's Automations tab is shown, and its listing read, only for
  them.
- Every automation page, org and project scope, sits behind
  `AutomationsAccessGate` in a new layout route: others get Access
  denied (`accessDenied.automations`). An author keeps the page while the
  role refetches, so an open editor never unmounts.
- The detail title never names an automation for a denied viewer, cold
  deep links included (`loaderAbility`, `loadAutomationName`).
- Task surfaces keep a run's name, steps, questions and approvals, but
  drop "View automation" and "Open the full run" for others.
- Home never reopens a project automation page for someone who cannot
  open it.
- A linkless system org notification lands on the org home, and an agent
  question from a project run with no task, answerable only on its run
  page, notifies only Owners, Admins and Developers.

Server reads, test runs, cancels and task-side answers stay open to
every member, because tasks and the Inbox rely on them.
The platform guides still said Members and Editors see Automations once
an organization-wide automation is deployed, open run lists, and answer
or decide on the run detail. In EN, DE and FR they now say that only
Owners, Admins and Developers see Automations, its runs and a project's
Automations tab, and that a run working a task shows its question and
approval cards on the task, where anyone who can open the task acts on
them. The roles table no longer calls workflow resources read-only for
Editors.
@yannickmonney

Copy link
Copy Markdown
Contributor Author

Review of exact head 9401837: one remaining UI consistency issue.

A live role downgrade leaves the automation name in the browser title. Open an automation detail as a Developer, then let its member-context query resolve to Member. AutomationsAccessGate removes the body and shows Access denied, but the detail route head still uses the earlier loader result. The settled membership change does not rerun that loader or replace its title.

Independent local reproduction with the production gate, role loader, detail route loader/head, real TanStack Router/HeadContent and QueryClient: title is Private ledger - Tale before and after demotion, while the body is denied. The cold Member control passes with a generic title. The automation response/body and shell membership delivery are inert fixtures; this is a source-bound jsdom integration check, not a live deployment/browser-stack test. This is not a server data-exposure claim: member API reads remain intentionally available to Tasks/Inbox.

Please update/override the metadata when the resolved role denies access (including the project route), with a role-transition regression. Preserve the current behavior that keeps an author's editor mounted during an ordinary membership refetch.

Other bounded evidence: 131 affected UI tests, 85 server/scope tests, and 28 docs checks pass using retained local dependencies. Seventeen selected assertions fail against the prior implementation and pass here, confirming the role/navigation/task-link/Home fixes. Generated-route inspection places all 12 automation descendants under one of the new gates. EN/DE/FR and both modified manual guides were checked. No full-stack validation, formal approval or merge is implied.

An automation detail route titles the tab from what its loader read when
the page opened. When the viewer's role is lowered while the page is open,
the gate swaps the page for Access denied but no loader reruns, so the tab
kept the automation's name. The gate now claims the section's own title
("Automations - <org>") through `useDocumentTitle` whenever it denies, in
the organization and project scope alike, and hands the page's title back
when the denial goes away. An author's page, and its title, stay as they
were during an ordinary membership refetch.
@yannickmonney

Copy link
Copy Markdown
Contributor Author

Fixed in 3f1228b, the live role downgrade leaving the automation's name on the tab.

AutomationsAccessGate now claims the section's own title ("Automations - ") through useDocumentTitle while it shows the denial. The gate wraps both layouts, so the project route is covered too. The claim sits over whatever the detail route's head last computed, and hands the page's title back when the denial goes away. An author's page and title are untouched during an ordinary membership refetch.

Regressions:

  • automations-access-gate.test.tsx: Developer → Member re-render with a named title already on the tab, plus the author-refetch and hand-back cases.
  • automations/route.test.tsx: the title for both layouts.

The two transition tests fail with the claim removed.

@yannickmonney

Copy link
Copy Markdown
Contributor Author

Follow-up independent review at 3f1228b30b87a0919675cdf6d7bc01860e83712f: the normal Developer→Member title repair works; the same title guarantee still fails after a rejected membership refresh.

Reproduction through both actual organization and project routes: open a named automation as Developer, resolve membership to Member (body disappears/title becomes generic), then reject a background membership refresh. React Query retains Member data and sets isError; the dashboard includes that error in AbilityLoadingContext. The gate’s denied = !canUse && !abilityLoading becomes false and releases its generic title claim, restoring the automation’s earlier named title while the body stays empty.

Let the title claim remain tied to the known lack of ability, independently of the loading predicate used for the denial body. Preserve authorized pending-refetch drafts, role recovery and navigation cleanup. Add the Developer→Member→failed-refetch case in both scopes.

Existing author/prior controls:26/26 pass. Independent actual-route controls:6 pass /2 required assertions fail; clean local Chromium confirms both failed-refetch cases. Actual gate, title hook, ability predicate and TanStack head run with synthetic membership/action seams; no production/backend data exposure or new authentication vulnerability is claimed. This completes the same prior title finding, not a new root cause. Retained dependencies were used; no full frozen install or a11y/layout signoff. React Doctor on the exact three-file delta found no issues. Full current-head CI is still a separate gate.

After a role was lowered on an open automation page, a rejected
membership refetch keeps the Member data but raises the dashboard's
loading flag. The gate's title claim followed that flag too, so it let
go and the automation's name came back on the tab over the empty page.
The claim now follows the ability alone: whoever lacks it keeps the
section's name, whatever is loading. An author's page and title, role
recovery and the claim's release on navigation are unchanged.
@yannickmonney

Copy link
Copy Markdown
Contributor Author

Fixed in 7470b10: a failed membership refetch after a role downgrade no longer brings the automation's name back.

The title claim in AutomationsAccessGate now follows the ability alone (canUse ? undefined : documentTitle('automations')), not the loading flag. A rejected refetch keeps the Member data and raises AbilityLoadingContext; the body stays held (empty), and the tab keeps the section's name. The author's page and title during an ordinary refetch are unchanged, as are role recovery (the claim is released once the ability returns) and release on navigation.

Regressions: Developer → Member → failed refetch in automations-access-gate.test.tsx and in both scopes in automations/route.test.tsx, plus an author-refetch control in both scopes. All three new cases fail under the previous loading-based rule.

@yannickmonney
yannickmonney merged commit 91ce574 into main Sep 30, 2026
69 checks passed
@yannickmonney
yannickmonney deleted the fix/automations-developer-only branch September 30, 2026 11:23
@yannickmonney

Copy link
Copy Markdown
Contributor Author

Merged-source reconciliation: the failed-membership-refetch title finding from the preceding review is fixed on actual squash source 91ce574 (final author head 7470b10).

The generic title claim now follows canUse independently of the loading flag. The unchanged independent actual-route controls move from 6 pass / 2 fail on 3f1228b to 8 pass / 0 fail on the squash. All 39 focused tests pass. Local Chromium reproductions in organization and project scopes retain “Automations - Tale” with an empty protected body during cached-Member/rejected-refetch states; authorized pending drafts, late-head masking, role recovery and navigation cleanup also pass.

Final-head hosted UI separately executed on GitHub test merge aa5d8ee, with a cache miss and 4,928 passing tests. That CI source is not the squash source used by the local proof. No production test or broad layout/a11y/provider claim. All historical failing evidence remains preserved; this finding needs no further issue or patch.

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