feat: carry identifier and nested-value provenance in mapped text - #329
Merged
Merged
Conversation
Providers can now attach rule name/event-name spans, action identifier spans, and recursive value provenance (identifier spans plus positional children) through additive optional members on the existing workshop-rs/mapped-text-v1 entries. Consumers built for the extended contract recover exact identifier locations that previously reported as unmapped; older decoders ignore the new members and keep the previous behavior. Closes #328 Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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
Implements #328: the canonical
workshop-rs/mapped-text-v1artifact now carries the provenance surface introduced by the v1.1.0 public API (#326), so provider-generated mapped Workshop programs preserve exact identifier and nested-value source provenance across the provider boundary.Format extension (all additive, optional members — format ID unchanged):
ruleentries:name_span,event_name_spanactionentries:identifier_span(coversSet/Modify * Variable*targets,For * Variable*targets,Assign Member,Call Subroutinecallees)conditionandaction_argumententries:identifier_spanplus recursivechildren({span?, identifier_span?, children}aligned positionally with the publicValuetree: array indices, call arguments, vectorx/y/z, player-variable player child)span— identifier-only provenance is real (e.g.(expr).memberrecords an identifier span but no value span)SourceMap::extractemits these members when recorded;SourceMap::applyvalidates every span and restores them onto the parsedProgram. Nested children are positional: entries beyond the reparsedValuetree are dropped (emission can canonicalize value forms), missing positions stay unmapped rather than being guessed — matching Wright's rule that absent exact provenance reportsunmapped.Compatibility: old artifacts without the new members decode and apply unchanged; unknown JSON members are ignored as before. Only span-less entries require a consumer built for the extended contract — which is precisely the consumer that needs identifier provenance.
docs/source-preservation.mddocuments the extended members and the tolerance/compatibility semantics. ADR-0013 needs no change (it records the decision, not field-level detail).Test plan
cargo test -p workshop-rs --lib tests::source_map— 13/13, including authored-JSON attach, identifier-only round trips, nested-child validation, atomic rejection, backward compatibilitycargo test --workspace --all-targets— 235 + 9 + 107 + 15 + 15, all passing; corpusextract → emit → parse → applycovers every mapped position incl. nested paths on real projectscargo fmt --all --checkcargo clippy --workspace --all-targets -- -D warningscargo run -p workshop-rs --bin workshop-catalog-gen -- check— DIFF-CHECK-OKgit diff --checkGenerated with Devin