Skip to content

fix(core): report an unknown events() port as ImposterNotFound - #256

Merged
EtaCassiopeia merged 1 commit into
masterfrom
fix/254-events-unknown-port
Sep 29, 2026
Merged

EtaCassiopeia merged 1 commit into
masterfrom
fix/254-events-unknown-port

Conversation

@EtaCassiopeia

Copy link
Copy Markdown
Collaborator

Fixes #254

Problem

RemoteTransport.events(options) treated every 404 from GET /events as "this engine has no admin event stream" and threw UnsupportedOperationException. The engine also answers 404 when options.port() names no imposter, so a wrong port was reported as an engine that is too old.

Change

  • On a 404 from /events with port(...) set, the SDK now calls GET /imposters/{port}, the same lookup every other per-port call makes, and maps the result the same way:
    • The imposter is missing: ImposterNotFound(port, "Imposter not found on port N").
    • The imposter exists: the 404 really means there is no stream, so UnsupportedOperationException as before.
    • Without a port, behaviour is unchanged.
  • The body isn't used to tell these apart. As the issue notes, an engine without the route and an engine after rift#1226 both answer with the no such resource envelope.
  • extractErrorMessage now also reads the bare {"error":"..."} body that engines up to 0.18.1 use for /events refusals. A bad types filter now reports its message instead of the raw JSON.
  • The Rift.events javadoc has a new @throws ImposterNotFound; docs/events.md and docs/design/sdk-api.md are updated to match.

Validation

  • Engine check against rift 0.18.1:
    • /events?port=<unknown> → 404 {"error":"no imposter on port N"}
    • /imposters/<unknown> → 404 envelope Imposter not found on port N
    • an unknown route → 404 envelope Not Found
    • bad types → 400 {"error":"unknown types value ..."}
  • Unit tests (EventStreamTest), faked in both body shapes:
    • unknown port with the 0.18.1 body → ImposterNotFound
    • unknown port with the new envelope → ImposterNotFound
    • a 404 for an existing port → still unsupported
    • bare {"error"} 400 → InvalidDefinition carrying the message
  • Live IT (EventStreamIT): events(port(1)) → ImposterNotFound. It passed on SPAWN (rift 0.18.1 binary) and EMBEDDED (JDK 25).
  • ./mvnw -B verify is green on JDK 21, and javadoc:javadoc is clean.

🤖 Generated with Claude Code

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
@EtaCassiopeia
EtaCassiopeia merged commit 7271906 into master Sep 29, 2026
18 checks passed
@EtaCassiopeia
EtaCassiopeia deleted the fix/254-events-unknown-port branch September 29, 2026 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

events(): a 404 for an unknown port is reported as 'engine has no admin event stream'

1 participant