fix(plugin:codebase-memory): prefix plugin API routes + drop var-h shadow in ProjectList#6
Open
SirMinionBot wants to merge 1 commit into
Open
fix(plugin:codebase-memory): prefix plugin API routes + drop var-h shadow in ProjectList#6SirMinionBot wants to merge 1 commit into
SirMinionBot wants to merge 1 commit into
Conversation
…adow in ProjectList
The bundle that ships in plugins/codebase-memory/dist/index.js had two
showstoppers after the v0.1.0 release:
1. fetchJSON("/health"), fetchJSON("/projects"), fetchJSON("/iframe-url"),
and fetchJSON("/project/.../health") all bypassed the host's
/api/plugins/<name>/ prefix because they hardcoded leading
slashes without the plugin name. The host mounts the Python router
at /api/plugins/codebase-memory/* (see web_server.py:13835), so
those calls 404'd — and the SDK's loopback-mode auto-reload kicked
in on the domain-level 4xx, dragging the page into a reload storm
that looked like 'dashboard doesn't load'.
2. ProjectList shadowed the React.createElement alias (var h = ...)
with var h = healthByName[p.name];. When the project map iterated,
every button crashed with 'h is not a function' and React unmounted
the whole plugin.
Now both call sites use a top-level API = '/api/plugins/codebase-memory'
prefix and the project rendering reads per-project health inline
without shadowing. Also pass { allowUnauthorized: true } on all plugin
calls so the SDK's loopback-token-rotation reload trick doesn't trigger
on a domain-level 404 (the SDK never had a chance to get a valid token
for a plugin endpoint that hasn't been mounted yet).
Validated by visual smoke test on the iBit dashboard after deploy:
the iframe renders, the project list renders, and /api/projects
returns the JSON list of indexed repos from the local
codebase-memory-mcp binary.
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.
Diagnosed after the iBit dashboard stopped loading the
/codebase-memorytab. Two showstoppers in the bundle that ships in this plugin:fetchJSON("/health"),/projects,/iframe-urland/project/.../healthwere all hardcoded leading-slash paths — but the host mounts each plugin's Python router under/api/plugins/<name>/*(web_server.py:13835). The calls 404'd, and the SDK's loopback-mode auto-reload (api.ts:158) reloaded on the domain-level 4xx, dragging the dashboard into a reload loop every time someone clickedCODEBASE MEMORYin the sidebar.ProjectListshadowed the React.createElement alias withvar h = healthByName[p.name]on every project button render. The first iteration of.mapcrashed with "h is not a function" and React unmounted the whole plugin.The bundle now defines a top-level
API = '/api/plugins/codebase-memory'and all four calls useAPI + '/...'with{ allowUnauthorized: true }so the SDK's loopback-token-rotation reload trick doesn't fire on a 4xx from a freshly-mounted plugin endpoint.Validated on the iBit dashboard (
/:9119) after deploy: clickingCODEBASE MEMORYfrom the sidebar now renders the iframe shell, the project list populates from/api/plugins/codebase-memory/projects, and per-project health lazy-loads on selection.