Repository navigation
fix(builder): one resource per plugin endpoint instead of one per plugin (#202) - #204
Merged
Merged
Conversation
…gin (#202) NetBox tags every plugin endpoint `plugins`, so _resource_from_path took the plugin name as the resource and every endpoint of a plugin collapsed into one resource whose CRUD slots overwrote each other (`nsc plugins branching list` listed changes, `create` created branches; branch lists, branch-events and branchable-models were unreachable). Derive (plugin, resource) from /api/plugins/<plugin>/<resource>/ paths; the generic `plugins` tag becomes the plugin's URL segment, a plugin's own tag is kept. Bump MODEL_FORMAT_VERSION so cached models rebuild. Also adds the live e2e assertion deferred from #180: `nsc branching changes list --branch <schema_id>` filters without switching branch. Claude-Session: https://claude.ai/code/session_01RD8NgCVtp3yYFd6NSZpbUb
_build_fk_resources parsed paths without the plugin route, so plugin serializers never mapped to a resource and TUI FK pickers could not resolve plugin targets. Share one `_route` helper between _assimilate and the FK index. Claude-Session: https://claude.ai/code/session_01RD8NgCVtp3yYFd6NSZpbUb
Owner
Author
|
Pushed 128a46a: review found plugin list serializers weren't indexed for FK resolution ( |
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.
Fixes #202.
NetBox tags every plugin endpoint
plugins._resource_from_pathanchored on that segment, so the resource became the plugin name, and all of a plugin's endpoints collapsed into one resource whose CRUD slots overwrote each other. On NetBox 4.7.3 with netbox-branching 1.2.2:nsc plugins branching listlisted changes, whilecreatecreated branches.branch-eventsandbranchable-models.The documented case (a plugin with its own tag,
/api/plugins/my-plugin/widgets/) was broken the same way.Fix (
nsc/builder/build.py):_plugin_routemaps/api/plugins/<plugin>/<resource>/…to(plugin, resource). The plugin root view/api/plugins/<plugin>/is skipped.pluginstag becomes the plugin's URL segment. A plugin that sets its own tag keeps it.MODEL_FORMAT_VERSION1 → 2, so cached command models rebuild. They're keyed by schema hash, so they'd otherwise keep the broken tree.Resulting tree (live, NetBox 4.7.3 + Branching 1.2.2):
nsc ls branchesresolves the plugin resource.nsc plugins <plugin> …→nsc <plugin> <resource> …. The old tree was mixing objects, so this ships as a fix, with the change called out in the CHANGELOG.Tests:
tests/builder/test_plugin_paths.py:tests/e2e/test_branching.py: a new live test lists branches viansc branching branches list. It also checks thatnsc branching changes list --branch <schema_id>filters to the branch's change without switching into the branch (no⎇notice). This is the e2e assertion deferred from test: end-to-end coverage for subcommand --branch query filter (#170 scenario) #180. It passed locally on the e2e-branching stack: 4 passed.Docs:
docs/guides/working-with-plugins.md, CHANGELOG.https://claude.ai/code/session_01RD8NgCVtp3yYFd6NSZpbUb