Skip to content

feat: sync with the inference gateway API - #15

Merged
NLX-SeokHwanKong merged 12 commits into
mainfrom
feat/gateway-api-sync
Nov 18, 2026
Merged

NLX-SeokHwanKong merged 12 commits into
mainfrom
feat/gateway-api-sync

Conversation

@kp-attlab

Copy link
Copy Markdown
Collaborator

Description

Brings the TUI up to date with the inference gateway API. swagger_new.yml and swagger-extras.yml (the raw-handler routes) are verbatim copies of api/swagger.yml and api/swagger-extras.yml at loxilb-io/loxilb-inference-gateway@40199cde89d (2026-11-16), and the YAML schemas are regenerated from them. The bundled knowledge base was checked against cb61ead7728 and has not been re-checked since.

Review guide:

  • About 10.9k of the 14.8k added lines are the two vendored specs (9.2k) and the regenerated schemas in src/yaml/schema/generated/ (1.7k, covered by the schema drift check). The hand-written part is about 2.5k lines in src/, 1.2k in tests and 0.2k in docs.
  • The commits can be read one at a time, and each message explains its part. The first seven were written against cb61ead7728 (2026-10-27). The later ones resync to 40199cde89d as a separate step, so what the gateway changed since then stays a small diff of its own (of the schemas, only LoadBalancer.json changes). They also fix what testing against the newer gateway turned up.

Behavior changes worth a look:

  • LoadBalancer security follows the 0-2 values the gateway parses (https and tls map to 1, e2ehttps to 2). The old bundled spec listed 0-3, so before this PR tls was sent as 2 (re-encryption) and e2ehttps as 3, which the gateway refuses. mode 6 (aigw) is no longer accepted.
  • A LoadBalancer rule's key includes its model_name, so rules on one VIP/port/protocol that differ only by model are told apart, and deleting a model-named rule passes ?model_name= (YAML, TUI delete, delete lb ... --model).
  • In YAML apply, LoadBalancer is now ordered after the AiJwtAuthProfile, Cert and Policy resources it can name and the IPv4Address/IPv6Address that holds its VIP; addresses in turn come after Vlan and VxlanTunnel. These kinds are now created before kinds that have no ordering rule (Route, Firewall and so on), wherever they sit in the YAML file. The order is per kind, so an underlay address a VxlanTunnel needs on its epIntf is still created after the tunnel, as on main.
  • The LoadBalancer adapter strips the read-only *_effective fields and the EPP connection state the gateway reports on fullproxy rules, so yaml export does not write them out as settings.
  • ApiError keeps the parsed error body, and StatusApi.ready() returns the gateway's not-ready 503 as data.
  • The bundled knowledge base no longer describes API-key and rate-limit enforcement as roadmap items: rules declare api_key_auth, and builds that enforce it list it in /version features. Please confirm that matches the builds you ship.

Not changed here: Cert has no list endpoint, so yaml apply posts every declared Cert on each run. For a Cert declared with a certId, the gateway answers 409 from the second run on and the apply exits non-zero. The Cert adapter is left as it is.

Type of change

  • Bug fix
  • New feature / enhancement
  • Documentation
  • CI / build / packaging / tooling
  • Refactor (no functional change)

How has this been tested?

  • bun run lint, bun run typecheck and bun test pass
  • Manually exercised against a LoxiLB instance (version: ghcr.io/loxilb-io/loxilb-inference-gateway:latest-u24, built 2026-11-15)

The image predates 40199cde89d by a day; the gateway's api/swagger.yml last changed on 2026-11-13.

Linux, Bun 1.3.6 (the CI version): lint 0 errors, typecheck clean, 698 pass, 0 fail. Line coverage 67.23% (floor 60%), no schema drift, linux-x64 build and smoke test pass, scripts/release-hygiene.sh (full history, with gitleaks) passes.

Windows 11, Bun 1.4.4: 697 pass, 0 fail (EACCES skipped, as in #14).

tests/e2e against that gateway with a PostgreSQL AI key store: 70 of 71 pass. As in #7, status.device fails only because the Docker Desktop kernel lacks /proc/version_signature.

On the same gateway:

  • An LB rule with an eppEndpoint reads back eppState and eppStateSince. Without the EPP stripping, yaml export wrote them into the YAML; with it, they are left out.
  • A YAML that declares a new VIP with IPv4Address and a fullproxy LoadBalancer on it applies in one run; without the ordering fix, the LoadBalancer was created first and refused with 400.
  • A Policy that targets a LoadBalancer rule in the same YAML is now created before the rule; it reads attached: false at first and true within a few seconds.
  • An AiObjective declared without priority re-applies as no change; without the fix, it was replaced on every apply.

Dependency Audit still fails on the unchanged bun.lock, as noted in #7.

Checklist

  • My commits are DCO signed-off (git commit -s)
  • I have not committed secrets, real infrastructure inventories, or credentials
  • No internal/planning references in comments or docs
  • Docs / CHANGELOG updated where relevant
  • A code owner (see .github/CODEOWNERS) has been requested for review

Related issues

Follows #14.

swagger_new.yml is now a verbatim copy of api/swagger.yml from
loxilb-io/loxilb-inference-gateway at cb61ead7728 (2026-10-27), and the
YAML schemas are regenerated from it (27 of 35 change; no property is
removed). Path-wise the gateway only added operations (+42, none
removed), so no existing call breaks.

Three integer enums change; two of them, on LoadBalancer, need code
changes:

- mode: 6 (aigw) is retired. Dropped from the YAML enum map, the LB
  form and the detail pane labels; the knowledge base marks it retired.
- security: the spec now lists 0-2 (no proxy TLS, frontend
  termination, frontend plus backend re-encryption), the values the
  gateway has always parsed. The old bundled spec's 0-3 (plain, https,
  tls, e2ehttps) was a documentation error the gateway corrected in
  August, so this client sent tls as 2 (re-encryption) and e2ehttps
  as 3, which the gateway now refuses. https and tls now map to 1,
  e2ehttps to 2. The mTLS semantic rules follow (mtls_backend now
  requires 2).
- Policy targetObject.attachment gains 2 (egress port); it is passed
  through as an integer, so nothing else changes.

Signed-off-by: KP <kp@attlab.org>
Every operation the synced spec added now has a typed client method,
with models in src/api/models.ts:

- AI gateway (AiGatewayApi): objectives, network identities, JWT auth
  profiles, per-user and default rate limits, model profiles, KV
  inventory, API key PATCH.
- Status (StatusApi): readiness, capabilities, diagnostics,
  maintenance read and enter/leave.
- Load balancer (LbApi): KV-exact status, sockmap reset, half-close
  settings and release.
- New AuditApi (/audit/*) and DpuApi (/config/dpu/*).

The KV inventory, DPU debug and hardware-counter, and API key PATCH
routes are raw handlers; their shapes come from swagger-extras.yml, now
vendored verbatim beside swagger_new.yml (same gateway commit,
cb61ead7728). The client gains put() and patch() for the PUT and PATCH
operations.

/status/ready answers "not ready" as a 503 whose body is the same
ReadyStatus with the reasons, so ApiError now keeps the parsed error
body and StatusApi.ready() returns that 503 as data.

tests/gateway-api.test.ts checks each method against the method and
path the spec declares.

Signed-off-by: KP <kp@attlab.org>
The gateway now takes objectives, network-identity bindings, JWT auth
profiles, per-user and default rate limits, the half-close hold settings
and the audit policy and sink through POST endpoints, so they can be
declared and reconciled like the existing kinds:

- ai-gateway: AiObjective, AiNetIdentity, AiJwtAuthProfile,
  AiUserRateLimit, AiRateLimitDefaults
- core: HalfClose (singleton)
- system: AuditPolicy, AuditSink (singletons)

The objective, network-identity and JWT profile lists come wrapped in an
envelope whose array an empty list may leave out, so those adapters read
the array themselves instead of letting the base adapter take the
envelope for a singleton. AiObjective strips the server-assigned
updated_at and AuditSink the session state its GET reports, so
re-applying unchanged YAML is a no-op. A "rule" defaults row is deleted
with its rule_ident query parameter.

A POST to an existing objective, binding or JWT profile name replaces
it, so these kinds carry an upsert flag and the executor updates them
with a plain POST. Delete-then-create would fail for a profile an LB
rule still names (409) and would leave an objective or binding missing
between the two calls.

Ordering: a load balancer rule naming a jwt_auth_profile is refused
until the profile exists, so profiles are created before load balancers
and deleted after them. Objectives are created before the API keys and
tenant rate limits that name them in default_objective and
allowed_objectives. Load balancers are likewise created after the
certs their backend_ca_cert_id and backend_client_cert_id name and
the QoS policy their vip_qos_policy_id names.

A LoadBalancer rule's key now includes model_name: rules on one
VIP/port/protocol can differ only by model, and a DELETE without
?model_name= matches only the model-less rule. The YAML identity key
and delete path, the TUI delete and the delete lb command (--model)
pass it.

AiUserRateLimit and AiRateLimitDefaults have no list-all GET, so, like
AiTenantRateLimit, their live state is unreadable and every spec plans
as CREATE (POST is upsert). Secondary audit sinks are left out: they are
written with PUT /audit/sinks/{name}, and the schema generator only
walks POST bodies. None of the new definitions has an integer enum, so
ENUM_MAPS is unchanged.

The LoadBalancer adapter also drops the read-only half_close_effective,
fc_effective and backend_tls_effective state the gateway now reports on
fullproxy rules; otherwise each of them showed as an UPDATE on
re-apply. The Policy adapter likewise drops the read-only attached
field.

Signed-off-by: KP <kp@attlab.org>
The AI group gains four list tabs with a detail pane, built like Trace
Parsers: Model Profiles, Objectives, Net Identities and JWT Auth
Profiles. All four are list reads, so they ride the normal poll.

- Model Profiles shows the published registry generation and a short
  setDigest in the header; generation 0 (no registry) is the empty
  list.
- Objectives shows where the list came from (store or lkg) and flags a
  key store that did not answer, so a list served during an outage is
  not mistaken for a live one. The detail pane derives the request class
  from the priority sign, as the gateway does.
- Net Identities and JWT Auth Profiles render the configured bindings
  and issuer profiles. A field left unset shows what the gateway
  applies: empty service and model lists read as "all" and "any", and
  unset enums, algorithms and claim paths show their documented default.

The LB detail pane adds, for the selected rule, the enforced and desired
KV-exact states, the bound model profile and the reason codes, fetched
per selection alongside status and stats. Only rules with a nonzero
kvExactMode are asked, since the gateway answers 404 for any other rule;
LbService gains that field from the spec. READY is green, a fenced state
red, READY_FUNCTIONAL_ONLY amber, LEGACY_ACTIVE_UNATTESTED muted, and
any other state amber.

The dashboard gets a one-line gateway health summary under the System
tiles instead of a new tab: readiness and its reasons, maintenance and
drain state, in-flight requests and streams, the management audit trail
state, the half-close hold settings, and which optional capabilities
are not ready (with their reason code). The line never wraps, because
the fixed-height dashboard has one spare row at 120x40; while the
gateway is not ready or in maintenance, the reasons and drain progress
take the place of the routine segments. These reads are issued from the
line itself on the poll tick, so they only run while the dashboard is
on screen, and a failed read leaves its part out.

Rate limits and KV inventory get no tab: they need a tenant, rule or
endpoint key the UI has no picker for. DPU state gets none either. The
assistant tools cover all three. tests/detail-fields.test.ts covers the
new field builders, and the user guide lists the new tabs.

Signed-off-by: KP <kp@attlab.org>
The assistant could not see readiness, maintenance, the audit trail, the
AI tenancy config, KV state or the DPU, so it had nothing to answer from
when asked about them. Twelve get_* tools cover the read operations the
API client gained, all but the single model-profile and named-sink
reads: get_ai_objectives, get_ai_identities (network identities and
JWT auth profiles), get_ai_model_profiles,
get_ai_rate_limit_defaults, get_ai_user_rate_limits, get_kv_inventory,
get_kv_exact_status, get_half_close, get_readiness, get_diagnostics,
get_audit_status and get_dpu_status. The MCP server, the system prompt
and the claude-cli tool allowlist pick them up from the registry.

All of them only read. Writes and one-shot actions (audit rotate,
half-close release, sockmap reset, DPU debug actions, maintenance
enter/leave, API key PATCH) get no tool, in line with the registry's
read-only contract. Grouped reads report a failed section in place and
keep the others. A 404 that means "not configured" or "no such rule" is
answered as absent rather than as an error; for the DPU it means a
gateway build without those routes. get_readiness reads /status/ready,
whose not-ready answer is a 503 carrying the reasons.

The knowledge base now documents these endpoints (api-quick-reference,
features, troubleshooting, README), and no longer calls API-key and
rate-limit enforcement roadmap: rules declare api_key_auth, builds that
enforce it say so in /version features, and rate-limit rows are stored
quotas. The CHWBL pattern's KV-exact note now gives the single-pool mode
the spec accepts. Provenance comments keep their original sync date and
name the bundled specs (gateway commit cb61ead7728) for the parts
checked against them. docs/mcp-server.md lists the new tools.

tests/ai-tools.test.ts checks that each tool is registered with its
required params, reads exactly the paths it should with GET only, and
reports a failed read as an error string.

Signed-off-by: KP <kp@attlab.org>
README still described 32 panels, 16 MCP tools and 34 configurable
kinds; with the AI tabs, read tools and kinds added on this branch they
are 36, 28 and 42. The developer guide's kind count follows.

docs/yaml-config.md now names the kinds the gateway cannot list back
as write-only: diff always shows them, apply posts them on every run,
and export, snapshots, rollback and --prune do not see them. The
README's YAML row links there.

Signed-off-by: KP <kp@attlab.org>
The live suite still swept only the endpoints the TUI polled before the
API sync, so a drifted path on the new readiness, audit, DPU or AI
config reads would pass unnoticed.

The core read sweep adds status ready, capabilities, diagnostics and
maintenance, half-close, the audit status, policy and sink, model
profiles, net identities, JWT auth profiles and both DPU reads, which
answer the disabled, empty shape on a gateway without a DPU provider.
The feature-gated tier adds the AI key store reads: objectives and an
unknown tenant's user rate limits. Rate-limit defaults stay out: with
no defaults row they answer a resource 404 that tier cannot tell from
a wrong path.

Two new layers: AI config round-trips (net identity and JWT auth
profile create, list and delete, and the same for objectives when a
key store is configured, otherwise the create must say
ai_key_store_unconfigured), and a half-close change to capSeconds that
is then restored. Named fixtures
use E2E_NAME, and afterAll deletes them and puts the half-close values
back even when a step fails.

Signed-off-by: KP <kp@attlab.org>
swagger_new.yml is again a verbatim copy of api/swagger.yml, now at
loxilb-io/loxilb-inference-gateway 40199cde89d (2026-11-16), where
swagger-extras.yml is unchanged. Since cb61ead7728 the gateway reports
eppState, eppStateSince and eppLastError on LB rules that name an
eppEndpoint, accepts an EPP on a pd_disagg rule when eppFailureMode is
FailOpen, answers 409 to a cert upload whose certId is in use, and
writes snapshot schema 1.13. Regenerating changes only
LoadBalancer.json: the three read-only fields and the eppEndpoint and
fc_expose_headers descriptions.

Signed-off-by: KP <kp@attlab.org>
A rule that names an eppEndpoint now reads back with eppState and
eppStateSince, and eppLastError after a failed request. They are
runtime state the gateway ignores on create or replace, yet export
wrote them into the YAML as if they were settings. They are now
stripped alongside the *_effective fields.

Signed-off-by: KP <kp@attlab.org>
Putting LoadBalancer into the dependency graph made it sort ahead of
every kind outside the graph, IPv4Address included. A fullproxy rule
binds only an address the gateway holds, so a YAML that declared a new
VIP and the rule on it failed its first apply with 400 ("externalIP
... is not an address of this gateway"). LoadBalancer now also depends
on IPv4Address and IPv6Address.

That brings the address kinds into the graph as well, so they in turn
depend on Vlan and VxlanTunnel: an address set on an interface that
does not exist yet is accepted but never applied.

Signed-off-by: KP <kp@attlab.org>
The gateway always returns priority, 0 when the objective was created
without one, so an objective declared without priority showed as an
UPDATE on every plan and each apply replaced it. Both sides of the diff
now drop priority 0.

Signed-off-by: KP <kp@attlab.org>
The CHANGELOG said the bundled spec was synced to "the current gateway
API", which says nothing once the gateway moves on; it now names
40199cde89d. The knowledge-base provenance lines said they were checked
against "the bundled" specs at cb61ead7728, which no longer matches the
bundled copy; they now name that commit directly.

Signed-off-by: KP <kp@attlab.org>
@kp-attlab
kp-attlab marked this pull request as ready for review November 17, 2026 06:35
@NLX-SeokHwanKong
NLX-SeokHwanKong merged commit 8eb085a into main Nov 18, 2026
12 of 13 checks passed
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.

2 participants