refactor(config): drop unused safeParse wrappers and stale Zod comments in config/schema.ts
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- Medio día
- Aptitud para principiantes
- 62/100
- Tipo de issue
- Refactorización
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- typescript
- Área
- cli
Línea de trabajo
Start by running rg for the five unused exports (ApiKeyAuthSchema, BasicAuthSchema, AuthSchema, ServiceBlockSchema, ConfigFileSchema) in src/config/schema.ts to confirm only tests use them, then run rg -i zod src to find the stale comments in loader.ts, ajv-validate.ts, json-schema-args.ts, namespaces.ts and factory.ts. Done means the wrappers and their tests are removed with a justification, the post-checks live only in ContextSchema, rg -i zod src is empty, and npm test and npx tsc --noEmit pass. Leave the strip* helpers and additionalProperties alone, since #716 covers them.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
src/config/schema.ts exports five ajv-backed safeParse wrappers that nothing in src/ calls. Only tests use them. Several comments across src/ also still describe validation as Zod-based, but zod has been removed from the project.
Unused exports (current main):
ApiKeyAuthSchema(line 306)BasicAuthSchema(line 316)AuthSchema(line 326)ServiceBlockSchema(line 335)ConfigFileSchema(line 402)
Production code uses only StructuralConfigSchema (loader.ts, completion/complete.ts, completers/context-names.ts), ContextSchema (loader.ts, config/commands.ts) and CommandPolicySchema (loader.ts, completion/complete.ts).
ConfigFileSchema also duplicates the three per-context post-checks from ContextSchema, with different wording:
- At least one service block:
ContextSchemaline 382-383 vsConfigFileSchemaline 426-427 ("at least one service block required"). contextUrlErrors: line 385 vs line 429.contextVersionErrors: line 387 vs line 431.
These were around lines 378-385 and 431-440 in an earlier revision.
Stale Zod comments:
src/config/loader.ts:14: "Validate active context with full Zod schemas"src/lib/ajv-validate.ts:7src/lib/json-schema-args.ts:9src/namespaces.ts:107src/factory.ts:737
Proposal
- Delete the five unused wrappers and their tests. Deleting
ConfigFileSchemaremoves the duplicated post-checks, soContextSchemabecomes their single home. - Update the Zod comments so they describe the current ajv/JSON Schema behaviour.
The PR must explicitly justify deleting the tests for the removed wrappers: they cover only code being removed, and the behaviour that remains is still covered through ContextSchema/StructuralConfigSchema.
Out of scope: deferred to #716 (design decision 1)
This issue does not cover replacing the strip* helpers (schema.ts ~238-298, plus the ! assertions on their results) with ValidateFunction<T> type guards, or adding additionalProperties: false. Either change would alter behaviour. Today unknown config keys are silently stripped (schema.ts:137: "no additionalProperties — we strip manually"). A type guard would pass them through, and additionalProperties: false would reject them, which would break existing configs that have extra keys. Both options also overlap with #716's raw-shape plus per-field leaf validator split, which reshapes ContextSchema, contextUrlErrors, contextVersionErrors and the strip* helpers. Decide them there.
Acceptance criteria
-
ConfigFileSchema,AuthSchema,ApiKeyAuthSchema,BasicAuthSchemaandServiceBlockSchemaare removed, or any that stay have a documented reason. - The three per-context post-checks exist only in
ContextSchema. - No comment in
src/refers to Zod (rg -i zod srcis empty). - The PR justifies each deleted test.
- No behaviour change: unknown keys are still stripped, and
npm testandnpx tsc --noEmitpass.
Related
- #716 (design decision 1: the
strip*/type-guard and unknown-key handling is deferred there)
authored by Pi Coding Agent (Claude Opus)
- Lenguaje dominante
- TypeScript
- Estrellas
- 47
- Forks
- 27
- Merge medio
- 2 d 6 h
- PR fusionados (30 d)
- 52
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de elastic/cli
-
feat: ship skills/elastic/SKILL.md for agent invocationPosiblemente ocupada @onatozmenn la tomó hace 15 días. Abiertoenhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
elastic/cli#628 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
elastic/cli#617 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 20/100
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
Todos los issues de elastic/cli
Issues similares
-
affected/v17 affected/v18 area/frontend type/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
umbraco/Umbraco-CMS#24186 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
better-auth/better-auth#11723 · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
area: docs difficulty: easy documentation good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
Worker-Erstellung bricht langsame Git-Worktree-Checkouts nach 20 Sekunden abPosiblemente ocupada @KajoVanBuyten la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 69/100
AgentSystemLabs/agent-office#367 ·
Los mantenedores suelen responder en 1 día