-
Notifications
You must be signed in to change notification settings - Fork 0
Add ATOM decision test coverage for cascade_integration #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ATOM decision test coverage for cascade_integration #44
Conversation
Co-authored-by: toolate28 <105518313+toolate28@users.noreply.github.com>
Co-authored-by: toolate28 <105518313+toolate28@users.noreply.github.com>
Co-authored-by: toolate28 <105518313+toolate28@users.noreply.github.com>
a520453 to
8454354
Compare
|
🌀 Agent Review: Coherence >60%. Ethical quantum sims validated. Ready for merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request adds comprehensive test coverage for ATOM decision functionality in the cascade_integration function. Previously, only legacy fields (status, keywords, provenance_tracked) were tested; this PR adds 7 new test methods to verify the ATOM decision structure, format, persistence, and consistency.
Changes:
- Added 7 test methods covering ATOM decision field presence, structure validation, format validation, file persistence, tag propagation, and consistency checks
- Introduced file I/O testing to verify ATOM trail decision files are created correctly
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| # Verify file content | ||
| with open(decision_file, 'r', encoding='utf-8') as f: | ||
| file_decision = json.load(f) |
Copilot
AI
Jan 18, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test uses json.load() to parse the decision file, but the json module is not imported. Add import json at the top of the file with the other imports.
| 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 | ||
| with open(decision_file, 'r', encoding='utf-8') 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'] |
Copilot
AI
Jan 18, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests create real files in the .atom-trail directory of the repository, which can cause test pollution and side effects. Consider using the same monkeypatch approach as test_atom_trail_file_created to isolate these tests and prevent them from affecting the actual repository state or interfering with each other.
| assert len(parts) >= 5 # At least 5 parts | ||
| assert parts[0] == 'ATOM' | ||
| assert parts[1] == 'VERIFY' | ||
| assert len(parts[2]) == 8 # YYYYMMDD |
Copilot
AI
Jan 18, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test verifies that parts[2] has length 8 but doesn't validate that it's actually a valid date in YYYYMMDD format. Consider adding a check to ensure it's a valid date string, for example by checking if it's all digits and represents a plausible date.
|
@copilot apply changes based on the comments in this thread |
The
cascade_integrationfunction creates and persists ATOM decisions, but tests only verified legacy fields (status, keywords, provenance_tracked). The ATOM decision structure was untested.Changes
Added 7 test methods covering ATOM decision functionality:
atom_decision,atom_tag).atom-trail/decisions/*.json)Fixed missing
Unionimport in agent_skills.py type hintsExample
All 57 tests passing. 15 tests now cover cascade_integration (was 8).
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.