Repository navigation
refactor: namespace plugin RPC as 'devserverStatus.status' - #5
Merged
Merged
Conversation
…atus'
- Export RPC_NAMESPACE and RPC_METHOD constants as single source of truth in src/index.ts
- Update badge source.method and registerRpc to use RPC_METHOD (derives 'devserverStatus.status')
- Update tests to import the exported constants; replace all literal 'devserverStatus.status' / 'rpc:devserverStatus.status' usages with RPC_METHOD / `rpc:${RPC_METHOD}`
- Add test 'exposes the namespaced RPC contract from a single source of truth' that verifies the namespace and derivation
- Regenerate dist/index.js, dist/index.d.ts, dist/index.js.map via npm run build
Verified locally:
- npm run typecheck exit 0
- npm test exit 0 (13/13 tests pass, including the new namespace test)
- npm run build exit 0
- Badge id 'devserver-status' and slot 'session.row.badges' unchanged
- Hooks devserver.started|stopped|state.changed unchanged
- Only src/, test/, dist/ modified (CA-11)
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.
Type de PR (obligatoire)
Linked issue
Closes the namespace collision task described in the criteria below (no upstream issue number available; the change is driven by the requirement to avoid generic
statusRPC collisions between OpenFox plugins).Objective
Rename the
openfox-devserver-statusplugin's genericstatusRPC to the namespaceddevserverStatus.statusso it no longer collides with RPCs registered by other OpenFox plugins. Introduce a single source of truth (RPC_NAMESPACE+RPC_METHOD) so future renames are localised.Scope
src/index.ts:exportRPC_NAMESPACE = 'devserverStatus.'andRPC_METHOD =${RPC_NAMESPACE}status``.'status'argument ofregisterRpc(...)withRPC_METHOD.badge.source.methodwithRPC_METHOD.test/index.test.ts:RPC_NAMESPACEandRPC_METHODfrom../src/index.js.'devserverStatus.status'withRPC_METHOD.'rpc:devserverStatus.status'with`rpc:${RPC_METHOD}`.'exposes the namespaced RPC contract from a single source of truth'assertingRPC_NAMESPACE,RPC_METHOD, and their derivation.dist/index.js,dist/index.d.ts,dist/index.js.map: regenerated vianpm run build.Type of change
Verification performed
npm run typecheck→ exit 0 (tsc on bothtsconfig.jsonandtsconfig.test.json).npm test→ exit 0; 13/13 tests pass (12 pre-existing + 1 new namespace test).npm run build→ exit 0.grep -rn "'status'" src test --include="*.ts"no longer returns any RPC literal — only the`${RPC_NAMESPACE}status`template inside the constant definition.git diff dist/shows only the expected substitution ('status'→RPC_METHOD) and the newly-exported constants indist/index.d.ts.Acceptance criteria
src/index.tsno longer registers an RPC named'status'; onlyRPC_METHOD(derived fromRPC_NAMESPACE) is used inregisterRpc.src/index.tsno longer registers a badge withsource.method === 'status'.RPC_NAMESPACE = 'devserverStatus.'exists at the top ofsrc/index.ts, and the registered RPC method is derived from it (single source of truth).'rpc:status'reference remains insrc/ortest/.id: 'devserver-status'and slot'session.row.badges'unchanged (badge behavior preserved).devserver.started,devserver.stopped,devserver.state.changedunchanged.npm run typecheckexits 0.npm testexits 0; all tests pass (now 13 cases including the new namespace test).npm run buildexits 0 anddist/index.jscontainsregisterRpc(RPC_METHOD, ...)which emits'devserverStatus.status'.dist/regenerated correctly (will passgit diff --exit-code -- distonce this PR is merged intomainand the dist is re-committed onmain).src/,test/, anddist/are modified. No other repo files are touched.Out of scope
src/openfox-plugin.d.tsalready accepts a free-form method name).'devserver-status', slot'session.row.badges', hooks, persistence keys, or runtime state.Risks / known limitations
'status'method name for this plugin's badge would break; this is by design — the namespace is the whole point of the change.dist/is rebuilt as part of the same commit; if the merge rebase conflicts ondist/index.js.map, re-runnpm run buildto regenerate.package.jsonhas nolintscript); onlytypecheck,build, andtestwere executed.