Fix test_extract_summary for copied_from creating-job guard

_original_hda/_original_hdca now stop walking copied_from at content with
its own creating job. test_finds_original_job_if_copied gave its "copied"
HDAs their own creating jobs, so it modeled the kept-as-step case, not a
passive copy - make the derived HDAs jobless passive copies. Add
test_keeps_copy_with_own_creating_job to lock in the guard.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
John Chilton
2026-06-14 20:02:49 -04:00
co-authored by Claude Opus 4.8
parent 67a5eee24e
commit 8cde4610fb
+17 -2
View File
@@ -42,10 +42,12 @@ class TestWorkflowExtractSummary(TestCase):
assert job_dict[hda3.job] == [("out3", hda3)]
def test_finds_original_job_if_copied(self):
# Passive copies (no creating job of their own) normalize back to the
# source, so the output is attributed to the source's creating job.
hda = MockHda()
derived_hda_1 = MockHda()
derived_hda_1 = MockHda(job=UNDEFINED_JOB)
derived_hda_1.copied_from_history_dataset_association = hda
derived_hda_2 = MockHda()
derived_hda_2 = MockHda(job=UNDEFINED_JOB)
derived_hda_2.copied_from_history_dataset_association = derived_hda_1
self.history.active_datasets.append(derived_hda_2)
job_dict, warnings = self._summarize()
@@ -53,6 +55,19 @@ class TestWorkflowExtractSummary(TestCase):
assert len(job_dict) == 1
assert job_dict[hda.job] == [("out1", derived_hda_2)]
def test_keeps_copy_with_own_creating_job(self):
# A copy that records its own creating job (e.g. Extract Dataset output)
# is a real step and must not normalize past copied_from to the source.
hda = MockHda()
derived_hda = MockHda()
derived_hda.copied_from_history_dataset_association = hda
self.history.active_datasets.append(derived_hda)
job_dict, warnings = self._summarize()
assert not warnings
assert len(job_dict) == 1
assert job_dict[derived_hda.job] == [("out1", derived_hda)]
assert hda.job not in job_dict
def test_fake_job_hda(self):
"""Fakes job if creating_job_associations is empty."""
hda = MockHda(job=UNDEFINED_JOB)