Skip to content

fix(workflow): a plain save writes is_public as NULL from the second autosave on (regression from #8125) #8496

Description

@yangzhang75

What happened?

Open any workflow and let it autosave twice. The first POST /api/workflow/persist succeeds; the second, and every one after it, returns 500. On the operator canvas the autosave subscription has no error handler, so this is silent: the user keeps editing and nothing after the first save is stored. The Form View shows "Could not save. Your latest changes are not stored yet." on every debounce. Expected: every save succeeds and leaves the publish flag alone.

Root cause, two halves:

  1. Backend: feat(workflow): persist is_form_view and add Form View toggle endpoints #8125 replaced workflowDao.update(workflow) in persistWorkflow with an explicit UPDATE ... SET name, description, content, is_public = workflow.getIsPublic. The DAO update never wrote a null isPublic; the explicit set does.
  2. Frontend: every caller feeds the persist response back into setWorkflowMetadata(...). That response is the stored row, whose flag is named isPublic, while the metadata type and GET /api/workflow/{wid} call it isPublished. After the first save isPublished is undefined, the next save posts isPublic: undefined, JSON drops the key, the pojo field is null, and the backend writes NULL into a NOT NULL column.

A stale isPublic: false on a save could likewise un-publish a published workflow, since publishing has its own endpoints (/public, /private) and a save should not touch the flag at all.

Fix: persistWorkflow writes name, description and content only; the frontend stops sending isPublic on a save and parseWorkflowInfo carries a persist response's isPublic over to isPublished so metadata fed back from a save keeps the publish state. Found while verifying #8455 (parent #8011).

How to reproduce?

  1. Open any workflow on the canvas or in the Form View (flag on).
  2. Make an edit, wait for the autosave (5 s). It succeeds.
  3. Make another edit, wait again. POST /api/workflow/persist returns 500; on the canvas nothing is shown, on the Form View "Could not save" appears.

Or replay the request directly: POST /api/workflow/persist with {wid, name, description, content} and no isPublic key returns 500.

Version/Branch

1.4.0-incubating-SNAPSHOT (main)

Commit Hash (Optional)

b28faee (#8125) introduced the explicit is_public write; reproduced on 1fbd346.

What browsers are you seeing the problem on?

Chrome

Relevant log output

[ERROR] [io.dropwizard.jersey.errors.LoggingExceptionMapper] [dw-736 - POST /api/workflow/persist] - Error handling a request: a05806be43d8c174
org.jooq.exception.IntegrityConstraintViolationException: SQL [update "texera_db"."workflow" set "name" = ?, "description" = ?, "content" = ?, "is_public" = ? where "texera_db"."workflow"."wid" = ?]; ERROR: null value in column "is_public" of relation "workflow" violates not-null constraint
	at org.apache.texera.web.resource.dashboard.user.workflow.WorkflowResource.persistWorkflow(WorkflowResource.scala:463)
"POST /api/workflow/persist HTTP/1.1" 500

Activity

  1. github-actions commented on Sep 11, 2026

    @github-actions
    Contributor

    👋 Thanks for opening this issue, @yangzhang75!

    It looks like the issue description doesn't quite follow our template yet:

    • This issue doesn't appear to use one of our templates (Bug, Feature, or Task). Please open it using a template so the required details are captured.

    Filling out the template helps reviewers understand and triage your contribution faster. Please edit the description to complete it. This message will disappear automatically once the template is followed.

    You can find the template prompts by editing the description, or see CONTRIBUTING.md for the full contribution flow.

  2. yangzhang75 commented on Sep 11, 2026

    @yangzhang75
    ContributorAuthor

    /take

  3. added a commit that references this issue on Sep 11, 2026
    3488d37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions