Skip to content

feat(analyzer): report identifier spans from workshop-rs provenance - #438

Merged
Teakowa merged 3 commits into
mainfrom
wright-433-identifier-spans
Sep 29, 2026
Merged

Teakowa merged 3 commits into
mainfrom
wright-433-identifier-spans

Conversation

@e54-bot

@e54-bot e54-bot commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Bump workshop-rs to 1.1.0, which records identifier-level source spans for declarations, action targets and callees, and nested values (wrightkit/workshop-rs#324, wrightkit/workshop-rs#325).
  • SemanticIndex now takes declaration/write/call/read spans from the provenance accessors (*_name_span, action_identifier_span, rule_event_name_span, condition_value_span, action_argument_value_span); visit_value_tree threads the child-position path the nested-value accessors address by.
  • Text-search identifier recovery is removed from the raw build path; absent provenance reports span: null (unmapped per docs/agent-contract.md), never an enclosing span. The provider-authored-source search stays confined to build_with_sources, and its condition fallback no longer mistakes a ValueId for a condition index.
  • Lint findings that name an expensive call now point at the call expression instead of the enclosing action.

Provider (OPY/DEL) note

The mapped-text SourceMap carries declaration name spans, so provider programs still report exact declaration spans, but the format cannot attach action identifiers, rule/event names, or nested value nodes — writes, calls, definitions, and nested reads on mapped OPY/DEL input now report unmapped instead of a coarse enclosing span. That is the contract this issue specifies; restoring identifier fidelity there is the providers' job once wrightkit/workshop-rs#328 extends the map format.

Test plan

  • overpy-cake.ws: every cakePos/i2/candlePos reference slices to the identifier and the declaration reference is present
  • symbols returns declaration-name spans for the fixture's globals
  • nested reads (Add(First Of(Global.cakePos), …), Event Player.stamina inside Add) slice to the identifier
  • same-name strings/comments in the action are never reported
  • subroutine declaration/definition/call spans slice to the name
  • missing provenance reports unmapped, never the enclosing span
  • cargo fmt --all -- --check, cargo clippy --workspace --all-targets --all-features -- -D warnings, cargo test --workspace --all-targets --all-features, git diff --check all clean

Closes #433

The 1.1.0 release records identifier-level source spans for declarations, action targets and callees, and nested values (wrightkit/workshop-rs#324, wrightkit/workshop-rs#325), which Wright consumes to report exact reference and symbol locations.

Refs #433
Raw Workshop references and symbol declarations now take their spans from the parser-recorded provenance accessors (global/player/subroutine/rule name spans, action identifier spans, condition and action-argument value paths) instead of re-searching the source text inside a coarse enclosing span. visit_value_tree carries the child-position path the provenance API addresses values by, and analysis findings point at the offending call expression rather than a whole enclosing action.

Without recorded provenance — a programmatically built program or a provider-attached program without identifier spans — spans report as unmapped instead of falling back to an enclosing span. The provider-side text search remains only in SemanticIndex::build_with_sources, which resolves provider-file occurrences for OPY/DEL sources.

Closes #433
…coverage

build_with_sources' read fallback passed the ValueId as a condition index to condition_span — wrong or out of range for multi-condition rules. The fallback is removed rather than re-indexed: provider condition reads resolve through the mapped root span, and nested reads without recorded provenance report unmapped.

Tests now also slice subroutine declaration/definition/call spans and a nested Event Player variable read to their identifiers.

Refs #433
@Teakowa
Teakowa merged commit 2ce4854 into main Sep 29, 2026
22 checks passed
@Teakowa
Teakowa deleted the wright-433-identifier-spans branch September 29, 2026 19:02
e54-bot pushed a commit that referenced this pull request Sep 29, 2026
Main gained identifier spans from workshop-rs provenance (#438), so the references list now includes the declaration entry beside reads and writes (18 for cakePos). Refresh the assertion and drop the stale 'until #433 lands' notes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

Report reference and declaration spans at the identifier, from workshop-rs provenance

2 participants