This document maps every system component to tests and identifies missing test coverage.
File: ui/dev/runtimeFlowTests.js
Entry: Run via command bar: frame test or frame.test
Function: runFrameFlowTests()
Tests:
-
show wallet —
wallet.balanceintent- Intent resolution ✓
- Execution graph ✓
- Execution ✓
- UI plan ✓
- Receipt generation ✓
-
send 5 frame to Alice —
wallet.sendintent- Intent resolution ✓
- Execution graph ✓
- Execution ✓
- Receipt optional (may need vault) ✓
-
create note "hello world" —
notes.createintent- Intent resolution ✓
- Execution ✓
- Receipt generation ✓
-
list contacts —
contacts.searchintent- Intent resolution ✓
- Execution ✓
-
system overview —
system.overviewintent- Intent resolution ✓
- Empty graph allowed ✓
- UI plan ✓
- Receipt optional ✓
Per-test checks:
- Intent resolved (action set) ✓
- Execution graph built ✓
- Execution completed ✓
- UI plan generated ✓
- Receipt produced (when applicable) ✓
-
canonicalize()— Array canonicalization -
canonicalize()— Object key sorting -
canonicalize()— Nested structures -
sha256()— Hash computation -
canonicalHash()— Canonical hash computation
-
validateCanonicalJson()— Safe integer validation -
validateCanonicalJson()— Float rejection -
validateCanonicalJson()— NaN/Infinity rejection -
validateCanonicalJson()— Function rejection -
validateCanonicalJson()— Date rejection -
validateCanonicalJson()— Circular reference detection -
deepCloneAndFreeze()— Deep freeze behavior -
read()— Storage read -
write()— Storage write with validation
-
list()— List identities -
getCurrent()— Get current identity -
switch()— Switch identity -
create()— Create identity -
getCapabilities()— Get identity capabilities
-
computeStateRoot()— State root computation -
computeCodeHash()— Code hash computation -
loadInstalledDApps()— dApp loading -
gatherStorageData()— Storage enumeration -
computeReceiptChainCommitment()— Chain commitment -
selfTest()— Determinism self-test
-
exportIdentity()— Identity export -
importIdentity()— Identity import - AES-256-GCM encryption
- PBKDF2 key derivation
- Password validation
-
handleIntent()— Intent execution -
kernelNormalize()— Kernel normalization -
normalizeViaAiDApp()— AI normalization -
validateIntent()— Intent validation -
handleBuiltIn()— System intents -
buildScopedApi()— Scoped API construction -
capabilityGuard()— Capability enforcement -
buildReceipt()— Receipt creation -
appendReceipt()— Receipt appending -
executeCompositeIntent()— Composite execution -
installDeterministicSandbox()— Sandbox installation -
installAsyncBlockers()— Async blocker installation -
checkIntegrityLock()— Integrity lock check -
verifyDAppCodeHash()— Code hash verification
-
loadManifests()— Manifest loading -
validateManifest()— Manifest validation -
resolve()— Intent resolution (exact match) -
resolve()— Intent resolution (prefix match) -
resolve()— Intent resolution (AI routing) -
execute()— dApp execution -
queryPreviews()— Preview queries - Path security (no
..traversal) - Module path validation
-
replayExecutionLog()— Full replay -
reconstructStateFromReceipts()— State reconstruction -
verifyReceiptChain()— Chain verification -
verifyReceiptSignatureWithKey()— Signature verification -
exportAttestation()— Attestation export -
verifyAttestation()— Attestation verification -
exportStateAttestation()— State attestation export -
verifyStateAttestation()— State attestation verification -
exportGenesis()— Genesis export - Network response injection during replay
-
exportReceiptChain()— Chain export -
findDivergenceIndex()— Divergence detection -
mergeReceiptChains()— Chain merge -
importReceiptChain()— Chain import - Replay-before-merge verification
-
createContract()— Contract creation -
proposeContract()— Contract proposal -
counterContract()— Contract counter -
signContract()— Contract signing -
activateContract()— Contract activation -
updateDriverLocation()— Driver location update -
updateRiderLocation()— Rider location update -
transitionRideStatus()— Ride status transition - Contract revision increments
- Ride state machine transitions
-
exportSnapshot()— Snapshot export -
importSnapshot()— Snapshot import - Version compatibility checks
- Rollback on failure
- State root verification
- Protocol version checks
- Receipt field checks
- State root schema checks
- Capability schema checks
- Runtime surface checks
- Module registration removal
- All boot assertions
-
run()— Intent parsing -
run()— Chat responses -
run()— Text summarization -
preview()— Preview responses -
classify()— Intent classification - Request queue handling
- Model loading (if implemented)
-
run()— Balance check -
run()— Send payment -
run()— Mint frame -
run()— Burn frame -
run()— Escrow lock -
run()— Escrow release -
run()— Escrow refund -
preview()— Payment preview - Total supply tracking
- Escrow balance calculation
-
run()— Deposit -
run()— Withdraw - Proof canonicalization
- Duplicate prevention
- Supply updates
- Deterministic timestamping
- Contract lifecycle
- Ride state machine
- Location updates
- Status transitions
-
resolveIntent()— Intent resolution -
processUserMessage()— Message processing - AI fallback behavior
-
planExecution()— Execution graph planning -
executeGraph()— Graph execution - Topological sort
- Dependency injection
- Parallel execution
- Retry logic
- Provider fallback
- Manifest scanning
- Capability indexing
- Provider scoring
- Best provider selection
- Deterministic replay with frozen time
- Deterministic replay with seeded randomness
- Network response sealing and replay
- State root determinism (same state → same root)
- Capability escalation attempts
- Undeclared capability access
- Permission bypass attempts
- Path traversal attempts
- Receipt tampering detection
- Signature forgery attempts
- Receipt version mismatch handling
- State root version mismatch handling
- Capability version mismatch handling
- Protocol version mismatch handling
- dApp module load failure
- Manifest validation failure
- Receipt chain corruption
- State root mismatch detection
- Code hash mismatch detection
- Full intent execution flow
- Composite execution with rollback
- Snapshot export/import
- Federation sync
- Replay verification
- Empty receipt chain
- Single receipt chain
- Large receipt chains
- Concurrent execution (if supported)
- Identity switching during execution
- Unit test framework (Jest, Mocha, etc.)
- Integration test framework
- Mock/stub infrastructure for Tauri backend
- Test data fixtures
- Test utilities (canonical helpers, hash helpers)
- CI/CD test execution
Recommended structure:
tests/
├── unit/
│ ├── runtime/
│ ├── dapps/
│ └── system/
├── integration/
│ ├── flows/
│ └── federation/
└── e2e/
└── scenarios/
- Receipt creation and verification
- State root computation
- Deterministic replay
- Capability enforcement
- Capability isolation
- Permission enforcement
- Path security
- Signature verification
- Intent execution flow
- Composite execution
- Snapshot operations
- Federation sync
- Error handling
- Failure recovery
- Edge case scenarios
- Runtime Invariants - What must be true
- Failure Modes - What can break
- Integration Flows - How modules connect