The GitHub Actions job "Required Checks" on 
texera.git/gh-readonly-queue/main/pr-8575-41848581d3343f2a9c0cb3bc483ab1aa65e0049c
 has failed.
Run started by GitHub user aglinxinyuan (triggered by aglinxinyuan).

Head commit for run:
2351cb856d8f67b3da3ee53f1e72381122ee7cf6 / yangzhang75 <[email protected]>
feat(workflow): serve the pinned copy to public viewers (#8575)

### What changes were proposed in this PR?

With a version pinned, a workflow has two copies. This routes every read
that serves a viewer
without granted access through the frozen one.

- **The seam** — `WorkflowAccessResource.hasGrantedAccess(wid, uid)`:
granted access, as opposed
to being able to read a workflow only because it is public. An owner or
a shared user keeps
tracking the author's latest, because sharing is not publishing.
Everyone else is here only
  because the workflow is public, and gets the public copy.
- **One copy, not four fields** — `WorkflowPublishService.PublicCopy`
carries the name, the
description, the content and the default view together, and
`publicCopyOf` hands them out as a
group, so no surface can serve the published graph under a title the
author never published, or
  open a form view over a copy whose content carries no form.
- **Routed through it** — opening a workflow, the hub's read of a public
workflow, Clone,
Duplicate, `/workflow_name`, `/workflow_description`, and the size a
listing shows.
- **The revision history is a door into the same room.** Replaying a
version folds deltas back
from the author's *current* content, so listing or checking out versions
would hand a public
viewer the drafts the pin is holding back. `canReadHistory` keeps the
history open to anyone
with granted access, and to everyone while nothing is pinned — the
public copy is then the
author's latest and its history is the history of what everyone can
already see.

**A workflow that follows the author's latest — every workflow today —
is served exactly what it
is served now.** `publicCopyOf` returns the working copy when nothing is
frozen, so with no UI to
pin from yet (that arrives later in the series), nothing anyone can see
changes.

### Any related issues, documentation, discussions?

Closes #7939
Part of #7828. Design discussion: #7128. Builds on #7853, now merged.

### How was this PR tested?

22 new cases in `WorkflowPublishSpec` (54 in the suite, 540 in the
dashboard package):

- the published version reaching a stranger while the author keeps their
own working copy;
- opening a pinned workflow serving the whole copy — its own title,
description and view — and
  the author still opening everything they have;
- a collaborator with granted read access tracking the author's latest
as they keep editing;
- clone and duplicate taking the published copy, metadata included,
while a private workflow
still clones its working copy and a copy starts with no publish state of
its own;
- the size each case reports;
- the revision history: a public viewer is refused while a pin is in
place, a collaborator is
not, and a public workflow with nothing pinned keeps the history it has
today;
- a public copy of a workflow that is not public being refused rather
than falling through.

The history guard was checked by mutation: restoring `hasReadAccess`
turns the leak case red,
and the case was written from a reproduction — a stranger retrieving a
version of a pinned
workflow and getting back an unpublished draft.

`scalafmtCheckAll` clean.

### Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Opus 5)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5 <[email protected]>

Report URL: https://github.com/apache/texera/actions/runs/38665226491

With regards,
GitHub Actions via GitBox

Reply via email to