Skip to content

Commit 978161c

Browse files
PhysShellclaude
andcommitted
C01-PRECISION-1: baseline, parity, diagnosis, preregistration, sealed holdout, controls
Research-only commit made BEFORE any product-code change: baseline gates on 1750769, Python/Rust parity on the frozen H1 facts (byte-identical), diagnosis of the C01 false positive mechanisms, the preregistered H-IFACE hypothesis with its predicted MAUI delta, the sealed holdout (3 repos + SHAs + rules) and 17 compilable control programs whose expected before/after verdicts are fixed in-file. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent 1750769 commit 978161c

25 files changed

Lines changed: 1028 additions & 0 deletions
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# C01-PRECISION-1 — baseline до изменения кода
2+
3+
Дата: 2026-10-23, 17:57–18:05Z. Всё — в WSL NixOS, инструменты разово из `nix shell` (ничего не устанавливалось).
4+
5+
## Состояние репозитория
6+
| | значение |
7+
|---|---|
8+
| worktree | `~/Documents/ownnet-eng/Own.NET` (worktree blobless-клона `refs/Own.NET`) |
9+
| ветка | `claude/c01-precision-1` |
10+
| baseline SHA | `175076925058b6b4eb60087a3b1e834e7315ebad` (= `origin/main`, тот же SHA, что в H1) |
11+
| незакоммиченные изменения | нет (`git status --porcelain` пуст) |
12+
| инструменты | Python 3.12.13, .NET SDK 8.0.422, cargo/rustc 1.95.0, ruff и mypy из nixpkgs |
13+
| NuGet | restore только с `--configfile` = nuget.org-only (`work/nuget.isolated.config`, копия H1) |
14+
15+
## Базовые результаты (команды выбраны по `AGENTS.md` и `.github/workflows/ci.yml`)
16+
Скрипт: `work/gates.sh baseline` (тот же скрипт потом гоняется на патче). Журналы: `work/logs/baseline/`.
17+
18+
| шаг | команда | результат |
19+
|---|---|---|
20+
| Python core | `python tests/run_tests.py` | **rc 0** (первый запуск rc 1 только потому, что `cargo` не был в PATH — `tests/test_mutate_campaign` вызывает cargo; с cargo в окружении rc 0) |
21+
| lint | `ruff check .` | rc 0 |
22+
| типы | `mypy` (strict для `ownlang`) | rc 0 |
23+
| extractor | `dotnet restore … --configfile` + `dotnet build` `OwnSharp.Extractor` | rc 0 |
24+
| Tier-B extractor (`OWN_TIERB_REQUIRED=1`) | `test_extractor_columns`, `_deep_flow`, `_sibling_locals`, `_partial_dispose`, `test_guarded_consume` | все rc 0 |
25+
| CI samples | блоки «Extract OwnIR facts from sample C#» + «Check facts through the core» из `ci.yml`, перенесены дословно генератором `work/mk_ci_samples.py` | rc 0, `CI_SAMPLES_ALL_ASSERTIONS_PASSED` |
26+
| corpus benchmark (реальный C#) | `python scripts/benchmark.py --min-recall 25` (engine python) | rc 0: **58/62 bugs caught · 62/62 fixes clean · 0 FP on fixes** |
27+
| Rust | `cargo build -p own-cli --release && cargo test -p own-cli && cargo test -p own-bridge` | rc 0 |
28+
29+
Не запускалось на baseline (и на патче): полный `cargo test` по всему workspace, `cargo clippy`, formal/Kani,
30+
Windows-джобы CI, workflow `oracle`/`mine` (сеть и сторонние репозитории), `owen --engine` Stage-1/2/3-контроли.
31+
Причина: бюджет одного агент-дня и то, что патч не трогает Rust/ядро (см. `result.md`).
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// C01-PRECISION-1 controls: shared publisher types. Not a control by itself.
2+
using System;
3+
using System.Collections.Generic;
4+
5+
namespace C01P1.Common
6+
{
7+
// A plain strong event: the publisher's delegate list keeps every subscriber reachable.
8+
public sealed class Publisher
9+
{
10+
public event EventHandler? Changed;
11+
public void Raise() => Changed?.Invoke(this, EventArgs.Empty);
12+
}
13+
14+
// The detach contract the target mechanism is about (MAUI's IDisconnectable shape).
15+
public interface IDetachable
16+
{
17+
void Detach();
18+
void Pause();
19+
}
20+
21+
// Process-lived holder for the static-source forms.
22+
public static class Hub
23+
{
24+
public static readonly Publisher Shared = new Publisher();
25+
}
26+
27+
// Form 8: a publisher whose event stores handlers weakly in its own add/remove accessors.
28+
public sealed class WeakPublisher
29+
{
30+
private readonly List<(WeakReference Target, System.Reflection.MethodInfo Method)> _handlers = new();
31+
32+
public event EventHandler Changed
33+
{
34+
add => _handlers.Add((new WeakReference(value.Target), value.Method));
35+
remove => _handlers.RemoveAll(h => ReferenceEquals(h.Target.Target, value.Target) && h.Method == value.Method);
36+
}
37+
38+
public void Raise()
39+
{
40+
foreach (var (target, method) in _handlers.ToArray())
41+
if (target.Target is { } t)
42+
method.Invoke(t, new object[] { this, EventArgs.Empty });
43+
}
44+
}
45+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<!-- C01-PRECISION-1 controls: compile check only (scored cases must compile without errors).
3+
Never referenced by any Own.NET build; the extractor reads the .cs files directly. -->
4+
<PropertyGroup>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<Nullable>enable</Nullable>
7+
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
8+
<NoWarn>CS0067;CS0414</NoWarn>
9+
</PropertyGroup>
10+
<ItemGroup>
11+
<!-- F09 only: a publisher type the extractor's loose compilation cannot resolve -->
12+
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
13+
</ItemGroup>
14+
</Project>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Form 1 — SAFE: the publisher is created by the subscriber and never escapes it, so it cannot
2+
// outlive the subscriber (collectable publisher<->subscriber cycle).
3+
// Oracle: no retention of the subscriber by anything longer-lived. Own.NET today: P-004 self-owned
4+
// exemption (field constructed with `new`) -> silent. The patch must not change this.
5+
using System;
6+
using C01P1.Common;
7+
8+
namespace C01P1.F01
9+
{
10+
public sealed class Subscriber
11+
{
12+
private readonly Publisher _own = new Publisher();
13+
14+
public Subscriber()
15+
{
16+
_own.Changed += OnChanged; // EXPECT before=none after=none
17+
}
18+
19+
private void OnChanged(object? sender, EventArgs e) { }
20+
}
21+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Form 2 — DANGEROUS: one publisher shared by many short-lived subscribers and outliving them;
2+
// nothing ever unsubscribes. Every Subscriber stays reachable from the shared publisher.
3+
// Oracle: real retention (the Registry keeps the publisher for the process; views come and go).
4+
// Own.NET: OWN001 injected (source is a ctor parameter). Must stay.
5+
using System;
6+
using C01P1.Common;
7+
8+
namespace C01P1.F02
9+
{
10+
public static class Registry
11+
{
12+
public static readonly Publisher Bus = new Publisher();
13+
public static Subscriber Open() => new Subscriber(Bus);
14+
}
15+
16+
public sealed class Subscriber
17+
{
18+
private readonly Publisher _bus;
19+
20+
public Subscriber(Publisher bus)
21+
{
22+
_bus = bus;
23+
_bus.Changed += OnChanged; // EXPECT before=OWN001 after=OWN001
24+
}
25+
26+
private void OnChanged(object? sender, EventArgs e) { }
27+
}
28+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Form 3 — DANGEROUS: shared process-lived publisher (static), subscription with no unsubscribe at
2+
// all; the subscriber even has a Dispose, but it does not detach.
3+
// Oracle: real retention for the process lifetime. Own.NET: OWN014 (static source). Must stay.
4+
using System;
5+
using C01P1.Common;
6+
7+
namespace C01P1.F03
8+
{
9+
public sealed class Subscriber : IDisposable
10+
{
11+
public Subscriber()
12+
{
13+
Hub.Shared.Changed += OnChanged; // EXPECT before=OWN014 after=OWN014
14+
}
15+
16+
public void Dispose() { }
17+
18+
private void OnChanged(object? sender, EventArgs e) { }
19+
}
20+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Form 4a — SAFE: shared publisher, the subscription is removed on the actual teardown
2+
// (IDisposable.Dispose), same handler, same receiver. Own.NET today: released (#278) -> silent.
3+
using System;
4+
using C01P1.Common;
5+
6+
namespace C01P1.F04a
7+
{
8+
public sealed class Subscriber : IDisposable
9+
{
10+
private readonly Publisher _bus;
11+
12+
public Subscriber(Publisher bus)
13+
{
14+
_bus = bus;
15+
_bus.Changed += OnChanged; // EXPECT before=none after=none
16+
}
17+
18+
public void Dispose()
19+
{
20+
_bus.Changed -= OnChanged;
21+
}
22+
23+
private void OnChanged(object? sender, EventArgs e) { }
24+
}
25+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Form 4b — SAFE, TARGET OF THE PATCH (the MAUI iOS Shell renderer shape, ShellSectionRenderer.cs:270-306):
2+
// shared publisher; Dispose(bool) calls THIS object's own explicit interface implementation through a
3+
// cast, and that implementation removes the same handler from the same receiver.
4+
// Dispose(true) -> (this as IDetachable).Detach() -> IDetachable.Detach() { _bus.Changed -= OnChanged; }
5+
// Oracle: C# dispatch of `(this as IDetachable).Detach()` on an instance of THIS sealed class can only reach
6+
// the implementation declared here, so the `-=` runs whenever Dispose(true) runs — exactly as if Dispose
7+
// contained the `-=` itself (form 4a). Own.NET today: OWN001 (the #278 closure only follows `M()`/`this.M()`).
8+
// Expected after the patch: released -> silent. The field-null guard is the class's own state (#278 rule).
9+
using System;
10+
using C01P1.Common;
11+
12+
namespace C01P1.F04b
13+
{
14+
public sealed class Subscriber : IDisposable, IDetachable
15+
{
16+
private Publisher? _bus;
17+
18+
public Subscriber(Publisher bus)
19+
{
20+
_bus = bus;
21+
_bus.Changed += OnChanged; // EXPECT before=OWN001 after=none
22+
}
23+
24+
void IDetachable.Detach()
25+
{
26+
if (_bus != null)
27+
_bus.Changed -= OnChanged;
28+
}
29+
30+
void IDetachable.Pause() { }
31+
32+
public void Dispose() => Dispose(true);
33+
34+
private void Dispose(bool disposing)
35+
{
36+
if (disposing && _bus != null)
37+
{
38+
(this as IDetachable).Detach();
39+
}
40+
_bus = null;
41+
}
42+
43+
private void OnChanged(object? sender, EventArgs e) { }
44+
}
45+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// Form 4c — SAFE, TARGET OF THE PATCH, other spellings of the same self-call:
2+
// `((IDetachable)this).Detach()`, `(this as IDetachable)?.Detach()`, and an IMPLICIT (public) implementation.
3+
// Oracle: same as 4b — the call resolves to this class's own implementation. Expected after: silent.
4+
using System;
5+
using C01P1.Common;
6+
7+
namespace C01P1.F04c
8+
{
9+
public sealed class CastSpelling : IDisposable, IDetachable
10+
{
11+
private readonly Publisher _bus;
12+
13+
public CastSpelling(Publisher bus)
14+
{
15+
_bus = bus;
16+
_bus.Changed += OnChanged; // EXPECT before=OWN001 after=none
17+
}
18+
19+
void IDetachable.Detach() => _bus.Changed -= OnChanged;
20+
void IDetachable.Pause() { }
21+
22+
public void Dispose() { ((IDetachable)this).Detach(); }
23+
24+
private void OnChanged(object? sender, EventArgs e) { }
25+
}
26+
27+
public sealed class ConditionalSpelling : IDisposable, IDetachable
28+
{
29+
private readonly Publisher _bus;
30+
31+
public ConditionalSpelling(Publisher bus)
32+
{
33+
_bus = bus;
34+
_bus.Changed += OnChanged; // EXPECT before=OWN001 after=none
35+
}
36+
37+
void IDetachable.Detach() { _bus.Changed -= OnChanged; }
38+
void IDetachable.Pause() { }
39+
40+
public void Dispose() { (this as IDetachable)?.Detach(); }
41+
42+
private void OnChanged(object? sender, EventArgs e) { }
43+
}
44+
45+
public sealed class ImplicitImpl : IDisposable, IDetachable
46+
{
47+
private readonly Publisher _bus;
48+
49+
public ImplicitImpl(Publisher bus)
50+
{
51+
_bus = bus;
52+
_bus.Changed += OnChanged; // EXPECT before=OWN001 after=none
53+
}
54+
55+
public void Detach() { _bus.Changed -= OnChanged; }
56+
public void Pause() { }
57+
58+
public void Dispose() { ((IDetachable)this).Detach(); }
59+
60+
private void OnChanged(object? sender, EventArgs e) { }
61+
}
62+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Form 5 — DANGEROUS: the setter unsubscribes the OLD value before subscribing the new one, but nothing
2+
// detaches the current value when the owner goes away (the MAUI Picker.ItemsSource / Border.StrokeDashArray
3+
// shape). A shared, long-lived value keeps the last owner alive.
4+
// Oracle: real retention of the owner by the current value. Own.NET: OWN001. Must stay.
5+
using System;
6+
using C01P1.Common;
7+
8+
namespace C01P1.F05
9+
{
10+
public sealed class Owner : IDisposable
11+
{
12+
private Publisher? _source;
13+
14+
public Publisher? Source
15+
{
16+
get => _source;
17+
set
18+
{
19+
if (_source != null)
20+
_source.Changed -= OnChanged;
21+
_source = value;
22+
if (_source != null)
23+
_source.Changed += OnChanged; // EXPECT before=OWN001 after=OWN001
24+
}
25+
}
26+
27+
public void Dispose() { }
28+
29+
private void OnChanged(object? sender, EventArgs e) { }
30+
}
31+
}

0 commit comments

Comments
 (0)