fix(gateway): fail-closed publish_schema compile + compile-once cache (GW-01 follow-up)

- new gateway::schema_cache — PublishSchemaCache: compile the op's
  publish_schema once per registration (value-keyed invalidation for
  hot reload), cache compile failures (logged once at error level,
  never retried per request)
- /publish compile failure is now fail-closed: the chunk stream
  terminates with INTERNAL (500), the error text stays in the log
  (no schema internals on the wire) — the per-request warn-and-skip
  unvalidated ingest path is removed
- schema resolution is lazy (first chunk poll, after invoke_sink's
  404/403/422 pre-checks — GW-11 order preserved) and keyed by schema
  value, so re-registration/hot reload is picked up (test)
- NdjsonChunkStream: first Err item is terminal (done + stream end),
  mirroring the wire pump's send(Err) + break — Ok chunks can never
  follow an error on the HTTP path either (found by spy-handler test)

Verified: cargo test (308), cargo test --all-features, clippy
--all-targets -D warnings (default + all-features), fmt --check.

Tasks: review-001-publish-schema-validation-robust
This commit is contained in:
2026-08-30 07:02:27 +00:00
parent 5d6945cd4b
commit 1572a9d2d0
6 changed files with 716 additions and 53 deletions
+1
View File
@@ -1,6 +1,7 @@
pub mod dispatch;
pub mod error;
pub mod routes;
pub(crate) mod schema_cache;
pub use dispatch::GatewayDispatch;
pub use routes::CallRequest;