From 66b19bf3a06ae71f4df9555796beab5e6753d058 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 18 Jan 2026 00:55:44 +0000 Subject: [PATCH 1/3] Add comprehensive ATOM decision test coverage for cascade_integration Co-authored-by: toolate28 <105518313+toolate28@users.noreply.github.com> --- tests/test_agent_skills.py | 110 +++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) diff --git a/tests/test_agent_skills.py b/tests/test_agent_skills.py index c3051b7..6353960 100644 --- a/tests/test_agent_skills.py +++ b/tests/test_agent_skills.py @@ -311,6 +311,116 @@ def test_vortex_marker_present(self): result = agent_skills.cascade_integration("test body") assert result['vortex'] == agent_skills.VORTEX_MARKER + + def test_atom_decision_present(self): + """Test that ATOM decision is present in result""" + result = agent_skills.cascade_integration("quantum provenance test") + + assert 'atom_decision' in result + assert isinstance(result['atom_decision'], dict) + + def test_atom_tag_present(self): + """Test that ATOM tag is present in result""" + result = agent_skills.cascade_integration("ethical review test") + + assert 'atom_tag' in result + assert isinstance(result['atom_tag'], str) + assert result['atom_tag'].startswith('ATOM-') + + def test_atom_decision_structure(self): + """Test that ATOM decision has correct structure""" + result = agent_skills.cascade_integration("quantum coherence test") + + decision = result['atom_decision'] + + # Verify required fields + assert 'atom_tag' in decision + assert 'type' in decision + assert 'description' in decision + assert 'timestamp' in decision + assert 'files' in decision + assert 'tags' in decision + assert 'freshness' in decision + assert 'verified' in decision + + # Verify field types and values + assert decision['type'] == 'VERIFY' + assert isinstance(decision['description'], str) + assert isinstance(decision['timestamp'], str) + assert isinstance(decision['files'], list) + assert isinstance(decision['tags'], list) + assert decision['freshness'] == 'fresh' + assert decision['verified'] is False + + def test_atom_decision_tags_include_keywords(self): + """Test that ATOM decision tags include detected keywords""" + result = agent_skills.cascade_integration("quantum provenance ethical test") + + decision = result['atom_decision'] + tags = decision['tags'] + + # Base tags should always be present + assert 'cascade' in tags + assert 'provenance' in tags + assert 'ethical-review' in tags + + # Keywords found should be in tags + assert 'quantum' in tags + assert 'ethical' in tags + + def test_atom_trail_file_created(self, tmp_path, monkeypatch): + """Test that ATOM trail decision file is created""" + # Use temporary directory for ATOM trail + atom_trail_dir = tmp_path / ".atom-trail" + atom_counters_dir = atom_trail_dir / "counters" + atom_decisions_dir = atom_trail_dir / "decisions" + + # Monkey patch the ATOM trail directories + monkeypatch.setattr(agent_skills, 'ATOM_TRAIL_DIR', atom_trail_dir) + monkeypatch.setattr(agent_skills, 'ATOM_COUNTERS_DIR', atom_counters_dir) + monkeypatch.setattr(agent_skills, 'ATOM_DECISIONS_DIR', atom_decisions_dir) + + result = agent_skills.cascade_integration("test body") + + # Verify directories were created + assert atom_trail_dir.exists() + assert atom_counters_dir.exists() + assert atom_decisions_dir.exists() + + # Verify decision file was created + atom_tag = result['atom_tag'] + decision_file = atom_decisions_dir / f"{atom_tag}.json" + assert decision_file.exists() + + # Verify file content + import json + with open(decision_file, 'r') as f: + file_decision = json.load(f) + + assert file_decision['atom_tag'] == atom_tag + assert file_decision['type'] == 'VERIFY' + + def test_atom_tag_format(self): + """Test that ATOM tag follows correct format""" + result = agent_skills.cascade_integration("test") + + atom_tag = result['atom_tag'] + + # Format: ATOM-TYPE-YYYYMMDD-NNN-description + parts = atom_tag.split('-') + assert len(parts) >= 5 # At least 5 parts + assert parts[0] == 'ATOM' + assert parts[1] == 'VERIFY' + assert len(parts[2]) == 8 # YYYYMMDD + assert parts[3].isdigit() # Counter + assert len(parts[3]) == 3 # Three-digit counter + + def test_atom_decision_consistency(self): + """Test that atom_decision and atom_tag are consistent""" + result = agent_skills.cascade_integration("consistency test") + + # The atom_tag in result should match the one in atom_decision + assert result['atom_tag'] == result['atom_decision']['atom_tag'] class TestReviewPR: From 2d171eb1ff3d8ff90dde4f18bd8f117e9a90ba7c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 18 Jan 2026 00:56:50 +0000 Subject: [PATCH 2/3] Remove redundant local json import from test Co-authored-by: toolate28 <105518313+toolate28@users.noreply.github.com> --- tests/test_agent_skills.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_agent_skills.py b/tests/test_agent_skills.py index 6353960..2c39885 100644 --- a/tests/test_agent_skills.py +++ b/tests/test_agent_skills.py @@ -393,7 +393,6 @@ def test_atom_trail_file_created(self, tmp_path, monkeypatch): assert decision_file.exists() # Verify file content - import json with open(decision_file, 'r') as f: file_decision = json.load(f) From 8454354271d04aec2e28921211c9794393ae8611 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 18 Jan 2026 00:57:44 +0000 Subject: [PATCH 3/3] Specify UTF-8 encoding when reading ATOM decision file Co-authored-by: toolate28 <105518313+toolate28@users.noreply.github.com> --- tests/test_agent_skills.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_agent_skills.py b/tests/test_agent_skills.py index 2c39885..48fa68c 100644 --- a/tests/test_agent_skills.py +++ b/tests/test_agent_skills.py @@ -393,7 +393,7 @@ def test_atom_trail_file_created(self, tmp_path, monkeypatch): assert decision_file.exists() # Verify file content - with open(decision_file, 'r') as f: + with open(decision_file, 'r', encoding='utf-8') as f: file_decision = json.load(f) assert file_decision['atom_tag'] == atom_tag