Skip to content

feat(plugin): add FileAdapter project-owned registry#98

Open
ehennestad wants to merge 4 commits into
devfrom
feat/fileadapter-registry-pr1
Open

feat(plugin): add FileAdapter project-owned registry#98
ehennestad wants to merge 4 commits into
devfrom
feat/fileadapter-registry-pr1

Conversation

@ehennestad
Copy link
Copy Markdown
Collaborator

Summary

  • Introduces nansen.plugin.base.Registry — an abstract, plain-handle, three-tier registry (top / middle / bottom source slots) with pinTop, pinBottom, addSource, removeSource, reconcile, and list/get/resolve APIs, plus PluginAdded, PluginRemoved, PluginChanged, and PluginRegistryReconciled events with typed PluginEventData payloads
  • Adds nansen.plugin.fileadapter.Registry — concrete subclass whose scanSource delegates to the existing Module.listMFiles/listJsonFiles + FileAdapter.buildFileAdapterTable helpers; no new parsing logic
  • Wires FileAdapterRegistry into Project: constructed at end of constructor (core pinned bottom, optional modules appended to middle, project pinned top, then reconcile()), and kept in sync by updateModules
  • Rewrites listFileAdapters as a thin wrapper around project.FileAdapterRegistry.list(fileExtension); drops the unused refresh positional; gains an optional Project name-value argument; preserves the empty-list sentinel and nargout=0 table-return behaviour exactly
  • Adds deprecation warnings on Module.FileAdapters and Module.getTable('FileAdapter') pointing callers to the registry; both remain functional

Test plan

  • RegistryBaseTest — source pinning (top/bottom single-slot, replace), middle-tier ordered append, removeSource from any slot, reconcile event emission, precedence dedup
  • FileAdapterRegistryTest — 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 warnings
  • Existing test suite on dev should pass unchanged

🤖 Generated with Claude Code

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>
Comment thread code/+nansen/+plugin/+base/Registry.m Fixed
Comment thread code/+nansen/+plugin/+base/Registry.m Fixed
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 22, 2026

Test Results

223 tests   223 ✅  24s ⏱️
 13 suites    0 💤
  1 files      0 ❌

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>
@ehennestad ehennestad changed the title feat(plugin): add FileAdapter project-owned registry (PR 1) feat(plugin): add FileAdapter project-owned registry May 22, 2026
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.

2 participants