From 42f979af2ceed1efedbb04d4f1cdab202ee9231c Mon Sep 17 00:00:00 2001 From: rUv Date: Thu, 7 Aug 2025 14:31:12 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=96=20Checkpoint:=20Edit=20/workspaces?= =?UTF-8?q?/claude-code-flow/correct=5Freproduce=5Fbug.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .claude/checkpoints/1754577055.json | 1 + .claude/checkpoints/1754577057.json | 1 + correct_reproduce_bug.py | 51 +++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 .claude/checkpoints/1754577055.json create mode 100644 .claude/checkpoints/1754577057.json create mode 100644 correct_reproduce_bug.py diff --git a/.claude/checkpoints/1754577055.json b/.claude/checkpoints/1754577055.json new file mode 100644 index 0000000000..f7566eba38 --- /dev/null +++ b/.claude/checkpoints/1754577055.json @@ -0,0 +1 @@ +{"branch": "checkpoint/pre-edit-20250807-143055", "file": "/workspaces/claude-code-flow/benchmark/src/swarm_benchmark/swe_bench/multi_mode_engine.py", "timestamp": "2025-08-07T14:30:55Z", "type": "pre-edit", "original_branch": "swe-bench"} diff --git a/.claude/checkpoints/1754577057.json b/.claude/checkpoints/1754577057.json new file mode 100644 index 0000000000..2e8849a2c1 --- /dev/null +++ b/.claude/checkpoints/1754577057.json @@ -0,0 +1 @@ +{"tag": "checkpoint-20250807-143057", "file": "/workspaces/claude-code-flow/benchmark/src/swarm_benchmark/swe_bench/multi_mode_engine.py", "timestamp": "2025-08-07T14:30:57Z", "type": "post-edit", "branch": "swe-bench", "diff_summary": " .claude-flow/metrics/performance.json | 2 +- .claude-flow/metrics/system-metrics.json | 36 +++ .claude-flow/metrics/task-metrics.json | 6 +- .claude/checkpoints/1754577031.json | 1 + .claude/checkpoints/1754577033.json | 1 + .../swarm_benchmark/swe_bench/multi_mode_engine.py | 343 +++++++++++++++++++++ 6 files changed, 385 insertions(+), 4 deletions(-) "} diff --git a/correct_reproduce_bug.py b/correct_reproduce_bug.py new file mode 100644 index 0000000000..13ee258846 --- /dev/null +++ b/correct_reproduce_bug.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python +""" +Correctly reproduce astropy issue #12907: separability_matrix incorrect for nested CompoundModels +The issue is about nested CompoundModels, not Mapping followed by CompoundModel +""" +from astropy.modeling import models as m +from astropy.modeling.separable import separability_matrix + +# Create nested compound models as in the actual issue +# The issue is about nesting compound models within compound models +cm1 = m.Linear1D(10) & m.Linear1D(5) +print("First compound model (cm1):") +print(f" Model: {cm1}") +print(f" n_inputs: {cm1.n_inputs}, n_outputs: {cm1.n_outputs}") +sep1 = separability_matrix(cm1) +print(f" Separability matrix: {sep1}") +print() + +# Create another compound model that includes the first one +cm2 = m.Shift(1) & m.Shift(2) +print("Second compound model (cm2):") +print(f" Model: {cm2}") +print(f" n_inputs: {cm2.n_inputs}, n_outputs: {cm2.n_outputs}") +sep2 = separability_matrix(cm2) +print(f" Separability matrix: {sep2}") +print() + +# Now nest them - this is where the bug occurs +nested = cm1 | cm2 +print("Nested compound model (cm1 | cm2):") +print(f" Model: {nested}") +print(f" n_inputs: {nested.n_inputs}, n_outputs: {nested.n_outputs}") +sep_nested = separability_matrix(nested) +print(f" Separability matrix: {sep_nested}") +print() + +# The issue is that separability is not correctly propagated through nested compound models +# Each output should be separable since Linear1D and Shift are separable + +# Try with a more complex example +p1 = m.Polynomial1D(1) +p2 = m.Polynomial1D(2) +compound1 = p1 & p2 +compound2 = m.Scale(2) & m.Scale(3) +nested2 = compound1 | compound2 + +print("More complex nested model:") +print(f" Model: {nested2}") +sep_nested2 = separability_matrix(nested2) +print(f" Separability matrix: {sep_nested2}") +print(f" Expected: diagonal True elements since all are separable") \ No newline at end of file