Skip to content

Commit 4177327

Browse files
committed
spec: Inference.md — normative spec of the interprocedural ownership layer (roadmap stage 0)
Lifts the verdict-determining inference layer from an undocumented bridge concern (architecture-review R2, tech-debt-register §3's hard port prerequisite) into a normative, descriptive spec pinned by tests — the same posture as OwnIR.md. Covers: the MOS artifact and its two axes; the transfer lattice and join (INF-L); parameter skeleton derivation (INF-S, incl. the definite-release rule from D1 and the reserved adopt/return kinds from D3); return inference (INF-R); overload merge and the arity residual (INF-M); the SCC-condensation fixpoint (INF-F, incl. the observable-degradation rule from D5); call-site application and the tier ladder (INF-A, incl. the optimistic untrack from D6); the reporting policy and advisories OWN051/OWN052 (INF-P); the deterministic summary-dump serialization (incl. the omitted escapes axis from D2). Honestly marks every reserved element (escapes, adopt/return, strict mode, Tier C, source tiers beyond 'inferred') as 'in the model, no producer'. §11 maps every INF-* rule to its pinning test in test_ownership.py / test_ownir.py; registered in spec/README.md; OWN051/052 documented in spec/Diagnostics.md with a new interprocedural-advisory section. A conformance check pins the codes the spec names to the catalogue. Full suite green (ownir 245/245). Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LBmDyLWHqoQUGqiydSxroi
1 parent f9e4f04 commit 4177327

6 files changed

Lines changed: 392 additions & 14 deletions

File tree

‎docs/notes/interprocedural-roadmap.md‎

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -121,24 +121,27 @@ precision-баг с оракула в период порта чинится в
121121
(«spec it or relocate it — до любого порта»). Каждый следующий этап меняет именно
122122
этот слой; менять неспецифицированное — дороже всего.
123123

124-
**Делаем:**
125-
126-
- `spec/Inference.md` (или раздел в `spec/OwnIR.md`): нормативные правила
127-
вывода — когда параметр `dispose`/`forward`/`borrow`, правило
128-
«single unconditional straight-line forward», правила return-скелета
129-
(returned-param ≠ fresh и т.д.), правила слияния перегрузок, политика
130-
optimistic-по-умолчанию. По объёму это перенос докстрингов
131-
(`_build_skeletons`, `_merge_skeletons`, `solve`) в нормативный текст +
132-
привязка к `test_spec.py`-стилю.
133-
- Golden facts snapshots в CI (N3 из регистра) — шов extractor→bridge diff'ится
134-
на уровне фактов, а не только отрендеренных диагностик.
124+
**Сделано:**
125+
126+
- ✅ **`spec/Inference.md`** (shipped) — нормативная спека слоя: MOS-артефакт,
127+
решётка transfer, деривация параметров/возвратов/перегрузок (правила
128+
S/R/M-*), решатель (F-*), применение на call-site (A-*), оптимистичный
129+
дефолт + advisories OWN051/OWN052 (P-*), сериализация. Правила `INF-*`
130+
привязаны к `test_ownership.py`/`test_ownir.py` (§11 Conformance);
131+
зарегистрирована в `spec/README.md`, коды заведены в `spec/Diagnostics.md`.
132+
Спека честно фиксирует и reserved-элементы (`escapes`-ось, `adopt`/`return`
133+
path-kinds, strict-режим, Tier C) как «есть в модели, продюсера нет».
134+
- **Осталось:** Golden facts snapshots в CI (N3 из регистра) — шов
135+
extractor→bridge diff'ится на уровне фактов, а не только отрендеренных
136+
диагностик (C#-сторона; отдельный срез).
135137
- **Не делаем сейчас:** физический перенос инференции из моста в `ownlang/` —
136138
это «seam re-cut» из tech-debt §3, его триггер (P-017 multi-stack или
137139
рестарт ядра P-022) не сработал. Спека делает перенос механическим, когда
138140
сработает.
139141

140142
**Критерий готовности:** новый разработчик (или порт) может реализовать
141143
инференцию по спеке, не читая `ownir.py`; расхождение спеки и кода ловится CI.
144+
✅ по спеке; golden facts — остаток.
142145

143146
## 4. Этап 1 — наблюдаемость: OWN051 + дамп сводок (дни)
144147

‎docs/notes/interprocedural-tz.md‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@
33
> Статус: **рабочее ТЗ** (черновик нормы + критические требования). Дополняет
44
> [interprocedural-roadmap.md](interprocedural-roadmap.md): карта отвечает «что и
55
> когда», это ТЗ — «что именно, как и с какими инвариантами». Из §2–§4 напрямую
6-
> выделяется `spec/Inference.md` (этап 0 карты). Всё описанное «как есть» сверено
7-
> с кодом на коммите `adc1496`; каждое правило несёт ссылку `файл:строка`.
8-
> Расхождение D1 (§3) **воспроизведено исполнением**, не выведено из чтения.
6+
> выделена нормативная спека **[`spec/Inference.md`](../../spec/Inference.md)**
7+
> (этап 0 карты, ✅ shipped — правила `INF-*`, привязаны к
8+
> `test_ownership.py`/`test_ownir.py`); это ТЗ остаётся расширенным рабочим
9+
> черновиком с воспроизведёнными дефектами и требованиями к порту. Всё описанное
10+
> «как есть» сверено с кодом на коммите `adc1496`; каждое правило несёт ссылку
11+
> `файл:строка`. Расхождение D1 (§3) **воспроизведено исполнением**, не выведено
12+
> из чтения.
913
1014
## 1. Объект: слой — это три компонента, у каждого свой дом
1115

‎spec/Diagnostics.md‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,24 @@ guess a leak; we report, honestly, that it was not checked. Rendered as a
8383
|------|-------|
8484
| OWN050 | declaring type unresolved — leakage analysis skipped |
8585

86+
## Interprocedural ownership coverage (P-005 D5)
87+
88+
Advisory only — coverage notes from the interprocedural inference layer
89+
([Inference.md](Inference.md)), never verdicts. Rendered as `warning` regardless
90+
of `--severity`, excluded from the exit code, hidden at `--verbosity quiet`.
91+
92+
| Code | Title |
93+
|------|-------|
94+
| OWN051 | ownership transfer unverified — local not checked past this call |
95+
| OWN052 | interprocedural summary inference failed — method summaries skipped |
96+
97+
- **OWN051** anchors at a call site where an owned local is handed to a parameter
98+
position whose resolved transfer is `may` or `unknown` ([Inference §A5, §7](Inference.md)):
99+
the caller's obligation is optimistically dropped there (own-only 0), so the
100+
gap is recorded rather than guessed.
101+
- **OWN052** is module-level (no single site): the summary solve failed and the
102+
bridge degraded to intraprocedural-only checking ([Inference §F6](Inference.md)).
103+
86104
## Rendering
87105

88106
The CLI renders rustc-style: `file:line:col`, the source line, and a caret under

0 commit comments

Comments
 (0)