ShadowRPG-Q: IBM i-Style Quantum Job Control Runtime
Status: Original experimental implementation
NOT an IBM product - Independent clean-room implementation
Overview
ShadowRPG-Q is an original quantum job control runtime inspired by IBM i operational workflows, record-oriented processing, and job queue management. It provides:
- Job Queue Management: Priority-based job scheduling
- Append-Only Journaling: Deterministic replay and recovery
- Execution Receipts: Cryptographically sealed provenance records
- Hybrid FSM Coordination: Classical control with quantum execution states
Architecture
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β ShadowRPG-Q Runtime β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β ββββββββββββ ββββββββββββ ββββββββββββ β
β β Job βββββΆβ Queue βββββΆβ Executor β β
β β Builder β β Priority β β Engine β β
β ββββββββββββ ββββββββββββ ββββββββββββ β
β β β β
β βΌ βΌ β
β ββββββββββββ ββββββββββββ β
β β Journal β β Receipt β β
β β Append β β Seal β β
β ββββββββββββ ββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Core Components
Job (job.rs)
- Job lifecycle management (Received β Validated β Compiling β Compiled β Queued β Executing β Completed/Failed/Cancelled)
- Priority levels (Low, Normal, High)
- Builder pattern for job configuration
- Status tracking with timestamps
Queue (queue.rs)
- Priority-based binary heap queue
- Configurable maximum size
- Thread-safe job submission and retrieval
Journal (journal.rs)
- Append-only journal for audit trail
- Cryptographic hash verification
- Deterministic replay for recovery
- Journal entry types for all state transitions
Receipt (receipt.rs)
- Cryptographically sealed execution receipts
- Source code hash, compilation hash, result hash
- Immutable provenance records
- Receipt chain verification
Executor (executor.rs)
- Main execution engine
- Job submission and queue management
- Journal coordination
- Active job tracking
- Recovery from journal replay
Usage Example
use shadow_rpg_q::{Executor, ExecutorConfig, Job, JobPriority};
use std::path::PathBuf;
// Create executor with configuration
let config = ExecutorConfig {
max_queue_size: 1000,
journal_path: PathBuf::from("quantum.journal"),
max_concurrent_jobs: 4,
};
let executor = Executor::new(config)?;
// Create and submit a job
let job = Job::new(
"bell_state".to_string(),
"OPENQASM 2.0; qreg q[2]; h q[0]; cx q[0],q[1];".to_string(),
"qasm2".to_string(),
"simulator".to_string(),
)
.with_priority(JobPriority::High)
.with_shots(1024);
let job_id = executor.submit_job(job)?;
// Get next job from queue
let job = executor.get_next_job()?.unwrap();
// Execute job
let receipt = executor.execute_job(job)?;
// Verify receipt seal
assert!(receipt.verify_seal());
Job Lifecycle
RECEIVED βββΆ VALIDATED βββΆ COMPILING βββΆ COMPILED βββΆ QUEUED
β
βΌ
COMPLETED βββ EXECUTING ββββββββββββββββββββββββββββββββββ
β
ββββΆ FAILED
ββββΆ CANCELLED
Journal Format
Each journal entry contains:
- Sequence number (monotonically increasing)
- Timestamp (UTC)
- Job ID
- Entry type (JobSubmitted, StatusChanged, etc.)
- Old and new status
- Metadata
- Cryptographic hash
Receipt Format
Each execution receipt contains:
- Receipt ID (UUID)
- Job ID
- Source code hash (SHA-256)
- Compilation hash (SHA-256)
- Result hash (SHA-256)
- Timestamps (submitted, started, completed)
- Status
- Metadata (priority, language, shots)
- Cryptographic seal
Testing
cargo test -p shadow-rpg-q
Test Results: 15/15 tests passing
Design Principles
- Record-Oriented: All state is represented as immutable records
- Append-Only: Journal entries are never modified or deleted
- Deterministic: Replay from journal produces identical state
- Verifiable: All receipts are cryptographically sealed
- Recoverable: System can restart from any journal state
IBM i Inspiration
ShadowRPG-Q draws inspiration from IBM i concepts:
- Job queues and job descriptions
- Journaling and commitment control
- Record-level processing
- Operational control language
- Service programs and activation groups
Important: This is an independent implementation. It does not use IBM proprietary code, internal APIs, or confidential specifications.
Integration
ShadowRPG-Q is designed to integrate with:
- QATAAUM compiler pipeline
- Quantum simulators and backends
- Formal verification layers (Liquid Haskell, Lean 4)
- Provider-neutral execution interfaces
License
MIT License (see LICENSE file in repository root)
Line Count
job.rs: 260 linesqueue.rs: 110 linesjournal.rs: 210 linesreceipt.rs: 170 linesexecutor.rs: 180 lineslib.rs: 100 lines- Total: 1,030 substantive lines
Status
β
Job lifecycle management
β
Priority queue
β
Append-only journal
β
Cryptographic receipts
β
Execution engine
β
15/15 tests passing
β³ IBM i FFI boundary (future)
β³ Native RPG integration (future)
QATAAUM Project | Clean-Room Quantum Runtime | 2026