diff --git a/docs/INDEX.md b/docs/INDEX.md index a974bf8787..9c4a23473a 100644 --- a/docs/INDEX.md +++ b/docs/INDEX.md @@ -49,6 +49,7 @@ This index is navigation. Delivery status lives in issues, not here. - [Architecture decisions](adr/README.md) - [ADR 022 — Timeline 属性查询与正文重建](adr/022-event-property-queries.md)(中文):目标 API 与模块结构、属性查询、业务状态恢复和正文释放 - [ADR 023 — 上下文用量由独立分支部件维护](adr/023-context-usage.md)(中文):ContextUsage 的职责、增量统计、服务商校准及后续设计边界 +- [ADR 026 — Verification tiers, test coverage and CI governance](adr/026-verification-tiers-and-ci-governance.md)([中文](zh/adr/026-verification-tiers-and-ci-governance.md)):three operational test states, verification tiers (L0–L4), form-only doc checks and CI governance (#1938) - [Resume:按业务对象设计计算与读取](design/resume-read-design.md)(中文,草案):usage、输入队列、Prompt、显示详情、SQL 执行和恢复校验的分项设计与成本验收 - [当前状态字段索引](design/appserver/timeline-state-read-indexes.md)(中文,草案):现有API缺口、完整索引键、源位置前驱和SQL扫描验收 - [状态保存与恢复读取](design/owner-state-indexed-reads.md)(中文,草案):按业务对象决定持久化;当前队列点查、Prompt有效引用、Usage数字和真实流程读写数量 diff --git a/docs/adr/026-verification-tiers-and-ci-governance.md b/docs/adr/026-verification-tiers-and-ci-governance.md new file mode 100644 index 0000000000..4dbafa4b4f --- /dev/null +++ b/docs/adr/026-verification-tiers-and-ci-governance.md @@ -0,0 +1,173 @@ +# 026: Verification tiers, test coverage and CI governance + +Decision status: Proposed. + +## Context + +Repository verification grows monotonically when every discovered defect or new check is appended +directly to the pull-request gate. Over time, two distinct concepts get conflated: + +- **Repository verification coverage**: every check, formal model, suite, benchmark and acceptance + procedure the repository maintains. +- **Active pull-request gate**: the bounded subset that must complete synchronously before a change + merges. + +When those two are treated as identical, slow suites, cross-platform checks, compile-time rebuild +loops and brittle text scans all pile onto one flat gate. Raising timeouts when jobs approach the +ceiling hides the degradation until queues, compiler-cache eviction and mutual cancellations erode +both contributor turnaround and `main` signal quality. + +## Decision + +### D1. Verification separates into three operational states; tiers (L0–L4) map assets to states + +Every verification asset has an explicit operational state that governs its lifecycle and CI cost: + +1. **Active gate**: runs automatically on pull requests under explicit wall-clock budgets, guarding + high-frequency contracts and the affected dependency closure. +2. **Retained (on-demand & sweep)**: stays in the repository without gating ordinary pull requests. + Runs when the asset's own source files change (for example, formal model edits), on scheduled + full sweeps, before release, when diagnosing or reproducing a failure, or when a design/protocol + review calls for it — with the tier table's "Default state & trigger" column authoritative for + each tier. Retained Rust tests remain compiled (for example, consolidated with `#[ignore]`) so + they do not bitrot; external-toolchain checks (TLC/Java, local tmux E2E, standalone profiling + scripts) stay out of everyday build toolchains. +3. **Dev / exploratory**: temporary probes or fine-grained local tests created while developing or + debugging. Ablated before merge: enduring contract coverage moves into the active gate (D3), + reusable diagnostic reproducers move into Retained, and throwaway scaffolding is removed. + +Verification tiers (L0–L4) map each class of asset to its default operational state and trigger: + +| Tier | Question answered | Scope | Default state & trigger | +| --- | --- | --- | --- | +| **L0 — Design & formal** | Do abstract state-machine, protocol and handover invariants hold? | Formal models (e.g. TLA+ specifications and `.cfg` properties) | **Retained**: (a) triggered on formal model file changes (with tool cost disclosed under D4 if wired into CI), and (b) enforced via PR checklist/review whenever an implementation change alters a modelled handover, recovery or ordering guarantee. Not run on ordinary implementation PRs. | +| **L1 — Static form & contract** | Are formatting, dependency boundaries, ADR immutability, public schemas/wire types and license/advisory policies intact? | Formatters, linters, pure static form/structure checks (including ADR freeze checks on every PR / ADR edit), frontend typecheck/lint, source-derived wire/schema contracts, dependency advisory/license scans | **Active gate**: fast fail-first on every PR, scoped to the changed surface (dependency scans only on manifest, lockfile or policy changes). | +| **L2 — Business flows** | Do modified modules and their transitive consumers preserve behavioral contracts? | Unit and in-process or loopback flow tests (plus runtime-assembled structural checks that require compiling the workspace) | **Active gate** on the primary high-throughput platform for the **reverse-dependency closure** of changed crates (expanding to the full workspace when foundational crates or workspace-wide configuration change). Heavy historical, soak or low-frequency flows belong in **Retained**. | +| **L3 — Real environment & cross-platform** | Do real OS primitives, process/plugin wiring, terminal interaction and external protocol boundaries work? | OS-native boundary slices, real daemon + plugin runtime flows, interactive terminal E2E suites, external registry acceptance | **Split**: narrow OS-native boundary slices run in the **Active gate** only on PRs touching platform/client code; full cross-platform runs and external-registry acceptance are **Retained** (asynchronous `main`/scheduled sweeps, pre-release or on-demand); interactive terminal E2E is **Retained (local-only)** — run locally on demand or before release, **never** invoked by a CI workflow. | +| **L4 — Quality, performance & release** | Have model quality, resource budgets, executable layout or distribution artifacts regressed? | Evaluation harnesses, memory/startup measurements, native code-layout builds, multi-platform release builds and registry/image acceptance | **Execution is always Retained** (scheduled, manual or release train only — never gates ordinary feature PRs). Changes to an L4 harness itself run the harness's own L1/L2 checks in the **Active gate** on that PR. | + +Formal models (L0) verify that an abstract state machine satisfies safety and conditional liveness +invariants within a finite state space; they do not compile or test implementation code. Ordinary +implementation changes rely on L2 flow tests to guard that code still refines the model's actions. +If a code change alters a modelled handover or ordering guarantee, it is a design change and returns +to L0 through review before merging. + +### D2. Documentation guides and states semantic contracts; automated checks enforce form, not prose semantics + +Documentation exists to guide contributors and state semantic contracts. Automated checks over +documentation and source conventions enforce only **deterministic, low-false-positive form and +structural invariants**: + +- **Pure static form checks (L1, zero business compilation)**: lifecycle/immutability form (such as + accepted-ADR freeze checks), link and template structure, and manifest- or AST-derived structural + checks (such as crate/module dependency boundaries and source-parsed type declarations) that do + not compile business runtime crates and do not parse natural-language prose. +- **Runtime-assembled structural projections (workspace-coupled, alongside L2)**: deterministic + code-to-document projections that inherently require compiling and assembling the runtime (such + as a live public service catalog) run on the workspace-coupled build/verify path rather than + blocking pure-static docs, frontend or script PRs. +- **Keep generated snapshots minimal**: commit and freshness-check a generated file only when + downstream code consumes it (e.g. cross-language type declarations) or when it is a concise, + actively referenced public summary. Fine-grained internal dependency graphs computed for boundary + checks are verified live in memory and generated on demand rather than committed to Git as + conflict-prone snapshots. +- **Out of scope for automated checks**: semantic correctness of prose, design quality, and + judgement calls such as whether an edit alters a modelled invariant. Avoid introducing new brittle + cross-language text scanners that try to infer semantics from raw literals and rely on growing + manual allowlists (existing allowlist-backed scanners are kept only until replaced by types, + boundaries or behavioral tests rather than imitated); enforce invariants through types, + boundaries, review checklists, L0 models and L2 behavioral tests instead. + +### D3. Test coverage follows lowest flow/contract layer, single owner, release-safe injection and build hygiene + +Coverage quality is measured by contract protection per unit of cost, not by test count at the top +layer. + +- **Lowest flow or contract layer that proves the contract**: assertions about private modules, + helpers or single functions belong in the nearest flow or contract test rather than standalone + unit tests, while state transitions, rendering rules, validation errors and edge matrices stay + out of process-spawning, PTY or binary-copying E2E tests. End-to-end suites cover wiring and real + OS interaction on representative paths rather than exhaustive combinations. +- **One owning layer per behavior**: once a lower layer (or a dedicated suite such as the local + terminal E2E suite) proves a behavior, higher layers verify only connectivity and do not duplicate + its failure matrix. Migrating coverage to a better carrier requires retiring or demoting the + superseded active CI case in the same change or tracked migration. +- **Release-safe runtime injection instead of recompiling**: test variants (release stamps, build + IDs, clocks, endpoints, fault injection) must be injectable at runtime or test boundaries without + flipping build-time flags that recompile upstream crates in CI. **Production-safety bound**: every + test-only override must be unreachable in release builds (compiled only under debug/test builds) + or confined to test-harness entry points so test injection never widens what a shipped binary + accepts. +- **Treat test executables as build artifacts**: consolidate integration tests into a bounded number + of balanced entry binaries per crate to avoid linker and compiler-cache amplification from dozens + of single-file executables, while splitting oversized binaries that create single-process + scheduling tails or linker pressure. + +### D4. Active gates operate under recorded budgets and physical light/heavy isolation + +- **Recorded wall-clock and resource budgets**: every synchronous active-gate tier declares a + recorded latency and resource budget (maintained alongside runner measurements in + `docs/architecture/build.md` and tracking issues, not hardcoded as immutable constants in this + ADR). Approaching or hitting a budget is a regression fixed by narrowing scope, optimizing slow + tests, improving parallelism or demoting cases to Retained — **never** by raising job or target + timeouts alone. +- **Cost disclosure for gate additions**: any change that adds a required PR check or widens path + selection must state its incremental runtime, added compile dependencies and target runner pool. +- **Physical isolation of light checks from heavy builds**: pure static repository checks must not + depend on compiling business runtime crates. Docs, frontend, script and static checks run in + lightweight jobs and never contend for heavy build or scarce platform runner pools. + +### D5. Impact-scoped routing and platform minimalism require scheduled full sweeps and periodic pruning + +- **Impact-scoped routing with sweep prerequisite**: both pull requests and pushes to `main` route + by changed paths, and `main` pushes run to completion without cancelling earlier ones. Narrowing + `main` pushes is permitted **only while an active scheduled full sweep is running** to catch + cross-group drift; a sweep failure must have defined triage ownership and commit-range bisection + back to the regressing merge on `main`. +- **Explicit path classification**: new top-level repository directories and non-code assets must + be classified explicitly in the change router rather than silently falling through to the + most expensive full-workspace fallback. +- **Scarce platforms run platform-native boundaries only**: full workspace compilation and + platform-neutral L1/L2 verification run on the highest-throughput primary platform (Linux). + Secondary OS pools (macOS, Windows) run only checks covering platform-specific code paths + (`cfg(target_os = ...)`), native OS APIs or packaging boundaries on pull requests, verified + mechanically against the source rather than maintained as an unchecked manual list. +- **Periodic telemetry and pruning**: CI health (queue p90, execution p90, cache write/eviction + volume, slowest test targets, zero-match dead steps and cancellation waste) is reviewed + periodically to retire obsolete checks and demote emerging long tails to Retained. + +## Consequences + +- Every new test, static check or formal model declares its operational state (Active / Retained / + Dev), tier (L0–L4) and owner before wiring into CI. +- Until this ADR is accepted and its follow-up tooling changes land, `AGENTS.md` and + `docs/architecture/` remain the authoritative reference for today's commands and committed + snapshots; once aligned, `AGENTS.md` (`## Testing`) can consolidate its testing rules onto this + ADR so the rule is stated once. +- Pure static form checks are decoupled from workspace-coupled tooling so docs, frontend and script + PRs stay fast. +- Test-only build flags move to release-unreachable runtime/harness injection, eliminating + cascading CI recompiles without weakening production boundaries. +- Concrete workflow changes, runner migrations, scheduled sweeps, test-binary consolidation and + numeric budgets live in `docs/architecture/build.md`, `docs/release/README.md` and tracking + issues rather than here. + +## Non-goals + +- Lowering overall defect detection or deleting coverage without an owning replacement at a more + appropriate layer or operational state. +- Freezing numeric latency targets, runner hostnames, workflow syntax or crate-by-crate routing + tables in an immutable ADR. +- Replacing design review or code review with automated checks. + +## Supersession + +Does not supersede any prior ADR. Extends [ADR 008](008-documentation-ownership.md) by separating +verification and CI governance principles (here) from numeric budgets and current CI implementation +(`docs/architecture/build.md`, `docs/release/README.md`) and delivery status (issues). + +References: [ADR 008](008-documentation-ownership.md), +[Timeline finite model checking](../design/examples/capability-models/README.md), +[Build environment](../architecture/build.md), +[Terminal end-to-end suite](../architecture/tui-e2e.md), +[#1938](https://github.com/arcships/dim/issues/1938). diff --git a/docs/adr/README.md b/docs/adr/README.md index f6bdba0811..ab7e972b0d 100644 --- a/docs/adr/README.md +++ b/docs/adr/README.md @@ -32,6 +32,7 @@ original text. | [022 — Timeline 属性查询与正文重建](022-event-property-queries.md) | Proposed | Supersedes 019's event-only results, skip-based paging and start-only positions, and 020's single-predicate limit; retains 021's read ownership | | [023 — 上下文用量由独立分支部件维护](023-context-usage.md) | Accepted | Follows 021 and 022; separates context usage statistics from request preparation | | [024 — Web 抓取层使用请求库,地址策略在请求之前执行](024-web-fetch-transport.md) | Proposed | Follows 006 D1; replaces the hand-written transport and narrows the address policy to a pre-request check | +| [026 — Verification tiers, test coverage and CI governance](026-verification-tiers-and-ci-governance.md) | Proposed | Extends 008; defines three operational test states, verification tiers (L0–L4), form-only doc checks and CI governance | Source baseline: [initial foundation parent](https://github.com/arcships/dim/commit/aaaffa5768e031d781abb73e45b1915b05dc2aa0). This baseline includes lifecycle fixes not necessarily present on the default branch. diff --git a/docs/zh/adr/026-verification-tiers-and-ci-governance.md b/docs/zh/adr/026-verification-tiers-and-ci-governance.md new file mode 100644 index 0000000000..fba9e8756f --- /dev/null +++ b/docs/zh/adr/026-verification-tiers-and-ci-governance.md @@ -0,0 +1,89 @@ +# 026: 验证分层、测试覆盖与 CI 治理原则 + +决策状态:Proposed(提案)。 + +## 背景 + +每当主干出现回归或新增一种检查手段,如果习惯性地把它直接挂进 PR 必跑门禁,仓库的验证体系就会单调膨胀。时间一长,两个本应分开的概念会被混为一谈: + +- **仓库的验证覆盖面**:仓库维护的全部检查、形式化模型、测试套件、基准评估与发布验收手段。 +- **活跃 PR 门禁**:每次合入前必须同步跑完的有界子集。 + +一旦把两者画上等号,慢速集成测试、跨平台检查、为测试而触发的重复编译以及脆弱的文本扫描就会全部堆在同一条门禁里。耗时逼近上限时,靠调大超时阈值只会掩盖退化,最终演变为长队列等待、编译缓存写爆淘汰、任务相互取消,反过来同时伤害开发反馈速度与 `main` 主干信号质量。 + +## 决策 + +### D1. 测试按执行角色分为三态,验证分层(L0–L4)映射到对应状态 + +每项验证资产必须明确其执行态,以决定生命周期与 CI 成本归属: + +1. **活跃门禁(Active Gate)**:PR 每次自动运行并受明确耗时预算约束,守卫高频契约与受影响依赖闭包。 +2. **保留按需(Retained / On-demand & Sweep)**:保留在仓库中,**不阻塞日常 PR**;在资产自身文件变动(如形式化模型编辑)、定时全量扫、发版前、排障复现或设计/协议评审要求时拉起,各层级的具体触发条件以下表「默认执行态与触发方式」列为准。保留的 Rust 测试继续参与编译检查(例如聚合后标注 `#[ignore]`)以防编译腐烂;依赖外部工具链的检查(TLC/Java、本地 tmux E2E、独立性能脚本)不绑入日常构建链。 +3. **开发调试(Dev / Exploratory)**:开发或排障期间编写的临时探针与细粒度局部测试。合入前必须消融:具持久契约价值的进入活跃门禁(D3),具长期复现诊断价值的转为保留按需,其余随分支清理,不入主干长期背债。 + +五层验证资产(L0–L4)的默认执行态与触发方式如下: + +| 层级 | 守卫的核心问题 | 范围 | 默认执行态与触发方式 | +| --- | --- | --- | --- | +| **L0 — 设计与形式化层** | 抽象状态机、协议与交接不变量本身是否存在反例? | 形式化模型(如 TLA+ 规约及 `.cfg` 性质) | **保留按需**:(a) 修改形式化模型文件时触发(若接入 CI 须按 D4 披露工具链成本);(b) 当实现改动影响已建模的交接、恢复或先后序承诺时,通过 PR 清单与评审强制触发。普通实现 PR **不跑**。 | +| **L1 — 静态形式与契约层** | 格式、依赖边界、ADR 不可变形式、公开 schema / wire 类型及依赖合规是否破坏? | 格式化、Lint、纯静态形式/结构检查(含每个 PR / ADR 变动必跑的 ADR 冻结检查)、前端类型检查/Lint、源码静态提取的 wire/schema 契约、依赖漏洞与许可证扫描 | **活跃门禁**:每个 PR 最快失败门禁,按改动面精准触发(依赖合规仅在 manifest、lockfile 或策略文件变更时跑)。 | +| **L2 — 业务流层** | 改动模块及其传递下游的业务行为契约是否保持正确? | 单元测试与进程内或 loopback 流程测试(以及须编译 workspace 才能运行的运行时装配结构校验) | **活跃门禁**:在主力高吞吐平台运行改动 crate 的**反向依赖闭包**(公共底层 crate 或全局构建配置改动时扩大至全 workspace)。重型历史、长时压测或低频流程归入**保留按需**。 | +| **L3 — 真实环境与跨平台层** | 真实 OS 原语、真实进程/插件接线、终端交互与外部协议边界是否正常? | 平台专属边界窄集、真实 daemon + 插件运行时流、交互式终端 E2E、外部注册表验收 | **拆档**:仅触及平台/客户端代码时,极窄的 OS 专属原语边界进**活跃门禁**;全量跨平台与外部注册表验收归**保留按需**(`main` 异步/定时扫、发版前或按需);交互式终端 E2E 归**保留按需(仅限本地)**——只在本地按需或发版前运行,**绝不**由任何 CI workflow 触发。 | +| **L4 — 效果、性能与发布层** | 模型效果、资源预算、可执行文件布局或分发包是否退化? | 评测套件(eval)、内存/启动测量、原生代码布局构建、多平台发布包构建与注册表/镜像验收 | **执行始终归保留按需**(仅定时、手动或发版流程,绝不阻塞普通功能 PR);修改 L4 工具链自身时,该工具自身的 L1/L2 自检作为**活跃门禁**在其 PR 上运行。 | + +形式化模型(L0)验证的是「抽象状态机在有限状态空间内满足安全性与条件活性」,不是代码编译检查。普通代码改动依靠 L2 流程测试守住「实现依然精化模型动作」;若实现改动改变了模型假设的交接或先后序承诺,本质上属于设计变更,须通过评审回到 L0 更新并重跑模型后再合入。 + +### D2. 文档承担引导与语义约束;自动化检查只控形式与结构边界,不控内容语义 + +文档的职责是引导贡献者并陈述语义契约。针对文档和源码约定的自动化检查只应约束**确定性、低误报的形式与结构不变量**: + +- **纯静态形式检查(L1,零业务编译)**:生命周期与不可变形式(如已接受 ADR 冻结检查)、链接与模板结构完整性,以及基于 manifest 或 AST 的静态结构校验(如 crate/模块依赖边界、源码解析的类型声明),既不编译业务运行时 crate,也不解析自然语言散文。 +- **需组装运行时的结构投影(随 L2 编译路径)**:固有需要编译并装配运行时才能计算的确定性「代码到文档」投影(如实时公开服务目录)归入依赖 workspace 编译的校验路径,不阻塞纯文档、前端或脚本 PR。 +- **克制入库自动生成文件**:只有当生成文件被下游代码直接消费(如跨语言类型声明),或是精简且被文档实际引用的公开摘要时,才应提交进 Git 并做过期校验;纯用于依赖边界校验的细粒度内部图谱应在内存中实时检查、本地按需生成,不提交进 Git 制造合并冲突。 +- **不以自动化测试强控**:文档散文的语义正确性、设计优劣,以及“某次实现改动是否触及已建模不变量”这类语义判断。避免新增试图从源码字面量推断语义、依赖不断膨胀的人工白名单维系的跨语言文本扫描(既有白名单扫描器仅过渡保留至被类型、边界或行为测试替代,不再效仿);语义约束通过类型系统、模块边界、评审清单、L0 模型与 L2 行为测试保障。 + +### D3. 测试覆盖遵循最低流程/契约层、单一归属、生产不可达注入与产物治理 + +测试质量取决于单位成本下对契约的保护力,而不是在最高层堆积用例数量: + +- **能证明契约的最低流程层或契约层**:关于私有模块、helper 或单个函数的断言应落在最近的流程测试或契约测试中,不鼓励为内部实现写孤立单测;同时状态转换、渲染规则、参数校验与错误矩阵不得写成起真实进程、PTY 或拷贝二进制的端到端测试。E2E 只覆盖代表性接线与真实 OS 交互路径,不做排列组合穷举。 +- **单一归属原则**:下层(或专用套件,如本地终端 E2E)已证明的行为,上层仅验证链路接通,不重复异常矩阵。覆盖迁移到更合适的载体后,须在同一改动或对应迁移任务中同步退役或降级原活跃 CI 用例。 +- **生产安全的运行期注入替代重编译**:测试态差异(release 标记、build ID、时钟、端点、故障注入)应在运行期或测试边界注入,避免通过切换编译期环境变量迫使 CI 级联重编上游 crate。**生产安全红线**:所有仅用于测试的覆写入口**在 release 构建中必须不可达**(仅在 debug/test 构建编译),或严格限定在测试夹具入口内,绝不扩大生产二进制可接受的外部输入面。 +- **把测试二进制当作工程产物治理**:按 crate 将集成测试聚合为少量均衡的入口二进制,避免大量单文件测试可执行文件重复全图链接、放大编译缓存写盘体积;同时拆分过大的单一测试二进制,消除单进程调度长尾与链接器压力。 + +### D4. 活跃门禁实行有记录预算制与轻重物理隔离 + +- **有记录的耗时与资源预算**:每个同步活跃门禁层声明明确的耗时与资源预算(随 runner 实测数据记录在 `docs/architecture/build.md` 与追踪 issue 中,不在不可变 ADR 内写死具体分钟数)。逼近或触发预算上限视为退化,须通过收敛范围、优化慢测、提升并行度或降级到保留按需来压回预算,**禁止**以单纯调大作业或单目标超时作为解决方案。 +- **门禁增量成本显式化**:任何向 PR 必跑门禁新增检查或扩大路径匹配规则的变更,必须写明增量耗时、新增编译依赖与目标 runner 池。 +- **轻量检查与重型构建物理隔离**:纯静态仓库检查不得依赖编译业务运行时 crate。文档、前端、脚本与静态检查运行在轻量作业中,不得抢占重型编译或稀缺平台 runner 池。 + +### D5. 影响面路由与稀缺平台最小化,以定时全量扫和周期减法为前提 + +- **影响面路由与全量扫前置条件**:PR 与 `main` 推送均按改动路径选择检查组,且 `main` 推送各自独立跑完、不相互取消。**只有在定时全量扫已上线运行时,才允许收窄 `main` 推送**,以兜底跨组隐式耦合;全量扫失败须有明确的分诊归属与针对区间合并提交的二分定位流程。 +- **显式路径分类**:新增顶层目录或非代码资产时,必须在路径路由器中显式归类,不得静默落入最昂贵的全量兜底组。 +- **稀缺平台仅验证平台专属边界**:全量编译与平台无关的 L1/L2 验证集中在高吞吐主力平台(Linux)。稀缺 OS 池(macOS、Windows)在 PR 阶段仅运行触及平台专属代码路径(`cfg(target_os = ...)`)、原生 OS API 或目标打包边界的检查,且专属清单应由源码机制核对,不依赖易漂移的人工白名单。 +- **周期性可观测与减法维护**:定期复盘 CI 指标(排队 p90、执行 p90、缓存写入/淘汰体积、最慢测试目标、0 匹配死步骤与取消浪费率),持续淘汰过时检查并将新长尾降级至保留按需。 + +## 影响 + +- 新增测试、静态检查或形式化模型接入 CI 前,须先明确其执行态(活跃/保留/调试)、层级(L0–L4)与归属。 +- 在本 ADR 被正式接受且配套工具变更落地前,`AGENTS.md` 与 `docs/architecture/` 仍是现行命令与入库快照的权威依据;对齐后可将 `AGENTS.md`(`## Testing`)的测试规则统一收口指向本决策以避免重复。 +- 纯静态形式检查与依赖全后端的研发工具解耦,保持文档、前端与脚本 PR 的快速反馈。 +- 仅服务于测试的编译期开关改为生产不可达的运行期/夹具注入,消除级联重编且不放松生产安全边界。 +- 具体 workflow 调整、runner 迁移、定时全量扫、测试二进制聚合与具体预算数值均落在 `docs/architecture/build.md`、`docs/release/README.md` 与追踪 issue 中。 + +## 非目标 + +- 降低仓库整体缺陷检出能力,或在没有合适层级或执行态替代覆盖的情况下删除测试。 +- 在不可变 ADR 中写死具体分钟数阈值、runner 主机名、workflow 语法或逐 crate 路由表。 +- 用自动化检查替代设计评审与代码审查。 + +## 替代关系 + +不替代任何既有 ADR。本决策承接 [ADR 008](../../adr/008-documentation-ownership.md) 的分层边界:本文件仅定义验证与 CI 治理原则,预算数值与当前 CI 实现留在 `docs/architecture/build.md` 与 `docs/release/README.md`,推进状态留在 issues。 + +参考:[ADR 008](../../adr/008-documentation-ownership.md)、 +[Timeline 承诺的有限模型检查](../../design/examples/capability-models/README.md)、 +[Build environment](../../architecture/build.md)、 +[Terminal end-to-end suite](../../architecture/tui-e2e.md)、 +[#1938](https://github.com/arcships/dim/issues/1938)。