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
Let me check how UnRegister is invoked and how revision is calculated, to understand URL identity in the unregister flow.
- Assistant
Now wire the removals into the unregister/unsubscribe flows in
service_discovery_registry.go: - Assistant
Now build and add tests. First verify compilation:
- Assistant
Build passes. Let me check existing info tests, then add tests:
- Assistant
Now add tests to
metadata/metadata_test.go: - Assistant
Now add registry-level tests. First update the mock mapping to support a Remove failure:
- Assistant
Now append the new registry tests:
- Assistant
All green and gofmt-clean. Here's a summary of the fix:
Changes
metadata/metadata.go— added the two package-level functions from the spec:RemoveService(registryId string, url *common.URL)— delegates toMetadataInfo.RemoveService, removing the provider URL fromServices(used for service matching) andexportedServiceURLs(used for revision calculation). No-op for an unknown registry.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.