Skip to content

docs(P-006): reconcile OQ#3 — directly-injected IServiceScopeFactory is modelled (Closes #200)#213

Merged
PhysShell merged 1 commit into
mainfrom
claude/own-net-issue-200-scopefactory
Jul 10, 2026
Merged

docs(P-006): reconcile OQ#3 — directly-injected IServiceScopeFactory is modelled (Closes #200)#213
PhysShell merged 1 commit into
mainfrom
claude/own-net-issue-200-scopefactory

Conversation

@PhysShell

Copy link
Copy Markdown
Owner

Что и зачем

#200 просил «recognize directly-injected IServiceScopeFactory as a positive signal» (P-006 OQ#3). Эмпирическая проверка показала, что функциональный деливерабл уже поставлен в PR #126 и запинен CI + юнит-тестами на main: корректный scope-per-operation паттерн молчит by construction (экстрактор эмитит scope_cached только на store-в-поле), а кэширование scope-resolved scoped-сервиса в поле — это DI005. Отдельного «флажка одобрения» добавлять не нужно и не следует: «positive signal» — это отсутствие captive-факта, а глушить другие captive-находки по факту инъекции фабрики было бы неверно (singleton, который вдобавок инжектит scoped напрямую, всё равно DI001). Поэтому деливерабл — сверка документации с реальностью, без изменений кода.

Доказательство (прогон DiCaptiveSample.cs через настоящий экстрактор + ядро на текущем main):

Фикстура Форма Вердикт сейчас
ScopeCachingService IServiceScopeFactory → resolve → кэш в поле DI005 горит
UnitOfWorkCachingService кэш транзиента, тянущего scoped DI005 транзитивно
ScopeUsingService IServiceScopeFactory → resolve в локал, use, dispose молчит
ClockCachingService кэш синглтона молчит (gate) ✓

Запинено: ci.yml:691–726 (DI-контраст) и tests/test_ownir.py:946–1027. Механизм в экстракторе — Program.cs:3166 (распознавание IServiceScopeFactory как scope-creator) + ScopeCachedTypes (эмиссия только на field store).

Тип изменения

  • docs — документация

Как проверено

  • ruff check . — clean (docs не трогают код; run_tests.py/mypy без изменений)
  • селфтест формата вклада: python scripts/validate_contrib.py --selftest → 16/16
  • эмпирика: dotnet run --project frontend/roslyn/OwnSharp.Extractor -- DiCaptiveSample.cs | python -m ownlang ownir — таблица выше

Связанные issue

Closes #200. Refs #126 (где деливерабл фактически поставлен).

Что именно поменялось (docs-only)

  • P-006-di-lifetimes.md OQ#3: «not yet implemented — a natural future extension» → resolved (shipped in feat(extractor): emit fresh-returning factory facts — D5.2 interprocedural leaks on real C# #126), с механизмом и пинами ScopeUsingService/ScopeCachingService.
  • di-captive-extractor.md: добавлена отсутствовавшая секция DI005 (док прыгал с DI004 сразу в «Next»); убран уже поставленный пункт из «Next»; записан действительно отложенный кандидат — scope-resolved scoped, убегающий из scope через return/ref/out/аргумент (сегодня молчит precision-safe, нужен flow-aware срез, не store-site модель).
  • ROADMAP.md milestone 3: строка вычеркнута из Remaining, остаются только динамические регистрации (явные non-goals).

Чеклист

  • изменение покрыто тестом/селфтестом (или объяснено): контраст ok/DI005 уже запинен CI + test_ownir.py; настоящий PR — сверка документации, новых фикстур не требует
  • README/docs обновлены при необходимости
  • коммиты в conventional-commit стиле (docs:)

🤖 Generated with Claude Code


Generated by Claude Code

…is modelled

#200 ("recognize directly-injected IServiceScopeFactory as a positive signal",
P-006 OQ#3): the functional deliverable already shipped in PR #126 and is
CI/test-pinned on main. The correct scope-per-operation pattern (resolve inside
the scope, use, discard) is silent BY CONSTRUCTION — the extractor emits
`scope_cached` only for a value stored into a FIELD — and caching a scope-resolved
scoped service into a field is DI005. There is no separate approval marker to add:
the "positive signal" is the ABSENCE of a captive fact. Recognising the factory
injection as licence to suppress other captive findings would be wrong (a singleton
that also injects a scoped service directly is still DI001).

Doc-reconciliation only, no code change:
- P-006-di-lifetimes.md OQ#3: "not yet implemented" -> resolved, with the mechanism
  and the ScopeUsingService/ScopeCachingService pins.
- di-captive-extractor.md: add the missing DI005 section (the doc jumped DI004 ->
  Next); drop the now-shipped item from Next; record the genuinely-deferred escape
  shape (scope-resolved scoped that escapes via return/ref/out/arg) as a candidate.
- ROADMAP.md milestone 3: strike the done item from Remaining, leaving only the
  dynamic-registration non-goals.

Verified: DiCaptiveSample.cs through the real extractor+core gives DI005 on
ScopeCachingService + UnitOfWorkCachingService, silence on ScopeUsingService +
ClockCachingService; contrib selftest 16/16; ruff clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Cg6DVXahkyY68Ruu7f76rG
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@PhysShell, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 52 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 28ec2390-8c4b-4939-8933-ed182adcb237

📥 Commits

Reviewing files that changed from the base of the PR and between 6d7d875 and a3a2c33.

📒 Files selected for processing (3)
  • docs/ROADMAP.md
  • docs/notes/di-captive-extractor.md
  • docs/proposals/P-006-di-lifetimes.md
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/own-net-issue-200-scopefactory

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.

@PhysShell PhysShell merged commit 3bc9a05 into main Jul 10, 2026
37 checks passed
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.

P-006 OQ#3: recognize directly-injected IServiceScopeFactory as a positive signal

2 participants