Skip to content

build(acp): 给版本天花板废弃专属诊断 id 并升级为错误 - #167

Merged
YoungSx merged 1 commit into
developfrom
design-implementation-plan-subagent-review
Sep 2, 2026
Merged

build(acp): 给版本天花板废弃专属诊断 id 并升级为错误#167
YoungSx merged 1 commit into
developfrom
design-implementation-plan-subagent-review

Conversation

@YoungSx

@YoungSx YoungSx commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

问题

AGENTS.md §11 要求生产代码不得引用版本天花板(AcpProtocolVersion.Latest / HighestModeled),但这条规则此前没有门禁

Latest 上的 [Obsolete] 报的是 CS0618 —— 所有过时成员共用的公共号码。而只有 SalmonEgg.Acp 自己开了 TreatWarningsAsErrorsSalmonEgg.Acp.csproj:12),根 Directory.Build.props 没开、code-quality.yml:114 也不加 warnaserror。所以任何 app 工程引用草案天花板只是一条黄警告,不会红。

想把 CS0618 整体升级成错误又不行 —— 会连坐仓库里所有无关的过时成员。

改动

给这条废弃一个专属诊断 id SEACP001AcpProtocolVersion.LatestRenamedDiagnosticId),并在根 Directory.Build.props<WarningsAsErrors> 精确升级这一个 id。

新增 AcpProtocolVersionGateTests 守两处 id 不漂移 —— 单侧改名会静默解除门禁而不会让任何构建失败,这是唯一需要断言的失败模式。测试注释里写明了它的作用域:断言"升级已声明",不断言"某次编译观察到了它"(后者需要一个引用 Latest 且不抑制的一次性工程,属门禁脚本而非进程内测试)。

同时扩展既有 AcpProtocolVersion_Latest_IsObsoleteAliasOfHighestModeled 断言 DiagnosticId

4 个文件、+26 −2 行,加一个 52 行的新门禁测试。

验证

结果
完整 ACP SDK 门禁 6 步(run-acp-sdk-gates.sh ReleaseACP_PACKAGE_BASELINE_VERSION=1.0.0 全绿,exit 0
pack 阶段 ApiCompat 对 1.0.0 基线 通过(属性差异不算破坏,EnableRuleAttributesMustMatch 默认关闭)
SalmonEgg.Acp.Tests 全量 461 / 0 失败
dotnet format --verify-no-changes(SDK + 测试工程) 均 exit 0
下游 SalmonEgg.ApplicationSalmonEgg.Infrastructure 编译 Build succeeded,未被新的 WarningsAsErrors 误伤

反向验证(三条,都实跑)

  1. 临时往测试工程塞一行不抑制的 AcpProtocolVersion.Latest 引用 → error SEACP001 + Build FAILED(探针已删除,未进提交)。证明门禁真有牙。
  2. 把 props 里的 id 改成 SEACP999AcpProtocolVersionGateTests 转红(Assert.Contains() Failure)。
  3. 摘掉 [Obsolete]DiagnosticId → 契约测试转红(Assert.Equal() Failure)。

范围说明

本 PR 只做这一件无争议的事。同一轮审查开出的两个高优 issue 都不在此 PR 内:

#166 不在此 PR 的原因是它依赖 #165 里一个尚未决定的子项:7 个 v2 判别子留在 [JsonDerivedType] 还是搬进 SessionUpdateParamsJsonConverter。读方向目前没有任何版本上下文AcpProtocolWriteContext.Enter 全仓唯一调用点是 AcpClient.cs:2486,在写方向的 ToElement 里;FromElement 是 static 且不带版本),所以修 #166 的第一步是造一个读上下文 —— 而它的形状随那个子项决策二选一,另一种是废码。

相关

AGENTS.md requires that production code never reference the modeled-version
ceiling, but the deprecation on AcpProtocolVersion.Latest reported CS0618 -
the shared id for every obsolete member. Only SalmonEgg.Acp itself enables
TreatWarningsAsErrors, so every other project treated a reference to the draft
ceiling as a warning, and escalating CS0618 repository-wide would have dragged
along every unrelated deprecation.

Give the deprecation its own diagnostic id and escalate exactly that id in
Directory.Build.props. AcpProtocolVersionGateTests asserts the id in the props
matches the one declared next to the attribute, because a rename on one side
only would disarm the gate without breaking any build.

Verified: SEACP001 is reported as an error for an unsuppressed reference; the
gate test turns red when the props id drifts, and the contract test turns red
when DiagnosticId is dropped. Full ACP SDK gates pass, including pack-time
ApiCompat against the 1.0.0 baseline (attribute differences are not treated as
breaking).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@vercel

vercel Bot commented Sep 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
salmonegg Ready Ready Preview Sep 2, 2026 3:35pm UTC

@YoungSx
YoungSx merged commit 4586142 into develop Sep 2, 2026
17 checks passed
@YoungSx
YoungSx deleted the design-implementation-plan-subagent-review branch September 2, 2026 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant