feat(diagnostics): preserve Registry and resource fault context for PLN-0176 step 28

This commit is contained in:
2026-10-07 21:13:59 +01:00
parent 74c7522dd1
commit 63e371955a
24 changed files with 1085 additions and 85 deletions
+717 -16
View File
@@ -396,9 +396,23 @@
"minimum": 0
},
"span": {
"type": [
"object",
"null"
"anyOf": [
{
"$ref": "#/$defs/sourceSpan"
},
{
"type": "null"
}
]
},
"resource": {
"anyOf": [
{
"$ref": "#/$defs/resourceFailure"
},
{
"type": "null"
}
]
}
},
@@ -407,7 +421,8 @@
"opcode",
"message",
"pc",
"span"
"span",
"resource"
],
"additionalProperties": false
}
@@ -465,20 +480,191 @@
"const": "vm_init"
},
"initError": {
"type": "object",
"properties": {
"code": {
"type": "string"
"oneOf": [
{
"type": "object",
"properties": {
"code": {
"const": "registry_load_failed"
},
"message": {
"type": "string"
},
"load": {
"$ref": "#/$defs/loadFailure"
}
},
"required": [
"code",
"message",
"load"
],
"additionalProperties": false
},
"message": {
"type": "string"
{
"type": "object",
"properties": {
"code": {
"const": "runtime_resource_limit"
},
"message": {
"type": "string"
},
"resource": {
"$ref": "#/$defs/resourceFailure"
}
},
"required": [
"code",
"message",
"resource"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"code": {
"const": "entrypoint_arguments_invalid"
},
"message": {
"type": "string"
},
"entry": {
"type": "object",
"properties": {
"function": {
"type": "integer",
"minimum": 0,
"maximum": 4294967295
},
"slot": {
"type": "integer",
"minimum": 0,
"maximum": 4294967295
},
"trapCode": {
"type": "integer",
"minimum": 0,
"maximum": 4294967295
}
},
"required": [
"function",
"slot",
"trapCode"
],
"additionalProperties": false
}
},
"required": [
"code",
"message",
"entry"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"code": {
"const": "loader_patch_failed"
},
"message": {
"type": "string"
},
"binding": {
"$ref": "#/$defs/bindingFailure"
}
},
"required": [
"code",
"message",
"binding"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"code": {
"const": "invalid_format"
},
"message": {
"type": "string"
}
},
"required": [
"code",
"message"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"code": {
"const": "unsupported_format"
},
"message": {
"type": "string"
}
},
"required": [
"code",
"message"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"code": {
"const": "image_load_failed"
},
"message": {
"type": "string"
}
},
"required": [
"code",
"message"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"code": {
"const": "entrypoint_not_found"
},
"message": {
"type": "string"
}
},
"required": [
"code",
"message"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"code": {
"const": "verification_failed"
},
"message": {
"type": "string"
}
},
"required": [
"code",
"message"
],
"additionalProperties": false
}
},
"required": [
"code",
"message"
],
"additionalProperties": false
]
}
},
"required": [
@@ -661,6 +847,521 @@
"shutdownTimeoutMs"
],
"additionalProperties": false
},
"resourceFailure": {
"type": "object",
"properties": {
"resource": {
"enum": [
"GuestBytes",
"HandleSlots",
"AuxiliaryBytes",
"TemporaryBytes",
"StringBytes",
"StringAllocations",
"IndividualStringBytes",
"CallDepth"
]
},
"reason": {
"enum": [
"Limit",
"SizeOverflow",
"AllocationFailed"
]
},
"requested": {
"type": "integer",
"minimum": 0
},
"limit": {
"type": "integer",
"minimum": 0
}
},
"required": [
"resource",
"reason",
"requested",
"limit"
],
"additionalProperties": false
},
"sourceSpan": {
"type": "object",
"properties": {
"file_id": {
"type": "integer",
"minimum": 0,
"maximum": 4294967295
},
"start": {
"type": "integer",
"minimum": 0,
"maximum": 4294967295
},
"end": {
"type": "integer",
"minimum": 0,
"maximum": 4294967295
}
},
"required": [
"file_id",
"start",
"end"
],
"additionalProperties": false
},
"loadFailure": {
"type": "object",
"properties": {
"code": {
"enum": [
"LOAD_INVALID_FORMAT",
"LOAD_UNSUPPORTED_FORMAT",
"LOAD_INVALID_REFERENCE",
"LOAD_INVALID_REGISTRY",
"LOAD_INVALID_CODE",
"LOAD_RESOURCE_LIMIT",
"LOAD_INVALID_ENTRYPOINT"
]
},
"reason": {
"enum": [
"Magic",
"Version",
"Endianness",
"Reserved",
"SectionKind",
"MissingSection",
"DuplicateSection",
"Overlap",
"Truncated",
"TrailingBytes",
"InvalidFlag",
"Utf8",
"Category",
"Builtin",
"TypeId",
"FunctionId",
"OwnerCategory",
"TraitCategory",
"DuplicateBuiltin",
"DuplicateArray",
"ArrayCycle",
"DuplicateImplementation",
"MethodCount",
"Signature",
"CodeRange",
"FrameSlots",
"ReturnSlots",
"Overflow",
"Limit",
"Allocation",
"ConstantTag",
"DebugRange",
"DuplicateSyscall",
"UnknownOpcode",
"LocalSlot",
"JumpTarget",
"InstructionBoundary",
"BooleanImmediate",
"ConstantIndex",
"NativeId",
"UnpatchedHostcall",
"StackUnderflow",
"StackOverflow",
"StackJoin",
"ReturnHeight",
"UnterminatedPath",
"UnknownClosureCallee",
"NotClosure",
"InvalidYield",
"TypeMismatch"
]
},
"section": {
"anyOf": [
{
"type": "integer",
"minimum": 0,
"maximum": 4294967295
},
{
"type": "null"
}
]
},
"record": {
"anyOf": [
{
"type": "integer",
"minimum": 0,
"maximum": 4294967295
},
{
"type": "null"
}
]
},
"member": {
"anyOf": [
{
"type": "integer",
"minimum": 0,
"maximum": 4294967295
},
{
"type": "null"
}
]
},
"referenced_id": {
"anyOf": [
{
"type": "integer",
"minimum": 0,
"maximum": 4294967295
},
{
"type": "null"
}
]
},
"function": {
"anyOf": [
{
"type": "integer",
"minimum": 0,
"maximum": 4294967295
},
{
"type": "null"
}
]
},
"pc": {
"anyOf": [
{
"type": "integer",
"minimum": 0,
"maximum": 4294967295
},
{
"type": "null"
}
]
},
"offset": {
"anyOf": [
{
"type": "integer",
"minimum": 0
},
{
"type": "null"
}
]
},
"id_domain": {
"enum": [
"Type",
"Function",
"Implementation",
null
]
},
"resource": {
"enum": [
"PbxBytes",
"CodeBytes",
"Types",
"Functions",
"Implementations",
"NestedRecords",
"NameBytes",
"RegistryBytes",
"TemporaryBytes",
"Work",
"ConstantEntries",
"ConstantStringBytes",
null
]
},
"requested": {
"anyOf": [
{
"type": "integer",
"minimum": 0
},
{
"type": "null"
}
]
},
"limit": {
"anyOf": [
{
"type": "integer",
"minimum": 0
},
{
"type": "null"
}
]
}
},
"required": [
"code",
"reason",
"section",
"record",
"member",
"referenced_id",
"function",
"pc",
"offset",
"id_domain",
"resource",
"requested",
"limit"
],
"additionalProperties": false
},
"bindingFailure": {
"oneOf": [
{
"type": "object",
"properties": {
"reason": {
"const": "unknown_syscall"
},
"module": {
"type": "string"
},
"name": {
"type": "string"
},
"version": {
"type": "integer",
"minimum": 0,
"maximum": 65535
}
},
"required": [
"reason",
"module",
"name",
"version"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"reason": {
"const": "missing_capability"
},
"module": {
"type": "string"
},
"name": {
"type": "string"
},
"version": {
"type": "integer",
"minimum": 0,
"maximum": 65535
},
"required": {
"type": "integer",
"minimum": 0
},
"provided": {
"type": "integer",
"minimum": 0
}
},
"required": [
"reason",
"module",
"name",
"version",
"required",
"provided"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"reason": {
"const": "abi_mismatch"
},
"module": {
"type": "string"
},
"name": {
"type": "string"
},
"version": {
"type": "integer",
"minimum": 0,
"maximum": 65535
},
"declared_arg_slots": {
"type": "integer",
"minimum": 0,
"maximum": 65535
},
"declared_ret_slots": {
"type": "integer",
"minimum": 0,
"maximum": 65535
},
"expected_arg_slots": {
"type": "integer",
"minimum": 0,
"maximum": 65535
},
"expected_ret_slots": {
"type": "integer",
"minimum": 0,
"maximum": 65535
}
},
"required": [
"reason",
"module",
"name",
"version",
"declared_arg_slots",
"declared_ret_slots",
"expected_arg_slots",
"expected_ret_slots"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"reason": {
"const": "hostcall_index_out_of_bounds"
},
"pc": {
"type": "integer",
"minimum": 0
},
"syscallIndex": {
"type": "integer",
"minimum": 0,
"maximum": 4294967295
},
"syscallsLength": {
"type": "integer",
"minimum": 0
}
},
"required": [
"reason",
"pc",
"syscallIndex",
"syscallsLength"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"reason": {
"const": "raw_syscall"
},
"pc": {
"type": "integer",
"minimum": 0
},
"syscallId": {
"type": "integer",
"minimum": 0,
"maximum": 4294967295
}
},
"required": [
"reason",
"pc",
"syscallId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"reason": {
"const": "unused_syscall"
},
"module": {
"type": "string"
},
"name": {
"type": "string"
},
"version": {
"type": "integer",
"minimum": 0,
"maximum": 65535
},
"syscallIndex": {
"type": "integer",
"minimum": 0,
"maximum": 4294967295
}
},
"required": [
"reason",
"module",
"name",
"version",
"syscallIndex"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"reason": {
"const": "hostcall_remaining"
},
"pc": {
"type": "integer",
"minimum": 0
},
"syscallIndex": {
"type": "integer",
"minimum": 0,
"maximum": 4294967295
}
},
"required": [
"reason",
"pc",
"syscallIndex"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"reason": {
"const": "decode_failed"
}
},
"required": [
"reason"
],
"additionalProperties": false
}
]
}
}
}