Skip to content

fix(sdk): expose network visibility on BoxInfo and REST responses - #7

Closed
G4614 wants to merge 1 commit into
network-info-inbound-outbound-splitfrom
pol-311-boxinfo-network-visibility
Closed

G4614 wants to merge 1 commit into
network-info-inbound-outbound-splitfrom
pol-311-boxinfo-network-visibility

Conversation

@G4614

@G4614 G4614 commented Aug 26, 2026

Copy link
Copy Markdown
Owner

Fixes POL-311. Stacked on boxlite-ai#1206 (POL-207) — based here on
G4614/boxlite because boxlite-ai#1206's branch isn't pushed to boxlite-ai/boxlite. Once
boxlite-ai#1206 merges to main, this should be retargeted to boxlite-ai/boxlite:main.

Before

SDK rt.get_info()/list_info()
  -> RestRuntime::get_info()          [src/boxlite/src/rest/runtime.rs]
  -> GET /v1/boxes/{id}
       apps/api boxToBoxResponse(box) [box-to-box.mapper.ts]  ← BUG: box.public
         already exists on BoxDto but never reaches the wire response
  -> BoxResponse::to_box_info()       [src/boxlite/src/rest/types.rs]
       network: None                  ← BUG: hardcoded, regardless of server data
  -> BoxInfo.network == None, hasattr(info, 'public') == False

Self-hosted boxlite serve had the same gap: it always computes BoxInfo.network
locally but never put it on the wire (BoxResponse in commands/serve/types.rs
had no network field).

After

SDK rt.get_info()/list_info()
  -> GET /v1/boxes/{id}
       apps/api boxToBoxResponse(box)
         -> network: { inbound: { mode: box.public ? enabled : disabled },
                        outbound: { mode: ..., allow_net: ... } }
  -> BoxResponse::to_box_info()
       network: self.network.clone()
  -> BoxInfo.network.inbound.mode  ==  the box's visibility

Reuses the NetworkInfo{ outbound, inbound } shape from boxlite-ai#1206 (POL-207) instead
of adding a separate public: bool — inbound.mode == Enabled is the visibility
signal, so there's one field to keep in sync instead of two.

Test plan

  • cargo test -p boxlite --lib --features rest rest::types::tests — 19/19 pass,
    including new test_box_response_to_box_info_carries_network_visibility
  • Two-side verification: reverted to_box_info()'s new line, new test failed at
    "network metadata should survive conversion"; restored, passes
  • cargo check -p boxlite --features rest -p boxlite-cli --tests — clean
  • yarn nx test api — 566 passed, 72 skipped, 0 failed (full api suite,
    including 4 new cases in box-to-box.mapper.spec.ts)

🤖 Generated with Claude Code

Fixes POL-311. `GET /v1/boxes/{id}` (and its self-hosted-server
twin) never included network metadata, so `BoxResponse::to_box_info()`
hardcoded `network: None` — the SDK's `get_info()`/`list_info()`
had no way to tell whether a box is publicly reachable.

Wire the field through: apps/api's boxToBoxResponse now serializes
the already-tracked box.public/networkBlockAll/networkAllowList as
network.{inbound,outbound}; core's BoxResponse deserializes it into
BoxInfo.network using the NetworkInfo shape from boxlite-ai#1206 (POL-207)
instead of adding a redundant public: bool. The self-hosted serve
command gets the same field for parity, since it already carries
this data locally.
@G4614

G4614 commented Aug 26, 2026

Copy link
Copy Markdown
Owner Author

Superseded by boxlite-ai#1364 (opened against upstream main instead of the fork).

@G4614 G4614 closed this Aug 26, 2026
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.

1 participant