-
Notifications
You must be signed in to change notification settings - Fork 0
Fix critical import errors and add missing test coverage for security features #45
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
Fix critical import errors and add missing test coverage for security features #45
Conversation
Co-authored-by: toolate28 <105518313+toolate28@users.noreply.github.com>
Co-authored-by: toolate28 <105518313+toolate28@users.noreply.github.com>
…functionality Co-authored-by: toolate28 <105518313+toolate28@users.noreply.github.com>
Signed-off-by: toolated <toolated@toolated.online>
|
🌀 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 addresses technical debt and adds comprehensive test coverage for quantum coding agent features. It resolves critical import issues, function naming mismatches, removes dead code, and adds 21 new tests for qubit validation and ATOM decision tracking.
Changes:
- Fixed critical import and function naming issues in both Python and TypeScript code
- Removed unused code (imports, functions, pytest markers) improving code cleanliness
- Added 21 new tests covering qubit range validation and ATOM decision functionality
- Improved documentation with better comments and consistent formatting
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_agent_skills.py | Removed unused json import, added 11 tests for qubit range validation and 10 tests for ATOM decision functionality |
| pytest.ini | Removed unused slow and integration test markers |
| packages/quantum-ethics/src/tests/vortex-wavespec.test.ts | Updated function name from fibonacciCoherenceBoost to applyFibonacciWeightedBoost throughout tests, removed unnecessary function existence check |
| agent_skills.py | Added Union to typing imports (required for type hints), removed unused os import, added explanatory comment to empty except clause |
| README.md | Fixed indentation inconsistency in contributing section to use proper markdown list formatting |
| .github/workflows/coding-agent.yml | Removed unused sanitizeInput function, added security reminder comment for future reference |
Comments suppressed due to low confidence (1)
tests/test_agent_skills.py:727
- The new ATOM decision tests create file system side effects (directories and JSON files in .atom-trail/) without cleanup. This can cause test pollution where tests may pass or fail depending on execution order or previous test runs. Consider adding setup/teardown methods or pytest fixtures to ensure clean test isolation. For example, you could add a fixture that creates a temporary directory for the ATOM trail and cleans it up after each test.
assert result['status'] == 'error'
assert 'error' in result
assert 'out of range' in result['error'].lower()
def test_error_message_format_single_qubit(self):
"""Test error message format for single-qubit gate"""
result = agent_skills.simulate_circuit("h(150)")
assert result['status'] == 'error'
expected_msg = "Qubit index 150 out of range. Must be between 0 and 100."
assert result['error'] == expected_msg
def test_error_message_format_cx_control(self):
"""Test error message format for CX gate with invalid control"""
result = agent_skills.simulate_circuit("cx(150,0)")
assert result['status'] == 'error'
expected_msg = "Control qubit index 150 out of range. Must be between 0 and 100."
assert result['error'] == expected_msg
def test_error_message_format_cx_target(self):
"""Test error message format for CX gate with invalid target"""
result = agent_skills.simulate_circuit("cx(0,150)")
assert result['status'] == 'error'
expected_msg = "Target qubit index 150 out of range. Must be between 0 and 100."
assert result['error'] == expected_msg
class TestErrorHandling:
"""Test error handling in various scenarios"""
def test_invalid_circuit_returns_error(self):
"""Test invalid circuit syntax returns error"""
result = agent_skills.simulate_circuit("bad_gate()")
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Addressed unresolved PR review feedback from #24, prioritizing issues blocking runtime execution and test validation.
Critical runtime fixes:
Uniontype import inagent_skills.py- function signature at L158 usedUnion[Tuple[int], Tuple[int, int]]without import, causing NameErrorfibonacciCoherenceBoostwhen actual export isapplyFibonacciWeightedBoostTest coverage for security features:
.atom-trail/decisions/*.jsonATOM-TYPE-YYYYMMDD-NNN-slug)Code hygiene:
sanitizeInputfunction from workflow (34 lines of dead code)os(agent_skills.py),json(test_agent_skills.py)Validation:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.