Skip to content

Polish and harden ACCL-Q: security, testing, code quality - #5

Merged
Core-Creates merged 6 commits into
corrinafrom
feat/accl-q-polish-and-hardening
Feb 18, 2026
Merged

Polish and harden ACCL-Q: security, testing, code quality#5
Core-Creates merged 6 commits into
corrinafrom
feat/accl-q-polish-and-hardening

Conversation

@Core-Creates

Copy link
Copy Markdown
Owner

Summary

  • Address all 15 remaining audit findings from code review
  • Add API security (rate limiting, emulator TTL cleanup, input validation)
  • Add 120 new tests (25 ULL API + 95 integration/deployment coverage)
  • Fix version mismatch, abstract stubs, magic numbers, print→logging
  • Add FeedbackScheduler context manager, DMA lazy init, vectorized syndrome computation
  • Upgrade CI to Python 3.13 matrix, add coverage + ruff lint job

Changes (11 files, +1,177/-30)

Area Files Changes
Security api_server.py Rate limiter, emulator TTL, num_cycles validation, env vars
Code quality driver.py, constants.py, integrations.py Named constants, NotImplementedError, vectorized numpy
Stubs completed feedback.py, hardware_accel.py FeedbackScheduler ctx mgr, DMA lazy init
Logging api_server.py print() → logging module
Version __init__.py 0.2.0 → 0.3.0
Tests test_ull_api.py, test_integrations_coverage.py 120 new tests
CI/CD python-tests.yml Python 3.13, pytest-cov, ruff lint

Test plan

  • 387 collected, 358 passed, 29 skipped (hardware validation), 0 failures
  • Demo script runs successfully
  • All ULL API endpoints tested (/ull/status, /configure, /feedback, /disarm)
  • Full QubiC/QICK/UnifiedQuantumControl integration coverage
  • Deployment config save/load roundtrip verified
  • Rate limiting and emulator TTL cleanup verified

🤖 Generated with Claude Code

Core-Creates and others added 6 commits February 16, 2026 23:17
MEDIUM fixes (9 issues):
- Cap _pending_ops dict with purge logic to prevent OOM (feedback.py)
- Cap QuantumCircuitValidator._results with deque(maxlen=10000) (emulator.py)
- Wrap decoder_callback in try/except for safe error handling (feedback.py)
- Wrap _trigger_action callback in try/except (feedback.py)
- Fix socket leak in deployment.py shutdown() with try/finally
- Replace deprecated np.random with per-instance default_rng (integrations.py)
- Fix FeedbackScheduler entry_id collision with monotonic counter (feedback.py)
- Add _state_lock to emulator read endpoints (api_server.py)
- Guard _get_qubit_rank against ZeroDivisionError (integrations.py)

LOW fixes (8+ issues):
- Fix `callable` -> `Callable` type annotations (stats.py)
- Initialize self._latency_budget = None in driver __init__
- Fix fragile sys.path in test_integration.py to use os.path.dirname
- Fix sync: SyncMode = None -> Optional[SyncMode] = None (driver.py, 6 sigs)
- Replace print() with logger.error() for alert callbacks (stats.py)
- Remove unused imports (Callable, Tuple, field, time, ABC, abstractmethod)
- Replace deprecated np.random calls in tests with default_rng
- Fix fragile op_id string parsing in profiler.py (store op name in tuple)
- Convert test functions from count-based to assertion-based (0 pytest warnings)

All 73 tests pass, 29 skipped (hardware), 0 warnings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Shift from software-mediated to hardware-autonomous feedback execution,
targeting <0.1% of 50us coherence time (50ns budget). Adds ULTRA_LOW_LATENCY
mode with zero-copy data paths, DMA buffer pooling, BRAM LUT decoder,
FPGA register interface, and hardware feedback engine with 5-phase pipeline
(readout 10ns + multicast 10ns + reduce 4ns + decode 8ns + trigger 2ns = 34ns).

46 new tests across 9 test classes, all 119 tests passing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…timization

feat: ACCL-Q Ultra-Low-Latency sub-50ns QEC feedback
…sts, CI, docs, demo

Add ultra_low_latency mode to API server with /ull/configure, /ull/feedback,
/ull/status, and /ull/disarm endpoints. Create pyproject.toml and requirements.txt
for Python packaging. Add ~100 new tests covering profiler, stats, deployment,
constants, and ULL latency validation (239 total passing). Add GitHub Actions
CI workflow for Python 3.11/3.12. Update performance_tuning.md with ULL guide,
README with architecture/API docs, and INSTALL.md with Python quickstart.
Add Demo 6 showcasing ULL hardware-autonomous feedback (16x speedup).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…hensive-improvements

feat: comprehensive ACCL-Q improvements
Address all 15 remaining audit findings:

- Fix version mismatch (__init__.py 0.2.0 → 0.3.0)
- Fix abstract method stubs (pass → raise NotImplementedError)
- Replace magic numbers in driver.py with named constants
- Replace print() with logging module in api_server.py
- Add API rate limiting middleware (ACCLQ_RATE_LIMIT env var)
- Add emulator TTL cleanup (ACCLQ_EMULATOR_TTL env var)
- Make MAX_EMULATORS configurable (ACCLQ_MAX_EMULATORS env var)
- Add input validation for /ull/feedback num_cycles
- Add FeedbackScheduler context manager (__enter__/__exit__)
- Add DMA buffer pool lazy initialization option
- Vectorize _compute_syndrome with numpy
- Add 25 ULL API endpoint tests (test_ull_api.py)
- Add 95 integration/deployment coverage tests (test_integrations_coverage.py)
- Upgrade CI to Python 3.13, add coverage reporting and ruff lint job

Tests: 387 collected, 358 passed, 29 skipped (hardware), 0 failures

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Core-Creates
Core-Creates merged commit 00c1769 into corrina Feb 18, 2026
0 of 4 checks passed
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.

1 participant