Feat: Declare plugin pipeline directions and complete ConfigSchema coverage - #847
Feat: Declare plugin pipeline directions and complete ConfigSchema coverage#847esnible wants to merge 1 commit into
Conversation
…verage Make plugin placement and config metadata machine-readable, so config generators no longer have to infer either from source or from a hand-maintained table. Directions (new PluginCapabilities field): Every plugin has an intended chain -- jwt-validation is inbound, token-exchange outbound, opa both -- but that lived only in the Direction column of docs/plugin-catalog.md. All 14 in-tree plugins now declare it as Capabilities().Directions, published on /v1/plugins and /v1/pipeline as `directions`, and asserted by a test so the docs table has a source of truth. Advisory, never fatal: no plugin enforces direction at runtime (opa, the one that cares, merely branches on pctx.Direction), so a misplaced plugin is a probable misconfiguration rather than a guaranteed one, and failing the boot would break configs that work today. A mismatch logs a startup WARN (plugins.WarnPluginDirections, called beside the existing WarnEmptyPipelines) and shows an advisory in abctl. Nil Directions means unconstrained, so out-of-tree plugins are unaffected. The wire field is plural and string-typed on purpose. `direction` (singular) already means "the chain this configured instance sits in" and stays untouched; `directions` is the type-level set of chains a plugin supports. Strings rather than []Direction because Direction.UnmarshalJSON decodes any unknown value to Inbound without erroring, which on a slice would turn a future third value into a false "inbound" claim. ConfigSchema: mcp-parser, opa, session-budget and litellm-budget-track were Configurable but not SchemaProvider, so /v1/plugins reported no field metadata and abctl rendered them as bare names. All four now implement it; mcp-parser and opa also gained the field annotations (defaults and required flags taken from their applyDefaults/Configure, not guessed). a2a-parser and inference-parser are deliberately excluded -- they have no config at all, and pipeline/schema.go names them as legitimate omissions. Also adds a "number" schema type for floats. litellm-budget-track is the first plugin to expose float config; without it max_budget and the five per-token rates would publish as "unknown" and render as quoted empty strings in templates. abctl: Templates carry a `# chain:` line per plugin, and the pre-apply validator flags a plugin pasted into a chain it doesn't declare. ValidationError gains a Severity so advisories render under their own banner -- folding them into the existing one would make its "framework reload will reject" claim false. Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com> Signed-off-by: Ed Snible <snible@us.ibm.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (39)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughPlugins now declare supported pipeline directions and configuration schemas. Session APIs and abctl expose this metadata. Runtime builds log placement warnings, while abctl reports direction mismatches as advisories. ChangesPipeline capability and schema contracts
Estimated code review effort: 4 (Complex) | ~45 minutes Merge Risk: ⚪ Minimal · up to The PR adds machine-readable plugin directions and configuration schemas while preserving existing execution behavior; no actionable merge-blocking risk remains beyond normal checks and review. Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant abctl
participant SessionAPI
participant PluginCatalog
participant PipelineValidator
participant PipelineBuild
abctl->>SessionAPI: request plugin and pipeline metadata
SessionAPI->>PluginCatalog: read normalized directions and schemas
SessionAPI-->>abctl: return directions and field schemas
abctl->>PipelineValidator: validate configured chain
PipelineValidator-->>abctl: return errors and direction advisories
PipelineBuild->>PluginCatalog: read plugin capabilities
PipelineBuild-->>PipelineBuild: log mismatches without blocking build
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 81.13% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 53 functions across 36 files. (3 skipped: 3 unsupported.) ✨ Finishing Touches 💡 1⚔️ Resolve merge conflicts 💡
🧪 Generate unit tests (beta)
Warning Some tools did not complete. Review the errors below. 🔧 golangci-lint (2.13.2)level=error msg="[linters_context] typechecking error: build constraints exclude all Go files in /authbridge/cmd/authbridge-cpex" Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Makes plugin placement and config field metadata machine-readable, so config generators don't have to infer either from source.
DirectionsNew
PluginCapabilities.Directionsfield. All 14 in-tree plugins declare their intended chain, published on/v1/pluginsand/v1/pipelineasdirections, and asserted by a test — so the Direction column indocs/plugin-catalog.mdnow has a source of truth instead of drifting.Advisory, never fatal. No plugin enforces direction at runtime (
opa, the one that cares, only branches onpctx.Direction), so a misplaced plugin is a probable misconfiguration rather than a guaranteed one, and failing the boot would break configs that work today. A mismatch logs a startup WARN (plugins.WarnPluginDirections, called beside the existingWarnEmptyPipelines) and shows an advisory in abctl. NilDirectionsmeans unconstrained, so out-of-tree plugins are unaffected.Two naming/typing decisions:
direction(singular) already means "the chain this configured instance sits in" and is untouched;directionsis the type-level set a plugin supports.[]string, not[]Direction, becauseDirection.UnmarshalJSONdecodes any unknown value toInboundwithout erroring — fine for a single value, but on a slice that turns a future third direction into a false "inbound" claim.ConfigSchemamcp-parser,opa,session-budgetandlitellm-budget-trackwereConfigurablebut notSchemaProvider, so/v1/pluginsreported no field metadata and abctl rendered them as bare names. All four now implement it;mcp-parserandopaalso gained field annotations, with defaults and required flags taken from theirapplyDefaults/Configurerather than guessed.a2a-parserandinference-parserare excluded — they have no config at all, andpipeline/schema.gonames them as legitimate omissions. (The original ask said six plugins; four is the real count, and two of those were already annotated.)Also adds a
"number"schema type for floats:litellm-budget-trackis the first plugin with float config, so without itmax_budgetand five per-token rates would publish as"unknown"and render as quoted empty strings in templates.abctl
Templates carry a
# chain:line per plugin, and the pre-apply validator flags a plugin pasted into a chain it doesn't declare.ValidationErrorgains aSeverityso advisories render under their own banner — folding them into the existing one would make its "framework reload will reject" claim false.Testing
go build,go vet,go testclean across all five modules (cpex type-checked with-tags cpex).I verified the two highest-risk new tests actually fail when the code is broken. The clone-isolation test initially passed with
Directionsremoved fromcloneCatalog— it hit its ownt.Skip, which is exactly the silent-drop bug it exists to catch; it now fails and names the culprit.End-to-end: the WARN fires with plugin, both directions and position, and the pipeline still builds;
/v1/pluginsreportsdirectionsfor all 11 default-build plugins andnumberfor the six float fields.Assisted-By: Claude (Anthropic AI) noreply@anthropic.com
Summary by CodeRabbit
New Features
0for numeric fields.Bug Fixes
Documentation