Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions web4-standard/implementation/sdk/web4/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,49 @@ class ErrorMeta:
400,
"Protocol downgrade attack detected",
),
# mcp-protocol.md §7.6 — Cross-Society MCP Errors
ErrorCode.CROSS_SOCIETY_UNRECOGNIZED_LCT: ErrorMeta(
ErrorCode.CROSS_SOCIETY_UNRECOGNIZED_LCT,
ErrorCategory.CROSS_SOCIETY,
"Unrecognized Cross-Society LCT",
404,
"Responding society does not recognize the caller's LCT",
),
ErrorCode.CROSS_SOCIETY_EXCHANGE_INVALID: ErrorMeta(
ErrorCode.CROSS_SOCIETY_EXCHANGE_INVALID,
ErrorCategory.CROSS_SOCIETY,
"Invalid Exchange Rate",
400,
"Cross-society ATP exchange rate is invalid or expired",
),
ErrorCode.CROSS_SOCIETY_LAW_CONFLICT: ErrorMeta(
ErrorCode.CROSS_SOCIETY_LAW_CONFLICT,
ErrorCategory.CROSS_SOCIETY,
"Law Oracle Conflict",
409,
"Sender and responding societies have conflicting law oracles",
),
ErrorCode.CROSS_SOCIETY_WITNESS_REQUIRED: ErrorMeta(
ErrorCode.CROSS_SOCIETY_WITNESS_REQUIRED,
ErrorCategory.CROSS_SOCIETY,
"Witness Required",
403,
"Cross-society action requires a witness but none is available",
),
ErrorCode.R7_REPUTATION_INVALID: ErrorMeta(
ErrorCode.R7_REPUTATION_INVALID,
ErrorCategory.CROSS_SOCIETY,
"Invalid R7 Reputation",
400,
"R7 reputation envelope is malformed or signature invalid",
),
ErrorCode.PROPAGATION_SCOPE_UNSUPPORTED: ErrorMeta(
ErrorCode.PROPAGATION_SCOPE_UNSUPPORTED,
ErrorCategory.CROSS_SOCIETY,
"Unsupported Propagation Scope",
400,
"Responding society does not support the requested propagation scope",
),
}


Expand Down Expand Up @@ -415,6 +458,12 @@ class ProtoError(Web4Error):
pass


class CrossSocietyError(Web4Error):
"""Error related to cross-society MCP operations (mcp-protocol.md §7.6)."""

pass


# Map categories to their subclass for from_problem_json dispatch
_CATEGORY_SUBCLASS: Dict[ErrorCategory, type[Web4Error]] = {
ErrorCategory.BINDING: BindingError,
Expand All @@ -423,6 +472,7 @@ class ProtoError(Web4Error):
ErrorCategory.AUTHZ: AuthzError,
ErrorCategory.CRYPTO: CryptoError,
ErrorCategory.PROTO: ProtoError,
ErrorCategory.CROSS_SOCIETY: CrossSocietyError,
}


Expand Down
6 changes: 6 additions & 0 deletions web4-standard/testing/conformance/atp-operations.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
"$schema": "https://web4.io/schemas/test-vectors/v1.json",
"suite": "ATP/ADP Operations",
"version": "0.1.0",
"provenance": {
"authored_against_sdk_version": "0.27.0",
"shape_source_commit": "759eaefa",
"shapes": ["ATPAccount"],
"last_freshness_review": "2026-05-16"
},
"description": "Conformance test vectors for ATP/ADP economy operations. Conservation invariant MUST hold across all operations.",

"account_vectors": [
Expand Down
6 changes: 6 additions & 0 deletions web4-standard/testing/conformance/r6-r7-actions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
"$schema": "https://web4.io/schemas/test-vectors/v1.json",
"suite": "R6/R7 Action Framework",
"version": "0.1.0",
"provenance": {
"authored_against_sdk_version": "0.27.0",
"shape_source_commit": "d155b6a6",
"shapes": ["R7Action", "Rules", "Role", "Constraint", "Request", "ResourceRequirements", "Reference", "WitnessAttestation"],
"last_freshness_review": "2026-05-16"
},
"description": "Conformance test vectors for R6 (Rules/Role/Request/Reference/Resource→Result) and R7 (+Reputation) action framework.",

"validation_vectors": [
Expand Down
6 changes: 6 additions & 0 deletions web4-standard/testing/conformance/society-roles.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
"$schema": "https://web4.io/schemas/test-vectors/v1.json",
"suite": "Society & Role Operations",
"version": "0.1.0",
"provenance": {
"authored_against_sdk_version": "0.27.0",
"shape_source_commit": "d155b6a6",
"shapes": ["RoleAssignment", "SocietyRole", "SocietyPhase"],
"last_freshness_review": "2026-05-16"
},
"description": "Conformance test vectors for Web4 society lifecycle and role management.",

"bootstrap_vectors": [
Expand Down
6 changes: 6 additions & 0 deletions web4-standard/testing/conformance/tensor-operations.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
"$schema": "https://web4.io/schemas/test-vectors/v1.json",
"suite": "T3/V3 Tensor Operations",
"version": "0.1.0",
"provenance": {
"authored_against_sdk_version": "0.27.0",
"shape_source_commit": "759eaefa",
"shapes": ["T3", "V3"],
"last_freshness_review": "2026-05-16"
},
"description": "Conformance test vectors for T3 (Trust) and V3 (Value) tensor operations. Any compliant implementation MUST produce identical results for these inputs.",

"t3_vectors": [
Expand Down
Loading