Skip to content

fix(workflow-form): redraw a result's chart in place, and drop the key that was meant to rebuild it - #9021

Open
yangzhang75 wants to merge 3 commits into
apache:mainfrom
yangzhang75:fix/form-result-frame-churn
Open

yangzhang75 wants to merge 3 commits into
apache:mainfrom
yangzhang75:fix/form-result-frame-churn

Conversation

@yangzhang75

@yangzhang75 yangzhang75 commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Closes #8759. Part of the Form View feature (#8011); from the #8439 refinements (the result-frame item, raised in the #8441 review and deferred there).

Two things about the chart frame a result card shows.

The Form View rebuilt the frame on every result update. Each chart frame was keyed on a per-operator version, bumped on every emission of the result-update stream, so that a changed result would rebuild the frame rather than reuse it (the frame reads its content once, at creation). A visualiser that outputs a row per input row -- HTML Visualizer, URL Visualizer -- sends several updates with a picture over a slow source, and each one rebuilt the frame: the flicker #8759 describes. The key, the map behind it and the *ngFor that carried it go; the frame stays, and redraws in place on its own operator's updates. A re-run does not need the key either: it replaces the snapshot inside the operator's result service, which lives until the page is left, and a result that is cleared takes the frame down through vizHasContent.

The frame redraws on the first update, and at most once per interval after. VisualizationFrameContentComponent redrew on the result-update stream through auditTime(2 s), which holds every redraw, the first included, until the interval has elapsed. With the frame no longer rebuilt that showed: a re-run that finishes inside the interval sends a single update, already carrying the new picture, and the mounted frame showed the old one for the whole 2 s (mengw15, measured against the real result service; on main the key redrew it at once). The frame now throttles with a leading and a trailing edge: the first update redraws at once, and further updates inside the window coalesce into one redraw when it closes, with whatever picture is current then. The filter for the frame's own operator also runs ahead of the throttle: an update event carries only the operators whose result changed, so with the throttle first a window that closed on another operator's event handed the filter that event, which dropped it, and this operator's pending redraw was lost -- the last update of a run could leave the previous picture showing for good. The canvas's pinned result window mounts the same frame and gains the same immediate first redraw.

Any related issues, documentation, discussions?

Closes #8759, which came out of the #8441 review (where the key was introduced, with the Copilot threads about it left open for this fix). Part of #8439 and the Form View feature #8011.

The issue's "expected" -- bump the key only for a genuinely new result, and handle clearResults -- is not what this does: with the frame redrawing in place there is nothing left for a key to do. clearResults() runs when a workspace is torn down and when a computing unit is switched, not during a run.

Worth knowing, not changed here: the backend emits an update only for an operator whose tuple count changed, so a single-row visualiser that replaces its HTML at the same count produces no event at all, on the canvas and the form alike. That is a separate gap and a follow-up candidate.

How was this PR tested?

Unit tests (vitest). The frame's spec: the first update after mounting redraws at once; updates inside the interval are held to one trailing redraw, of the latest picture, and a window nothing arrived in draws nothing more; a redraw pending for this operator survives a later emission for another operator (this operator's update, a second one inside the window, another operator's event, the window closing -- and the picture that lands is this operator's latest), which is the case the old order lost; the ignore-other-operators and no-operator tests still pass. The form's spec: a result update re-limits the shown results and re-fits the visualisations and rebuilds nothing; the rendered spec pins that the chart frame is the same instance and element across that step's result updates, which is the assertion a returning key would fail. Deletion-checked: the leading edge, the trailing edge and the filter-before-throttle order each turn a named test red; so does a key on the frame.

eslint, prettier and the production (AOT) build pass; the full frontend suite passes.

Was this PR authored or co-authored using generative AI tooling?

Yes. Generated-by: Claude Code (Anthropic). Co-authored with Claude, reviewed line by line by the author before submission.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FVvP3ttj22f9LB4p9u2anY

@github-actions

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @EmilySun621, @aglinxinyuan
    You can notify them by mentioning @EmilySun621, @aglinxinyuan in a comment.

@github-actions github-actions Bot added fix frontend Changes related to the frontend GUI labels Oct 19, 2026
@Yicong-Huang Yicong-Huang added release/v1.3 back porting to release/v1.3 release/v1.2 back porting to release/v1.2 labels Oct 19, 2026
@github-actions
github-actions Bot requested review from mengw15 and xuang7 October 19, 2026 05:12
@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Backport auto-label report

This fix: PR was checked against each actively-supported release branch. A release/* label nominates a backport target; the branch's release manager approving this PR is what sends the fix there. The required Backport Approvals check stays red until every label below is approved, so each manager either approves or removes their own label — which is why the labels left on a merged PR are exactly the branches it reached.

Release branch Analysis
🚫 release/v1.3 Label was removed earlier (opt-out); not re-added. Re-add it by hand if this fix should be backported here after all — the branch's release manager then has to approve before this PR can merge.
🚫 release/v1.2 Label was removed earlier (opt-out); not re-added. Re-add it by hand if this fix should be backported here after all — the branch's release manager then has to approve before this PR can merge.

Auto-label run.

@codecov-commenter

codecov-commenter commented Oct 19, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.63%. Comparing base (52093b4) to head (7e91fc7).
⚠️ Report is 108 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9021      +/-   ##
============================================
+ Coverage     91.60%   91.63%   +0.02%     
+ Complexity     5038     5037       -1     
============================================
  Files          1283     1288       +5     
  Lines         57004    56961      -43     
  Branches       7419     7436      +17     
============================================
- Hits          52221    52198      -23     
+ Misses         2915     2903      -12     
+ Partials       1868     1860       -8     
Flag Coverage Δ *Carryforward flag
access-control-service 77.44% <ø> (ø) Carriedforward from ff0fc31
agent-service 99.56% <ø> (ø) Carriedforward from ff0fc31
amber 85.33% <ø> (ø) Carriedforward from ff0fc31
computing-unit-managing-service 64.05% <ø> (ø) Carriedforward from ff0fc31
config-service 87.73% <ø> (ø) Carriedforward from ff0fc31
file-service 82.31% <ø> (ø) Carriedforward from ff0fc31
frontend 96.49% <100.00%> (+0.07%) ⬆️
notebook-migration-service 83.77% <ø> (ø) Carriedforward from ff0fc31
pyamber 98.50% <ø> (ø) Carriedforward from ff0fc31
workflow-compiling-service 78.30% <ø> (ø) Carriedforward from ff0fc31

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mengw15 mengw15 removed release/v1.2 back porting to release/v1.2 release/v1.3 back porting to release/v1.3 labels Oct 19, 2026
@mengw15
mengw15 requested a balanced review from Copilot October 19, 2026 22:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

3 open issues
What changed in this PR

Fixes a latent redraw ordering issue in visualization frames and removes the unused “result version key” mechanism from the Form View chart frames.

Changes:

  • Reorders RxJS operators in VisualizationFrameContentComponent so per-operator filtering happens before auditTime, preventing missed redraws.
  • Removes per-operator resultVersion / resultKey / trackByKey logic and simplifies the Form View template to render the visualization frame directly.
  • Updates/adjusts unit tests to cover the redraw ordering case and remove the now-obsolete keying behavior.
File Description
frontend/​src/​app/​workspace/​component/​workflow-form/​workflow-form.component.ts Removes result-version keying logic and updates result-update handling/comments.
frontend/​src/​app/​workspace/​component/​workflow-form/​workflow-form.component.html Drops the *ngFor keyed frame workaround and renders the visualization panel content directly.
frontend/​src/​app/​workspace/​component/​workflow-form/​workflow-form.component.spec.ts Removes tests for the deleted keying API and refocuses result-update assertions.
frontend/​src/​app/​workspace/​component/​visualization-panel-content/​visualization-frame-content.component.ts Filters result-update events before throttling to avoid losing pending redraws.
frontend/​src/​app/​workspace/​component/​visualization-panel-content/​visualization-frame-content.component.spec.ts Adds coverage for the “interleaving operator update” redraw-loss scenario.

Review effort: Lite

yangzhang75 added a commit to yangzhang75/texera that referenced this pull request Nov 2, 2026
…and tidy the subscription (review)

Copilot on apache#9021: the unit test's "rebuilds nothing" was only a name, so the rendered spec now
holds the frame's component instance and host element across two updates for its step and checks
both are the same objects afterwards; the frame's three .pipe() calls are one pipe, so the
filter-before-audit order is visible in one place; and the result-update comment is cut to the
invariant, with the measurements left on apache#8759.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FVvP3ttj22f9LB4p9u2anY
@yangzhang75
yangzhang75 force-pushed the fix/form-result-frame-churn branch from 0b43bf1 to 1a216cd Compare November 12, 2026 21:43
yangzhang75 added a commit to yangzhang75/texera that referenced this pull request Nov 12, 2026
…and tidy the subscription (review)

Copilot on apache#9021: the unit test's "rebuilds nothing" was only a name, so the rendered spec now
holds the frame's component instance and host element across two updates for its step and checks
both are the same objects afterwards; the frame's three .pipe() calls are one pipe, so the
filter-before-audit order is visible in one place; and the result-update comment is cut to the
invariant, with the measurements left on apache#8759.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FVvP3ttj22f9LB4p9u2anY
yangzhang75 and others added 2 commits November 15, 2026 20:15
…y that was meant to rebuild it

The visualization frame audited before it filtered. An update event carries
only the operators whose result changed, so a window that closed on another
operator's event was handed that event by the filter and dropped, taking this
operator's pending redraw with it: the last update of a run could leave the
previous picture showing for good. Filter first. The canvas result panel uses
the same frame and gains the same reliability.

The Form View keyed each chart frame by a per-operator version, bumped on every
result update, meaning to rebuild the frame rather than reuse it. It could not
do that. Every visualisation operator takes its whole input before it draws
(`process_table`, single-snapshot output), so the update that carries a picture
is the one that mounts the frame, and a second one never arrives; measured on a
run, the chart's operator sees two updates, one picture and one frame, with the
key and without it. A re-run replaces the snapshot inside the operator's result
service, which lives until the page is left, so there is no new frame to key on
there either. The machinery never fired, so it goes.

No visible change: this fixes a latent ordering bug and removes code that
cannot run.

Closes apache#8759

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FVvP3ttj22f9LB4p9u2anY
…and tidy the subscription (review)

Copilot on apache#9021: the unit test's "rebuilds nothing" was only a name, so the rendered spec now
holds the frame's component instance and host element across two updates for its step and checks
both are the same objects afterwards; the frame's three .pipe() calls are one pipe, so the
filter-before-audit order is visible in one place; and the result-update comment is cut to the
invariant, with the measurements left on apache#8759.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FVvP3ttj22f9LB4p9u2anY

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues block approval of the chart-redraw ordering and in-place frame-update changes.

No open issues 🎉

3 resolved since last review

Review effort: Balanced

@mengw15 mengw15 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments

.pipe(untilDestroyed(this))
.pipe(
filter(rec => this.operatorId !== undefined && rec[this.operatorId] !== undefined),
auditTime(VisualizationFrameContentComponent.UPDATE_INTERVAL_MS),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the key gone, a quick re-run shows the old chart for 2 more seconds. Results are first polled 2 s after the run starts, so a run that finishes sooner sends a single update, already carrying the new picture. Nothing clears the previous result, so the frame is still mounted and waits out this window. On main the key redraws it at once.

I ran this with the real result service: the new picture appears immediately on main, and after 2 s here. Drawing on the first update (throttleTime with leading and trailing) fixes it and still keeps the same frame.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed and changed: throttleTime(UPDATE_INTERVAL_MS, asyncScheduler, { leading: true, trailing: true }), filter still first. The first update redraws at once, updates inside the window coalesce into one trailing redraw of whatever is current then, and a window nothing arrived in draws nothing more. The spec has the quick re-run case (first update after mounting redraws immediately), the coalescing, and the cross-operator case re-done with a pending second update so it still catches the order; each of leading, trailing and filter-before-throttle turns a named test red when flipped. The pinned result window mounts the same frame, so it gains the immediate first redraw too (7e91fc7).

// A result update re-limits what the form shows and re-fits the visualisations. The chart
// frame is left alone: it redraws in place on its own operator's updates. The per-operator
// version that used to key the frame here never produced a second frame -- a visualisation
// operator draws once, from its whole input -- so it is gone; the measurements are on #8759.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't true for every visualisation: HTML Visualizer and URL Visualizer output one row per input row, so a slow source sends several updates with a picture. On main each one rebuilds the frame, which is the flicker in #8759, and this PR does fix it. Also, there are no measurements on #8759. Could you correct this comment, the one in the template, and the description?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, and thanks for the measurement. The pie chart I counted on is a single-snapshot case and does not generalise: a row-per-row visualiser sends an update per batch, the key fired on each, and that rebuild was the flicker. Corrected here, in the template comment and in the description, which now says what the key did and what this PR fixes; the sentence pointing at measurements on #8759 is gone (7e91fc7).

…t the key did

Review fixes on apache#9021 (mengw15). The frame redrew on its operator's
updates through auditTime, which held the first redraw for the whole
interval: with the frame no longer rebuilt, a re-run that finished inside
the interval sent one update, already carrying the new picture, and the
mounted frame showed the old one for 2 s. It throttles with a leading and
a trailing edge now, so the first update redraws at once and the rest
coalesce into one redraw per window. The comments on the form (and the
PR description) claimed the removed key never fired; it fired on every
update of a visualiser that outputs a row per input row, and each rebuild
was the flicker of apache#8759 -- corrected.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FVvP3ttj22f9LB4p9u2anY
@yangzhang75
yangzhang75 requested a review from mengw15 November 28, 2026 03:54

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix frontend Changes related to the frontend GUI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(workflow-form): a result update rebuilds the visualization frame on every emission

5 participants