Repository navigation
fix(P-004): capture-aware static-lambda tier — non-capturing lambda is not a region escape - #211
Merged
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Что и зачем
Issue #199 (subscription precision, lambda-handler tier). Проверив поведение против реального экстрактора локально (поднял .NET SDK в песочнице), обнаружил, что четыре тира по времени жизни источника уже работают для лямбд (static→OWN014, injected→OWN001 warning, bounded/local→silent), но общий static-путь флагал OWN014 на non-capturing лямбде (
SomeBus.Pinged += (_,_) => StaticHandle()), хотя она не удерживает ни одного инстанса — это false positive против нашей же записанной политики (subscription-leaks-and-profiles.md: «static event + capturing handler → error») и несогласовано с исключением static-method (non-capturing method group уже молчит).Почему меняется запиненное поведение — с ссылкой на политику: OWN014-посылка «сильная подписка пиннит подписчика к времени жизни источника» не выполняется для хендлера, который ничего не удерживает (static method с null-target, либо non-capturing лямбда — closure-аналог static-method исключения). Захватывающий (
thisили локал — CsvHelpercts/resetEvent) остаётся OWN014.Состав:
source=="static" && HandlerRetainsNoInstance. Строго консервативен: любой недоказуемо-non-retaining случай (захваченный локал, непрозрачный delegate-typed value) → считается retaining → OWN014. Никогда не расширяется синтаксически (неclsIsStatic, не «все лямбды»).NonAppDomainSubscriberрасщеплён (не удалён): теперь захватывающая лямбда (cts) → OWN014 (сохраняет намерение, которое защищал Codex — CsvHelper-шейп); новыйNonCapturingStaticSubscriber→ silent (FP, который убираем).-=handle», как OWN001 (extractor уже ставитlambda:true). Method-group captures без изменений.-=-impossible-but-bounded).Безопасность (условие «ничего запиненное не исчезает молча»): CsvHelper oracle-baseline записи — это захватывающий
cts/resetEventшейп (остаётся OWN014); каждый OWN014 corpus-кейс (systemevents-region-escape,screentogif-systemevents-leak) — method-group instance handler (retaining) и остаётся OWN014 (перепроверил с материализованным WindowsDesktop ref pack); единственный переклассифицированный кейс (NonAppDomainSubscriber) явно виден в диффе.Про CI: PR трогает
.github/workflows/ci.yml; #204 (тоже правил ci.yml) уже влит в main, ветка от свежего main — конфликта нет.Тип изменения
Как проверено
python tests/run_tests.py— зелено (ownir 250/250, wpf 9/9, corpus 32/32)ruff check .иmypy— чистоthis/локал) → OWN014 с нотой; injected → OWN001 warning; bounded/local/self-owned → silentСвязанные issue
Closes #199
Чеклист
fix:)🤖 Generated with Claude Code
https://claude.ai/code/session_01Cg6DVXahkyY68Ruu7f76rG
Generated by Claude Code
Summary by CodeRabbit
Bug Fixes
-=handle is available for detachment.Documentation
Tests