Skip to content

fix(webapp): guard Flux viewer against js-yaml 5.x empty-input throw (2.x)#8890

Merged
rzo1 merged 1 commit into
2.xfrom
fix-flux-jsyaml-v5-empty-doc-2.x
Jul 1, 2026
Merged

fix(webapp): guard Flux viewer against js-yaml 5.x empty-input throw (2.x)#8890
rzo1 merged 1 commit into
2.xfrom
fix-flux-jsyaml-v5-empty-doc-2.x

Conversation

@rzo1

@rzo1 rzo1 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

2.x companion to #8889.

2.x already merged js-yaml 5.2.0 (#8863), which carries a latent runtime bug: js-yaml 5.x changed load('') to throw YAMLException: expected a document, but the input is empty instead of returning undefined (see the v4→v5 migration guide).

The Flux Topology Viewer (flux.html) calls parseAndRender() on page load while the textarea holds only # YAML Definition, so jsyaml.load(input) now throws before the if (doc == null) return; guard — the viewer fails to render.

This slipped through on 2.x because cypress-tests.yml only triggered on master, so 2.x PRs never ran the e2e suite that catches it (this is exactly what happened with #8863).

Fix

  • Wrap jsyaml.load() in try/catch, treating empty/comment-only/malformed input as "no document".
  • Broaden cypress-tests.yml to also run on 2.x.

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.
@rzo1 rzo1 added this to the 2.8.9 milestone Jul 1, 2026
@rzo1 rzo1 merged commit 91b1040 into 2.x Jul 1, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant