The GitHub Actions job "Benchmarks" on texera.git/main has succeeded.
Run started by GitHub user github-merge-queue[bot] (triggered by 
github-merge-queue[bot]).

Head commit for run:
0b103f813666b13ab4aa2bad7dd29d06a92685a7 / yangzhang75 <[email protected]>
feat(gui): add the Form View edit mode, with instruction and result authoring 
(#8516)

### What changes were proposed in this PR?

Closes #8026. Part of the Form View stack (parent issue #8011), on main.
This is the first half of what was #8455 (closed, split in two at 2200
lines); the second half, authoring the inputs themselves, is #8517
stacked on this one. Four commits: the first is the feature, the second
and third are test-only follow-ups (the Windows CI leg and the template
coverage report), and the last opens the result picker to everyone with
one saved list of shown results (the design changes asked for in review,
mengw15's list shape included). The review commit is the branch tip.

Adds the edit mode of the page and the page-level authoring it enables.

- `toggleAuthoring`: with write access, Edit turns the page into
in-place authoring; Done returns it to the reader state. Edit mode is
the only state that enables workflow modification here
(`applyEditability`), and entering it is refused without write access at
the method itself, not only by hiding the button.
- The inspect panel goes live in edit mode: it acts as an editor
(`actsAsEditor`), its expose tick boxes are on (`exposeChoosing`), and
`inert` comes off, so the author opens a step on the embedded preview
and chooses which of its settings people fill in right there. It stays
inert and read-only for everyone else, as before.
- The embedded preview's right-click menu carries the structure lock.
The menu's re-shaping commands followed the modification flag alone, so
re-enabling it for the panel would have offered cut, paste, delete and
disable on the structure-locked preview. `texera-context-menu` now takes
`[structureLocked]` from the editor and gates those on modification AND
no lock (`canModify`); copy, the result toggles, execute-to and export
do not re-shape the graph and are unchanged.
- Write the author's instruction in place: the heading is edited in the
header (a row rather than one button, so the input is not nested in a
control) and the body as markdown with Write / Preview tabs. A reader
still sees it rendered, only when there is text.
- Pick which results to show, for everyone: the picker lists the final
steps and the intermediate steps that have view-result on the canvas,
and rebuilds live when an eye is toggled or the graph's shape or names
change (a step deleted, disabled, given a downstream link, or renamed, a
co-editor's edit included), from the graph's own streams rather than
only after the debounced compilation. What shows is one saved list,
`shownResultIds` (the shape mengw15 proposed): absent, every final step
shows, as on the canvas; once the author has chosen, exactly the listed
steps show, and `[]` means none, a choice the earlier pair of
opposite-signed lists (featured / turned off) could not store and could
contradict each other on. In edit mode a pill adds the step to or
removes it from that list; the first choice starts the list from the
final steps at that moment, so nothing the author saw disappears. The
accepted cost: a step that becomes final after the author has chosen
does not appear by itself. A definition whose only content is that list,
an empty one included, is still saved. A listed step whose eye has since
been turned off stays offered in edit mode only, so the author can take
it off the list; a reader is not offered a pill that could never turn
on. Anyone else, a writer merely viewing included, gets the same picker
but changes only their own view of the page; nothing is written, so a
reader without write access can choose too, and the choice lasts for the
page. A disabled step is neither offered nor shown, eye or no eye: the
compiled plan leaves it out.
- Edit mode is the only state that unlocks the graph from this page, and
only while no run is in flight (the canvas rule, kept so that entering
edit mode mid-run cannot undo it). The lock is a root-level flag with
writers that know nothing of this page: the execute service unlocks it
whenever a run ends (completed, failed, killed, reset), and the
computing-unit selector embedded here unlocks it when it finds no run on
the chosen unit. Rather than chase each caller, the page clamps at the
stream they all report to (`getWorkflowModificationEnabledStream`):
whenever the flag turns on while the page must stay locked, it is turned
off again, so a writer merely viewing can never reach the preview's
view-result command. In edit mode the canvas rule stands: locked while
running, unlocked when the run ends. The clamp runs a microtask after
the unlocking call, never inside it: `enableWorkflowModification`
enables undo/redo after it emits, and the stream still has other
subscribers to reach, so a nested disable would leave them on the stale
"true"; run afterwards, the disable is the last word and every consumer
sees one locked state. The execute service flips the lock before it
emits the new state; by the time the clamp looks, the execution-state
handler has re-applied the same rule with the final state, so in edit
mode the unlock stands. The step panel follows the same rule
(`panelLive`), not edit mode alone: the property frame does not consult
the lock before its own writes (the version sync on mount, the schema
defaults ajv fills in, the editing marker), so a step selected while a
run is in flight stays a read-only, inert mount even in edit mode and
turns live when the run ends. Done dismisses the step panel before
leaving edit mode, while the frame is still an editor: that is the only
state in which the property editor clears the "currently editing" marker
co-editors see.
- The embedded preview grows no editing buttons: no link tools on hover
(remove, breakpoint), and a selected operator unfolds its state and port
counts but not its delete, chat and add/remove-port buttons. None of
them can act on the structure-locked preview, so they only suggested it
could be edited.
- Open canvas saves first and hands over only once the save has
completed: the switch is a full-page load, which aborts a request still
in flight. Saves go out one at a time, in order: two persists in flight
at once can reach the backend out of order and the older content would
win, so the switch's save waits for an autosave already on its way, and
the page hands over only once the queue has drained: that save and any
asked for while it was in flight (the page stays interactive until the
hand-over) have completed; each request carries the workflow as it was
when the save was asked for, so the last one enqueued is the latest. The
drain outlives the page: the final save on the way out joins the same
queue rather than racing an autosave still in flight, and the queue is
closed after it. A failed save keeps the author on the form with the
error shown and does not stop the queue; a reader with nothing to save
goes straight through. A save's response feeds back the server-owned
metadata (the timestamp, and the normalised name when nothing changed)
but never undoes a rename made while it was in flight, and repaints
nothing once the page is gone. (#8456 does the save-then-navigate part
on the canvas side.)
- Keyboard focus is visible on the pill and tab buttons
(`:focus-visible`). The picker's pills are tracked by step (`trackBy`):
a toggle re-reads the config and rebuilds the choices as new objects,
and re-created buttons would have dropped the keyboard focus from the
pill just pressed. The instruction body carries an `aria-label`, since
its placeholder is gone as soon as there is text.
- `29c54bb85` (test only, workspace menu): the menu's export test
module-mocked the CommonJS `file-saver` package with `vi.mock`. Under
the Angular unit-test builder that call is not reliably hoisted (Vitest
warns about it on every platform), and with this stack's shared-chunk
graph it stopped applying on the Windows leg (7 of the last 8 Windows
runs of the unsplit PR, while main passes). The export now goes through
the existing injectable `FileSaverService`, as the dashboard downloads
already do, and the spec stubs that with TestBed. No behaviour change.
- `695c2fb4f` (test only, Form View rendered spec): the spec swapped the
property panel for a stub by overriding the page's imports, which
JIT-recompiles the page; a JIT template has no mapping back to the
`.component.html`, so the page's template read as 0% covered on codecov
from #8442 on (the 10 "missing" template lines there, 132 on the unsplit
PR). The real panel's template is blanked instead, with its lifecycle
hooks switched off, so the page stays AOT-compiled and its template is
measured again. The edit-mode markup this PR adds is then covered
through the DOM: Edit / Done, the Write / Preview tabs, heading and body
writing through, the picker's pills and empty hint.

The diff is about 1400 added lines because 725 of them are spec against
694 of source (of which 192 are stylesheet); the two test-only commits
and the review-driven redesign of the picker are a large part of it, and
the feature itself is under 700 lines.

Not in this PR: renaming, hiding, reordering, help text and removal of
the exposed inputs, and the author's view of a broken input. Those are
#8517.

### Any related issues, documentation, discussions?

Closes #8026. Part of the Form View feature (parent issue #8011).
Replaces the first half of #8455.

### How was this PR tested?

Unit tests (vitest). Direct-construction tests cover the authoring gate
(enter, leave, refused without write access, always allowed to leave),
the result picker's range (final steps until the author chooses, then
exactly the saved list, `[]` included; viewed and listed intermediates;
disabled steps left out), its live rebuild on an eye toggle, the
edit-mode toggle writing the default (the saved list started from the
final steps on the first choice), a viewer's own toggle writing nothing
and giving way on entering edit mode, a reader not offered a saved pick
whose eye is off, the lock clamped back whenever anything else unlocks
the graph outside edit mode, unlocked in edit mode once a run has ended
in the execute service's real order (unlock before state), and kept
locked when edit mode is entered mid-run, the switch's save queued
behind an autosave in flight with navigation after both, the final save
on the way out drained behind an autosave in flight after the page is
gone, a failed save not stopping the queue, a failed final save still
reported without throwing, an older save's response not undoing a rename
made meanwhile and no metadata repaint after the page is gone, a shown
step dropped from the cards and the picker the moment the graph's shape
makes it unavailable, a pill renamed the moment its step's display name
changes, the hand-over waiting for a save queued behind the switch's and
staying put when that save fails, the step panel dismissed on Done while
the frame is still an editor, the instruction writes going through the
binding service, and the switch's save-then-navigate order (navigates on
complete, stays on error, straight through for a reader). The rendered
spec covers the edit-mode header shape (title input outside the toggle,
`aria-controls`), the panel turning live in edit mode (editor on, tick
boxes on, inert off), and the panel staying read-only while a run is in
flight even in edit mode, turning live when the run ends. The context
menu's spec renders it under a structure lock with modification enabled
and checks cut, paste, delete, disable and enable are off while copy and
the result toggle stay; the editor's spec opens the right-click menu on
a locked editor and checks the lock arrived, and checks a locked preview
grows no link tools on hover or on add, and keeps a selected operator's
delete, chat and port buttons hidden while its state still unfolds,
while the canvas shows all of them. The binding service's spec checks
the first choice starts the list from the default handed in, later
choices flip within the list ignoring the default, and turning off the
only shown step leaves `[]` rather than an absent list; the action
service's spec checks a definition whose only content is
`shownResultIds: []` is still carried in the saved content. Each new
guard was deletion-checked (removing it turns the corresponding test
red). eslint, prettier and the production (AOT) build pass; every
changed line, template lines included, is statement and function covered
(5830 tests).

#### Video


https://github.com/user-attachments/assets/ca2f8e99-357a-48f7-95cb-6bf4e57c1bc4

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

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

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01FVvP3ttj22f9LB4p9u2anY

---------

Co-authored-by: Claude Fable 5.1 <[email protected]>
Co-authored-by: Meng Wang <[email protected]>
Co-authored-by: mengw15 <[email protected]>

Report URL: https://github.com/apache/texera/actions/runs/34702339732

With regards,
GitHub Actions via GitBox

Reply via email to