refactor(authbridge): simplify PluginCapabilities — remove unused fields#463
Conversation
Remove five fields that were either deprecated or speculative infrastructure with no current plugin usage: - BodyAccess: deprecated alias for ReadsBody - Reads: no plugin declared it; validation was never triggered - Writes: useless without Reads — the slot contract only works as a pair - After: soft ordering; only appeared in tests, no plugin used it - Claims: mutual exclusion; only appeared in tests, no plugin used it Removing Reads/Writes also eliminates the defaultSlots map, WithSlots option, and the slot-name/prior-write validation block in validateCapabilities(). That function now only enforces body-mutation ordering rules. Result: PluginCapabilities goes from 9 fields to 5 (ReadsBody, WritesBody, Requires, RequiresAny, Description). The interface a plugin author must understand is materially smaller. Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com> Signed-off-by: Hai Huang <huang195@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughRemoves extension-slot capability fields and deprecated BodyAccess; simplifies PluginCapabilities to ReadsBody/WritesBody/Requires/RequiresAny/Description; pipeline validation, plugins, registry, session API, CLI/TUI, and tests updated; removes unused ClaimAuthorizationHeader constant. ChangesPlugin Capability Model and Pipeline Validation Refactor
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
The previous commit renamed bodyAccess → readsBody on the /v1/pipeline wire and dropped writes/reads/after/claims. This commit brings abctl into sync: - PipelinePlugin: BodyAccess → ReadsBody (json:"readsBody"); drop Writes, Reads, After, Claims - PluginCatalogEntry: drop Writes, Reads, After, Claims - pipeline_pane: remove WRITES column; fix body indicator field name - plugin_detail_pane: remove Writes/Reads/After/Claims render sections - deps: remove afterStatus(); update pluginDepsAllSatisfied/HasAnyDeps - catalog_pane: remove dead field mappings - edit/validate: remove After and Claims client-side validation (catalog no longer emits those fields) - All associated tests updated Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com> Signed-off-by: Hai Huang <huang195@gmail.com>
There was a problem hiding this comment.
🧹 Nitpick comments (1)
authbridge/cmd/abctl/apiclient/client_test.go (1)
154-159: ⚡ Quick winRemove stale
writesfield from mock JSON.The mock still includes
"writes": ["x"]but theWritesfield has been removed from the data model. While Go silently ignores unknown JSON fields so the test passes, this is misleading and should be cleaned up as part of this refactoring.🧹 Proposed fix
_, _ = w.Write([]byte(`{ "plugins": [ - {"name": "alpha", "description": "A plugin", "writes": ["x"]}, + {"name": "alpha", "description": "A plugin"}, {"name": "beta", "requires": ["alpha"]} ] }`))🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@authbridge/cmd/abctl/apiclient/client_test.go` around lines 154 - 159, The test's mock JSON in authbridge/cmd/abctl/apiclient/client_test.go still contains the removed "writes" field; update the mock payload written by the test handler (the w.Write call that emits the plugins array) to remove `"writes": ["x"]` from the "alpha" plugin object (and remove any other occurrences of the obsolete Writes field in that test) so the sample matches the current data model used by the client tests.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@authbridge/cmd/abctl/apiclient/client_test.go`:
- Around line 154-159: The test's mock JSON in
authbridge/cmd/abctl/apiclient/client_test.go still contains the removed
"writes" field; update the mock payload written by the test handler (the w.Write
call that emits the plugins array) to remove `"writes": ["x"]` from the "alpha"
plugin object (and remove any other occurrences of the obsolete Writes field in
that test) so the sample matches the current data model used by the client
tests.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 927e9dd9-570a-4fd0-8b01-051b39c0a815
📒 Files selected for processing (11)
authbridge/cmd/abctl/apiclient/client.goauthbridge/cmd/abctl/apiclient/client_test.goauthbridge/cmd/abctl/edit/validate.goauthbridge/cmd/abctl/edit/validate_test.goauthbridge/cmd/abctl/tui/catalog_pane.goauthbridge/cmd/abctl/tui/catalog_pane_test.goauthbridge/cmd/abctl/tui/deps.goauthbridge/cmd/abctl/tui/deps_test.goauthbridge/cmd/abctl/tui/pipeline_pane.goauthbridge/cmd/abctl/tui/plugin_detail_pane.goauthbridge/cmd/abctl/tui/plugin_detail_pane_test.go
💤 Files with no reviewable changes (2)
- authbridge/cmd/abctl/tui/catalog_pane_test.go
- authbridge/cmd/abctl/tui/plugin_detail_pane_test.go
Update plugin-reference.md, plugin-tutorial.md, and CLAUDE.md to reflect the simplified PluginCapabilities: - Declaring plugin relationships: struct, table, and subsections for After and Claims removed; now documents only Requires/RequiresAny - Body mutation capability fields: remove Reads, Writes, BodyAccess from the struct example - plugin-tutorial.md gotchas: remove stale note about slot validation (Reads/Writes slot checking was removed from the framework) - CLAUDE.md: update /v1/pipeline and /v1/plugins endpoint wire shapes Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com> Signed-off-by: Hai Huang <huang195@gmail.com>
pdettori
left a comment
There was a problem hiding this comment.
Clean refactoring — comprehensive removal of 5 unused/deprecated fields from PluginCapabilities (BodyAccess, Reads, Writes, After, Claims). The struct goes from 9 fields to 5, materially reducing the surface a plugin author must understand.
Reviewed: pipeline validation logic, CLI/TUI sync, API wire format, test coverage, documentation updates.
- All 3 commits properly signed-off
validateCapabilities()remains coherent (body-mutation ordering only)- Test removals are complete — no stale assertions referencing deleted fields
- CodeRabbit's nit about
"writes"in mock JSON is already addressed in the diff - CI: all checks passing
Assisted-By: Claude Code
Summary
PluginCapabilitiesthat were deprecated or speculative infrastructure with no current plugin usage:BodyAccess,Reads,Writes,After,ClaimsReads/Writesas a pair also eliminatesdefaultSlots,WithSlots, and the slot-wiring validation block invalidateCapabilities()PluginCapabilitiesgoes from 9 fields to 5 — the surface a plugin author must understand is materially smallerResult:
Why each field was removed
BodyAccessReadsBodyReadsWritesReads— the slot contract only works as a pairAfterClaimsTest plan
go build ./authlib/...— cleango test ./authlib/pipeline/... ./authlib/plugins/... ./authlib/sessionapi/... ./authlib/listener/...— all 20 packages passAssisted-By: Claude Code
Summary by CodeRabbit
Refactor
API Changes
User Interface