Salsa database owns incremental analysis memoization
Platform spec ADR
Salsa database owns incremental analysis memoization
Spec standingStandard
- Stage ordering and lowering - Contracts and edge cases Required ordering guarantees and behavior under parse or semantic failures.
- Stage ordering and lowering - Design model Pipeline stage model and artifact boundaries for the reference compiler.
- Stage ordering and lowering - Examples Newcomer-oriented examples of pipeline execution order and failure points.
- Stage ordering and lowering - FAQ and troubleshooting Troubleshooting guide for stage ordering assumptions in build and run commands.
- Stage ordering and lowering - Flow and algorithm Ordered lowering algorithm used by build and run command paths.
- Unit artifact cache schema On-disk and in-process unit snapshot layout under obj/beskid/cache/salsa/units/.
- Stage ordering and lowering - Verification and traceability Source and test anchors that verify lowering order and backend artifact handoff.
0 revisions (git unavailable at build; counts may be empty)
No commits recorded for this path.
Full tree: run pnpm verify:platform-spec-layout (writes src/generated/platform-spec-layout-report.json).
Context
Section titled “Context”Within-run deduplication and ad-hoc JSON unit caches did not provide dependency-tracked invalidation. LSP and CLI paths recomputed assembly and typing independently; session caches could return stale assemblies after edits.
Decision
Section titled “Decision”beskid_queries::BeskidDatabaseis the single incremental host for analysis memoization (Salsa 0.26 inputs + tracked queries + on-disk persistence under{project}/obj/beskid/cache/salsa/).- CLI, LSP, and tests route prepare/assembly through
beskid_queriesentry points—CLI via process-scoped session inbeskid_queries::session, LSP via workspaceState.compilation_db, tests via local or session handles—no second analysis spine. - Unit materialization during program assembly uses Salsa-backed unit queries (
parse_and_expand_unit_tracked,unit_hir_tracked,unit_imports); legacyobj/beskid/cache/units/JSON records are retired in favor ofobj/beskid/cache/salsa/units/{content_fp}/(see unit artifact cache schema). - Pipeline observers emit
salsa.query_hit,salsa.query_miss,salsa.revision_bump,salsa.artifact_disk_hit, andsalsa.artifact_disk_misscounters for verification.
Consequences
Section titled “Consequences”- File text edits invalidate only affected units and dependents via import edges.
- LSP
didChangesetsfile_textinputs; diagnostics and IDE snapshots share the same database. - Mod-host invalidation keys (
syntax_generation_id,manifest_generation_id,capability_set_id) map to Salsa inputs inbeskid_queries::modhost.
Status
Section titled “Status”Accepted — implemented in compiler/crates/beskid_queries/ and compiler/crates/beskid_artifacts/. Legacy units/ JSON cache is retired; disk persistence uses content-addressed salsa/units/ snapshots.