Skip to content

Commit 3fbb33e

Browse files
committed
docs(obligations): address CodeRabbit review on #176
- P-025: tag the protocol-verbs fence as text (MD040; the C# fence was already tagged) - __main__: de-OWN050-ify the cmd_ownir docstring and the advisory comment block — the band now carries OBL005 too - diagnostics: EXPLANATIONS for the maybe-siblings OBL002/OBL004, mirroring OBL001/OBL003 so ownlang explain answers all four symmetrically Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NXzqX7Qwn5QzBLGVCATdgm
1 parent 9e77980 commit 3fbb33e

3 files changed

Lines changed: 20 additions & 5 deletions

File tree

docs/proposals/P-025-obligation-protocols.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ subscription-leak epicenter).
4747

4848
The same three verbs cover the whole family:
4949

50-
```
50+
```text
5151
IsLoaded=false must become true before PropertyChanged(Document)
5252
_suppressNotifications must be restored before return/throw
5353
BeginUpdate must meet EndUpdate before Refresh / method exit

ownlang/__main__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ def cmd_ownir(path: str, fmt: str = "human", severity: str = "error",
307307
selects the surface: human (CLI), github (CI annotations), msbuild (VS),
308308
sarif (SARIF 2.1.0 log);
309309
`severity` picks how the host shows them (error/warning); `verbosity` is
310-
`quiet` (errors only — hide the advisory OWN050 notes), `normal` (default), or
310+
`quiet` (errors only — hide the advisory notes), `normal` (default), or
311311
`verbose` (also print a per-code breakdown)."""
312312
from .ownir import OwnIRError, build_sarif, check_facts, load, render_finding
313313
try:
@@ -321,9 +321,9 @@ def cmd_ownir(path: str, fmt: str = "human", severity: str = "error",
321321
# pollute that stream.
322322
machine = fmt in {"github", "msbuild", "sarif"}
323323
summary_to = sys.stderr if machine else sys.stdout
324-
# OWN050 "leakage analysis skipped" notes are advisory (P-014 Tier A): always
325-
# shown as warnings regardless of --severity, and never affect the exit code —
326-
# they are coverage notes ("we could not check this"), not verdicts.
324+
# Advisory findings (OWN050 "leakage analysis skipped", OBL005 "dead protocol
325+
# rule") are always shown as warnings regardless of --severity, and never
326+
# affect the exit code — they are coverage/hygiene notes, not verdicts.
327327
leaks = [f for f in findings if not f.advisory]
328328
notes = [f for f in findings if f.advisory]
329329
shown = leaks if verbosity == "quiet" else findings

ownlang/diagnostics.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,14 @@ class Severity(Enum):
197197
"the notification), or — if that notification is genuinely safe while open — add it to "
198198
"the protocol's `allow` list."
199199
),
200+
"OBL002": (
201+
"Like OBL001, but the obligation is open on only *some* paths that reach the barrier — "
202+
"whether the notification publishes a broken object depends on the branch taken (the "
203+
"same definite/maybe split as OWN002 vs OWN009).\n"
204+
"Fix: close the obligation on every path before the barrier (or on none — make the "
205+
"state unambiguous), or add the call to the protocol's `allow` list if it is genuinely "
206+
"safe while open."
207+
),
200208
"OBL003": (
201209
"A project-declared obligation is opened but not closed before the method exits "
202210
"(return / throw / falling off the end) on every path — the object is left in its "
@@ -205,6 +213,13 @@ class Severity(Enum):
205213
"forever when `Load()` throws.\n"
206214
"Fix: close in a `finally`, or on every early-return path."
207215
),
216+
"OBL004": (
217+
"Like OBL003, but the obligation is left open on only *some* exit paths — whether the "
218+
"object stays broken depends on the branch taken (typically an early return or a "
219+
"may-throw call before the close).\n"
220+
"Fix: close on every exit path — a `finally` covers the throw paths; move the close "
221+
"above the early returns."
222+
),
208223
"OBL005": (
209224
"Advisory, not a verdict: a protocol's `scope.methods` matched none of the methods the "
210225
"frontend reported events for — the rule is dead (usually a typo'd or renamed method "

0 commit comments

Comments
 (0)