Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 18, 2026

The cascade_integration function 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:

    • Field presence (atom_decision, atom_tag)
    • Structure validation (type, description, timestamp, files, tags, freshness, verified)
    • Format validation (ATOM-TYPE-YYYYMMDD-NNN-description)
    • File persistence (.atom-trail/decisions/*.json)
    • Tag propagation (detected keywords → decision tags)
    • Consistency (result.atom_tag ≡ result.atom_decision.atom_tag)
  • Fixed missing Union import in agent_skills.py type hints

Example

result = cascade_integration("quantum provenance test")

# Now tested:
assert 'atom_decision' in result
assert 'atom_tag' in result
assert result['atom_decision']['type'] == 'VERIFY'
assert result['atom_tag'].startswith('ATOM-VERIFY-')
assert Path(f".atom-trail/decisions/{result['atom_tag']}.json").exists()

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.

Copilot AI mentioned this pull request Jan 18, 2026
Copilot AI changed the title [WIP] WIP address feedback from review on PR #24 Add ATOM decision test coverage for cascade_integration Jan 18, 2026
Copilot AI requested a review from toolate28 January 18, 2026 01:00
Copilot AI and others added 3 commits January 18, 2026 12:02
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>
@toolate28 toolate28 force-pushed the copilot/sub-pr-24-another-one branch from a520453 to 8454354 Compare January 18, 2026 01:02
@toolate28 toolate28 marked this pull request as ready for review January 18, 2026 01:02
Copilot AI review requested due to automatic review settings January 18, 2026 01:02
@toolate28 toolate28 merged commit 429de75 into copilot/sub-pr-8-again Jan 18, 2026
3 checks passed
@toolate28 toolate28 deleted the copilot/sub-pr-24-another-one branch January 18, 2026 01:02
@github-actions
Copy link

🌀 Agent Review: Coherence >60%. Ethical quantum sims validated. Ready for merge.

Copy link
Contributor

Copilot AI left a 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)
Copy link

Copilot AI Jan 18, 2026

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.

Copilot uses AI. Check for mistakes.
Comment on lines +315 to +422
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']
Copy link

Copilot AI Jan 18, 2026

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.

Copilot uses AI. Check for mistakes.
assert len(parts) >= 5 # At least 5 parts
assert parts[0] == 'ATOM'
assert parts[1] == 'VERIFY'
assert len(parts[2]) == 8 # YYYYMMDD
Copy link

Copilot AI Jan 18, 2026

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 uses AI. Check for mistakes.
@toolate28
Copy link
Owner

@copilot apply changes based on the comments in this thread

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants