feat(plugin): add FileAdapter project-owned registry#98
Open
ehennestad wants to merge 4 commits into
Open
Conversation
Establishes the pattern of project-owned plugin registries with a
source-based API. Introduces a three-tier precedence model (top/middle/
bottom) where Project pins itself at top, optional modules in the middle,
and core at the bottom.
- Add nansen.plugin.base.Registry: abstract handle class with pinTop,
pinBottom, addSource, removeSource, reconcile, list/get/resolve APIs
and PluginAdded/PluginRemoved/PluginChanged/PluginRegistryReconciled
events with PluginEventData payload
- Add nansen.plugin.fileadapter.Registry: concrete subclass that scans
+fileadapter/ subfolders and returns the struct shape existing callers
expect (FileAdapterName, FunctionName, SupportedFileTypes, DataType,
IsDynamic)
- Wire FileAdapterRegistry into Project: constructed at end of Project
constructor, updated incrementally in updateModules
- Rewrite listFileAdapters as a thin wrapper around
project.FileAdapterRegistry.list(); drops the unused refresh positional
and gains an optional Project name-value argument
- Add deprecation warnings on Module.FileAdapters and
Module.getTable('FileAdapter') pointing to the registry
- Tests: RegistryBaseTest (source slots, precedence, reconcile events),
FileAdapterRegistryTest (sidecar discovery, filter, conflict, project-
agnostic use), ConcreteRegistry test double
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Test Results223 tests 223 ✅ 24s ⏱️ Results for commit d05a2c8. ♻️ This comment has been updated with latest results. |
- Remove dead MtimeCache and ParsedEntryCache (allocated but never read) - Make primaryId abstract in base Registry; concrete subclasses must declare their id field explicitly — prevents silent breakage when new plugin types are added - Override primaryId in FileAdapter/Registry and ConcreteRegistry - Replace orderedSources loop with a single struct-array concat - Remove trivial section comments (% Removed / % Added / % Changed) from reconcile — variable names are self-documenting - Align core module source ID with RequiredModuleName constant so the pinBottom id and the middle-tier skip guard use the same value Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
nansen.plugin.base.Registry— an abstract, plain-handle, three-tier registry (top / middle / bottom source slots) withpinTop,pinBottom,addSource,removeSource,reconcile, andlist/get/resolveAPIs, plusPluginAdded,PluginRemoved,PluginChanged, andPluginRegistryReconciledevents with typedPluginEventDatapayloadsnansen.plugin.fileadapter.Registry— concrete subclass whosescanSourcedelegates to the existingModule.listMFiles/listJsonFiles+FileAdapter.buildFileAdapterTablehelpers; no new parsing logicFileAdapterRegistryintoProject: constructed at end of constructor (core pinned bottom, optional modules appended to middle, project pinned top, thenreconcile()), and kept in sync byupdateModuleslistFileAdaptersas a thin wrapper aroundproject.FileAdapterRegistry.list(fileExtension); drops the unusedrefreshpositional; gains an optionalProjectname-value argument; preserves the empty-list sentinel andnargout=0table-return behaviour exactlyModule.FileAdaptersandModule.getTable('FileAdapter')pointing callers to the registry; both remain functionalTest plan
RegistryBaseTest— source pinning (top/bottom single-slot, replace), middle-tier ordered append,removeSourcefrom any slot,reconcileevent emission, precedence dedupFileAdapterRegistryTest— sidecar adapter discovery, extension filter (with and without dot), dynamic add/remove, top-wins-on-conflict, project-agnostic tempdir construction,Module.FileAdapters/Module.getTable('FileAdapter')deprecation warningsdevshould pass unchanged🤖 Generated with Claude Code