Skip to content

front: share pipeline/workflow ownership check across controllers - #1376

Draft
skipi wants to merge 1 commit into
mainfrom
mk/front/target-switch-ownership
Draft

skipi wants to merge 1 commit into
mainfrom
mk/front/target-switch-ownership

Conversation

@skipi

@skipi skipi commented Oct 28, 2026

Copy link
Copy Markdown
Member

What

PipelineController resolves the pipeline named in the URL and checks it actually belongs to the request's organization/workflow before acting on it. Extracted that into Front.Models.Pipeline.belongs_to_workflow?/3 and applied the same check in TargetController.trigger/2, which was resolving its pipeline differently and skipping it.

Why

Keeps the ownership check in one place instead of duplicated inline logic, and brings TargetController in line with the pattern already used elsewhere for pipeline-scoped actions.

Tested

Added a couple of controller tests for the new ownership check (mismatched switch/pipeline, mismatched workflow) alongside the existing target_controller_test.exs coverage.

… trigger

PipelineController already resolves a pipeline from the URL and checks it
actually belongs to the organization/workflow in the request before acting
on it. Extract that check into Front.Models.Pipeline.belongs_to_workflow?/3
so both controllers use the same logic, and apply it in TargetController's
trigger/2 as well, where it was missing — the promotion switch is now
required to resolve to a pipeline in the already-validated workflow.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant