Skip to content

Commit 33b153a

Browse files
committed
fix(p1): capture verifier reference bytes within bounded cancellation
1 parent 6567bc5 commit 33b153a

8 files changed

Lines changed: 349 additions & 9 deletions

File tree

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
{
2+
"schemaVersion": 1,
3+
"evidenceKind": "p1-reference-retention-repair-acceptance",
4+
"candidateSha": "b404f0dd62cb0368159c319e67ba98e6542eb2c4",
5+
"candidateTreeSha": "11523f2ca44103bcb96e86ddc53a1b53b9eb6328",
6+
"sourceInputCount": 694,
7+
"sourceHashes": [
8+
{
9+
"path": "tools/RustSharp.Conformance/P1SourcePackagePlatformRunner.cs",
10+
"sha256": "228F479AB554C9D8D70A2C868FBAD4880700B223F92C8F7F9F738B45073FE69A",
11+
"snapshotMatched": true
12+
},
13+
{
14+
"path": "tests/RustSharp.Tests/Program.cs",
15+
"sha256": "C6EDDFC9867B25DC912910983EF6AE7ADA074C6AAC1D2163D4E8F9BC79E1D8D3",
16+
"snapshotMatched": true
17+
},
18+
{
19+
"path": "tests/RustSharp.Tests/P1ReferenceRetentionTests.cs",
20+
"sha256": "D6AA05E4FBA7C01C9AC4E9ABFEB35589D91651D80C7DE9F38A0047D668A1348D",
21+
"snapshotMatched": true
22+
}
23+
],
24+
"reports": [
25+
{
26+
"path": "artifacts/p1-source-package/reference-retention-full-v3.json",
27+
"sha256": "4C6DACD8AF23ED2412CE37B51218813CAD9FF05B8087C16145B752EE95005AD4"
28+
},
29+
{
30+
"path": "artifacts/p1-supervision/reference-retention-root-v3/source-snapshot.json",
31+
"sha256": "26D2FBB79F4C7F63763042AED492FC96F5F10C2FB7C0A5D472D677BEA2CB55FC"
32+
},
33+
{
34+
"path": "artifacts/p1-supervision/reference-retention-root-v3/release-build.json",
35+
"sha256": "562BEEEE1764B79EBCA3D3C77AB0F9571D2ED2D8E221ACDA0BF13711DD981D60"
36+
},
37+
{
38+
"path": "artifacts/p1-supervision/reference-retention-root-v3/tiny-harness.json",
39+
"sha256": "1CD4AD5B9F23A07F011B95D339FD27EDF5178C8FF88CBE043879099858073F32"
40+
},
41+
{
42+
"path": "artifacts/p1-supervision/reference-retention-root-v3/reference-harness.json",
43+
"sha256": "D95FB6A8476F119F81F7889CA34AECC45F78462E2765E265BA3CA9B026FD6B69"
44+
},
45+
{
46+
"path": "artifacts/p1-supervision/reference-retention-root-v3/legacy-source-harness.json",
47+
"sha256": "F34915768B68E33B5255D082CCC4187995390761603217CD8530031D3E0DBF67"
48+
},
49+
{
50+
"path": "artifacts/p1-supervision/reference-retention-root-v3/source-full-launch.process.json",
51+
"sha256": "DD57C4CD219D5C47EC45A92B5A19E9C3924457E76B5F9326AF3B1BA4D463B739"
52+
},
53+
{
54+
"path": "artifacts/p1-supervision/reference-retention-root-v3/full-validator-launch.process.json",
55+
"sha256": "8AC02CF3C7D45096FEE42E096477B9AD12C9013B1AEF191801C037FD620F2202"
56+
},
57+
{
58+
"path": "artifacts/p1-supervision/reference-retention-root-v3/full-validator-launch.stdout.log",
59+
"sha256": "83B40C6339CB9B5F3B60541FA30090CAB761926A659887E4335065AEE282D90A"
60+
},
61+
{
62+
"path": "artifacts/p1-supervision/reference-retention-root-v3/acceptance-audit.json",
63+
"sha256": "B682B14382A07AC5198B8DA01A39E64453486FAA60AE2217A08883BC35D19CD0"
64+
},
65+
{
66+
"path": "artifacts/p1-supervision/reference-retention-root-v3/frozen-scope.json",
67+
"sha256": "39047397C9050C6C61E1C0639D9104DB0FB85DCCC296B1A1F38E99FD69278096"
68+
}
69+
],
70+
"windowsSourcePackages": 19,
71+
"originalPeIlVerify": 39,
72+
"coreClr": 19,
73+
"nativeAot": 19,
74+
"referenceControls": 4,
75+
"legacySourceControls": 12,
76+
"registeredTests": 1144,
77+
"fullHarnessExecuted": false,
78+
"validator": {
79+
"Valid": true,
80+
"ArtifactContentVerified": true,
81+
"SatisfiesGate": true,
82+
"Errors": []
83+
},
84+
"recordedProcessIdentitiesAbsent": 100,
85+
"temporaryDirectoriesAbsent": 20,
86+
"timerDelayFaultInjected": false,
87+
"fullP1Closure": false,
88+
"fullP2Closure": false
89+
}

‎docs/p1-reference-retention-v1.md‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# P1 verifier reference retention repair
2+
3+
English | [简体中文](p1-reference-retention-v1_zh.md)
4+
5+
## Delivery
6+
7+
✅ Complete for this repair: the Windows source-package verifier retains actual
8+
reference bytes using cancellable asynchronous 64KiB reads. Every batch keeps
9+
the original ten-second deadline and 512-path ceiling; each reference has a
10+
512MiB size bound and 8193-read ceiling. Length and EOF are checked. No hashes
11+
are reused across cases. The final monotonic-clock check prevents acceptance
12+
after the deadline even if timer cancellation is delayed.
13+
14+
## Acceptance
15+
16+
Candidate `b404f0dd62cb0368159c319e67ba98e6542eb2c4`, tree
17+
`11523f2ca44103bcb96e86ddc53a1b53b9eb6328`, binds 694 source inputs.
18+
Fresh SDK 10.0.401 Release passes with zero warnings/errors. The one-case trial,
19+
four reference controls and twelve inherited source-package controls pass.
20+
The final real Windows x64 producer passes all 19 source packages, 39 original
21+
PE ILVerify checks, 19 CoreCLR programs and 19 Native AOT programs. The strict
22+
physical-artifact validator returns `Valid=true`, `ArtifactContentVerified=true`
23+
and `SatisfiesGate=true` for this platform report. Failure, blocked and
24+
not-executed counts are zero.
25+
26+
The [acceptance archive](evidence/p1/reference-retention-v1-archive.json) retains
27+
raw report hashes, exact source binding and validator proof. Physical reports
28+
remain under `artifacts/p1-supervision/reference-retention-root-v3/` and
29+
`artifacts/p1-source-package/reference-retention-full-v3.json`. Root checked
30+
the 100 recorded producer identities and owned source-package/AOT temporary
31+
directories after exit. Earlier build failures and superseded v2 checks remain
32+
preserved. The worker independently read the final build and filtered controls;
33+
its final audit call failed parsing, so root completed the remaining binding,
34+
producer and cleanup checks. Timer-delay fault injection was not executed.
35+
36+
## Remaining closure
37+
38+
🚧 In progress: fresh same-pushed-SHA Windows/Linux CI, full 1144-case harness,
39+
NativeV5 receipt/joint gate integration and independent descendant containment.
40+
The local platform validator does not close the six P1 phase gates or a P2 leaf.
41+
P2 remains 8/101 ✅ Complete leaves.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# P1 验证器引用留存修复
2+
3+
[English](p1-reference-retention-v1.md) | 简体中文
4+
5+
## 交付
6+
7+
本修复为 ✅ 已完成:Windows 源码包验证器使用可取消的异步 64KiB 读取留存真实
8+
引用字节。每批保留原有十秒截止和 512 路径上限;每个引用保留 512MiB 大小界限和
9+
8193 次读取上限。核对长度及 EOF,不跨用例复用哈希。最终单调时钟检查可避免计时器
10+
取消延迟时仍接受超过截止的结果。
11+
12+
## 验收
13+
14+
候选 `b404f0dd62cb0368159c319e67ba98e6542eb2c4`、tree
15+
`11523f2ca44103bcb96e86ddc53a1b53b9eb6328` 绑定 694 个源码输入。
16+
新鲜 SDK 10.0.401 Release 构建零警告/零错误。一项极小试跑、四项引用控制及十二项
17+
既有源码包控制均通过。最终真实 Windows x64 producer 通过全部 19 个源码包、39 项
18+
原始 PE ILVerify、19 个 CoreCLR 程序及 19 个 Native AOT 程序。严格物理制品验证器
19+
对该平台报告返回 `Valid=true`、`ArtifactContentVerified=true` 和
20+
`SatisfiesGate=true`。失败、阻塞和未执行均为零。
21+
22+
[验收归档](evidence/p1/reference-retention-v1-archive.json) 保留原始报告哈希、准确
23+
源码绑定及验证器证明。物理报告保留于
24+
`artifacts/p1-supervision/reference-retention-root-v3/` 和
25+
`artifacts/p1-source-package/reference-retention-full-v3.json`。root 在退出后核对
26+
100 个已记录 producer 身份及自有源码包/AOT 临时目录。此前构建失败和被替代的 v2
27+
检查均保留。worker 独立读取最终构建及过滤控制;其最后审阅调用解析失败,因此 root
28+
补全其余绑定、producer 和清理检查。未执行计时器延迟故障注入。
29+
30+
## 剩余闭环
31+
32+
🚧 进行中:新鲜同一推送 SHA 的 Windows/Linux CI、完整 1144 项测试、NativeV5
33+
回执/joint 门禁集成及独立后代进程约束。此本地平台验证器不关闭六个 P1 阶段门禁或
34+
任何 P2 叶项。P2 仍为 8/101 个 ✅ 已完成叶项。

‎docs/roadmap/P2-HANDOFF.md‎

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,37 @@
22

33
English | [简体中文](P2-HANDOFF_zh.md) | [P2 contract](P2.md)
44

5-
## Current checkpoint — 2026-10-08 06:08
5+
## Current checkpoint — 2026-10-08 06:28
6+
7+
✅ Complete for the verifier-reference retention repair. Final candidate
8+
`b404f0dd62cb0368159c319e67ba98e6542eb2c4`, tree
9+
`11523f2ca44103bcb96e86ddc53a1b53b9eb6328`, binds694 inputs; fresh SDK401
10+
Release has zero warnings/errors, trial1, reference4 and legacy-source12 pass.
11+
The real Windows source-package producer passes19/19, original-PE ILVerify39,
12+
CoreCLR19 and Native AOT19; strict physical validation passes. Root checked100
13+
recorded process identities absent and20 owned temporary directories absent.
14+
See `docs/p1-reference-retention-v1.md` and its paired translation/archive.
15+
Worker's final audit call failed parsing; root completed remaining checks.
16+
Timer-delay injection and independent descendant containment remain open.
17+
P2 remains8/101 ✅ Complete leaves; all six P1 phase gates remain open.
18+
19+
CI follow-up v12 for existing e90e9fe run37693029849 reconciles74 hashes/27
20+
reports, Linux1140 and693 inputs, mapped440/pending24 and both production
21+
receipts. Windows expanded and both aggregates were not obtained within its
22+
budget. Continue that run without duplicating dispatch or substituting it for
23+
the new repair. Push this accepted repair and dispatch one fresh SHA-bound run.
24+
NativeV5 receipt/transport/joint integration still awaits real acceptance.
25+
26+
Receipt diagnostic controls are frozen in `receipt-diagnostic-controls-v1/`:
27+
standard patch apply-check, trial1/fixed3 utility controls pass; actual production
28+
source integration and acceptance remain open. Formatter v2 review-manifest
29+
contains exact replacement hashes and49+10 cases; runtime0, leafClosed=false.
30+
Its standard-patch generator and final resource handoff are being resumed after
31+
the previous read-only variable error. Preserve prior failures, user tmp and
32+
the sole ACTIVE thirty-minute heartbeat. Next integrate/accept/commit receipt
33+
diagnostics independently, then resume joint/native gates and formatter.
34+
35+
## Historical checkpoint — 2026-10-08 06:08
636

737
The previous05:54 checkpoint omitted its Chinese translation. Both language
838
versions now carry the same checkpoint and this corrective record; no task

‎docs/roadmap/P2-HANDOFF_zh.md‎

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,32 @@
22

33
[English](P2-HANDOFF.md) | 简体中文 | [P2 契约](P2_zh.md)
44

5-
## 当前检查点 — 2026-10-08 06:08
5+
## 当前检查点 — 2026-10-08 06:28
6+
7+
验证器引用留存修复为 ✅ 已完成。最终候选
8+
`b404f0dd62cb0368159c319e67ba98e6542eb2c4`、tree
9+
`11523f2ca44103bcb96e86ddc53a1b53b9eb6328` 绑定694输入;新鲜SDK401
10+
Release零警告/零错误,trial1、reference4及legacy-source12通过。
11+
真实Windows源码包producer通过19/19、原始PE ILVerify39、CoreCLR19及Native
12+
AOT19;严格物理验证通过。root核对100个已记录进程身份不存在、20个自有临时目录
13+
不存在。参见 `docs/p1-reference-retention-v1.md`、成对翻译及归档。
14+
worker最后审阅调用解析失败,root补完其余检查。计时器延迟注入及独立后代进程
15+
约束仍开放。P2仍为8/101个 ✅ 已完成叶项,六个P1阶段门禁均保持开放。
16+
17+
CI follow-up v12针对既有e90e9fe的run37693029849对账74个hash/27报告、Linux1140
18+
及693输入、mapped440/pending24和两平台production回执。其预算内未取得Windows
19+
expanded及两个aggregate。接续该run,不重复调度、不用于替代本次新修复证明。
20+
推送本次已验收修复并调度一次新SHA绑定run。NativeV5回执/transport/joint集成仍
21+
等待真实验收。
22+
23+
回执诊断控制冻结于 `receipt-diagnostic-controls-v1/`:标准patch适用性检查及
24+
trial1/fixed3工具控制通过;真实生产源码接入及验收仍开放。Formatter v2的
25+
review-manifest保留准确替换hash和49+10用例,runtime0、leafClosed=false。
26+
上次只读变量错误后的标准patch生成及最终资源交接正在接续。保留旧失败、用户tmp及
27+
唯一ACTIVE半小时heartbeat。下一步独立接入/验收/提交回执诊断,然后接续joint/native
28+
门禁及formatter。
29+
30+
## 历史检查点 — 2026-10-08 06:08
631

732
此前05:54检查点遗漏了中文翻译。两种语言现包含相同检查点及本更正记录;不改变
833
任务状态或验收分母。提交 `e90e9fe83b201be882c76c0e5c9f20be3b779b66` 已推送;
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
using System.Security.Cryptography;
2+
using System.Text.Json.Nodes;
3+
using RustSharp.Conformance;
4+
5+
namespace RustSharp.Tests;
6+
7+
internal static class P1ReferenceRetentionTests
8+
{
9+
public static IReadOnlyList<TestCase> All { get; } =
10+
[
11+
new("P1 reference retention hashes actual PE bytes in exact input order", PeBytesAsync),
12+
new("P1 reference retention pre-cancellation performs no file open", CancellationAsync),
13+
new("P1 reference retention rejects missing files without partial acceptance", MissingAsync),
14+
new("P1 reference retention preserves the fixed 512-path ceiling", CountAsync),
15+
];
16+
17+
private static async Task PeBytesAsync()
18+
{
19+
string[] paths = [Path.Combine(AppContext.BaseDirectory, "RustSharp.Runtime.dll"),
20+
Path.Combine(AppContext.BaseDirectory, "RustSharp.Conformance.dll")];
21+
var inputs = new JsonArray(paths.Select(path => (JsonNode)JsonValue.Create(path)!).ToArray());
22+
using var deadline = new CancellationTokenSource(TimeSpan.FromSeconds(12));
23+
JsonArray result = await P1SourcePackagePlatformRunner.CaptureReferenceArtifactsAsync(inputs, deadline.Token).ConfigureAwait(false);
24+
AssertEx.Equal(2, result.Count);
25+
for (int index = 0; index < paths.Length; index++)
26+
{
27+
deadline.Token.ThrowIfCancellationRequested();
28+
byte[] bytes = await File.ReadAllBytesAsync(paths[index], deadline.Token).ConfigureAwait(false);
29+
AssertEx.Equal(paths[index], result[index]!["path"]!.GetValue<string>());
30+
AssertEx.Equal(Convert.ToHexString(SHA256.HashData(bytes)), result[index]!["sha256"]!.GetValue<string>());
31+
}
32+
}
33+
34+
private static async Task CancellationAsync()
35+
{
36+
using var cancelled = new CancellationTokenSource();
37+
cancelled.Cancel();
38+
try
39+
{
40+
await P1SourcePackagePlatformRunner.CaptureReferenceArtifactsAsync(new JsonArray("nonexistent-reference"), cancelled.Token).ConfigureAwait(false);
41+
}
42+
catch (OperationCanceledException) { return; }
43+
throw new InvalidOperationException("Pre-cancellation must take precedence over file access.");
44+
}
45+
46+
private static async Task MissingAsync()
47+
{
48+
string absent = Path.Combine(Path.GetTempPath(), "rsc-reference-absent-" + Guid.NewGuid().ToString("N"));
49+
using var deadline = new CancellationTokenSource(TimeSpan.FromSeconds(12));
50+
try
51+
{
52+
await P1SourcePackagePlatformRunner.CaptureReferenceArtifactsAsync(new JsonArray(
53+
Path.Combine(AppContext.BaseDirectory, "RustSharp.Runtime.dll"), absent), deadline.Token).ConfigureAwait(false);
54+
}
55+
catch (FileNotFoundException) { return; }
56+
throw new InvalidOperationException("A missing reference must fail the complete batch.");
57+
}
58+
59+
private static async Task CountAsync()
60+
{
61+
var inputs = new JsonArray(Enumerable.Range(0, 513).Select(index => (JsonNode)JsonValue.Create(index.ToString(System.Globalization.CultureInfo.InvariantCulture))!).ToArray());
62+
using var deadline = new CancellationTokenSource(TimeSpan.FromSeconds(12));
63+
try
64+
{
65+
await P1SourcePackagePlatformRunner.CaptureReferenceArtifactsAsync(inputs, deadline.Token).ConfigureAwait(false);
66+
}
67+
catch (ArgumentException) { return; }
68+
throw new InvalidOperationException("A batch over 512 paths must fail before opening files.");
69+
}
70+
}

‎tests/RustSharp.Tests/Program.cs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public static async Task<int> Main(string[] args)
6767
tests = [.. tests, .. P2CargoCfgTests.All];
6868
tests = [.. tests, .. P2CargoLockTests.All];
6969
tests = [.. tests, .. P2InteropBindingTests.All];
70+
tests = [.. tests, .. P1ReferenceRetentionTests.All];
7071
return await RegressionHarness.RunAsync(tests, args).ConfigureAwait(false);
7172
}
7273
}

0 commit comments

Comments
 (0)