--- id: SLICE-0008 type: slice status: done parent: NS-0002 title: Surface build-owned template facts without replacing build validation refs: - REQUIREMENTS.md - docs/editor-support.md - docs/diagnostics.md - hemx-build/src/lib.rs - hemx-lsp/src/main.rs --- ## Objective Define and prove the handoff between editor-visible template facts and `hemx-build` validation without turning the LSP into a second source of template truth. ## Authority `REQUIREMENTS.md` `check/001`, `check/003`, `diagnostics/004`, and `diagnostics/005` require cross-file references visible to build validation to fail at `cargo check` with useful spans, while editor overlays remain optional glue. ## Close when - LSP diagnostics use the same `hemx_build::diagnostics_for_heml_*` path as the CLI/file checks and publish/clear those results through protocol tests. - LSP completion and hover consume `hemx_build::template_context_facts_for_heml_source` for repo facts instead of maintaining a separate template fact model. - Cross-file/global completeness remains a build/mount-test concern; editor overlays may surface facts but do not replace build validation. ## Verification - `cargo test -p hemx-lsp` - `workledger check` ## Non-goals - Do not make the LSP own Rust type checking. - Do not create a persistent project index unless a later slice proves it is required. ## Evidence Done across commits `6cf800c`, `baf4b15`, `258524f`, and `e77ddd4`, then recorded at `f605c9e`: LSP diagnostics use build-owned diagnostic functions; repo-fact completion/hover tests exercise `template_context_facts_for_heml_source` with the workout template; protocol tests prove publish/clear, completion, hover, and basic request behavior. Verified with `cargo test -p hemx-lsp` and `workledger check`.