fix(core): report an unknown events() port as ImposterNotFound - #256
Merged
Merged
Conversation
The engine answers 404 both when it has no /events route and when the requested
port has no imposter, and the body cannot tell them apart. A 404 with a port set
now checks GET /imposters/{port} first, so a wrong port surfaces as the same
ImposterNotFound every other per-port call throws instead of claiming the engine
cannot stream. Bare {"error": ...} bodies from engines through 0.18.1 now yield
their message too.
Fixes #254
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #254
Problem
RemoteTransport.events(options)treated every404fromGET /eventsas "this engine has no admin event stream" and threwUnsupportedOperationException. The engine also answers404whenoptions.port()names no imposter, so a wrong port was reported as an engine that is too old.Change
404from/eventswithport(...)set, the SDK now callsGET /imposters/{port}, the same lookup every other per-port call makes, and maps the result the same way:ImposterNotFound(port, "Imposter not found on port N").UnsupportedOperationExceptionas before.no such resourceenvelope.extractErrorMessagenow also reads the bare{"error":"..."}body that engines up to 0.18.1 use for/eventsrefusals. A badtypesfilter now reports its message instead of the raw JSON.Rift.eventsjavadoc has a new@throws ImposterNotFound;docs/events.mdanddocs/design/sdk-api.mdare updated to match.Validation
/events?port=<unknown>→404 {"error":"no imposter on port N"}/imposters/<unknown>→404envelopeImposter not found on port N404envelopeNot Foundtypes→400 {"error":"unknown types value ..."}EventStreamTest), faked in both body shapes:ImposterNotFoundImposterNotFound{"error"}400 →InvalidDefinitioncarrying the messageEventStreamIT):events(port(1))→ImposterNotFound. It passed on SPAWN (rift 0.18.1 binary) and EMBEDDED (JDK 25)../mvnw -B verifyis green on JDK 21, andjavadoc:javadocis clean.🤖 Generated with Claude Code