Web API Exercise¶
Every generated Web wrapper member is one GodotBackendCalls.invoke<Shape>(descriptor, ...) call, and the
Web backend implements each call shape of scripts/platform_backend_calls.json once (a Kotlin arm, a
JS bridge extern and a GDScript arm), so a defect in a shape is shared by every opcode of it. The web3d
smoke runs one generated row per shape (ApiExerciseProbe.kt): the row calls the shape on an object the
scene constructs and checks it against the generic tier (WebExperimentalGenericCall.callImmediate, callv
by name) on the same object. The browser driver requires every row to pass (checks.apiExercise), in
Chrome and Firefox; the console line is [kanama:web] API EXERCISE: <n> passed, <m> failed, <w> weak,
<r> reach, <e> excluded in <ms> ms, with one [kanama:web] API EXERCISE FAIL: <shape> <Class.method>
expected <x> got <y> per failed row.
Shapes: 93 (333 opcodes). Rows by check: oracle 39, readback 24, custom 23, reach 5, excluded 1, reach (draw) 1.
| check | the row asserts |
|---|---|
| oracle | the call's result equals the generic call of the same method with the same arguments on the same object; a result equal to its type's zero is weak (counted, not failed) |
| readback | a void call's value reads back through the generic getter (a queued mutation a frame later), and the getter read something else before the call |
| custom | an assertion the generic tier cannot be the oracle of, written in the row: a connected handler's payload, a new object's state, the engine's seeded random generator |
| reach | the call returns without an exception: the shape's arguments have no generic encoding and nothing reads its effect back |
| excluded | not called (the reason is in the table) |
The row table (opcode, receiver, arguments, and the check where the rule cannot derive it) is hand-kept in
scripts/generate_web_exercise.py; the descriptor, the SPI call, the generic oracle call, a setter's
getter and the queued-mutation frame are derived. A shape the contract gains without a row fails --check.
| shape | opcode | call | mode | check | why |
|---|---|---|---|---|---|
BASIS_RET_LONG |
206 | GridMap.get_orthogonal_index_from_basis |
IMMEDIATE_RESULT | oracle | GridMap.get_orthogonal_index_from_basis of a quarter turn about Y |
BOOL_ARG |
97 | Node3D.set_visible |
QUEUED_MUTATION | readback | Node3D.set_visible: a fresh Node3D is visible, so false reads back as a change |
BOOL_RET_HANDLE |
38 | Tween.set_parallel |
IMMEDIATE_RESULT | custom | Tween.set_parallel returns its receiver: both paths must answer the same tween |
BOOL_RET_INT |
1 | Node.get_child_count |
IMMEDIATE_RESULT | oracle | Node.get_child_count on a fresh node given three children |
CALLABLE_DOUBLE_RANGE_RET_HANDLE |
192 | Tween.tween_method |
IMMEDIATE_RESULT | reach | a Callable argument has no generic encoding; the tween is killed before it steps |
CALLABLE_RET_HANDLE |
137 | Tween.tween_callback |
IMMEDIATE_RESULT | reach | a Callable argument has no generic encoding; the tween is killed before it steps |
COLOR_ARG |
32 | CanvasItem.set_modulate |
QUEUED_MUTATION | readback | CanvasItem.set_modulate on a fresh Node2D (CanvasItem is abstract) |
COLOR_RET_HANDLE |
290 | PropertyTweener.from |
IMMEDIATE_RESULT | custom | PropertyTweener.from returns its receiver: both paths must answer the same tweener |
DOUBLE_ARG |
316 | Camera3D.set_fov |
QUEUED_MUTATION | readback | Camera3D.set_fov on a fresh camera (75 before) |
DOUBLE_RET_DOUBLE |
306 | Curve.sample |
IMMEDIATE_RESULT | oracle | Curve.sample on a fresh two-point curve |
DOUBLE_RET_HANDLE |
321 | SceneTree.create_timer |
IMMEDIATE_RESULT | custom | SceneTree.create_timer makes a new timer per call: the generic tier reads the new timer's time left |
LONG_ARG |
115 | DirectionalLight3D.set_sky_mode |
QUEUED_MUTATION | readback | DirectionalLight3D.set_sky_mode, the first non-default mode |
LONG_ARG_SINGLETON |
269 | Engine.set_max_fps |
IMMEDIATE_RESULT | readback | Engine.set_max_fps reads back through Engine.get_max_fps; the value read first is set back at the end |
LONG_BOOL_ARG |
155 | CollisionObject3D.set_collision_mask_value |
IMMEDIATE_RESULT | readback | CollisionObject3D.set_collision_mask_value on a fresh body (mask 1: layer 3 is off) |
LONG_BOOL_DOUBLE_LONG_DOUBLE_DOUBLE_ARG_SINGLETON |
326 | RenderingServer.environment_set_ssao_quality |
IMMEDIATE_RESULT | reach | RenderingServer.environment_set_ssao_quality has no getter; the arguments are the project defaults |
LONG_DOUBLE_ARG |
84 | Light3D.set_param |
QUEUED_MUTATION | readback | Light3D.set_param(PARAM_ENERGY) on a fresh light (1.0 before); Light3D is abstract |
LONG_LONG_RET_HANDLE |
217 | SceneState.get_node_property_value |
IMMEDIATE_RESULT | oracle | SceneState.get_node_property_value of the packed node's mesh (the Web shape returns object values) |
LONG_LONG_RET_STRING |
216 | SceneState.get_node_property_name |
IMMEDIATE_RESULT | oracle | SceneState.get_node_property_name of the packed node's mesh |
LONG_OBJECT_ARG |
210 | MeshLibrary.set_item_mesh |
IMMEDIATE_RESULT | readback | MeshLibrary.set_item_mesh reads back through get_item_mesh (the item must exist) |
LONG_RET_BOOL_SINGLETON |
313 | Input.is_key_pressed |
IMMEDIATE_RESULT | oracle | Input.is_key_pressed(KEY_A): nothing presses it |
LONG_RET_HANDLE |
133 | Node.get_child |
IMMEDIATE_RESULT | oracle | Node.get_child, a const lookup, on a fresh node given three children |
LONG_RET_LONG |
215 | SceneState.get_node_property_count |
IMMEDIATE_RESULT | oracle | SceneState.get_node_property_count of a packed MeshInstance3D with a mesh |
LONG_RET_STRING |
214 | SceneState.get_node_type |
IMMEDIATE_RESULT | oracle | SceneState.get_node_type of a packed MeshInstance3D |
LONG_RET_VECTOR3 |
173 | ShapeCast3D.get_collision_point |
IMMEDIATE_RESULT | oracle | ShapeCast3D.get_collision_point(0) of a cast down onto the scene's floor (index 0 must exist: an empty cast logs an error) |
LONG_TRANSFORM3D_ARG |
211 | MeshLibrary.set_item_mesh_transform |
IMMEDIATE_RESULT | readback | MeshLibrary.set_item_mesh_transform reads back through get_item_mesh_transform |
NOARGS_RET_BOOL |
139 | Timer.is_stopped |
IMMEDIATE_RESULT | oracle | Timer.is_stopped on a fresh timer (true): an immediate read with no snapshot |
NOARGS_RET_COLOR |
31 | CanvasItem.get_modulate |
SNAPSHOT_READ | oracle | CanvasItem.get_modulate, the shape's only opcode (a snapshot read; a constructed node's is seeded) |
NOARGS_RET_DOUBLE |
317 | Camera3D.get_fov |
IMMEDIATE_RESULT | oracle | Camera3D.get_fov on a fresh camera: an immediate read with no snapshot |
NOARGS_RET_HANDLE |
73 | Node.get_parent |
IMMEDIATE_RESULT | oracle | Node.get_parent of a fresh child: a const read of an existing node |
NOARGS_RET_HANDLE_LIST |
167 | Area3D.get_overlapping_bodies |
IMMEDIATE_RESULT | oracle | Area3D.get_overlapping_bodies, the shape's only opcode: empty out of the tree (weak) |
NOARGS_RET_LONG |
296 | InputEventKey.get_keycode |
IMMEDIATE_RESULT | oracle | InputEventKey.get_keycode after a generic set_keycode(KEY_A) |
NOARGS_RET_LONG_LIST_SINGLETON |
312 | Input.get_connected_joypads |
IMMEDIATE_RESULT | oracle | Input.get_connected_joypads: none in a headless browser (weak) |
NOARGS_RET_LONG_SINGLETON |
145 | Input.get_mouse_mode |
IMMEDIATE_RESULT | oracle | Input.get_mouse_mode: stable within a run |
NOARGS_RET_RECT2 |
4 | CanvasItem.get_viewport_rect |
SNAPSHOT_READ | oracle | CanvasItem.get_viewport_rect, a snapshot read: the probe's own (scripted, in the tree) is refreshed by its proxy |
NOARGS_RET_STRING |
278 | Node.get_name |
IMMEDIATE_RESULT | oracle | Node.get_name after a generic set_name |
NOARGS_RET_STRING_ARRAY |
72 | SpriteFrames.get_animation_names |
SNAPSHOT_READ | oracle | SpriteFrames.get_animation_names, a snapshot read: the bridge seeds it when AnimatedSprite2D.get_sprite_frames hands the frames over |
NOARGS_RET_STRING_SINGLETON |
329 | OS.get_name |
IMMEDIATE_RESULT | oracle | OS.get_name: the immediate opcode of the shape |
NOARGS_RET_VECTOR2 |
252 | Control.get_position |
IMMEDIATE_RESULT | oracle | Control.get_position after a generic set_position: an immediate read with no snapshot |
NOARGS_RET_VECTOR2_SINGLETON |
314 | Input.get_last_mouse_velocity |
IMMEDIATE_RESULT | oracle | Input.get_last_mouse_velocity: nothing moves the mouse |
NOARGS_RET_VECTOR3 |
239 | CPUParticles3D.get_emission_box_extents |
IMMEDIATE_RESULT | oracle | CPUParticles3D.get_emission_box_extents after a generic set: an immediate read with no snapshot |
NOARGS_RET_VECTOR3I_LIST |
208 | GridMap.get_used_cells |
IMMEDIATE_RESULT | oracle | GridMap.get_used_cells after a generic set_cell_item |
NOARGS_VOID |
5 | CanvasItem.queue_redraw |
QUEUED_MUTATION | custom | CanvasItem.queue_redraw on the probe: its draw callback runs again |
NODEPATH_RET_HANDLE |
17 | Node.get_node_or_null |
IMMEDIATE_RESULT | oracle | Node.get_node_or_null of a named child |
OBJECT_ARG |
16 | Sprite2D.set_texture |
QUEUED_MUTATION | readback | Sprite2D.set_texture reads back through get_texture |
OBJECT_BOOL_LONG_ARGS |
13 | Node.add_child |
QUEUED_MUTATION | readback | Node.add_child reads back as one child |
OBJECT_LONG_VECTOR2_ARGS |
21 | Input.set_custom_mouse_cursor |
IMMEDIATE_RESULT | reach | Input.set_custom_mouse_cursor(null) restores the default cursor; nothing reads a cursor back |
OBJECT_NODEPATH_COLOR_DOUBLE_RET_HANDLE |
40 | Tween.tween_property |
IMMEDIATE_RESULT | custom | Tween.tween_property makes a new tweener per call: a zero-duration tween sets the final value when it steps |
OBJECT_NODEPATH_DOUBLE_DOUBLE_RET_HANDLE |
289 | Tween.tween_property |
IMMEDIATE_RESULT | custom | Tween.tween_property makes a new tweener per call: a zero-duration tween sets the final value when it steps (a swap of the two doubles leaves it at 0) |
OBJECT_NODEPATH_VECTOR2_DOUBLE_RET_HANDLE |
39 | Tween.tween_property |
IMMEDIATE_RESULT | custom | Tween.tween_property makes a new tweener per call: a zero-duration tween sets the final value when it steps |
OBJECT_NODEPATH_VECTOR3_DOUBLE_RET_HANDLE |
136 | Tween.tween_property |
IMMEDIATE_RESULT | custom | Tween.tween_property makes a new tweener per call: a zero-duration tween sets the final value when it steps |
OBJECT_RET_HANDLE |
134 | Tween.bind_node |
IMMEDIATE_RESULT | custom | Tween.bind_node returns its receiver (a second bind through the generic tier would rebind it) |
OBJECT_STRING_RET_LONG_SINGLETON |
223 | ResourceSaver.save |
IMMEDIATE_RESULT | oracle | ResourceSaver.save of a fresh Resource under user:// (removed at the end): both paths answer OK |
STRINGNAME_ARG |
66 | Label.set_text |
QUEUED_MUTATION | readback | Label.set_text (AudioStreamPlayer.set_bus reads Master back for a bus that does not exist) |
STRINGNAME_ARG_SINGLETON |
292 | InputMap.add_action |
IMMEDIATE_RESULT | readback | InputMap.add_action reads back through InputMap.has_action; the action is erased at the end |
STRINGNAME_BOOL_ARG |
67 | Object.set_deferred |
QUEUED_MUTATION | readback | Object.set_deferred reads back through get once the deferred set ran |
STRINGNAME_BOUND_CALLABLE_LONG_RET_LONG |
34 | Object.connect |
IMMEDIATE_RESULT | custom | a Callable argument has no generic encoding: the bound connection returns OK and a generic emit hands its handler the bound value |
STRINGNAME_CALLABLE_LONG_RET_LONG |
22 | Object.connect |
IMMEDIATE_RESULT | custom | a Callable argument has no generic encoding: the connection returns OK and a generic emit reaches its handler |
STRINGNAME_DOUBLE_ARG |
151 | Object.set_indexed |
QUEUED_MUTATION | readback | Object.set_indexed of a component path reads back through get_indexed |
STRINGNAME_INT_RET_INT |
8 | Object.emit_signal |
IMMEDIATE_RESULT | custom | an emit returns OK whether or not anything listens: the probe's connected handler reads the payload |
STRINGNAME_LONG_ARG |
231 | Object.set_indexed |
QUEUED_MUTATION | readback | Object.set_indexed of an int property reads back through get_indexed |
STRINGNAME_OBJECT_ARG |
281 | Object.call_deferred |
QUEUED_MUTATION | readback | Object.call_deferred("add_child", node) reads back as one child once the deferred call ran |
STRINGNAME_OBJECT_ARG_SINGLETON |
293 | InputMap.action_add_event |
IMMEDIATE_RESULT | readback | InputMap.action_add_event reads back through InputMap.action_has_event |
STRINGNAME_OBJECT_RET_INT |
148 | Object.emit_signal |
IMMEDIATE_RESULT | custom | an emit returns OK whether or not anything listens: the probe's connected handler reads the payload |
STRINGNAME_RET_BOOL |
23 | Object.is_class |
IMMEDIATE_RESULT | oracle | Object.is_class on a fresh Node3D |
STRINGNAME_RET_BOOL_SINGLETON |
83 | OS.has_feature |
IMMEDIATE_RESULT | oracle | OS.has_feature("web") |
STRINGNAME_RET_DOUBLE_SINGLETON |
187 | ProjectSettings.get_setting |
IMMEDIATE_RESULT | oracle | ProjectSettings.get_setting of a float setting (980.0): Input's opcodes need a pressed action |
STRINGNAME_RET_HANDLE |
12 | ClassDB.instantiate |
IMMEDIATE_RESULT | custom | ClassDB.instantiate makes a new object per call: the generic tier reads the new object's class |
STRINGNAME_RET_HANDLE_LIST |
318 | SceneTree.get_nodes_in_group |
IMMEDIATE_RESULT | oracle | SceneTree.get_nodes_in_group of a group of one |
STRINGNAME_RET_INT |
35 | Object.emit_signal |
IMMEDIATE_RESULT | custom | an emit returns OK whether or not anything listens: the probe's connected handler counts the emission |
STRINGNAME_RET_LONG |
264 | ConfigFile.load |
IMMEDIATE_RESULT | oracle | ConfigFile.load of a path that does not exist: ERR_FILE_NOT_FOUND on both paths (save would be OK = weak) |
STRINGNAME_RET_LONG_SINGLETON |
190 | OS.shell_open |
IMMEDIATE_RESULT | excluded | OS.shell_open is the only opcode: on Web it opens a browser window |
STRINGNAME_RET_STRING |
268 | ConfigFile.get_value |
IMMEDIATE_RESULT | custom | ConfigFile.get_value packs section and key into the one slot and tags the result (s: for a String) |
STRINGNAME_RET_VECTOR2 |
233 | Object.get |
IMMEDIATE_RESULT | oracle | Object.get("position") after a generic set_position |
STRINGNAME_STRINGNAME_ARG |
230 | Object.set_indexed |
QUEUED_MUTATION | readback | Object.set_indexed of a String property reads back through get_indexed |
STRINGNAME_STRINGNAME_RET_DOUBLE_SINGLETON |
104 | Input.get_axis |
IMMEDIATE_RESULT | oracle | Input.get_axis(negative, positive) with the positive action pressed: 1.0, and -1.0 if the slots swap |
STRINGNAME_STRING_RET_INT |
196 | Object.emit_signal |
IMMEDIATE_RESULT | custom | an emit returns OK whether or not anything listens: the probe's connected handler reads the payload |
STRINGNAME_VECTOR2I_RET_INT |
28 | Object.emit_signal |
IMMEDIATE_RESULT | custom | an emit returns OK whether or not anything listens: the probe's connected handler reads the payload |
STRINGNAME_VECTOR2_ARG |
232 | Object.set_indexed |
QUEUED_MUTATION | readback | Object.set_indexed reads back through get_indexed |
STRINGNAME_VECTOR3_VECTOR3_ARG |
191 | Object.call |
QUEUED_MUTATION | readback | Object.call("look_at_from_position", position, target): the node moves to the first vector (it would move to the second if they swap) |
STRING_LIST_RET_STRING |
229 | PhysicsDirectSpaceState3D.intersect_ray |
IMMEDIATE_RESULT | custom | PhysicsDirectSpaceState3D.intersect_ray (receiver: a node of the world; from, to, mask and flags as text parts) packs the collider and the hit; the generic tier queries the same ray with a PhysicsRayQueryParameters3D |
STRING_STRING_BOOL_BOOL_RET_HANDLE_LIST |
224 | Node.find_children |
IMMEDIATE_RESULT | oracle | Node.find_children(pattern, type, recursive, owned = false) of unowned children: the type filter keeps one |
STRING_STRING_LONG_RET_HANDLE |
7 | ResourceLoader.load |
IMMEDIATE_RESULT | oracle | ResourceLoader.load with CACHE_MODE_REUSE: both paths answer the cached resource |
TEXTURE2D_VECTOR2_COLOR_ARGS |
6 | CanvasItem.draw_texture |
QUEUED_MUTATION | reach (draw) | CanvasItem.draw_texture is valid only inside a draw callback: the probe's draw() makes the call once after queue_redraw |
UTILITY_NOARGS_RET_DOUBLE |
11 | @GlobalScope.randf |
IMMEDIATE_RESULT | custom | randf after seed(125) equals a GDScript seed(125); randf() (the generic tier calls no utility) |
UTILITY_NOARGS_RET_LONG |
10 | @GlobalScope.randi |
IMMEDIATE_RESULT | custom | randi after seed(125) equals a GDScript seed(125); randi() (the generic tier calls no utility) |
UTILITY_NOARGS_VOID |
9 | @GlobalScope.randomize |
IMMEDIATE_RESULT | reach | randomize: nothing to read back |
VECTOR2_ARG |
3 | Node2D.set_position |
QUEUED_MUTATION | readback | Node2D.set_position (the snapshot-writing setter) |
VECTOR2_RET_VECTOR3 |
219 | Camera3D.project_ray_normal |
IMMEDIATE_RESULT | oracle | Camera3D.project_ray_normal (the origin of a camera at the origin is the zero vector); the camera must be in the tree |
VECTOR3I_LONG_LONG_ARG |
203 | GridMap.set_cell_item |
IMMEDIATE_RESULT | custom | GridMap.set_cell_item(cell, item, orientation) reads back through two getters (a swap of the two longs reads 10, 4) |
VECTOR3I_RET_LONG |
204 | GridMap.get_cell_item |
IMMEDIATE_RESULT | oracle | GridMap.get_cell_item after a generic set_cell_item |
VECTOR3_ARG |
74 | Node3D.set_position |
QUEUED_MUTATION | readback | Node3D.set_position (the snapshot-writing setter) |
VECTOR3_RET_HANDLE |
166 | PhysicsBody3D.move_and_collide |
IMMEDIATE_RESULT | custom | PhysicsBody3D.move_and_collide of a shapeless body far from the scene: no collision, and the motion vector is where it went |
VECTOR3_VECTOR3_ARG |
108 | Node3D.look_at_from_position |
IMMEDIATE_RESULT | readback | Node3D.look_at_from_position(position, target): the node moves to the first vector (it would move to the second if the slots swap) |