From 954a226aef7dfb87e7160984699fd06cf49fbb62 Mon Sep 17 00:00:00 2001 From: Lukasz Juranek Date: Sat, 14 Feb 2026 10:49:51 +0100 Subject: [PATCH] fix: preserve program insertion order in OrchProgramManager Replace `pop()` with `remove(0)` in both `into_program_manager()` and `Design::into_programs()` to process designs and programs in FIFO order instead of LIFO. This ensures programs maintain the order they were added via `add_program()`. Also fix the `TestGraphInSeparatePrograms` test to use the `integration_graph` scenario (which runs all programs) instead of `graph_program` (which only runs one), and remove the xfail marker since the bug is now fixed. Closes #60 Co-Authored-By: Claude Opus 4.6 --- src/orchestration/src/api/design.rs | 2 +- src/orchestration/src/api/mod.rs | 2 +- tests/test_cases/tests/orchestrator/test_graph.py | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/orchestration/src/api/design.rs b/src/orchestration/src/api/design.rs index 9a2e739..18267d6 100644 --- a/src/orchestration/src/api/design.rs +++ b/src/orchestration/src/api/design.rs @@ -169,7 +169,7 @@ impl Design { shutdown_events: &GrowableVec, container: &mut GrowableVec, ) -> Result<(), CommonErrors> { - while let Some(program_data) = self.programs.pop() { + while let Some(program_data) = self.programs.remove(0) { let mut builder = ProgramBuilder::new(program_data.0); (program_data.1)(&mut self, &mut builder)?; container.push(builder.build(shutdown_events, self.config())?); diff --git a/src/orchestration/src/api/mod.rs b/src/orchestration/src/api/mod.rs index 220e0ae..1b3eef2 100644 --- a/src/orchestration/src/api/mod.rs +++ b/src/orchestration/src/api/mod.rs @@ -166,7 +166,7 @@ impl OrchestrationApi<_DesignTag> { /// Returns an error if there is an issue while creating the programs, such as a design not being valid. pub fn into_program_manager(mut self) -> Result { let mut programs = GrowableVec::default(); - while let Some(design) = self.designs.pop() { + while let Some(design) = self.designs.remove(0) { design.into_programs(&self.shutdown_events, &mut programs)? } diff --git a/tests/test_cases/tests/orchestrator/test_graph.py b/tests/test_cases/tests/orchestrator/test_graph.py index 9a30e66..9f8a3c9 100644 --- a/tests/test_cases/tests/orchestrator/test_graph.py +++ b/tests/test_cases/tests/orchestrator/test_graph.py @@ -371,10 +371,13 @@ def test_valid(self, logs_nodes: LogContainer): class TestGraphInSeparatePrograms(CommonGraphProgramConfig): + @pytest.fixture(scope="class") + def scenario_name(self) -> str: + return "orchestration.graphs.integration_graph" + def graph_name(self) -> str: return "two_programs" - @pytest.mark.xfail(reason="https://github.com/qorix-group/inc_orchestrator_internal/issues/382") def test_valid(self, logs_nodes: LogContainer): n0 = logs_nodes.find_log(field="message", pattern="node0 was executed") n1 = logs_nodes.find_log(field="message", pattern="node1 was executed")