feat(analyzer): report identifier spans from workshop-rs provenance - #438
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
workshop-rsto 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).SemanticIndexnow 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_treethreads the child-position path the nested-value accessors address by.buildpath; absent provenance reportsspan: null(unmapped perdocs/agent-contract.md), never an enclosing span. The provider-authored-source search stays confined tobuild_with_sources, and its condition fallback no longer mistakes aValueIdfor a condition index.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
unmappedinstead of a coarse enclosing span. That is the contract this issue specifies; restoring identifier fidelity there is the providers' job oncewrightkit/workshop-rs#328extends the map format.Test plan
overpy-cake.ws: everycakePos/i2/candlePosreference slices to the identifier and the declaration reference is presentsymbolsreturns declaration-name spans for the fixture's globalsAdd(First Of(Global.cakePos), …),Event Player.staminainsideAdd) slice to the identifiercargo fmt --all -- --check,cargo clippy --workspace --all-targets --all-features -- -D warnings,cargo test --workspace --all-targets --all-features,git diff --checkall cleanCloses #433