Skip to content

feat: add SourceMap and canonical mapped Workshop artifact - #274

Merged
Teakowa merged 1 commit into
mainfrom
feat/source-map-272
Sep 24, 2026
Merged

Teakowa merged 1 commit into
mainfrom
feat/source-map-272

Conversation

@e54-bot

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

Copy link
Copy Markdown
Contributor

Fixes #272

Summary

  • Shape guard: attached mappings record the program shape; span accessors return None after rules, conditions, or actions are inserted or removed.
  • Public SourceMap (extract / apply) and MappedText, defining workshop-rs/mapped-text-v1 (JSON: text, file table, shape, position-keyed spans). workshop-rs/text-v1 is plain Workshop text.
  • apply rejects the whole mapping with a typed SourceMapError on shape mismatch or invalid entries; the program is left unchanged.
  • Documented in docs/source-preservation.md, docs/compatibility-facades.md, and rustdoc.

Notes

  • Shape also includes global/player variable and subroutine counts (ADR lists rules/conditions/actions) so declaration spans cannot displace.
  • File table carries paths only; authored source text can be added later as an optional field.
  • Re-attaching a span records the current shape of that scope.

Test plan

  • cargo fmt --all --check, cargo clippy --workspace --all-targets -- -D warnings
  • cargo test --workspace --all-targets (real-project extract → emit → parse → apply round trip, shape mismatch, drift, non-ASCII columns)
  • workshop-catalog-gen check, git diff --check
  • cargo semver-checks: additive

Define workshop-rs/text-v1 and workshop-rs/mapped-text-v1, a public
SourceMap that extracts from a span-bearing Program and applies to a
Program parsed from the same text, and a shape guard so span accessors
return None after rules, conditions, or actions are inserted or removed.

Fixes #272
@Teakowa
Teakowa enabled auto-merge (squash) September 24, 2026 08:25
@Teakowa
Teakowa merged commit 35ccc2f into main Sep 24, 2026
5 checks passed
@Teakowa
Teakowa deleted the feat/source-map-272 branch September 24, 2026 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Define canonical Workshop artifact formats and SourceMap

2 participants