Skip to content

Add an engine-facing source map sidecar - #6

Merged
konojunya merged 1 commit into
mainfrom
jj/add-source-map-sidecar
Sep 3, 2026
Merged

Add an engine-facing source map sidecar#6
konojunya merged 1 commit into
mainfrom
jj/add-source-map-sidecar

Conversation

@konojunya

Copy link
Copy Markdown
Contributor

Background

Task 7 needs post-compiler layout, icon, and theme diagnostics to resolve back to authored Stack ranges without adding source locations to portable normalized IR. Omitted defaults also need to remain distinct from unknown semantic identities.

Implementation

  • add compile_with_source_map and compile_bytes_with_source_map as additive mapped compilation APIs
  • map the diagram theme identifier, every node icon string, and every diagram/group order hint by semantic identity
  • represent authored spans and omitted values explicitly with SourceOrigin
  • cover complete order statements from the keyword through the closing bracket, including intervening comments/trivia
  • keep node and layout entries in deterministic depth-first order using bounded vectors
  • leave AST, normalized IR, schemas, and existing compile APIs unchanged
  • document the Rust-only sidecar boundary in ADR-0006 and the frontend specification

Testing

  • cargo +stable fmt --check
  • cargo +stable test (38 unit tests, 6 integration tests)
  • STACK_SPECIFICATION_DIR=../specification cargo +stable test --features conformance --test conformance
  • cargo +stable clippy --all-targets --all-features -- -D warnings
  • RUSTDOCFLAGS="-D warnings" cargo +stable doc --no-deps
  • cargo +stable llvm-cov --lib --all-features --workspace --fail-under-lines 95 --fail-under-functions 95 --fail-under-regions 95 (97.90% regions, 99.13% functions, 98.60% lines)
  • cargo +1.85.0 test
  • cargo +1.85.0 clippy --all-targets --all-features -- -D warnings
  • git diff --check

Review focus / concerns

  • icon and theme origins point to their authored value tokens; order origins cover the complete statement required by future STK4001 diagnostics
  • an omitted value is SourceOrigin::Omitted, while a lookup for an unknown node/group returns None
  • source maps are emitted only when normalized IR is valid, avoiding ambiguous identities in error results
  • the sidecar is Rust-only and deliberately has no portable JSON representation

@konojunya
konojunya merged commit 007f153 into main Sep 3, 2026
2 checks passed
@konojunya
konojunya deleted the jj/add-source-map-sidecar branch September 3, 2026 04:47
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.

1 participant