Skip to content

fix: implement real validateSchema replacing always-true stubs#99

Merged
MarcosBrendonDePaula merged 4 commits intomainfrom
claude/review-issues-create-pr-JUz5U
Mar 14, 2026
Merged

fix: implement real validateSchema replacing always-true stubs#99
MarcosBrendonDePaula merged 4 commits intomainfrom
claude/review-issues-create-pr-JUz5U

Conversation

@MarcosBrendonDePaula
Copy link
Copy Markdown
Collaborator

Summary

  • Fixes Implementar ou remover validateSchema() stub #76 - validateSchema() stubs in 3 files always returned { valid: true } without performing any real validation
  • Replaced stubs in core/server/framework.ts, core/framework/server.ts, and core/cli/command-registry.ts with delegation to createPluginUtils() from core/plugins/config.ts
  • This leverages DefaultPluginConfigManager.validatePluginConfig() which performs real JSON schema validation: type checks, required properties, string/number/array constraints, enum validation, nested objects, and additionalProperties checks

What changed

File Before After
core/server/framework.ts Always { valid: true } Delegates to DefaultPluginConfigManager
core/framework/server.ts Always { valid: true } Delegates to DefaultPluginConfigManager
core/cli/command-registry.ts Always { valid: true } Delegates to DefaultPluginConfigManager

Note: core/plugins/config.ts already had correct validation and was not changed.

Test plan

  • TypeScript compiles without errors (bunx tsc --noEmit)
  • All 527 tests pass (bun run test)
  • Verify plugins with invalid config are now properly rejected
  • Verify plugins with valid config continue to work as expected

https://claude.ai/code/session_01CWaNPvPTb2Du3UEmFJxmxX

@MarcosBrendonDePaula MarcosBrendonDePaula force-pushed the claude/review-issues-create-pr-JUz5U branch from 95c45fe to 386aa97 Compare March 14, 2026 16:19
claude and others added 2 commits March 14, 2026 18:25
…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>
@MarcosBrendonDePaula MarcosBrendonDePaula force-pushed the claude/review-issues-create-pr-JUz5U branch from 386aa97 to 972a703 Compare March 14, 2026 21:25
@MarcosBrendonDePaula
Copy link
Copy Markdown
Collaborator Author

Rebase feito na main

Branch atualizada via rebase. Mudanças que eram regressões foram eliminadas automaticamente:

Diff final (limpo):

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.

MarcosBrendonDePaula and others added 2 commits March 14, 2026 18:27
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>
@MarcosBrendonDePaula MarcosBrendonDePaula merged commit 3df49d7 into main Mar 14, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implementar ou remover validateSchema() stub

2 participants