Skip to content

feat(ui): workflow tickets fancytable - #5642

Draft
SolidProgramming wants to merge 30 commits into
CactuseSecurity:developfrom
SolidProgramming:issue_5571
Draft

SolidProgramming wants to merge 30 commits into
CactuseSecurity:developfrom
SolidProgramming:issue_5571

Conversation

@SolidProgramming

@SolidProgramming SolidProgramming commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Changes

  • Tree table (MonitorWorkflowTicketTable.razor): tickets are root rows; request tasks expand below each ticket, and implementation tasks and approvals below each request task. Only the current page is loaded. The state change and "create implementation tasks" actions stay available per row. Columns can be resized and hidden; the page size selector sits at the right edge above the table.

    • Columns: actions, id, type, name, tasks, requester, state, start and end time. The task number and flow bundle id columns are no longer shown.
  • Server-side query (WorkflowTicketQueryBuilder): translates the table's column filters, sort and page, plus the task type and state dropdowns of the page, into Hasura where / order_by / limit / offset variables.

    • Filters are offered on id, name, requester, state, start and end time. All except the requester find a ticket if the ticket or any of its request tasks, implementation tasks or approvals matches; negated operators (e.g. "does not equal") only find tickets where no level matches.
    • State and id compare ids, so the database answers them quickly. The id filter compares ids exactly and therefore only offers "equals" and "does not equal"; other operators on the id are ignored by the table and the query builder.
    • The name filter compares the titles of ticket, request and implementation tasks and the approver group of approvals (case-insensitive). It only offers "equals", "does not equal" and "starts with".
    • Start and end time use the date filter of FancyTable 1.6.0 (date picker; "equals", "after", "on or after", "before", "on or before", "between" with both bounds included, "is empty"). Only the day is compared, the time is ignored.
    • The requester filter compares the user name of the ticket's requester (case-insensitive, all text operators; %, _ and \ in the input match literally). The requester exists only on the ticket, so this is a single lookup per ticket.
    • There is no free text search and no "contains" filter over all levels: such a match cannot use an index and is too slow on many tickets. The previous view had no search either. The type column is display only.
    • Sorting is offered on id, name, state, start and end time of the ticket.
  • Pager with total count: the pager shows the number of all matching tickets, the page numbers and always the first and last page (FancyTable 1.7.0). The count (request_ticket_aggregate) is much slower than a page on many tickets (≈0.2–0.7 s for 50,000 tickets), so WorkflowTicketCountCache keeps it while only page or sort change; it is counted again when the filters or dropdowns change or the list is refreshed. Page and count are queried in parallel.

  • GraphQL: getFullTicketsPaged now takes $where and $orderBy instead of $taskTypes / $stateIds; new getTicketCount with the same $where.

  • Hasura permissions: allow_aggregations for role auditor on request.ticket (the monitoring queries run with the best of admin and auditor). It only exposes the count of tickets the auditor can already read.

  • State icons (WorkflowStateIcons): the state column shows an icon after the state name for each default workflow state (e.g. a green check for "Done", a red cross for "Rejected"). Custom states are shown without icon.

  • Texts and help: help text H7030 describes the tree, paging, total count and the filter semantics; texts for the date filter operators (filter_op_greater_than, filter_op_greater_than_or_equal, filter_op_less_than, filter_op_less_than_or_equal, filter_op_between, filter_value_from, filter_value_to); new "what's new" entry; removed the unused text no_workflow_tickets.

  • Dependencies: SoPro.FancyTable updated to 1.7.0 (filter operators per column, date filters, total count in server mode); SBOM updated.

  • Version & docs: version bumped to 9.9.4 (9.9.3 is already released); revision history and version feature overview list this change under 9.9.4. The feature overview also gets back the correct number 9.9.2 for the rule hit import entry, which the branch had shifted to 9.9.3 after a merge.

Closing #5571


image brave_yXOJlR6CuN

@SolidProgramming SolidProgramming self-assigned this Nov 4, 2026
SolidProgramming and others added 25 commits November 4, 2026 14:39
minor table changes
make requester filterable again
…-orchestrator into issue_5571

# Conflicts:
#	documentation/version-feature-overview.md
#	roles/database/files/sql/idempotent/fworch-texts.sql
#	roles/ui/files/FWO.UI/FWO.Ui.csproj
@SolidProgramming
SolidProgramming marked this pull request as ready for review November 17, 2026 14:36
@tpurschke

Copy link
Copy Markdown
Contributor

PR review — round 1 of max. 5

Reviewed commit: 40db14a6af8320dacd61dda5bc7e2130ec143994 against develop (all 22 changed files inspected)

Findings

# Criticality Confidence Status Subject
F1 🟠 medium 🟢 high 🔴 new Date filter "Is empty" hides an open ticket once any of its tasks or approvals has a date, which contradicts help text H7030
F2 🔵 low 🟢 high 🔴 new revision-history.md adds entries for this feature to the released 9.9.0 section, with outdated details
F3 🔵 low 🟢 high 🔴 new Raw bi- icon classes instead of Icons.cs constants (WorkflowStateIcons, expand/collapse buttons)
F4 🔵 low 🟢 high 🔴 new MonitorWorkflow.razor re-implements the existing RunWithMonitoringRole extension
F5 🔵 low 🟡 medium 🔴 new A page size of 0 or less now means an unlimited ticket fetch (the old fallback to the default page size was removed)

No security defects found.

Recommendations

Fix in this PR (small and within the PR's purpose):

  • F1: make "Is empty" on the date columns match the documented semantics, or document the actual semantics in H7030.
  • F2: drop the three lines added under ## 9.9.0. The 9.9.4 entry already covers the feature.
  • F4: use apiConnection.RunWithMonitoringRole(user, action) and remove kMonitoringRoles.
  • F5: fall back to the default page size, or cap the limit, when PageSize <= 0.

Create follow-up issue:

  • F3: "UI: add Icons.cs constants for workflow state icons and tree expand/collapse buttons". The collapse/expand markup is copied from FancyRulesReport.razor, and new Icons constants need maintainer approval, so this fits better as one repo-wide cleanup. Alternatively, switch to existing constants in this PR.

Details

F1 — date "Is empty" uses all-levels negation, help says any level (roles/ui/files/FWO.UI/Services/WorkflowTicketQueryBuilder.cs:137, :248)
PositiveOperator maps IsEmpty to _not of "any level IsNotEmpty". For end_time this means "Is empty" only finds tickets where the ticket's date_completed, every request task's and implementation task's stop, and every approval's approval_date are all null. In practice, users filter "end time is empty" to find open tickets. An open ticket whose approval is already granted (approval_date set), or whose request task is stopped, disappears from the result. H7030 says the opposite for the date filters: "These filters also find a ticket if one of its levels matches" / "Auch diese Filter finden ein Ticket, wenn eine seiner Ebenen passt". The test EndTimeFilter_NegatedOperator_NegatesConditionOnAllLevels pins the current behavior, so this looks deliberate. It is still not what users expect from this operator, and it is not what the help text describes.
Suggested fix: for date columns, translate IsEmpty positively, e.g. ticket-level {date_completed: {_is_null: true}} (the ticket's own end) or any-level _is_null: true, and keep _not for NotEquals only. Otherwise state in H7030 (DE/EN) that "Is empty" requires all levels to be empty. Add a test with an open ticket that has an approved approval.

F2 — released 9.9.0 notes changed (documentation/revision-history.md:77-79)
Three bullets were added under ## 9.9.0 - 04.11.2026: the workflow monitoring tree table, state icons, and "update NuGet package SoPro.FancyTable to 1.5.0". This feature ships in 9.9.4, which has its own entry. The 9.9.0 lines also list the wrong filters (state, id, requester) and the wrong package version. This looks like a leftover from an earlier merge. Also, the 9.9.4 entry says the name filter offers "equals" and "starts with", but it also offers "does not equal".

F3 — raw icon classes (roles/ui/files/FWO.UI/Services/WorkflowStateIcons.cs:21-26, roles/ui/files/FWO.UI/Pages/Monitoring/MonitorWorkflowTicketTable.razor:38,44)
kWaitingIcon, kInProgressIcon, kPhaseDoneIcon and kNegativeIcon are private "bi bi-…" literals. The tree action buttons use bi bi-arrows-collapse / bi bi-arrows-expand directly. The UI guideline allows only existing Icons.cs constants (Icons.Undo, Icons.Warning, Icons.Check, Icons.Delete, Icons.Edit are already used correctly in the same file).

F4 — duplicated role-scope helper (roles/ui/files/FWO.UI/Pages/Monitoring/MonitorWorkflow.razor:80, :259-265)
ApiConnectionRoleScopeExtensions.RunWithMonitoringRole(user, action) already runs with the best of [Roles.Admin, Roles.Auditor], and MainLayout.razor and MissingSshHostKeysWarning.razor use it. The page's private copy plus its own role list can drift from the shared definition. Keep only the authenticationStateTask == null test branch around the shared extension.

F5 — page size of 0 or less is unbounded (roles/ui/files/FWO.UI/Services/WorkflowTicketQueryBuilder.cs:78)
Build turns request.PageSize <= 0 into limit = int.MaxValue and offset = 0. The paged query then loads the full ticketDetails fragment (request tasks, implementation tasks, approvals, comments, …) of every matching ticket. The previous page fell back to the default page size for such values, and the removed test UpdatePageSize_NonPositiveValueFallsBackToDefaultPageSize covered that. I could not verify whether FancyTable 1.7.0's default page-size selector can emit 0, so this may be latent today (hence medium confidence). The builder is public and FancyTable documents PageSize <= 0 as "pagination disabled", so a fallback or cap is cheap insurance.

Security coverage

Threat map: the page /monitoring/workflow is restricted to admin/auditor ([Authorize]). Ticket queries run under RunWithBestRole([admin, auditor]). Attacker-controlled inputs are the table's column filter values (Blazor Server, built server-side), and ticket/task/approval titles, approver groups and requester names (stored text) rendered in the table.

  • GraphQL injection — verified (static). The $where/$orderBy variables are built from fixed field and operator constants. Column and sort keys are allow-listed by switch (unknown keys are ignored). User values only appear as comparison values in GraphQL variables. _ilike input is escaped for \, %, _ (EscapeLikePattern, covered by RequesterFilter_EscapesLikeWildcards). State filters resolve to ids on the client side. Dates are parsed with DateOnly.TryParseExact, and ids with long.TryParse.
  • Authorization / Hasura — verified (static). The new allow_aggregations applies only to role auditor on request.ticket. That role's select filter is {}, so the count exposes no rows the auditor cannot already read. I checked the auditor column permissions for every field used in where/order_by (ticket, reqtask, impltask, approval, uiuser.uiuser_username), and all are granted. ticket.uiuser is the requester_id relationship. The metadata is applied by roles/api/tasks/hasura-install.yml on install and upgrade.
  • Role switching under concurrent page loads — verified (static). The table can overlap page requests. GraphQlApiConnectionRoles keeps the role stack in an AsyncLocal, so a superseded request cannot leak a role into another one.
  • HTML output / stored XSS — verified (static). There are no MarkupString or Html.Raw additions. Names, requester and state names are rendered as Razor text or through FancyTable ValueSelector. Icon classes are constants. There are no inline scripts or handlers, and the CSP is unchanged.
  • Resource limits — partially verified. Paging is pushed into the query (limit/offset), and the expensive count is cached per where. See F5 for the unbounded fallback. The unindexed _ilike on titles is limited to admin/auditor and to prefix matches.
  • Not applicable: authentication/JWT, REST endpoints (none changed), file handling, remote fetches, secrets, and the installer (only the version bump and metadata).
  • Negative tests inspected: unsupported operators are ignored, non-numeric ids match nothing, LIKE wildcards are escaped, superseded requests do not overwrite tickets, and query failures are reported and return empty. There is no test with hostile markup in titles for the new table. That is low risk because rendering goes through Razor text.

Tests

I ran dotnet test … --filter UiMonitorWorkflow|WorkflowTicketQueryBuilder|WorkflowTicketCountCache|WorkflowStateIcons|FancyTableTextFactory on the PR head: 131 passed, 0 failed (build of the PR head succeeded). The test files were checked by grep for guideline conformance (Assert.That, no ClassicAssert, no inline array arguments, one fixture per file) and their method lists were reviewed; the query-builder tests were read in full. I did not run the full suite or dotnet format, and I did not test the UI in a browser.

Review metadata

  • Model: Claude Opus 5.5 (claude-opus-5-5) in Claude Code, with the default reasoning settings of this session (no extended effort override).
  • Depth: deep, chosen because of the Hasura permission change and server-side query construction from user filter input. I ran the correctness/quality pass and the security pass directly with the fwo-review-pr checklists. No built-in review command or sub-agent was used.
  • Delegation: none. All scans (inline arrays, icon usage, localization keys, help/whats-new presence) ran on the primary model, because the diff was small enough to inspect directly.
  • Usage: ≈152k review tokens (input + output + cache creation, deduplicated by message id; cache reads of ≈4.7M reported separately and excluded), measured from the Claude Code session transcript (method 2). The ceiling is 1M (deep). The figure was taken just before posting.
  • Notes: The PR description says SoPro.FancyTable was updated to 1.7.0 and the SBOM was updated. However, develop already references 1.7.0, and this PR only adds a trailing newline to the SBOM.

@SolidProgramming
SolidProgramming marked this pull request as draft November 18, 2026 10:03
…-orchestrator into issue_5571

# Conflicts:
#	documentation/version-feature-overview.md
#	roles/database/files/sql/idempotent/fworch-texts.sql
@SolidProgramming
SolidProgramming marked this pull request as ready for review November 18, 2026 11:05
@sonarqubecloud

Copy link
Copy Markdown

@tpurschke

tpurschke commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

@SolidProgramming looking really good. just found one issue with filtering the name column

Screencast_20261118_222904.webm

@SolidProgramming
SolidProgramming marked this pull request as draft November 24, 2026 07:38
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.

Monitoring - Workflow - Tickets: filter & sorting not working

2 participants