How do you approach CI/CD pipelines when deploying new features?
Implement a function that orders pipeline stages while respecting their dependencies. Return an empty list when the dependencies contain a cycle.
stages is a list of unique stage names. dependencies contains pairs [before, after], meaning before must run before after. Return a lexicographically smallest valid ordering, or [] if no valid ordering exists.
def deployment_order(stages, dependencies):