feat(workflow-form): Form View page shell, load, and the shared spec harness - #8376
Conversation
Automated Reviewer SuggestionsBased on the
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8376 +/- ##
============================================
+ Coverage 94.03% 94.04% +0.01%
Complexity 4821 4821
============================================
Files 1204 1207 +3
Lines 48991 49090 +99
Branches 5956 5959 +3
============================================
+ Hits 46067 46166 +99
Misses 1458 1458
Partials 1466 1466
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
69507ad to
ea2e7ae
Compare
|
/request-review @mengw15 |
There was a problem hiding this comment.
🟡 Changes recommended
The new page is unreachable without route registration, and its feature-flag and error-handling behavior must be corrected.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds the initial read-only workflow Form View shell and reusable test harness.
Changes:
- Loads Form View workflows behind a feature flag.
- Adds navigation, collaborator display, and service cleanup.
- Adds shared mocks and unit tests.
File summaries
| File | Review |
|---|---|
frontend/src/app/workspace/component/workflow-form/workflow-form.spec-harness.ts |
Adds reusable test mocks and fixtures. No issues found. |
frontend/src/app/workspace/component/workflow-form/workflow-form.component.ts |
Implements loading, redirects, read-only state, and cleanup. Critical: the component lacks route registration. Moderate: check the feature flag before requests and avoid misreporting generic failures as access errors. |
frontend/src/app/workspace/component/workflow-form/workflow-form.component.spec.ts |
Tests loading, redirects, read-only behavior, and cleanup. No issues found. |
frontend/src/app/workspace/component/workflow-form/workflow-form.component.scss |
Styles the shell and top bar. No issues found. |
frontend/src/app/workspace/component/workflow-form/workflow-form.component.html |
Defines the page shell and view switch. Nit: add required visual evidence to the PR description. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 4
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
mengw15
left a comment
There was a problem hiding this comment.
Two asks:
-
Please register the
workflow/:id/formroute here rather than in the final slice — the shell already guards it fully (flag off redirects to the canvas, and even with the flag on nothing can setdefault_view = FORMfrom the UI yet), so it exposes nothing while making this and every later slice testable at the real URL. Note it must sit aboveworkflow/:idso the segment isn't swallowed. -
With the route in, a screenshot (or short recording) of the shell in the description becomes cheap — and since the spec deliberately skips template rendering, it would be the review's only evidence of the rendered page, as #8318's screenshots were.
ea2e7ae to
a3ed02c
Compare
|
Thanks @mengw15. Both addressed in a3ed02c:
|
mengw15
left a comment
There was a problem hiding this comment.
Left one comment, plus a coverage ask: codecov has the patch at 74.5%, with 25 of the 26 missing lines in the template (the direct-construction specs never render it). Could you add a TestBed-rendered spec covering the template — the name/avatar row, the Canvas button actually triggering the switch, and the loading/body swap — and bring the patch as close to 100% as the v8-ignored navigation allows? That also replaces the screenshot as rendering evidence going forward.
…harness The read-only shell of the Form View page: behind the feature flag it loads the workflow the URL names, redirects to the operator canvas when the workflow does not open in the form (or the flag is off), shows it read-only, hands back to the canvas, and releases the shared singleton services on the way out. The title bar's rename/save, the read-only preview, the inputs, running and results are added on top by later PRs. Also adds the shared spec harness (workflow-form.spec-harness.ts) these specs build the component from; later slices extend it with the mocks they introduce. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
a3ed02c to
fcafb53
Compare
|
@mengw15 on the coverage ask: added |
mengw15
left a comment
There was a problem hiding this comment.
LGTM, thanks for addressing the comments
…apache#8391) ### What changes were proposed in this PR? Building on the Form View page shell (apache#8376), this PR adds the title bar and the save it needs (parent issue apache#8011). Frontend only. * The workflow name, renamable inline exactly as on the operator canvas, with the same "Saved at ..." state beside it. Both follow the workflow's metadata live through the same `workflowMetaDataChanged` subscription the canvas uses, so a rename or save (this page's own, or a co-editor's) refreshes the name, its width, and the saved-at state from one place, and the two views never drift apart. * The debounced save both views share, so an edit in one view is not lost in the other. It saves only the workflow this page opened (never spawning a stray "Untitled workflow" from a payload with no id), preserves a position for every operator (a partial map makes a workflow unopenable), saves once more on the way out and before handing back to the canvas, and reports a failed save rather than losing it silently. * Locks the workflow to read-only on this page (`disableWorkflowModification`): the graph and its properties are shown, not edited. A later PR's authoring mode makes them editable with write access. The read-only preview, the inputs, running and results are added by later PRs. #### Screenshot The title bar (renamable name, "Saved at ..." state, the Canvas / Form View switch) on the read-only page: <img width="1280" height="86" alt="Screenshot 2026-09-03 at 11 18 10 PM" src="https://github.com/user-attachments/assets/b1fa29a8-8b08-4b0c-bfda-51e62d8628f6" /> ### Any related issues, documentation, discussions? Part of the Form View feature (parent issue apache#8011); stacked on apache#8376 (the page shell). Until apache#8376 merges, this PR's diff includes that PR's commit as well. close apache#8019 ### How was this PR tested? Unit tests (vitest): `workflow-form.component.spec.ts` (21 tests). As with the shell, the component injects heavy services and child components, so its spec constructs it directly with the shared harness's mocks rather than through TestBed; template rendering is therefore not exercised, but the component and the harness are at 100% of the TypeScript lines this PR adds. The template compiles cleanly under `ng build`. ### Was this PR authored or co-authored using generative AI tooling? Yes. Co-authored with Claude (Anthropic), reviewed line by line by the author before submission. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
### What changes were proposed in this PR? Building on the title-bar frame (apache#8391), this PR adds the collapsible read-only **workflow preview** to the Form View, and the read-only support the embedded editor needs (parent issue apache#8011). Frontend only. * A "Workflow" strip on the page that opens to show the same workflow editor and mini-map the operator canvas uses, embedded here read-only. It is built the first time the reader opens the strip (a frame after the strip is revealed, so JointJS measures a real size rather than a zero-sized one that misroutes links), then centred. * `structureLocked` on the shared `workflow-editor`: a mode that locks the paper's own interactions (dragging, linking, the editor's delete/cut/port commands) without touching the workflow-modification lock the property panel rides on, and suppresses the shared cursor so a read-only view never broadcasts one. It defaults to `false`, so the operator canvas is unchanged. A container `ResizeObserver` keeps the paper sized to its own container (the strip toggles it via `display:none`, which the window-resize handler never hears), and operators already in the graph when this late-mounting editor appears are repainted so a completed run's colours are not missing. * With the flag on the form renders for any workflow, so the preview shows the graph read-only regardless of the workflow's default view. The inputs, running and results are added on top of this by later PRs. #### Screenshot The workflow preview open on the read-only page (the "Workflow" strip expanded to the embedded editor + mini-map): <img width="1247" height="543" alt="Screenshot 2026-09-04 at 1 25 22 PM" src="https://github.com/user-attachments/assets/bf5ce08e-6df9-4c68-9629-6cff55f3b491" /> ### Any related issues, documentation, discussions? Closes apache#8020. Part of the Form View feature (parent issue apache#8011). Builds on the now-merged page shell (apache#8376) and title bar (apache#8391); this PR's diff is only its own change on current main. ### How was this PR tested? Unit tests (vitest): `workflow-form.component.spec.ts` (direct construction) and `workflow-form.rendered.spec.ts` (TestBed-rendered template) cover the strip's open/build/close/walk-away behaviour and the rendered bar; the shared `workflow-editor.component.spec.ts` (106 tests) is unchanged and green, confirming the `structureLocked` split leaves the canvas untouched. The page component is at 100% of its TypeScript, and every line added to `workflow-editor` is covered. Three template lines are not exercised: the `<texera-workflow-editor>` and `<texera-mini-map>` embed behind `*ngIf`, which need a real JointJS paper jsdom cannot provide (the editor's own paper code is v8-ignored for the same reason). `ng build` is clean. ### Was this PR authored or co-authored using generative AI tooling? Yes. Co-authored with Claude (Anthropic), reviewed line by line by the author before submission. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
What changes were proposed in this PR?
The base of the Form View page (parent issue #8011): a new
/user/workflow/:id/formpage, of which this PR lays down the read-only shell. Frontend only.This PR is independent of the property-editor "choose exposed" PR (#8318) and builds directly on the merged foundation (feature flag #8013,
default_view#8014, shared types #8015, form-binding service #8016). The Form View is two parallel tracks -- the authoring affordance (#8318) and the reader page -- and this is the first slice of the reader-page track; the later page slices (title bar/save, read-only preview, rendering the inputs, running, results, authoring) all build on this component.Behind the
formViewEnabledflag it loads the workflow the URL names; with the flag off it hands straight to the operator canvas. With the flag on the form renders for any workflow --default_viewonly picks which view a workflow lands on by default, not whether the form is reachable (per Form View: a form-based view for running a workflow #8011) -- and a failed load shows a neutral message.Shows the workflow read-only (the graph and its properties are not edited here) and offers a switch back to the operator canvas via a full page load.
Releases the shared singleton services (graph, shared model, computing-unit connection, console, results) on destroy, so nothing left bound here follows the user to the next page.
Registers the
workflow/:id/formroute (above the canvasworkflow/:idroute, so the trailing segment is not swallowed), making the page reachable at its real URL. The page still guards itself, so nothing is exposed while the flag is off.It also adds
workflow-form.spec-harness.ts, the shared mock/factory the later page slices build their specs from; each slice extends it with the dependencies it introduces.Screenshot
Screenshot
The read-only page shell at
/user/workflow/:id/form(behind the flag, a form-default workflow). Since the spec deliberately skips template rendering, this is the rendered-page evidence for the view.Any related issues, documentation, discussions?
Closes #8018.
Part of the Form View feature (parent issue #8011); builds on the merged #8013/#8014/#8015/#8016. Independent of #8318.
How was this PR tested?
Unit tests (vitest):
workflow-form.component.spec.ts(7 tests, direct construction) plusworkflow-form.rendered.spec.ts(4 TestBed-rendered tests that stand the real template up -- only the two child icons are blanked, so the page's own template renders as shipped). The page component injects ~14 services and heavy child components, so the direct spec constructs it with the shared harness's mocks; the rendered spec covers the template through TestBed. The component (61/61) and the template (31/31) are both at 100% locally. The template compiles cleanly underng build.Was this PR authored or co-authored using generative AI tooling?
Yes. Co-authored with Claude (Anthropic), reviewed line by line by the author before submission.