Skip to content

docs: ADR 006 — Phase 2b interprocedural method-value propagation#30

Merged
flaglint merged 1 commit into
mainfrom
docs/adr-006-interprocedural-method-values
Jul 8, 2026
Merged

docs: ADR 006 — Phase 2b interprocedural method-value propagation#30
flaglint merged 1 commit into
mainfrom
docs/adr-006-interprocedural-method-values

Conversation

@flaglint

@flaglint flaglint commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Summary

Closes the loop from ADR 005, which deferred issue #26 (method value crossing a function boundary — the real, field-tested e2b-dev/infra case) as "Phase 2b" without committing to an approach.

Documents a wrinkle found while scoping this: the flag key is also interprocedural, not just the method value's identity — it's a plain call-site literal, invisible from inside the callee's own body — which rules out a naive "propagate the binding into the callee" fix.

Accepts a narrow "forwarding function" pattern (recognize a callee that forwards its function-valued parameter to a call using one of its own parameters as the key, resolving identity at the call site) over general go/ssa/go/callgraph data-flow — discussed with and approved by the user before writing this up.

Test plan

  • Docs-only change — no code affected

Summary by CodeRabbit

  • Documentation
    • Added a new architecture decision record describing the next phase of method-value propagation work.
    • Documented the recommended approach, known limitations, and a possible future expansion path.
    • Updated the ADR index to include the new entry.

Closes the loop from ADR 005, which deferred issue #26 (a method value
captured in one function, passed as an argument, invoked from inside a
different callee — the real, field-tested e2b-dev/infra case) as "Phase
2b" without committing to an approach.

Documents a wrinkle found while scoping this: the flag key is *also*
interprocedural, not just the method value's identity — it's a plain
call-site literal, invisible from inside the callee's own body — which
rules out simply propagating a binding into the callee and ruled out a
naive first instinct for how this might be solved.

Presents two approaches and accepts the narrower one: a "forwarding
function" pattern (recognize a callee that forwards its function-valued
parameter to a call using one of its own parameters as the key,
resolving identity at the call site rather than inside the callee — no
go/ssa/go/callgraph needed, reuses existing infrastructure) over general
data-flow via go/ssa/go/callgraph (generalizes further but is a
meaningfully larger, riskier engineering investment with its own
precision/soundness tradeoffs). Matches how #16 played out: a narrower
mechanism than expected turned out to be sufficient once shipped.

Signed-off-by: Krishan Kant Sharma <krishansharma0327@gmail.com>
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8455112b-572b-4f0d-a1d6-f6e86e35bd33

📥 Commits

Reviewing files that changed from the base of the PR and between a645d12 and 14c9ee5.

📒 Files selected for processing (2)
  • docs/adr/006-interprocedural-method-values.md
  • docs/adr/README.md

📝 Walkthrough

Walkthrough

This PR adds ADR 006, documenting the decision to implement interprocedural method-value propagation via a forwarding-function pattern (approach A), with a broader go/ssa/callgraph approach (approach B) noted as a future escalation. The ADR index is updated with the new entry.

Changes

ADR Documentation

Layer / File(s) Summary
New ADR 006 content and index entry
docs/adr/006-interprocedural-method-values.md, docs/adr/README.md
Documents the decision, problem context, forwarding-function detection strategy with false negatives, alternative go/ssa-based approach, recommendation to ship approach A first, and open questions; adds a corresponding row to the ADR index table.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the docs-only ADR addition about Phase 2b interprocedural method-value propagation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/adr-006-interprocedural-method-values

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@flaglint flaglint merged commit f4db6be into main Jul 8, 2026
14 checks passed
@flaglint flaglint deleted the docs/adr-006-interprocedural-method-values branch July 8, 2026 03:32
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.

2 participants