feat: dual-track registration with early claim + rollback support#721
feat: dual-track registration with early claim + rollback support#721jlin53882 wants to merge 2 commits intoCortexReach:masterfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 013c1785b3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| singleton = _singletonState; | ||
| } catch (err) { | ||
| api.logger.error(`memory-lancedb-pro: _initPluginState failed — ${String(err)}`); | ||
| _registeredApisMap.delete(api); // dual-track rollback: init failed, un-claim |
There was a problem hiding this comment.
Roll back WeakSet claim when init fails
If _initPluginState(api) throws, the catch block only removes api from _registeredApisMap, but the earlier _registeredApis.add(api) is never undone. Because register() gates on _registeredApis.has(api), a later retry with the same API object is skipped permanently, so initialization cannot recover after a transient startup failure. Add _registeredApis.delete(api) in this failure path (or delay the WeakSet add until after successful init) to preserve retry behavior.
Useful? React with 👍 / 👎.
Why This PR MattersThe ProblemAfter PR #522, places only after successful . This means:
The Dual-Track Solution
Registration flow now: Concrete Benefits
|
Codex PR CortexReach#721 review: if _initPluginState throws, only _registeredApisMap was rolled back, but _registeredApis.add(api) happened BEFORE the try block so the WeakSet entry remained. This caused register()'s _registeredApis.has(api) guard to permanently skip retry — plugin could not recover from transient init failures. Fix: delete from both WeakSet and Map in the catch block.
Summary
Dual-track registration system for memory-lancedb-pro:
This enables test inspection of registered APIs and provides explicit rollback semantics on init failure.
Changes
Dependencies
Based on master after PR #522 merge.