fix: implement real validateSchema replacing always-true stubs#99
Merged
MarcosBrendonDePaula merged 4 commits intomainfrom Mar 14, 2026
Merged
Conversation
95c45fe to
386aa97
Compare
…DefaultPluginConfigManager
The validateSchema() in core/server/framework.ts, core/framework/server.ts,
and core/cli/command-registry.ts always returned { valid: true } without
performing any validation. This gave plugins a false sense of security.
Now all three sites delegate to createPluginUtils() from core/plugins/config.ts,
which uses DefaultPluginConfigManager.validatePluginConfig() for real JSON schema
validation (type checks, required properties, string/number/array constraints,
enum validation, nested objects, and additionalProperties checks).
Closes #76
https://claude.ai/code/session_01CWaNPvPTb2Du3UEmFJxmxX
Covers DefaultPluginConfigManager.validatePluginConfig and createPluginUtils().validateSchema: type checks, required props, string/number/array constraints, enum, nested objects, and additionalProperties warnings. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
386aa97 to
972a703
Compare
Collaborator
Author
Rebase feito na
|
| Arquivo | Mudança |
|---|---|
core/framework/server.ts |
Stub → delega para createPluginUtils() |
core/cli/command-registry.ts |
Stub → delega para createPluginUtils() |
tests/unit/core/plugins/validate-schema.test.ts |
+383 linhas (28 testes) |
567 testes passando, incluindo os 28 novos e os 12 do compat guard.
The `logger` imported from `@core/utils/logger` is already the same `winston.Logger` type that `createPluginUtils()` expects. Also fixes `data`/`schema` params in `core/framework/server.ts` from `any` to `unknown` for consistency with `command-registry.ts`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- `validateSchema` now typed as `(data: Record<string, unknown>, schema: PluginConfigSchema)` - `deepMerge` now typed as `(target: Record<string, unknown>, source: Record<string, unknown>) => Record<string, unknown>` - Made `DefaultPluginConfigManager.deepMerge` public to avoid `as any` cast - Updated all implementation sites to match the interface 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
validateSchema()stubs in 3 files always returned{ valid: true }without performing any real validationcore/server/framework.ts,core/framework/server.ts, andcore/cli/command-registry.tswith delegation tocreatePluginUtils()fromcore/plugins/config.tsDefaultPluginConfigManager.validatePluginConfig()which performs real JSON schema validation: type checks, required properties, string/number/array constraints, enum validation, nested objects, and additionalProperties checksWhat changed
core/server/framework.ts{ valid: true }DefaultPluginConfigManagercore/framework/server.ts{ valid: true }DefaultPluginConfigManagercore/cli/command-registry.ts{ valid: true }DefaultPluginConfigManagerNote:
core/plugins/config.tsalready had correct validation and was not changed.Test plan
bunx tsc --noEmit)bun run test)https://claude.ai/code/session_01CWaNPvPTb2Du3UEmFJxmxX