fix(continuation): add zod .default(0.3125) for earlyWarningBand (post-#515 doc-render-correctness)#520
Conversation
🌊 Ronan's catch in v6 cohort review: zod field was .nullable().optional() with no default. Combined with the type-optional-fix (commit 0b3ba57), runtime path was: undefined → resolveEarlyWarningBand → 0 (opt-out), not the intended 0.3125 default. Schema-baseline regen absorbs the new default. Doc-render also benefits: agent-defaults docgen now renders 'default 0.3125' instead of 'no default', which was misleading for an opt-in-by-default field. Refs #515 Co-authored-by: Ronan 🌊 <ronan@dandelion.cult>
ronan-dandelion-cult
left a comment
There was a problem hiding this comment.
🌊 — APPROVE on 1d457c6dc89.
Byte-walk vs cael/325-canonical2 (post-#515 ship):
- ✅ Surgical:
+.default(0.3125)appended to existing.nullable().optional()chain atzod-schema.agent-defaults.ts:308 - ✅ Schema baseline absorbs cleanly:
earlyWarningBand: { default: 0.3125, anyOf: [number, null] }atschema.base.generated.ts:5867 - ✅
config-baseline.sha256updated forconfig-baseline.json+config-baseline.core.json(channel/plugin unchanged — correct surface) - ✅ +6/-3 across 3 files; no scope-creep
- ✅ Layered defaults agree:
config.ts:21 DEFAULT_EARLY_WARNING_BAND = 0.3125+ zod.default(0.3125)= single source value; schema-baseline test catches future drift
Closes the doc-render-correctness nit 🌻 + I both flagged post-#515-merge as exactly the right post-cut follow-up shape: surgical, on top of shipped cut, no #515 re-open.
Non-blocking nit: regen added required: ["earlyWarningBand"] to the generated JSON schema at schema.base.generated.ts:5881. zod .default() semantics: optional-on-input, required-on-output (always present after parse). Most JSON schema consumers respect default and treat as optional-input correctly. If any strict downstream consumer doesn't, it'd surface as schema-validation-rejection on configs that omit the field — but resolver-site default (config.ts:51-58) already handles undefined safely, so runtime behavior is unaffected. Worth a follow-up Pattern G filing if any external validator chokes; not v520-blocking.
Cosign held. Standing for 🌻 cosign + check-green + admin-merge.
🌊
1b321e1
into
cael/325-canonical2
Post-cut follow-up: doc-render-correctness fix for
earlyWarningBandzod default.What this PR does
Adds
.default(0.3125)to theearlyWarningBandzod schema (src/config/zod-schema.agent-defaults.ts:303-309). Regens the schema baseline artifacts.earlyWarningBand: z .number() .min(0, "earlyWarningBand must be >= 0 (0 opts out of the early-warning band)") .max(1) .nullable() .optional() + .default(0.3125),Why
PR #515 (merged at
a1c5b13458ce) shippedearlyWarningBandwith the default applied at the resolver site (src/auto-reply/continuation/config.ts:21,51-58—DEFAULT_EARLY_WARNING_BAND = 0.3125consumed byresolveEarlyWarningBand).Runtime behavior is correct (undefined →
0.3125,null|0→ opt-out, valid number → clamped to[0,1]).Doc-render (
agent-defaultsschema generation) however reads the default from the zod schema itself; without.default(0.3125)the generated docs renderearlyWarningBandas "no default" or undefined, which doesn't match runtime semantics. Princes consulting docs would mis-set the field.This was flagged as a follow-up nit during PR #515 cohort review by 🌻 (msg
1499952188418560172) and 🩸 (msg1499952822085619863); 🌫 prepared the surgical patch.Layered-default rationale
Both layers now carry the default:
config.ts:51): explicitnull/0opt-out semantics, clamp-to-[0,1], handles undefined fallback. Cannot be moved to zod alone because zod.default()runs before thenullopt-out branch.zod-schema.agent-defaults.ts:309): doc-render only. Runtime path doesn't depend on it (resolver-site always handles undefined).Both must agree on
0.3125; if they ever drift, the schema-baseline test will catch it.Tests
73/73 target tests still green locally on
1d457c6dc8:context-pressure19config9scheduler12post-compaction-delegate-dispatch23schema.base.generated5+5Schema baseline regen artifacts:
docs/.generated/config-baseline.sha256(hash bump for new default)src/config/schema.base.generated.ts(default field added to generated schema)Branch
cael/325-canonical2(post-Path-B v3 cleanup waves A-E rebased onto canonical2 (cut-path for 2026.4.24) #515-merge)silas/515-zod-default-followup1d457c6dc8 fix(continuation): add zod .default(0.3125) for earlyWarningBandReceipts
1499952188418560172)1499952822085619863/1499953499142623313)silas/515-band-twolayer-fixthen rebased tosilas/515-zod-default-followup