Repository navigation
chore(lsp): review follow-ups — per-file codecs, memoization tests, doc fixes - #4007
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughAdds Salsa memoization tests and test workflow guidance, and changes LSP references and workspace symbol handlers to reuse ChangesMemoization test coverage
LSP position codec caching
Estimated code review effort: 2 (Simple) | ~15 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
⏭️ Performance benchmarks were skippedPerf benchmarks (CodSpeed) are opt-in on pull requests — they no longer run on every push. They always run automatically after merge to To run them on this PR, do any of the following, then push a commit (or re-run CI):
|
Binary size checks passed✅ 7 passed
Generated by |
…oc fixes Batches the four review items deferred from #4000's review cycle: - references and workspace/symbol handlers build one PositionCodec per distinct target file instead of per result (codec construction scans the whole file for its line table; many results share a file). - Port the salsa event-log memoization tests: file_annotations and semantic_tokens execute once cold, zero warm, and re-execute after a source edit (pins the B1 tracked-query contract; count-based so implementation rewrites keep the tests meaningful). - TEST_INSTRUCTIONS.md: add `cargo test --lib` to the verification section; fix two case-sensitive UPDATE_EXPECT references (lowercase `update_expect=1` is a silent no-op). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VEMxti5WQ8bCgJUuX9AQvo
5329262 to
d3cfa2c
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
baml_language/crates/baml_lsp2_actions_tests/src/memoization.rs (1)
88-93: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winDecouple invalidation checks from result inequality.
A query can be correctly invalidated and recomputed while producing the same observable result. The contract under test is the
WillExecute == 1assertion, soassert_ne!makes these tests unnecessarily brittle.
baml_language/crates/baml_lsp2_actions_tests/src/memoization.rs#L88-L93: removeassert_ne!(changed, cold)forfile_annotations.baml_language/crates/baml_lsp2_actions_tests/src/memoization.rs#L109-L114: removeassert_ne!(changed, cold)forsemantic_tokens.Suggested adjustment
- assert_ne!(changed, cold); assert_eq!(query_execution_count(&db, &events, "file_annotations"), 1);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@baml_language/crates/baml_lsp2_actions_tests/src/memoization.rs` around lines 88 - 93, Remove the result-inequality assertions from both memoization checks: the file_annotations test at baml_language/crates/baml_lsp2_actions_tests/src/memoization.rs:88-93 and the semantic_tokens test at baml_language/crates/baml_lsp2_actions_tests/src/memoization.rs:109-114. Keep the WillExecute/query_execution_count assertions as the sole validation that each query was invalidated and recomputed.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@baml_language/crates/baml_lsp2_actions_tests/src/memoization.rs`:
- Around line 88-93: Remove the result-inequality assertions from both
memoization checks: the file_annotations test at
baml_language/crates/baml_lsp2_actions_tests/src/memoization.rs:88-93 and the
semantic_tokens test at
baml_language/crates/baml_lsp2_actions_tests/src/memoization.rs:109-114. Keep
the WillExecute/query_execution_count assertions as the sole validation that
each query was invalidated and recomputed.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: a5fb1f8b-aaca-4259-8d5f-512ad86f56f9
⛔ Files ignored due to path filters (1)
baml_language/Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (5)
baml_language/TEST_INSTRUCTIONS.mdbaml_language/crates/baml_lsp2_actions_tests/Cargo.tomlbaml_language/crates/baml_lsp2_actions_tests/src/lib.rsbaml_language/crates/baml_lsp2_actions_tests/src/memoization.rsbaml_language/crates/bex_project/src/bex_lsp/multi_project/request.rs
Stacked on #4000 (retargets to canary when it merges). Batches the four small items deferred from the #4000 review cycle so the approved, CI-green main PR stayed untouched.
PositionCodecinreferencesandworkspace/symbol— CodeRabbit's one valid Major on fix(lsp): resolve the 0.14 mutex/latency regression — Phase 0 containment + Phase 1 bounded ingress #4000: codec construction scans the entire target file to build its line table, and both handlers built one per result; a symbol with N usages in one file did N identical scans. Now one codec per distinct file via a lazy map inside each handler (the same patterndocument_symbolalready used).file_annotationsandsemantic_tokensexecute exactly once cold, zero times warm, and once again after a source edit — asserted by counting salsaWillExecuteevents, so future implementation rewrites (including the feat(lsp): resolution-first semantic tokens rework #3867 re-land) keep the tests meaningful. This also formally answers the stale "bypasses Salsa memoization" review claim on refactor(lsp): Phase 0 latency and mutex containment #3969 by pinning the invariant.TEST_INSTRUCTIONS.md: the "Verify all tests pass" section now includescargo test --lib(previously the documented flow skipped the workspace unit tests entirely — where all of fix(lsp): resolve the 0.14 mutex/latency regression — Phase 0 containment + Phase 1 bounded ingress #4000's new tests live), and two case-sensitiveUPDATE_EXPECTreferences fixed (lowercaseupdate_expect=1is a silent no-op for expect-test).Validation:
bex_project45/45,baml_lsp2_actions_tests377/377 (incl. the 2 new memoization tests), clippy-D warningsclean, wasm check clean.🤖 Generated with Claude Code
https://claude.ai/code/session_01VEMxti5WQ8bCgJUuX9AQvo
Summary by CodeRabbit
Performance
Bug Fixes
Documentation