yangzhang75 opened a new pull request, #7853:
URL: https://github.com/apache/texera/pull/7853

   Part of #7828. Stacked on #7851 — until that merges this PR shows its commit 
too; the review here is the second commit, `feat(workflow): freeze a pinned 
version as the public copy`.
   
   A public workflow follows the author's latest content, as publishing has 
always done. This adds the other state: the author pins the version they have 
now, and the public copy stops moving until they pin again.
   
   ## What lands
   
   `is_public` stays the on/off switch. `published_content` is the pin — NULL 
means following, non-NULL is the frozen copy.
   
   `WorkflowPublishService` owns the two states and the moves between them 
(`publish`, `pinLatest`, `unpin`, `unpublish`, `statusOf`), and three endpoints 
expose them:
   
   | Endpoint | Does |
   |---|---|
   | `POST /workflow/pin/{wid}` | freezes the author's current version as the 
public copy; called again, moves the pin forward |
   | `DELETE /workflow/pin/{wid}` | drops the pin, back to following the latest 
|
   | `GET /workflow/publish-status/{wid}` | published, pinned, and whether a 
pin is holding edits back |
   
   Publishing and unpublishing move through the same service, so unpublishing 
drops the pin rather than leaving a private workflow carrying one. 
Re-publishing starts in the following state: coming back should not silently 
put old public content on show again.
   
   ## Two paths narrowed so a pin can hold
   
   Saving a workflow read the whole row and wrote it all back. Two 
consequences, both fixed here by writing only name, description and content:
   
   - a publish landing while a save was in flight was silently rolled back to 
what the save had read;
   - a request body could set the publish columns itself.
   
   Creating a workflow clears those columns for the same reason.
   
   ## Nothing on screen changes
   
   No read path consults the pinned copy yet, and there is no UI. Every 
workflow is in the following state it is in today. The endpoints answer, and 
nothing calls them.
   
   ## Tests
   
   19 backend cases in `WorkflowPublishSpec`: the state machine (follow → pin → 
re-pin → unpin → unpublish → re-publish), the guards (no write access, not 
published, workflow missing), that a create cannot inject publish columns, and 
that a save, a collaborator's save and a rename all leave the publish state 
alone.
   
   `hasUnpublishedChanges` compares the two copies as parsed JSON rather than 
as strings — the same graph can come back with its keys in another order, and 
reporting that as an edit is an alarm the author cannot clear. One case covers 
it.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to