Skip to content

feat(stream): make SSE maxEventSize configurable end-to-end - #568

Merged
calvarjorge merged 1 commit into
mainfrom
fix/stream-config-per-call-overrides
Sep 2, 2026
Merged

feat(stream): make SSE maxEventSize configurable end-to-end#568
calvarjorge merged 1 commit into
mainfrom
fix/stream-config-per-call-overrides

Conversation

@calvarjorge

Copy link
Copy Markdown
Contributor

Summary

Makes the SSE maxEventSize limit actually overridable by application code. Two commits:

  1. fix(stream) (existing) — raise the default event limit to 5 MiB, honour a per-call maxEventSize (it was read off the StreamManager instance, so per-call values passed via executeStream({ stream }) type-checked and were then silently ignored), and measure UTF-8 bytes instead of String.length.

  2. feat(stream) (new) — expose streamConfig on BasePluginConfig.

Why the second commit

Even after the per-call fix, no shipped path could reach the knob:

  • Plugin always constructed new StreamManager() with no options, so the constructor-level defaults (including maxEventSize) were unreachable through plugin config.
  • The built-in analytics plugin — the one that emits Event exceeds max size — builds its StreamExecutionSettings with no stream field, so the per-call override never reached it.

Result: an app hitting the limit had no way to raise it without patching AppKit.

Change

Add streamConfig?: StreamConfig to BasePluginConfig and forward it to the plugin's StreamManager. A per-call executeStream({ stream }) override still layers on top of these instance defaults.

createApp({
  plugins: [
    analytics({
      streamConfig: { maxEventSize: 20 * 1024 * 1024 }, // 20 MiB, overrides the 5 MiB default
    }),
  ],
});

Notes

  • Per-plugin: each plugin instance can carry its own stream limits.
  • Client side must be raised in tandem — a browser using connectSSE's default maxBufferSize (5 MiB) will reject a larger event; pass connectSSE({ maxBufferSize }) to match.

Testing

  • New plugin tests assert streamConfig is forwarded to the StreamManager constructor (and undefined when unset).
  • plugin.test.ts (54) and stream/tests/ (112) pass.

This pull request and its description were written by Isaac.

@calvarjorge
calvarjorge requested a review from a team as a code owner September 2, 2026 13:33
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

📦 Bundle size report

Compared against bundle-size-baseline.json (main).

@databricks/appkit

npm tarball (packed): 1.0 MB (+1.5 KB) — gzipped download (dist + bin; excludes release-only docs/NOTICE).

dist raw gzip
JS (runtime) 1.0 MB (+1.2 KB) 376 KB (+457 B)
Type declarations 385 KB (+533 B) 136 KB (+186 B)
Source maps 2.1 MB (+2.4 KB) 705 KB (+858 B)
Other 11 KB 3.7 KB
Total 3.5 MB (+4.1 KB) 1.2 MB (+1.5 KB)
Per-entry composition (own code — deps external (as shipped))
Entry Initial (gz) Lazy (gz) Total (gz) node_modules (min) Own code (min)
. 95 KB (+6 B) 2.5 KB 97 KB (+6 B) external 311 KB (+16 B)
./beta 75 KB (+189 B) 457 B 75 KB (+189 B) external 226 KB (+498 B)
./testing 17 KB 0 B 17 KB external 50 KB
./tsdown 520 B 0 B 520 B external 813 B
./type-generator 22 KB 0 B 22 KB external 65 KB

Chunks:

Entry Chunk Load Size (gz)
. index.js initial 91 KB
. utils.js initial 4.0 KB
. remote-tunnel-manager.js lazy 2.5 KB
./beta beta.js initial 59 KB
./beta stream-manager.js initial 5.8 KB
./beta wide-event-emitter.js initial 3.2 KB
./beta databricks.js initial 3.2 KB
./beta configuration.js initial 2.1 KB
./beta service-context.js initial 1.3 KB
./beta client.js initial 434 B
./beta client-options.js initial 220 B
./beta supervisor-api.js lazy 193 B
./beta databricks.js lazy 142 B
./beta index.js lazy 122 B
./testing index.js initial 17 KB
./tsdown index.js initial 520 B
./type-generator index.js initial 22 KB

@databricks/appkit-ui

npm tarball (packed): 350 KB (+13 B) — gzipped download (dist + bin; excludes release-only docs/NOTICE).

dist raw gzip
JS (runtime) 395 KB 132 KB
Type declarations 229 KB (+23 B) 84 KB (+6 B)
Source maps 766 KB (+1 B) 253 KB
CSS 16 KB 3.2 KB
Total 1.4 MB (+24 B) 473 KB (+6 B)
Per-entry composition (consumer bundle — deps bundled, peerDeps external)
Entry Initial (gz) Lazy (gz) Total (gz) node_modules (min) Own code (min)
./js 5.3 KB 49 KB 55 KB 208 KB 14 KB
./js/beta 20 B 0 B 20 B 0 B 0 B
./react 432 KB 49 KB 481 KB 1.3 MB 177 KB
./react/beta 1.0 KB 0 B 1.0 KB 0 B 1.9 KB

Chunks:

Entry Chunk Load Size (gz)
./js index.js initial 5.2 KB
./js chunk initial 120 B
./js apache-arrow lazy 49 KB
./js/beta beta.js initial 20 B
./react index.js initial 430 KB
./react tslib initial 2.1 KB
./react apache-arrow lazy 49 KB
./react/beta beta.js initial 1.0 KB

Plugins constructed their StreamManager with `new StreamManager()`, so the
constructor-level stream defaults (including `maxEventSize`) were unreachable
through plugin config. Combined with the built-in plugins never setting a
per-call `stream` config, an app hitting the event-size limit had no way to
raise it without patching AppKit.

Add `streamConfig?: StreamConfig` to `BasePluginConfig` and forward it to the
plugin's StreamManager. A per-call `executeStream({ stream })` override still
layers on top of these instance defaults.

  analytics({ streamConfig: { maxEventSize: 20 * 1024 * 1024 } })

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>
@calvarjorge
calvarjorge force-pushed the fix/stream-config-per-call-overrides branch from 6fdff0b to 617816c Compare September 2, 2026 13:38
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

🤖 AppKit PR bot

🔬 Run evals

Start an eval for this PR from the evals-monitor app: Go to Evals Monitor →

📦 Try this PR's app template

Scaffolds a new app from this PR's SDK build. Run it in any folder (requires the GitHub CLI — gh auth login — and the Databricks CLI):

gh run download 33636926482 -R databricks/appkit -n appkit-template-0.69.2-pr.2972984-fix-stream-config-per-call-overrides-568 -D appkit-pr-568 \
  && unzip -o "appkit-pr-568/appkit-template-0.69.2-pr.2972984-fix-stream-config-per-call-overrides-568.zip" -d "appkit-pr-568" \
  && databricks apps init --template "appkit-pr-568"

The template pins @databricks/appkit and @databricks/appkit-ui to tarballs built from this branch, so the scaffolded app runs against this PR's code.

@calvarjorge
calvarjorge merged commit 2d7d17c into main Sep 2, 2026
10 checks passed
@calvarjorge
calvarjorge deleted the fix/stream-config-per-call-overrides branch September 2, 2026 13:50
IamGalymzhan added a commit that referenced this pull request Sep 2, 2026
Resolves the one content conflict in plugin/tests/plugin.test.ts: keeps both
this branch's 'binds the cache its context carries' test and #568's two
streamConfig tests. plugin.ts auto-merged cleanly — new StreamManager(
config.streamConfig) from #568 sits alongside the per-app cache/telemetry
changes. Regenerated API docs pick up #568's streamConfig on the configs that
extend BasePluginConfig; caching.md's upgrade heading moves to 0.71.0 since
0.70.0 already shipped.

Signed-off-by: Galymzhan <zhangazy2004@gmail.com>
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