Skip to content

42381 frontend [ workflows ] When cleaning and changing filters, the results does not match the filter#98

Open
Maria-Lordwill wants to merge 108 commits intomasterfrom
frontend/workflows/42381__when_cleaning_and_changing_filters_the_results_does_not_match_the_filter
Open

42381 frontend [ workflows ] When cleaning and changing filters, the results does not match the filter#98
Maria-Lordwill wants to merge 108 commits intomasterfrom
frontend/workflows/42381__when_cleaning_and_changing_filters_the_results_does_not_match_the_filter

Conversation

@Maria-Lordwill
Copy link
Collaborator

@Maria-Lordwill Maria-Lordwill commented Jan 13, 2026

Fix workflows filters to use task API names and add cancelable filter requests, updating endpoints to GET /templates/titles-by-workflows and GET /templates/titles-by-tasks with count results

Replace step-id filtering with task API name filtering across backend serializers, queries, and frontend sagas/slices; add cancelable filter/preset/steps requests; introduce task- and workflow-based template titles endpoints and UI filters; update tables to a clickable Task column and propagate count in titles responses.

📍Where to Start

Start with the templates titles endpoints in processes.views.template.TemplateViewSet at [file:backend/src/processes/views/template.py], then review query changes in TemplateTitlesByWorkflowsQuery and TemplateTitlesByTasksQuery at [file:backend/src/processes/queries.py], followed by the workflows slice and saga at [file:frontend/src/public/redux/workflows/slice.ts] and [file:frontend/src/public/redux/workflows/saga.ts].


📊 Macroscope summarized ecb1efa. 36 files reviewed, 22 issues evaluated, 11 issues filtered, 0 comments posted

🗂️ Filtered Issues

backend/src/processes/queries.py — 0 comments posted, 4 evaluated, 2 filtered
  • line 1743: The status parameter is typed as Optional[WorkflowStatus] (an integer enum with values 0, 1, 3), but the code attempts to use it as a key in WorkflowApiStatus.MAP which has string keys ('running', 'done', 'snoozed'). This will raise a KeyError at runtime when a valid WorkflowStatus integer is passed. The lookup WorkflowApiStatus.MAP[status] expects a WorkflowApiStatus string, not a WorkflowStatus integer. [ Already posted ]
  • line 1839: The _get_where method only explicitly handles TaskStatus.ACTIVE and TaskStatus.DELAYED, but TaskStatus.LITERALS includes PENDING, COMPLETED, and SKIPPED. If a caller passes TaskStatus.PENDING or TaskStatus.SKIPPED, the code falls into the else branch which filters for dereferenced_performers.is_completed IS TRUE. This is semantically incorrect for pending and skipped tasks, which are not completed. [ Already posted ]
backend/src/processes/views/template.py — 0 comments posted, 3 evaluated, 3 filtered
  • line 154: The action name 'titles' in get_permissions() at line 154 was not updated to 'titles_by_workflows' when the action was renamed. This causes the titles_by_workflows action to fall through to the default permissions at lines 180-186, which incorrectly require UserIsAdminOrAccountOwner() permission instead of the intended basic permissions (UserIsAuthenticated, ExpiredSubscriptionPermission, BillingPlanPermission). [ Already posted ]
  • line 154: The get_permissions() method still checks for 'titles' at line 154, but the action was renamed from titles to titles_by_workflows. This means when the titles_by_workflows endpoint is accessed, self.action will be 'titles_by_workflows' which won't match 'titles' in the tuple, causing the permission check to fall through to the default case (lines 180-186) which incorrectly requires UserIsAdminOrAccountOwner() permission instead of the intended less restrictive permissions. [ Already posted ]
  • line 489: The action was renamed from titles to titles_by_workflows, but the permissions check in get_permissions() at line 154 still references 'titles' instead of 'titles_by_workflows'. This means the titles_by_workflows endpoint will fall through to the default permissions (lines 180-186) which require UserIsAdminOrAccountOwner(), potentially blocking regular users who should have access to this endpoint. [ Already posted ]
frontend/src/public/api/getTemplatesTitlesByTasks.ts — 0 comments posted, 1 evaluated, 1 filtered
  • line 12: The newly added function getTemplatesTitlesByTasks relies on urls.templatesTitlesByTasks, but there is no evidence in the provided code (specifically frontend/src/public/utils/getConfig.ts or commonRequest.ts's getBrowserConfigEnv) that this new key exists in the configuration object returned by getBrowserConfigEnv(). Accessing a property on an undefined configuration object or accessing a missing key that results in undefined being passed to commonRequest could lead to constructing an invalid URL (e.g., undefined?status=active). [ Already posted ]
frontend/src/public/components/Highlights/TemplatesFilter.tsx — 0 comments posted, 2 evaluated, 1 filtered
  • line 77: The logic inside the truncatedTemplates useMemo hook triggers a state update (handleShowAll calls setShowAllVisibleState) at line 77 during the component's render phase. Triggering side-effects (like state updates) directly within the render body or useMemo violates React's purity contract. This can cause 'Too many re-renders' errors or inconsistent state if the conditional logic isSelectedWorkflowsHidden (which was modified in this diff) fails to stabilize immediately. [ Out of scope ]
frontend/src/public/components/Tasks/container.ts — 0 comments posted, 2 evaluated, 2 filtered
  • line 80: A runtime logic error occurs due to the interaction between the new taskApiNameFilter property and the SyncedTasks configuration. The getQueryParamByProp for taskApiNameFilter is set to the String constructor. Since taskApiNameFilter is nullable (defaulting to null), String(null) produces the string "null", which is then serialized to the URL (e.g., &template-task=null). When reading this back, the createAction logic checks if (taskApiNAme) which evaluates the string "null" as truthy, resulting in setFilterStep("null") being called. This causes the task list to filter by the literal string API name "null" instead of applying no filter. This contrasts with templateIdFilter where Number("null") results in NaN and is handled safely. [ Already posted ]
  • line 140: In container.ts, the withSyncedQueryString configuration for taskApiNameFilter uses String as the serializer in getQueryParamByProp. When taskApiNameFilter is null (indicating no filter), String(null) returns "null", causing ?template-task=null to be written to the URL. [ Already posted ]
frontend/src/public/components/TuneViewModal/TuneViewModal.tsx — 0 comments posted, 1 evaluated, 1 filtered
  • line 112: In TuneViewModal, templateTasks can be undefined if getTemplatesTasks returns undefined for the given templateId (e.g., during loading or if invalid). While optional chaining (?.) is used in the useEffect, it is NOT used when accessing templateTasks inside handleApplyChanges. If handleApplyChanges is triggered (e.g. by user clicking 'Apply') while templateTasks is still undefined, templateTasks.forEach will throw TypeError: Cannot read properties of undefined (reading 'forEach'). [ Out of scope ]
frontend/src/public/components/Workflows/WorkflowModal/WorkflowModal.tsx — 0 comments posted, 1 evaluated, 1 filtered
  • line 107: In componentDidUpdate, the code previously accessed this.props.workflow?.kickoff.id using optional chaining, guarding against cases where kickoff might be undefined on the workflow object (a case explicitly handled in renderKickoff with if (!initialKickoff ...)). The new implementation destructures kickoff from workflow and accesses kickoff.id directly without a check. If a workflow is loaded that is missing the kickoff object (e.g. legacy data or partial API response), accessing kickoff.id will throw a runtime error ('Cannot read property id of undefined'). [ Already posted ]

Maria-Lordwill and others added 30 commits October 27, 2025 15:05
…ces and update related queries and serializers to use template_task_api_name instead
…to frontend/tech_debt/36989__moving_template_task_id_to_template_task_api_name
… from templateTaskId to templateTaskApiName and replace the stepIdFilter entity with the taskApiNameFilter entity
…component and getRenderPlaceholder into a separate function
…e table from a 'starters' filter to plain text
…maticapp/pneumaticworkflow into frontend/workflows/43469__move_filters_to_header
…GET /templates/titles-by-tasks and in the response rename the property workflows_count to count
…ET /templates/titles-by-workflows and in the response rename the property workflows_count to count
- for the 'FilterSelect' component, add the ability to disable it
- in 'workflowTable' component: replace the header in the 'performers' column in the table from a 'performers' filter to plain text
- in the performers filter at the top: added the icon and added displaying text on the badge
…m one template to multiple templates; remove the 'All options' checkbox from all filters on the workflow page
…s to the loadTemplateSteps logic (preserve selected tasks for existing templates and remove tasks for deleted templates)
@worldzofai

This comment was marked as spam.

Removed default empty arrays from getTemplatesTasks and
getTemplatesVariables selectors, which caused Maximum update
depth exceeded error for non-existent templateId
@Maria-Lordwill Maria-Lordwill added the bug Something isn't working label Jan 20, 2026
@Maria-Lordwill Maria-Lordwill added bug Something isn't working Frontend Web client changes request and removed bug Something isn't working Frontend Web client changes request labels Jan 20, 2026
placeholder,
type = 'text',
icon,
ref,
Copy link

Choose a reason for hiding this comment

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

If a caller passes an id prop, it overwrites the generated id on the input (via ...props), but htmlFor still uses the generated inputId, breaking label-input association. Consider destructuring id from props and using id || inputId for both attributes.

🚀 Want me to fix this? Reply ex: "fix it for me".

user: User,
with_tasks_in_progress: Optional[bool] = None,
workflows_status: Optional[WorkflowStatus] = None,
status: Optional[WorkflowStatus] = None,
Copy link

Choose a reason for hiding this comment

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

status is typed as WorkflowStatus (integers like 0, 1, 3), but WorkflowApiStatus.MAP expects WorkflowApiStatus string keys ('running', 'done', 'snoozed'). This will raise KeyError. Consider fixing the type hint to Optional[WorkflowApiStatus] or changing the lookup logic.

Suggested change
status: Optional[WorkflowStatus] = None,
status: Optional[WorkflowApiStatus] = None,

🚀 Want me to fix this? Reply ex: "fix it for me".

export type TGetTemplatesTitlesByTasksResponse = ITemplateTitleBaseWithCount[];

export function getTemplatesTitlesByTasks(completionStatus: ETaskListCompletionStatus) {
const {
Copy link

Choose a reason for hiding this comment

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

Possible runtime error: code assumes config/data always exist. Suggest guarding before destructuring/iterating (e.g., ?., default values) so missing values don’t throw.

🚀 Want me to fix this? Reply ex: "fix it for me".

…ormersCounters and cancelTemplateTasksCounters actions
return;
}

if (result) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the result check is redundant here.

@Maria-Lordwill Maria-Lordwill dismissed pneumatic-ilyacedrik’s stale review February 3, 2026 08:47

The merge-base changed after approval.

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

Labels

bug Something isn't working Frontend Web client changes request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants