You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[finding] RestServer.normalizeConfig still discards the parsed api output — its ?? chain duplicates RestApiConfigSchema's defaults key for key, and the validate-only reason has expired #14366
Observation from #11984, which made normalizeConfig parse AND consume the four sibling sub-objects (crud / metadata / batch / routes) after measuring, per sub-object, that every key the method reads is one the schema declares. api was deliberately left as #11637 shaped it — validate-only, parsed output discarded, the normalized block built from a ?? chain over the raw cast — because flipping it is that seam's own change, not a rider on the siblings.
The key diff for api is now empty too: normalizeConfig reads version, basePath, apiPath, enableCrud, enableMetadata, enableUi, enableBatch, enableDiscovery, enableOpenApi, enableSearch, enableProjectScoping, projectResolution, documentation, responseFormat — all fourteen declared by RestApiConfigSchema.
Consequence today: twelve defaults exist in two places (z.default(...) in packages/spec and ?? ... in packages/rest). They agree key for key right now; a spec default change would not propagate, and nothing pins that the two stay equal.
Suggested shape
Consume the parse for api exactly as #11984 did for the siblings — parseDeclaredSubConfig('api', schemas.api, config.api) already returns the parsed output; build the api block from it and delete the ?? chain, keeping the .omit({ requireAuth: true }) and the version rationale. Pin: requireAuth: false still constructs and still warns via the plugin; every ?? default is now the schema's. Low risk, but it is a change to the seam #11637 / #12450 own and wants its own measurement; that is why it is filed rather than ridden on #11984.
Blocked-by: #11984
Observation from #11984, which made
normalizeConfigparse AND consume the four sibling sub-objects (crud/metadata/batch/routes) after measuring, per sub-object, that every key the method reads is one the schema declares.apiwas deliberately left as #11637 shaped it — validate-only, parsed output discarded, the normalized block built from a??chain over the raw cast — because flipping it is that seam's own change, not a rider on the siblings.What is true on
origin/main@08e49496fRestApiConfigSchemaconstrainsapi.versionwith a regex the REST server never runs — the seam casts instead of parsing, soapi.version: ''is accepted and mounts the whole API at/api//#11637 made the parse validate-only for two measured reasons:enableSearchhad no declared seat (a consumed parse would have stripped it and turned search back on), andrequireAuthis.omit()ed (把 public 从"全局开关的副产品"升级为声明式能力,然后删掉 api.requireAuth 开关 #3963 warn-and-ignore).api.enableSearchandmetadata.maskObjectFieldsare live REST config keys that no schema inpackages/specdeclares — read throughas any, and stripped by any parse of their own config object #11983 gaveenableSearchits declared seat; Once #11999 lands, a GREEN test in packages/rest asserts a rationale that is no longer true — plus theprojectResolutionomit it was written to justify #12450 withdrew theprojectResolutionomit. The only remaining.omit()isrequireAuth— a keynormalizeConfignever reads (the plugin reads it off the RAW config for its warning, inrest-api-plugin.ts, so a consumed parse would not touch that warning).apiis now empty too:normalizeConfigreadsversion,basePath,apiPath,enableCrud,enableMetadata,enableUi,enableBatch,enableDiscovery,enableOpenApi,enableSearch,enableProjectScoping,projectResolution,documentation,responseFormat— all fourteen declared byRestApiConfigSchema.z.default(...)inpackages/specand?? ...inpackages/rest). They agree key for key right now; a spec default change would not propagate, and nothing pins that the two stay equal.Suggested shape
Consume the parse for
apiexactly as #11984 did for the siblings —parseDeclaredSubConfig('api', schemas.api, config.api)already returns the parsed output; build theapiblock from it and delete the??chain, keeping the.omit({ requireAuth: true })and theversionrationale. Pin:requireAuth: falsestill constructs and still warns via the plugin; every??default is now the schema's. Low risk, but it is a change to the seam #11637 / #12450 own and wants its own measurement; that is why it is filed rather than ridden on #11984.Generated by Claude Code