Skip to content

P1: Add Obligation Protocols for project-specific barrier-sensitive rules #272

Open

Description

@PhysShell

Type

Enhancement / new analysis core slice.

Priority

P1 / High.

Tags

ownir, ownlang-core, protocols, obligations, barriers, project-specific-verification, legacy-dotnet, wpf

Context

Own.NET already has the right foundation for ownership/resource reasoning: OwnIR facts, Roslyn extraction, CFG, flow-sensitive state, loans/permissions, and method summaries. The next high-value slice is not another generic linter. It is a project-specific obligation checker.

The motivating failure mode:

IsLoaded = false;
// heavy document rebuild
OnPropertyChanged(nameof(Document)); // unsafe: observers can see inconsistent state
IsLoaded = true;

This is not a universal C# rule. It is a project/domain protocol: IsLoaded == false temporarily breaks the "document loaded / consistent" invariant, and selected notifications must not happen until that obligation is closed.

Proposed core model

Add an obligation/barrier vocabulary to OwnIR / Own.NET:

open obligation
close obligation
barrier
require obligation closed before barrier
require obligation closed before return/throw
allow selected barriers while obligation is open

First target rule shape:

DocumentLoading opens  when assign(this.IsLoaded, false)
DocumentLoading closes when assign(this.IsLoaded, true)
UnsafeNotification barrier when OnPropertyChanged(Document | Rows | Totals | SelectedItem)
Allowed notifications: IsLoaded, IsBusy, Progress, StatusText

Scope

MVP should be intraprocedural only:

  • one method;
  • CFG/path-sensitive;
  • no interprocedural summaries yet;
  • no generic theorem proving;
  • no SMT;
  • no mandatory user-authored OwnLang.

Acceptance criteria

  • Clean method passes:
    • IsLoaded=false;
    • work;
    • IsLoaded=true;
    • OnPropertyChanged(nameof(Document)).
  • Unsafe barrier before close fails.
  • Early return before close fails.
  • throw path before close fails unless guarded by finally.
  • try/finally restoration passes.
  • Allowed notifications, for example OnPropertyChanged(nameof(Progress)), can be configured as safe while open.
  • Diagnostic includes a path witness, not just a vague warning.
  • Diagnostic maps back to the original C# location when facts come from the Roslyn extractor.

Non-goals

  • Do not build a generic temporal logic language.
  • Do not require users to write .own by hand.
  • Do not put this in OwnAudit. OwnAudit should only consume/report findings.
  • Do not mix this with perf gates yet.

Suggested diagnostic

OWN201: open obligation crosses forbidden barrier.

Example:

OWN201: DocumentLoading is still open before OnPropertyChanged(Document).
Path: IsLoaded=false -> if (...) -> OnPropertyChanged(Document)
Expected: close DocumentLoading with IsLoaded=true before publishing Document.

Why this matters

This catches human-factor regressions that ordinary Roslyn analyzers, type checks, and architecture metrics do not understand, because they do not know the project-specific meaning of IsLoaded. That is the whole point: small verification-style guardrails for real legacy C# without rewriting the codebase or making developers learn a new language.

2026-11-15 — Yahui Song: future conditions as obligation protocols

Prior art: SAS 2025: future conditions, ProveNFix (FSE 2024), research page. The requires → ensures → future distinction makes this issue's existing open obligation → forbidden barrier → close semantics explicit. Keep this issue finite-trace safety and intra-procedural first. A practical first check: IsLoaded=false → notify(Document) must fail with source path witness; correct finally restoration must pass. Do not add LTL syntax or adopt Infer. Distinguish TRACE-CONFORMS-BOUNDED, actual CFG witness, UNKNOWN; future liveness is intentionally out of this issue (#446 for genuine infinite traces). Evaluate ProveNFix as a repair research donor, not an authorized autofixer.

Activity

  1. added
    enhancement
    on Jul 13, 2026
  2. PhysShell commented on Nov 28, 2026

    @PhysShell
    OwnerAuthor

    Reference: narrowly scoped artifact/protocol checks — cnc_pcb_tools (2026-11-28)

    mattwach/cnc_pcb_tools, common checks, copper-operation checks. Apache-2.0 project; small Python G-code checker for PCB milling, motivated by an author-reported real tooling failure. Checks include spindle state, coordinate bounds, plunge depth and feed constraints; common predicates are separated from operation-specific checks. The main check_gcode.py was not accessible in the preliminary review, so parser/modal-state fidelity, test coverage and soundness are unverified. LinuxCNC is a separate interpreter reference; CAMotics and pcb2gcode are adjacent simulation/generation tools, not equivalent checkers.
    Methodological analogy only: check a concrete emitted operation sequence against reviewed domain contracts, rather than infer safety from valid generator inputs. Distinguish protocol state, command semantics, environment assumptions and unsupported/unknown operations; report witnesses with exact artifact identity. Reuse #274 and #445 if a real Own.NET gap is identified. No evidence of incremental product value, no CNC frontend, new analyzer or implementation requested. REFERENCE-ONLY.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions