build(acp): 给版本天花板废弃专属诊断 id 并升级为错误 - #167
Merged
Merged
Conversation
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]>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
AGENTS.md §11 要求生产代码不得引用版本天花板(
AcpProtocolVersion.Latest/HighestModeled),但这条规则此前没有门禁。Latest上的[Obsolete]报的是CS0618—— 所有过时成员共用的公共号码。而只有SalmonEgg.Acp自己开了TreatWarningsAsErrors(SalmonEgg.Acp.csproj:12),根Directory.Build.props没开、code-quality.yml:114也不加warnaserror。所以任何 app 工程引用草案天花板只是一条黄警告,不会红。想把
CS0618整体升级成错误又不行 —— 会连坐仓库里所有无关的过时成员。改动
给这条废弃一个专属诊断 id
SEACP001(AcpProtocolVersion.LatestRenamedDiagnosticId),并在根Directory.Build.props用<WarningsAsErrors>精确升级这一个 id。新增
AcpProtocolVersionGateTests守两处 id 不漂移 —— 单侧改名会静默解除门禁而不会让任何构建失败,这是唯一需要断言的失败模式。测试注释里写明了它的作用域:断言"升级已声明",不断言"某次编译观察到了它"(后者需要一个引用Latest且不抑制的一次性工程,属门禁脚本而非进程内测试)。同时扩展既有
AcpProtocolVersion_Latest_IsObsoleteAliasOfHighestModeled断言DiagnosticId。4 个文件、+26 −2 行,加一个 52 行的新门禁测试。
验证
run-acp-sdk-gates.sh Release,ACP_PACKAGE_BASELINE_VERSION=1.0.0)EnableRuleAttributesMustMatch默认关闭)SalmonEgg.Acp.Tests全量dotnet format --verify-no-changes(SDK + 测试工程)SalmonEgg.Application、SalmonEgg.Infrastructure编译WarningsAsErrors误伤反向验证(三条,都实跑)
AcpProtocolVersion.Latest引用 →error SEACP001+Build FAILED(探针已删除,未进提交)。证明门禁真有牙。SEACP999→AcpProtocolVersionGateTests转红(Assert.Contains() Failure)。[Obsolete]的DiagnosticId→ 契约测试转红(Assert.Equal() Failure)。范围说明
本 PR 只做这一件无争议的事。同一轮审查开出的两个高优 issue 都不在此 PR 内:
AcpJsonContext旁路。有硬时限(打acp-sdk-v*tag 前免费)。它会用SEACP002——SEACP001已被本 PR 占用。#166 不在此 PR 的原因是它依赖 #165 里一个尚未决定的子项:7 个 v2 判别子留在
[JsonDerivedType]还是搬进SessionUpdateParamsJsonConverter。读方向目前没有任何版本上下文(AcpProtocolWriteContext.Enter全仓唯一调用点是AcpClient.cs:2486,在写方向的ToElement里;FromElement是 static 且不带版本),所以修 #166 的第一步是造一个读上下文 —— 而它的形状随那个子项决策二选一,另一种是废码。相关
Latest的语义在命名上说清」由 PR feat(acp): close v2 draft DTO gaps #160 完成;本 PR 补上它缺的门禁。