docs(lambda): decide edit bridge boundary#669
Conversation
|
Warning Review limit reached
More reviews will be available in 40 minutes and 32 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughAdds ADR ChangesLambda Edit Bridge Boundary Decision
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
lambda-editor | c78d6f7 | Commit Preview URL Branch Preview URL |
Jun 15 2026, 09:26 AM |
Benchmark Comparison ReportComparing PR branch against Main Module BenchmarksBase branch: PR branch: event-graph-walker BenchmarksBase branch: PR branch: Benchmarks run with |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
docs/decisions/2026-06-15-lambda-edit-bridge-boundary.md (1)
28-37: ⚡ Quick winRewrite audit table to maintain principle-level documentation per coding guidelines.
The audit table violates the guideline that architecture documentation (
docs/**/*.md) must contain principles only and never reference specific types, fields, or line numbers. The table currently lists many implementation details:TreeEditError,SpanEdit,registry,definition_index,lang/lambda/companion/tree_edit_bridge_test.mbt, function names likeapply_lambda_tree_editandmove_node, etc.Reframe the comparison at the principle level. For example:
- Return type: Replace specific result types with principle: "Stringly typed result vs. typed error variants + patch trace".
- Context: Replace field names with principle: "Generic context vs. language-specific structures requiring derivation from projection root".
- Module references: Replace file paths with principle: "Edit trace attestation requirements for inspector/patch consumers".
The core decision—that Lambda's application contract differs from the SPI in three persistent ways—is the principle that matters. The specific type/field names are implementation details that should not appear in architecture documentation.
📋 Reframed audit table template
| Dimension | Generic `LanguageSpec::apply_edit` | Lambda `apply_lambda_tree_edit` | Boundary decision | |---|---|---|---| | Required context | Fetches from editor; language closure computes edits from the generic shape: `(source, proj, source_map)` | Requires language-specific structures (registry, definition index) derived from projection state after cleanup; these are now derivable from the generic projection root, not requiring wider SPI context. | Context alone no longer blocks; Lambda remains separate because of application contract mismatch, not context width. | | Return type | Stringly typed result covering all outcomes | Typed error variants covering multiple failure modes; returns applied edit trace alongside the result | Preserve typed errors and trace; do not flatten into generic result without deliberate FFI consumer migration. | | Error transparency | Single error message per failure path | Multiple typed error branches for projection, parse, registry, transform, and edit failures | Keep typed errors as public API; do not drop them to unify the SPI. | | Patch trace | Applies edits internally; no successful edit trace exposed | Returns exact SpanEdit array applied; inspector/patch consumers depend on the trace attestation | Preserve the trace as a public invariant. | | Drop/move semantics | No editor-coupled branch; SPI only applies language-computed spans | Drop delegates to editor-owned `move_node` for placeholder/separator handling | Keep Drop out of SPI until another language requires the same editor coupling. | | FFI/public callers | JSON/Markdown wrappers; callers observe `Ok(())` or error string | Lambda facade used by semantic/intent surfaces that depend on typed messages and patch traces | Keep facade stable; changing it breaks consumers. |🤖 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 `@docs/decisions/2026-06-15-lambda-edit-bridge-boundary.md` around lines 28 - 37, The audit table in the decision document contains implementation-specific details (type names like TreeEditError and SpanEdit, field names like registry and definition_index, file paths like lang/lambda/companion/tree_edit_bridge_test.mbt, and function names like apply_lambda_tree_edit and move_node) that violate the architectural documentation guideline requiring principles-only content. Rewrite each row of the audit table to express the underlying architectural principle instead: generalize "Return type" to discuss the contrast between stringly-typed results versus typed error variants with patch tracing; replace "Context" field references with the principle of generic versus language-specific structures; replace file path citations with the principle of edit trace requirements for downstream consumers; and similarly abstract the "Drop/move_node" row to the principle of editor-coupled move semantics rather than specific function names. Keep the core decision intact (that Lambda's contract differs in three persistent ways from the SPI) but remove all concrete type names, field names, file paths, and function references.Source: Coding guidelines
🤖 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.
Inline comments:
In `@docs/plans/2026-06-14-lambda-cstfold-modernization-623.md`:
- Around line 3-4: The Status line contains `#634` which the Markdown parser
misinterprets as an atx-style heading marker due to the missing space after the
`#` symbol. Fix this by escaping the issue reference with a backslash (change
`#634` to `\`#634``) or by rewording the Status line to avoid placing the issue
reference in a position where it could be parsed as a heading marker. Apply this
fix to both occurrences of `#634` in the Status line on lines 3-4 of the
document.
---
Nitpick comments:
In `@docs/decisions/2026-06-15-lambda-edit-bridge-boundary.md`:
- Around line 28-37: The audit table in the decision document contains
implementation-specific details (type names like TreeEditError and SpanEdit,
field names like registry and definition_index, file paths like
lang/lambda/companion/tree_edit_bridge_test.mbt, and function names like
apply_lambda_tree_edit and move_node) that violate the architectural
documentation guideline requiring principles-only content. Rewrite each row of
the audit table to express the underlying architectural principle instead:
generalize "Return type" to discuss the contrast between stringly-typed results
versus typed error variants with patch tracing; replace "Context" field
references with the principle of generic versus language-specific structures;
replace file path citations with the principle of edit trace requirements for
downstream consumers; and similarly abstract the "Drop/move_node" row to the
principle of editor-coupled move semantics rather than specific function names.
Keep the core decision intact (that Lambda's contract differs in three
persistent ways from the SPI) but remove all concrete type names, field names,
file paths, and function references.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 445baf8f-b629-4af7-b499-442e24d73da4
📒 Files selected for processing (7)
docs/README.mddocs/decisions/2026-06-15-lambda-edit-bridge-boundary.mddocs/development/ADDING_A_LANGUAGE.mddocs/plans/2026-06-11-s3-lang-runtime-extraction.mddocs/plans/2026-06-14-lambda-cstfold-modernization-623.mdlang/lambda/README.mdlang/runtime/README.md
b543595 to
f20ac9f
Compare
f20ac9f to
c78d6f7
Compare
Summary
ModuleProjectiondecision record for Lambda: revisit edit bridge after ModuleProjection removal #634.apply_lambda_tree_editbridge; do not migrate it toLanguageSpec::apply_editor introduce a Lambda-only generic runtime API.ProjNode, while typed errors, patch trace, and editor-ownedDropremain the boundary.apply_lambda_tree_edit(..., cursor)wording totimestamp_ms.Closes #634.
Decision audit
DefinitionIndexare now derivable from the genericProjNoderoot; context alone is not a reason to widenLanguageSpec.Result[Array[SpanEdit], TreeEditError];LanguageSpec::apply_editreturnsResult[Unit, String].TreeEditError; do not flatten unless Lambda FFI/public consumers are deliberately migrated.Dropspecial-case throughSyncEditor::move_node.ffi/lambda/intent.mbt,ffi/lambda/semantic.mbt, and editor/example facade behavior.Reuse check
LanguageSpec::apply_edit,compute_text_edit,EditContext,DefinitionIndex::from_proj_node,SyncEditor::move_node,TreeEditError.moon ide outlineforlang/runtime/language_spec.mbt,lang/lambda/companion/lambda_editor.mbt, andlang/lambda/edits/text_edit.mbt;moon ide doc/peek-defhit a local IDE JSON parse error, so I cross-checked by reading the definitions and running validation.Validation
NEW_MOON_MOD=0 moon check lang/lambda/companion lang/lambda/edits ffi/lambda editor lang/runtime --deny-warnNEW_MOON_MOD=0 moon test lang/lambda/companion lang/lambda/edits ffi/lambda editor lang/runtime(485 passed)NEW_MOON_MOD=0 moon fmtNEW_MOON_MOD=0 moon info(reviewed.mbti; only unrelated trailing blank-line churn, reverted)git diff -- '*.mbti'(empty)git diff --checkbash scripts/check-agent-doc-links.shSummary by CodeRabbit
timestamp_msparameter).