/** * [ref] 批1 —— limitsHttp 组的 **stage 半场**([ref] 手法 A′ + B 簇1)。 * * 形与 `stageApprovalRequire` 同族:一切可抛/可判的事在 stage 做,commit 段只剩纯赋值。三条本域纪律: * * 1. **非粘**(applyRuntimeHot 的 NON-STICKY 同源):每次 apply 都从 **env 基线**重算 `present ? center : baseline` * ——center 撤键 ⇒ 回 env 底。「缺席=保上一个 center 值」会把一次已经撤回的限额永久冻在进程里。 * 2. **整批原子**([ref] §0③ + §4 混批零变异):本域任一键坏值/任一跨键不变量不过 ⇒ **整批拒**, * 合法键也不落地,旧值继续服务,拒因响亮点名键([ref] 法)。半应用一个限额面 = 运营看到的数字与真门 * 不是同一代,比整批拒糟得多。 * 3. **判据单源**:跨键不变量走 `config-invariants.ts` 的同一张表(boot 与 stage 同表);数值下限走 * config.ts 导出的同一组 floor 常量(env 腿夹取、center 腿拒——**判据阈值同源,处置刻意不同**: * env 是既有部署的存量值,夹取+点名不打断服务;center 发布是一次可重发的显式动作,拒绝才有意义)。 */ import type { ServiceConfig } from "../config-types.js"; import type { Logger } from "../observability/logger.js"; import { type Batch1LimitKey } from "./hot-keys-registry.js"; import type { EffectiveLimits } from "./types.js"; /** * stage 的入参视图。 * * 🔴 `legacyGates` 是**已过旧位 presence 判据**的闸值(判据属主 = `runtimeGatePresent`,调用方过一遍再传)。 * 两位刻意判据不同,不是疏忽:旧位(`runtime`)的容忍语义(例如 `costQuotaWindowSec: 0` 判「缺席」保 env) * 是既有 center 的在营契约,收紧它会把一个存量发布变成整批拒;新位(`limits`)从第一天起就是严判 * (坏值 = 整批响亮拒)。判据属主各只有一个,谁都没有被复刻第二份。 */ export interface LimitsSource { readonly version: number; readonly limits?: EffectiveLimits; readonly legacyGates?: Readonly>; } /** 逐键 defer 的铸因(codex R2-F2):值合法但这一键**不热**,变更只能重启生效。 */ export interface DeferredLimit { readonly key: Batch1LimitKey; readonly reason: string; } export interface StagedLimits { /** commit 段照单赋值。 */ readonly assignments: ReadonlyArray; /** 回 env 底、而底本身是「键缺席」的那些键(presence-as-semantics 的键必须**删**,不能写 undefined)。 */ readonly deletions: readonly Batch1LimitKey[]; /** 本世代真正换了值的键(通知载荷,post-commit 发)。 */ readonly changed: readonly string[]; /** 值合法但**不热**的键:不落地,铸因进世代账 + 一条响亮 warn(逐键 defer,不是整批拒)。 */ readonly deferred: readonly DeferredLimit[]; /** 整批被拒时的成因(消毒:只带键名与判据文案,**绝不带值**)。 */ readonly rejected?: { readonly keys: string[]; readonly reason: string; readonly restartReason?: string; }; } /** * STAGE:算出本世代 limitsHttp 组要 COMMIT 的全部赋值(纯计算,零变异)。 * * 返回 `rejected` 时 `assignments`/`deletions` 恒为空 —— 整批拒的物理保证在返回值形上,不靠调用方自律。 */ export declare function stageLimits(config: ServiceConfig, eff: LimitsSource, logger?: Logger): StagedLimits; //# sourceMappingURL=stage-limits.d.ts.map