Removing a registered or subscribed service leaves stale local metadata After a…
- User
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.
- Assistant
Now I'll add the package-level
RemoveServiceandRemoveSubscribeURLfunctions: - Assistant
Now make
removeUrlrobust to URLs that are equal in content but not the same pointer: - Assistant
Now build and run the relevant tests:
- Assistant
Build passes. Now add tests for the new functions:
- Assistant
All done. Summary of the fix:
Changes
metadata/metadata.go— added the two package-level functions from the interface spec:RemoveService(registryId string, url *common.URL)— removes a provider URL from that registry'sMetadataInfo(drops it fromexportedServiceURLsand deletes the matchingServiceInfoused for service matching / revision calculation). No-op if the registry id is unknown.RemoveSubscribeURL(registryId string, url *common.URL)— removes a consumer's subscribed URL from that registry's . Also a no-op for unknown registry ids.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.