docs(proposals): P-034 — runtime lifetime guard & disposal quarantine - #192
Conversation
Pins down a design discussion that asked whether the C/C++ "harden malloc/free" idea has a .NET analog. Maps the discussion's rule catalog onto what own-check/OwnLang already ships (OWN001-003/014, WPF001-005, DI001-005, POOL001-003, OwnAudit phase 5) so it isn't re-derived, records the already-decided non-goals (SafeHandle/Marshal balance proofs), and scopes the one genuinely new piece: a small opt-in runtime disposal guard + test-time quarantine that covers what static analysis structurally can't (D5 ownership transfer, cross-thread disposal races). Also cross-links the newly landed P-025/P-027 (static obligation/state-machine checks) as related-but-different mechanisms. Rebuilt on current main (branch claude/dotnet-lifetime-analyzer-hzor1x hit an unresolvable merge conflict: its README.md edit and main's consolidation PR #190 both inserted table rows at the same anchor point relative to their common ancestor — a pure git 3-way-merge hunk-adjacency collision, not a content disagreement).
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR adds a new draft proposal document, P-034 "Runtime lifetime guard & disposal quarantine", describing runtime-level complements to existing static lifetime checks, including a ChangesProposal Document Addition
Estimated code review effort: 1 (Trivial) | ~5 minutes 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ 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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d1a610989c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…st the throw Codex review on #192: if only the throw were compiled out for production (as the Non-goals bullet suggested — #if DEBUG around the throw, or a [Conditional] helper), execution fell through the guard branch and called DisposeCore() again on a second Dispose() — a real double-release bug in exactly the builds this proposal exists to keep safe. Fixed the example so the already-disposed branch always returns; only the diagnostic throw is DEBUG-gated via a [Conditional("DEBUG")] helper, and the idempotent short-circuit is unconditional.
Что и зачем
Заменяет #191 (закрыт с указателем сюда — см. причину ниже). Содержание не
поменялось: фиксирует итог обсуждения — есть ли смысл в .NET-аналоге C/C++
практики «обернуть malloc/free параноидальными enterprise-проверками». Ответ —
как allocator-шим почти нет смысла (managed-рантайм и так убирает
use-after-free/OOB/double-free), но как идея это уже реализовано в Own.NET
статически (
OWN001/002/003/014, P-004/P-005) и на рантайме в OwnAudit (фаза 5,ClrMD-корреляция). Новый
docs/proposals/P-034-runtime-lifetime-guard.mdфиксирует эту карту (чтобы никто не передобавлял то же самое) и предлагает
единственный реально недостающий кусок: лёгкий opt-in runtime-guard
(throw на double-Dispose/use-after-dispose в DEBUG/TEST) + disposal
quarantine для тестов — ClrMD-независимый комплемент к фазе 5 OwnAudit.
Почему новый PR вместо #191
#191 (ветка
claude/dotnet-lifetime-analyzer-hzor1x) была срублена доконсолидационного PR #190 и не смогла чисто смерджиться после: её правка
docs/proposals/README.mdи правка #190 независимо вставляли строки таблицыв одну и ту же точку привязки относительно общего предка — чистая коллизия
git-мерджа по соседству хуанков, не разногласие по содержимому (все 8
файлов P-026…P-033, скопированных в ту ветку, побайтово совпадали с main;
update-branchвсё равно падал с422 merge conflict). Инструментарий этойсессии не даёт создавать merge-коммиты или переставлять ref ветки, поэтому
единственный чистый выход — новая ветка от текущего main
(
claude/dotnet-lifetime-analyzer-hzor1x-v2) с ровно тем же содержимым:файл P-034 (уже прошедший правки по двум замечаниям CodeRabbit на #191) +
одна добавленная строка в индексе.
Тип изменения
Как проверено
python tests/run_tests.pyruff check .иmypypython scripts/<...>.py --selftest)Docs-only: новый
docs/proposals/*.md+ одна строка в индексе, кода некасается — тесты/линт неприменимы. Проверено вручную: ветка срублена от
текущего main, значит история линейна и мерджится чисто (в отличие от #191).
Связанные issue
Нет. Инициировано обсуждением в чате, не привязано к issue. Заменяет #191.
Чеклист
docs/proposals/README.mdобновлёнfeat:,fix:,docs:…)Generated by Claude Code
Summary by CodeRabbit