Your question is Dependency Traversal Function. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Vanta control workflows can depend on other controls or prerequisite checks. Given a collection of control records and a desired control ID, return every transitive dependency in dependency-first order, followed by the desired ID itself.
Implement get_dependency_order(records, desired_id).
records is a list of dictionaries. Each dictionary has a unique string id and a dependencies list containing string IDs.records.desired_id is the ID of an existing record.desired_id, with each ID appearing exactly once.ValueError.The input may contain records unrelated to desired_id; exclude them from the result.
recordsdef get_dependency_order(records, desired_id):