This is an automated email from the ASF dual-hosted git repository. rzo1 pushed a commit to branch fix-flux-jsyaml-v5-empty-doc-2.x in repository https://gitbox.apache.org/repos/asf/storm.git
commit 47784cba5d76c6da82bc6b70e63a611d743dc5af Author: Richard Zowalla <[email protected]> AuthorDate: Wed Jul 1 15:43:22 2026 +0200 fix(webapp): guard Flux viewer against js-yaml 5.x empty-input throw js-yaml 5.x (merged on 2.x via #8863) changed load('') to throw a YAMLException ('expected a document, but the input is empty') instead of returning undefined (see js-yaml migrate_v4_to_v5). The Flux Topology Viewer calls parseAndRender() on page load while the textarea holds only a comment (# YAML Definition), so jsyaml.load() now throws before the existing if(doc==null) guard, breaking the viewer at runtime. This latent bug shipped untested on 2.x because cypress-tests.yml was scoped to master only, so 2.x PRs never ran the e2e suite. Wrap the load in try/catch and treat empty/comment-only or malformed input as 'no document', and broaden cypress-tests.yml to run on 2.x. --- .github/workflows/cypress-tests.yml | 4 ++-- .../src/main/java/org/apache/storm/daemon/ui/WEB-INF/flux.html | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cypress-tests.yml b/.github/workflows/cypress-tests.yml index fc2c6007e..50b71368c 100644 --- a/.github/workflows/cypress-tests.yml +++ b/.github/workflows/cypress-tests.yml @@ -17,11 +17,11 @@ name: Cypress E2E Tests on: push: - branches: [ "master" ] + branches: [ "master", "2.x" ] paths: - 'storm-webapp/**' pull_request: - branches: [ "master" ] + branches: [ "master", "2.x" ] paths: - 'storm-webapp/**' workflow_dispatch: diff --git a/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/flux.html b/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/flux.html index ad676c17a..9d8699921 100644 --- a/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/flux.html +++ b/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/flux.html @@ -70,7 +70,14 @@ function parseAndRender() { var input = document.getElementById('taInput').value; - var doc = jsyaml.load(input); + var doc; + try { + doc = jsyaml.load(input); + } catch (e) { + // js-yaml >=5 throws on empty/comment-only input instead of + // returning undefined (see migrate_v4_to_v5); treat as no document. + return; + } if(doc==null){ return; }
