Skip to content

feat(workflows): show workflows read-only to users with view access - #126468

Closed
Silthus wants to merge 7 commits into
PostHog:masterfrom
Silthus:feat/private-workflows
Closed

Silthus wants to merge 7 commits into
PostHog:masterfrom
Silthus:feat/private-workflows

Conversation

@Silthus

@Silthus Silthus commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Problem

  • A teammate with view access to a workflow sees the full editor, and every edit they make fails to save.
  • First step toward requested private workflows: the author edits, others view until shared.

Impact

  • Grow Workflows: teams share workflows without a teammate changing a live flow. The workflow view only banner shown and workflow view only duplicated events track it.

Warning

🟡 Merge risk: medium · two-way door (merge-risk rubric)

  • A wrong access check locks editors out of the workflow editor. Reach: some users, unmeasured.
  • A missing access level stays editable. Logic tests cover editor and viewer.
  • Revert: git revert the merge commit.

Changes

  • Viewers see a banner that says the workflow is view-only and names the owner. It offers Duplicate when they can create workflows.
  • Viewers can read step settings, open nested sections and copy text. Clicks, typing, paste and number stepping do nothing.
  • The title and step names show as plain text. The auto-save switch and step deletion are hidden.
  • workflowLogic drops viewer edits in the four listeners that every layout writes through, and skips auto-save.
  • No backend change: object access control on hog_flow already rejects viewer saves.
Viewer opens a workflow Viewer opens a step Owner, unchanged
viewer viewer step owner

How did you test this code?

Test rationale: existing editor tests never load a viewer. Logic tests check that viewer edits never change or auto-save the workflow. workflowViewOnly.test.tsx checks blocked input and readable settings.

  • Live run on a local preview: the viewer sent only GET requests to hog_flows. The owner's edit saved.
  • Not checked: tree and tile layouts (behind flags), production access-level shapes.
  • Not run: the repo CI, because it does not run on fork PRs.

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Release status

  • No feature flag controls this change

Docs update

  • None.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Agent: Claude Code, claude-opus-5-5

Skills: /full-stop, /impact, /tdd, /qa-swarm, /merge-risk, /pr-description, /writing-pr-descriptions

Question Answer Who Where
Private editing for workflows? Author edits, others view until shared 👤 Human comment
New permission model or reuse? Reuse object access control on hog_flow 🤖 Agent comment
Where do viewer edits stop? workflowLogic listeners plus blocked input events 🤖 Agent comment
Read-only code editors now? Later, the guard drops their changes 🤖 Agent comment
Relation to #126070? A follow-up replaces its owner rule 🤖 Agent comment

Involvement: one design review, UI walk and live run captured, four GPT-6.1 Sol review reads with the last one clean.

More context for AI agents
  • Session: T3 Code thread, Claude Code with agent-browser and fleet proof.
  • Decisions: the design pass moved the guard from React Flow deletable into the workflowLogic listeners. Review rounds replaced the disabled fieldset with capture-phase event blocking, gated Duplicate, and limited cursor keys to text fields.
  • Follow-ups: a "Make private" toggle that sets the object default to viewer; default T3 Code step workflows to private and drop the feat(workflows): add a T3 Code step that starts a T3 Code agent run #126070 rule; hide tree and tile affordances; readOnly code editors.
  • Follow-ups: private workflows need the paid access control feature, and organization admins always edit.
  • Read closely: workflowLogic.ts listener guards, ViewOnlyArea.tsx.

🤖 Generated with Claude Code

Silthus and others added 3 commits October 30, 2026 06:54
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Guard the workflow edit listeners, disable step settings while keeping
collapsible sections openable, and hide title editing and the auto-save
switch from viewers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@trunk-io

trunk-io Bot commented Oct 30, 2026

Copy link
Copy Markdown

Merging to master in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

Silthus added a commit to Silthus/posthog that referenced this pull request Oct 30, 2026
Silthus added a commit to Silthus/posthog that referenced this pull request Oct 30, 2026
Silthus added a commit to Silthus/posthog that referenced this pull request Oct 30, 2026
@Silthus

Silthus commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor Author

Decision record for this PR, from the agent session and the design review round.

  • 👤 Should workflows support private editing? Yes: the author edits, others view until the author shares edit access.

  • 🤖 Build a new permission model or reuse one? Reuse object access control on hog_flow. The backend already enforces it, so this slice is frontend only.

  • 🤖 Where do viewer edits stop? In the four workflowLogic listeners every layout writes through, plus disabled step settings. Hiding controls alone missed the tree and tile layouts.

  • 🤖 Make code editors read-only now? Later. The listener guard already drops their changes; threading readOnly through the shared inputs is a follow-up.

  • 🤖 How does this relate to the T3 Code step owner rule in feat(workflows): add a T3 Code step that starts a T3 Code agent run #126070? A follow-up can default those workflows to private through this mechanism and drop the narrow rule.

  • 🤖 Disable step settings with a <fieldset disabled> or block input events? Block input events in a wrapper around the settings. A disabled fieldset also disables collapse headers, so viewers could not open nested settings. Some step controls call APIs directly, so the workflowLogic guard alone is not enough.

  • 🤖 Which keys may a viewer use? Tab, Escape, copy and select-all everywhere, and cursor keys only inside text fields. Cursor keys step number fields, selects and radios, and setWorkflowValue writes those changes unguarded.

  • 🤖 Who sees Duplicate in the banner? Only viewers who can edit workflows at the resource level, because a duplicate needs create access.

Silthus and others added 4 commits October 30, 2026 16:25
…viewers

A disabled fieldset also disabled collapse headers inside step settings,
so viewers could not open nested sections. Lock edit controls with a
view-only area that leaves collapse headers clickable. Offer Duplicate
only to users who can create workflows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ings

Pointer blocking alone left step controls reachable by keyboard, and some
of them call APIs directly. The view-only area now stops clicks, key
presses, paste and drop on everything except collapse headers and links.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Silthus

Silthus commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

Moved to #127180 on a branch in PostHog/posthog, so it gets the full CI.

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