Conformance Test Suite

A conforming RCAN implementation MUST pass all tests in this section.


1. RURI Validation Tests

Test IDInputExpectedDescription
RURI-001rcan://continuon.cloud/continuon/companion-v1/d3a4b5c6✅ VALIDStandard RURI
RURI-002rcan://local.rcan/unitree/go2/a1b2c3d4:9000/teleop✅ VALIDWith port and capability
RURI-003rcan://my-server.lan/acme/bot-x1/12345678-1234-1234-1234-123456789abc✅ VALIDFull UUID
RURI-004https://example.com/robot❌ INVALIDWrong scheme
RURI-005rcan://UPPERCASE/test/test/12345678❌ INVALIDUppercase not allowed
RURI-006rcan://a/b/c/1234567❌ INVALIDDevice ID too short
RURI-007rcan://continuon.cloud/continuon/companion-v1/d3a4b5c6/Arm❌ INVALIDCapability must be lowercase
RURI-008rcan://❌ INVALIDEmpty components

2. Role Hierarchy Tests

Test IDRoleRequiredExpectedDescription
ROLE-001OWNERGUEST✅ ALLOWHigher role can access lower
ROLE-002USEROWNER❌ DENYLower role cannot access higher
ROLE-003LEASEELEASEE✅ ALLOWSame role can access
ROLE-004CREATOROWNER✅ ALLOWCreator can access all
ROLE-005GUESTUSER❌ DENYGuest has minimal access

3. Authentication Tests

Test IDScenarioExpectedDescription
AUTH-001Valid credential, available role✅ GRANTEDNormal auth flow
AUTH-002Invalid credential❌ DENIED (INVALID_CREDENTIALS)Bad password
AUTH-003Valid credential, robot busy❌ DENIED (ROBOT_BUSY)Another controller active
AUTH-004Request CREATOR, max role OWNER✅ GRANTED as OWNERRole downgrade
AUTH-005Expired JWT❌ DENIED (TOKEN_EXPIRED)Token validation
AUTH-006Offline mode, cached token valid✅ GRANTED (OFFLINE)Resilience test

4. Safety Invariant Tests

Test IDScenarioExpectedDescription
SAFE-001SAFETY priority messageResponse < 100msPriority processing
SAFE-002Network partition during commandSafe-stop triggeredGraceful degradation
SAFE-003Remote command bypasses local limit❌ REJECTEDLocal safety wins
SAFE-004Any command executionAudit log entry createdLogging required

5. Error Codes

CodeNameDescription
1001INVALID_RURIMalformed RURI string
1002UNKNOWN_ROBOTRobot not found in registry
1003ROBOT_OFFLINERobot unreachable
2001INVALID_CREDENTIALSAuth credentials rejected
2002INSUFFICIENT_PRIVILEGESRole too low for operation
2003TOKEN_EXPIREDJWT has expired
2004TOKEN_REVOKEDJWT was revoked
2005RATE_LIMITEDToo many requests
3001ROBOT_BUSYRobot controlled by another user
3002COMMAND_TIMEOUTCommand execution timed out
3003COMMAND_REJECTEDCommand failed safety check
3004CAPABILITY_UNAVAILABLERequested capability not present
4001SAFETY_VIOLATIONAction would violate safety constraints
4002EMERGENCY_STOPRobot in emergency stop state

6. Python Test Runner

Run the conformance tests with pytest:

"""RCAN Conformance Test Suite"""
import pytest
from rcan import RURI, Role

class TestRURIValidation:
    @pytest.mark.parametrize("ruri,expected", [
        ("rcan://continuon.cloud/continuon/companion-v1/d3a4b5c6", True),
        ("rcan://local.rcan/unitree/go2/a1b2c3d4:9000/teleop", True),
        ("https://example.com/robot", False),
        ("rcan://UPPERCASE/test/test/12345678", False),
        ("rcan://a/b/c/1234567", False),
    ])
    def test_ruri_validation(self, ruri: str, expected: bool):
        assert RURI.is_valid(ruri) == expected

class TestRoleHierarchy:
    @pytest.mark.parametrize("role,required,expected", [
        (Role.OWNER, Role.GUEST, True),
        (Role.USER, Role.OWNER, False),
        (Role.CREATOR, Role.OWNER, True),
    ])
    def test_role_access(self, role: Role, required: Role, expected: bool):
        assert role.can_access(required) == expected

if __name__ == "__main__":
    pytest.main([__file__, "-v"])
pip install pytest
python -m pytest test_rcan_conformance.py -v

→ Next: Reference Implementations