Skip to content

Provenance

Semenov Dmitrii edited this page Feb 17, 2026 · 1 revision

GDShrapt provides provenance for every non‑trivial reference when --explain is used.
Provenance answers the question:

Why does this call site resolve to this symbol?

Evidence Types

Type Flow

Tracks how a value acquires its type across assignments, arguments, and returns.

Example: EnemyBase via target at tower_base.gd:L127


Collection Element Inference

EnemyBase (element of Array[EnemyBase]) for enemy in enemies_in_range


Signal Payload Flow

ProjectileBase.area_entered -> _on_area_entered(area: Area2D)

GDShrapt:

  1. Reads signal signature
  2. Tracks the parameter type
  3. Enumerates scene instances of that type

Scene Filtering

(filtered by scene collision_layer)

This removes impossible runtime targets and enables promotion from potential to strict.


Hierarchy Closure

Area2D descendants with take_damage: EnemyBasic, EnemyFast, EnemyTank, Entity

Promotion occurs only when all candidates implement the method.


Promotion Rule

A potential reference is promoted when:

  1. All runtime types are known
  2. All implement the target symbol
  3. Scene filters exclude incompatible nodes

This converts dynamic calls into provably safe edits.


Why Provenance Matters

Without provenance, dynamic calls are unsafe to refactor.

With provenance:

  • Refactors become deterministic
  • Users can audit the proof chain
  • CI can trust --apply

Clone this wiki locally