refactor(config): drop unused safeParse wrappers and stale Zod comments in config/schema.ts
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- Nửa ngày
- Mức phù hợp với người mới
- 62/100
- Loại issue
- Tái cấu trúc
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
- Lĩnh vực
- cli
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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)
- Ngôn ngữ chính
- TypeScript
- Star
- 49
- Fork
- 27
- Merge trung bình
- 1 ngày 18 giờ
- Pull request đã merge (30 ngày)
- 63
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của elastic/cli
-
feat: ship skills/elastic/SKILL.md for agent invocationCó thể đã có người làm @onatozmenn đã nhận 21 ngày trước. Đang mởenhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
elastic/cli#628 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
elastic/cli#617 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 38/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 58/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 20/100
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
Unsampled pageload span is profiled when profileLifecycle is 'trace' (browser UI profiling)Có thể đã có người làm @Jxxunnn đã nhận hôm nay. Đang mởBrowser Waiting for: Product Owner
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
getsentry/sentry-javascript#25497 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
e2e-failure ready-to-code
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
redhat-developer/rhdh-plugin-export-overlays#4438 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
resource: destroying a resource calls AbortController.abort() without a reason, creating an AbortError with a stack trace each timeCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởarea: core
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
angular/angular#71422 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug status: needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
facebook/docusaurus#12739 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
factory-active task-identify-harness-labels-done task-identify-issue-type-done
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 68/100
vercel/ai#23537 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày