yangzhang75 opened a new issue, #8496:
URL: https://github.com/apache/texera/issues/8496
### Symptom
Open any workflow, let it autosave twice. The first `POST
/api/workflow/persist` succeeds, the second returns 500:
```
IntegrityConstraintViolationException: null value in column "is_public" of
relation "workflow" violates not-null constraint
at WorkflowResource.persistWorkflow (WorkflowResource.scala:463)
```
On the operator canvas the autosave subscription has no error handler, so
the failure is silent: the user keeps editing and nothing after the first save
is stored. The Form View shows "Could not save" on every debounce.
### Root cause
Two halves, one on each side.
1. Backend: #8125 replaced `workflowDao.update(workflow)` in
`persistWorkflow` with an explicit `UPDATE ... SET name, description, content,
is_public = workflow.getIsPublic`. The DAO update skipped a null `isPublic`;
the explicit set writes it.
2. Frontend: every caller feeds the persist response back into
`setWorkflowMetadata(...)`. That response is the stored row, whose flag is
named `isPublic`; the metadata type (and `GET /api/workflow/{wid}`) call it
`isPublished`. So after the first save `isPublished` is undefined, the next
save posts `isPublic: undefined`, JSON drops the key, Jackson leaves the pojo
field null, and the backend writes NULL.
A stale `isPublic: false` on a save could likewise un-publish a published
workflow.
### Fix
- `persistWorkflow` writes name, description and content only. Publishing
stays with `/public` and `/private`, `default_view` with `/set-default-view`.
- 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.
- Scala tests: a save with no flag neither fails nor changes `is_public`; a
save carrying `false` does not un-publish. Frontend specs updated for the
payload and the mapping.
Found while verifying #8455 on a flag-on instance (parent #8011). Reproduced
against a real server with the exact second-save payload, and again in a
headless browser (two renames, both persists 200 after the fix).
--
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]