Skip to content

Commit 67da0f0

Browse files
committed
docs: align the hand-written plugin docs with the ADR-0049 retirements (#11982, #12587)
Docs-drift pass over the six pages the drift bot anchored to this diff: - plugins/anatomy.mdx: the Plugin-class example carried the retired configSchema field with a comment claiming the loader validates it; the block now shows constructor-owned config and names the retirement - plugins/index.mdx: the Configuration Validation bullet and the configSchema half of the securePlugin example removed (signature kept - live surface); replacement paragraph states the plugin-owned self-parse pattern - protocol/kernel/index.mdx: the Configuration Management snippet and the fail-fast callout no longer document the retired field as merely 'postponed' - both now state the retirement and the self-parse seam No change, with the reason measured per page: automation/flows.mdx names the ADR-0018 node-executor configSchema (different surface); getting-started/quick-reference.mdx names spec's plugin-validator.zod.ts PluginMetadata (locally-declared homonym, live); protocol/kernel/plugin-spec.mdx teaches the surviving self-parse pattern - its phantom manifest file-map row predates this diff and is filed as #12690. content/docs/releases/v17.mdx is release-owned and untouched; its four configSchema mentions are all the ADR-0018 / driver surfaces, none the kernel field. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LZbWd2jNV1FErXTPSS4Dry
1 parent a6c8315 commit 67da0f0

3 files changed

Lines changed: 23 additions & 30 deletions

File tree

‎content/docs/plugins/anatomy.mdx‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ Plugins are the building blocks of ObjectStack. A plugin is a plain JavaScript/T
99

1010
```typescript
1111
import type { Plugin, PluginContext } from '@objectstack/core';
12-
import { z } from 'zod';
1312

1413
export class MyPlugin implements Plugin {
1514
// Identity
@@ -21,12 +20,12 @@ export class MyPlugin implements Plugin {
2120
// This controls init ordering — it is NOT an npm-style version map.
2221
dependencies = ['com.objectstack.engine.objectql'];
2322

24-
// Configuration Schema (Optional)
25-
// Read by the plugin loader to validate config; it lives on the plugin
26-
// metadata rather than the base `Plugin` interface.
27-
configSchema = z.object({
28-
apiKey: z.string()
29-
});
23+
// Configuration (Optional)
24+
// A plugin owns its config: take it as a constructor/factory argument and
25+
// parse it yourself (with a Zod schema, say) before use. The kernel never
26+
// receives plugin config — the old `configSchema` metadata field was
27+
// retired under ADR-0049 because nothing could ever run it.
28+
constructor(private readonly options: { apiKey?: string } = {}) {}
3029

3130
/**
3231
* Init Phase (REQUIRED)

‎content/docs/plugins/index.mdx‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -284,22 +284,21 @@ const dbPlugin: PluginMetadata = {
284284

285285
ObjectStack supports plugin security features:
286286

287-
- **Configuration Validation**: Plugins can define a Zod `configSchema` for runtime validation
288287
- **Signature Verification**: Cryptographic signatures for plugin integrity
289288
- **Permission Enforcement**: Fine-grained access control for plugin operations
290289

291-
```typescript
292-
import { z } from 'zod';
290+
Plugin configuration is the plugin's own concern: take it as a constructor or
291+
factory argument and parse it at your own seam (a Zod `schema.parse` in the
292+
factory, constructor or `init`). The kernel-side `configSchema` metadata field
293+
was retired under ADR-0049 — the kernel never received a plugin's config, so
294+
the field could not validate anything.
293295

296+
```typescript
294297
const securePlugin: PluginMetadata = {
295298
name: 'com.example.secure',
296299
version: '1.0.0',
297-
configSchema: z.object({
298-
apiKey: z.string().min(1),
299-
region: z.enum(['us', 'eu', 'ap']),
300-
}),
301300
signature: 'ed25519:key-1:<base64url-signature>',
302-
301+
303302
async init(ctx) { /* ... */ },
304303
};
305304
```

‎content/docs/protocol/kernel/index.mdx‎

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -403,20 +403,14 @@ packages/plugins/plugin-slack-integration/
403403
404404
### Configuration Management
405405
```typescript
406-
// A plugin object may carry a Zod `configSchema` describing its settings.
407-
// NOTE: the kernel RECORDS the schema but does not enforce it yet — `use()`
408-
// takes no config argument, so the loader has nothing to parse and logs
409-
// "config validation postponed" instead of running the schema. Treat
410-
// `configSchema` as a declaration of shape, and validate values you actually
411-
// depend on yourself.
406+
// A plugin owns its config: `use()` takes no config argument and the kernel
407+
// never receives one, so validate the values you depend on at your own seam
408+
// (a Zod `schema.parse` in the plugin's factory, constructor or `init`).
409+
// The old `configSchema` metadata field was retired under ADR-0049 — the
410+
// loader only ever logged "config validation postponed" and returned.
412411
export const slackPlugin: Plugin = {
413412
name: 'slack-integration',
414413
version: '0.1.0',
415-
configSchema: z.object({
416-
apiKey: z.string().describe('Slack API Key'),
417-
channel: z.string().default('#general'),
418-
enabled: z.boolean().default(true),
419-
}),
420414
async init(ctx) {
421415
// Runtime-resolved values come from the `settings` service, not from a
422416
// `config` object on the context — there is no `ctx.config`.
@@ -487,10 +481,11 @@ const message = i18n.t('slack.button.send', context.locale);
487481
**Example:** Wiring, not config, is what the kernel currently enforces at boot. A plugin that declares a dependency the kernel never received fails `bootstrap()` outright — `[Kernel] Dependency 'com.objectstack.engine.objectql' not found for plugin 'com.objectstack.audit'` — and a dependency cycle throws `[Kernel] Circular dependency detected: <plugin>`. Boot stops there instead of a request failing later.
488482
489483
<Callout type="warn">
490-
Plugin `configSchema` is **not** part of this fail-fast path yet. The loader
491-
stores the schema and postpones the check, so a missing or malformed value in
492-
a plugin's config will not stop boot today. Validate config you depend on in
493-
your own `init`.
484+
Plugin config is **not** part of this fail-fast path. The old `configSchema`
485+
metadata field was retired under ADR-0049 — the loader never enforced it —
486+
so a missing or malformed value in a plugin's config will not stop boot.
487+
Parse config you depend on yourself, in your plugin's factory, constructor
488+
or `init`.
494489
</Callout>
495490
496491
## Comparison: Kernel vs Alternatives

0 commit comments

Comments
 (0)