ISSUE DESCRIPTION Removing a registered or subscribed service leaves stale local…
- User
ISSUE DESCRIPTION
Removing a registered or subscribed service leaves stale local metadata
After a successful unregister or unsubscribe operation, the corresponding provider or consumer URL must no longer participate in local metadata, service matching, or revision calculation. Removing one URL must preserve unrelated registrations. If the remote operation fails, local metadata must not be removed as though the operation succeeded.
Interface
Type: Function Name: RemoveService Path: metadata/metadata.go Input: registryId string, url *common.URL Output: (no return value) Description: Removes a provider service URL from the local metadata for the given registry. Use this during unregister flows to keep the in-memory application-level metadata consistent with the actual exported services.
Type: Function Name: RemoveSubscribeURL Path: metadata/metadata.go Input: registryId string, url *common.URL Output: (no return value) Description: Removes a subscribed service URL from the local metadata for the given registry. Use this during unsubscribe flows to ensure stale subscribed URLs are cleaned from the application-level metadata.
ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you callsubmit) usinggit statusorgit diffcommands. However you don't need to usegit addorgit commitbefore submitting your changes. In fact,submitonly submits currently unstaged changes because it usesgit diffto get the changes that need to be submitted.CHECKLIST
Before submitting your solution, please go over the following checklist and make sure you've done everything:
- If an error was reported in the issue description, I have successfully reproduced it.
- If an error was reported in the issue description, I have confirmed that my fix resolves the error.
- I have thought about edge cases and made sure my fix handles them as well.
- I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.
Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!
(Current directory: /dubbo-go, current file: none) bash-$
- Assistant
I'll start by exploring the repository structure and the metadata package to understand how services are currently registered and tracked.
- Assistant
Let me examine the metadata package implementation and how services are added today.
- Assistant
So AddService and AddSubscribeURL exist. I need to add RemoveService and RemoveSubscribeURL. Let me look at MetadataInfo.
- Assistant
Let me continue reading the file to see AddSubscribeURL and related methods.
- Assistant
MetadataInfo already has RemoveService and RemoveSubscribeURL. I'll check callers of AddService/AddSubscribeURL and any unregister/unsubscribe flows next.
- Assistant
rg is not available, let me use grep.
- Assistant
There's a service discovery registry that uses AddService and AddSubscribeURL. Let me look at unregister/unsubscribe flows.
- Assistant
Let me look at Unregister and UnSubscribe methods.
- Assistant
Let me read UnRegister and UnSubscribe fully.
- Assistant
I'll review the existing metadata tests and recent git history for related patterns.
- Assistant
I'll continue reading MetadataInfo for revision calculation and check whether other unregister paths need the same updates.
- Assistant
I'll inspect other registry unregister flows and any surrounding comments that explain intended behavior.
- Assistant
I'll inspect the UnRegister and UnSubscribe tests for expected behavior around metadata cleanup.
- Assistant
Let me check if Register tests use RegistryIdKey - and look at UnRegister tests to see how they work.
- Assistant
I'll check how unregister is invoked to see whether the same URL pointer is reused for pointer-equality removal.
- Assistant
I'll check registry protocol unregister path and URL identity usage.
- Assistant
I'll implement
RemoveServiceandRemoveSubscribeURL, then wire them into the unregister/unsubscribe paths after successful remote operations. - Assistant
Now I'll update UnRegister and UnSubscribe so they clear local metadata only after the remote operation succeeds.
- Assistant
I'll write a temporary test script to verify remove behavior, including failure cases and that unrelated registrations are preserved.
- Assistant
I'll set GOPATH/GOMODCACHE and rerun the test.
- Assistant
Metadata remove test passed. I'll remove the temporary test and run the related package tests.
- Assistant
I'll check how URL equality is defined so removal stays correct even if callers pass clones.
- Assistant
I'll inspect RegisterService versus Register to confirm when I should update local metadata.
- Assistant
I'll check how revision is calculated when services are removed.
- Assistant
I'll tighten the comments to match the existing style, then do a final review of the diff.
- Assistant
I'll verify with a temporary script that failed unregister keeps metadata and successful ones clean it up.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →