feat(generator): opt out of WebApplicationBuilder.Build() interception - #16
Conversation
Add a consumer-settable build property so a cooperating generator can own the
WebApplicationBuilder.Build() call site:
<QylAutoInstrumentationInterceptWebApplicationBuilderBuild>false</...>
C# allows only one interceptor per call site (CS9153). When a consumer also runs
another generator that intercepts builder.Build() — e.g. qyl's ServiceDefaults
generator, which composes our QylInterceptedAspNetCore.Build — the two collide.
This opt-out lets the consumer hand Build() to that generator while keeping every
other qyl auto-instrumentation interceptor.
- Generator reads build_property.QylAutoInstrumentationInterceptWebApplicationBuilderBuild
via AnalyzerConfigOptions; only an explicit "false" yields the call site. Absent or
any other value keeps full instrumentation, so default output is byte-identical.
- Core package build/buildTransitive targets expose it as a CompilerVisibleProperty.
- New tools/verify-build-interceptor-optout.py proves it is surgical (default emits the
Build interceptor + a control HttpClient interceptor; opt-out drops only Build, keeps
HttpClient, still builds) and is wired into the verify goal suite.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📜 Recent review details⏰ Context from checks skipped due to timeout. (2)
🧰 Additional context used📓 Path-based instructions (2)**⚙️ CodeRabbit configuration file
Files:
⚙️ CodeRabbit configuration file
Files:
src/**/*.cs⚙️ CodeRabbit configuration file
Files:
🔇 Additional comments (5)
📝 WalkthroughSummary by CodeRabbit
WalkthroughAdds a consumer-controlled opt-out for ChangesBuild interceptor opt-out
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
Why
C# allows only one interceptor per call site (
CS9153). When a consumer runs the qyl auto-instrumentation generator and another generator that also interceptsWebApplicationBuilder.Build()— e.g. qyl'sServiceDefaultsSourceGenerator, which composes ourQylInterceptedAspNetCore.Build— the two collide and the build fails. (This is currently breakingqylmain.)What
A consumer can hand
Build()interception to the cooperating generator while keeping all other qyl interceptors:build_property.QylAutoInstrumentationInterceptWebApplicationBuilderBuildviaAnalyzerConfigOptions. Only an explicitfalseyields the call site; absent or any other value keeps full instrumentation, so default generated output is byte-identical (existing snapshot unchanged).build/+buildTransitive/targets expose it as aCompilerVisibleProperty.tools/verify-build-interceptor-optout.py(wired into the verify goal suite) proves the opt-out is surgical: default emits the Build interceptor + a control HttpClient interceptor; opt-out drops only Build, keeps HttpClient, and still builds.Verification (local)
Follow-up
After merge: release
3.1.1(trusted publishing). Thenqylpins3.1.1, sets the property inqyl.collector, and itsServiceDefaultsBuild interceptor composesQylInterceptedAspNetCore.Build.🤖 Generated with Claude Code