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
Let me explore the repository structure and understand the metadata package.
Assistant
Now I understand the structure. The
metadata/metadata.gofile hasAddServiceandAddSubscribeURLfunctions that add to theregistryMetadataInfomap. But there are noRemoveServiceandRemoveSubscribeURLfunctions at the package level. TheMetadataInfostruct already hasRemoveServiceandRemoveSubscribeURLmethods.The issue wants me to add package-level
RemoveServiceandRemoveSubscribeURLfunctions inmetadata/metadata.gothat remove the service/subscribe URL from the local metadata for the given registry.Let me look at how the revision is calculated and whether removing a service should trigger a revision recalculation. Let me search for revision calculation.
Assistant
Let me look at the existing tests for the metadata package and check the metadata_info_test for context.
Assistant
Now let me check the
MetadataInfostruct for thread-safety. The functions use a global map. Let me check if there's a lock used in AddService. Looking at the code, there's no lock. Let me check if there are any mutexes in the metadata package.Assistant
Now I understand the issue. I need to add package-level
RemoveServiceandRemoveSubscribeURLfunctions inmetadata/metadata.gothat delegate to the existingMetadataInfomethods. Let me add them.Assistant
Now let me check where unregister/unsubscribe flows are, to verify these functions should be wired in.
Assistant
Let me look at the service discovery registry file where AddService and AddSubscribeURL are called, to understand the unregister/unsubscribe flows.
Assistant
Let me look at the full service_discovery_registry.go to understand the Register/UnRegister/Subscribe/UnSubscribe flows and where to wire in the removal calls.
Assistant
Let me check the git history and existing tests to understand the expected behavior.
Assistant
Let me look at the existing metadata_info tests to understand the expected behavior of RemoveService and RemoveSubscribeURL.
Assistant
Let me see where RegisterService and UnRegisterService are called and how the registry lifecycle works.
Assistant
Let me check existing tests for the service discovery registry to make sure I don't break anything if I wire in the removal calls.
Assistant
Now let me look at the UnRegister tests to understand how they call UnRegister.
Assistant
Let me check the test constants and whether RegistryIdKey is set on the registry URL.
Assistant
Now let me wire the removal calls into the UnRegister and UnSubscribe flows. Let me open the registry file.
Assistant
Now let me wire in the removal calls. First, the UnRegister method:
Assistant
Now let me verify the changes build and run the relevant tests.
Assistant
Build succeeds. Now let me run the relevant tests.
Assistant
All tests pass. Now let me write a temporary test to verify the new functions behave correctly (removing one URL preserves unrelated registrations, no-op on missing registry).
Assistant
All tests pass. Now let me remove the temporary test file and run the full metadata test suite once more.
Assistant
Let me review the final diff.
Assistant
Let me run a broader set of registry tests to ensure nothing broke.
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 →