Skip to content

Sprites fake answers POST /policy/network with 200 and a body; the real API answers 204 #2719

Closed

Description

@lex00

The Sprites fake answers POST /v1/sprites/{id}/policy/network with 200 and a {"rules": [...]} body. The real Sprites API answers 204 No Content, and every official SDK treats anything else as a failure:

  • Go, superfly/sprites-go policy.go:75: if resp.StatusCode != http.StatusNoContent returns an error
  • JS, @fly/sprites 0.2.3 dist/policy.js:34: if (response.status !== 204) throw
  • Python, sprites-py 0.7.1 sprites/policy.py:100: if response.status_code != 204 raises
  • Elixir, sprites 0.2.2 (superfly/sprites-ex) lib/sprites/policy.ex: only {:ok, %{status: 204}} is :ok; a 200 falls to {:error, {:api_error, 200, body}}

wisp answers 204 as well (internal/server/egress_test.go:104, :130).

The fake at lexicons/fly/src/op/activities/sprites-fake.ts:314 (origin/main 7c2a2b5):

return send(200, { rules: sprite.netPolicy });

should be a 204 with no body. The GET on the same path correctly stays 200 {"rules": [...]}.

chant's own client (sprite-config.ts, spriteApplyNetworkPolicy) accepts any status below 300, so it does not notice. A client built on an official SDK does: this is the bug INTENTIUS/spritzer#26 found in spritzer 0.6.0 (same 200-with-rules reply), where fountain v0.21.0 (managoat_sandbox 0.5.0, which calls the Elixir SDK) fails a networking_type: limited Environment with {:invalid, {:http, 200, %{"rules" => ...}}}. spritzer is being fixed to 204; the fake should match, and a test pinning 204 on the POST would keep the two in step.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions