@malloy-publisher/server 0.12.3 → 0.12.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/dist/app/api-doc.yaml +17 -1
  2. package/dist/app/assets/{EnvironmentPage-CewgI-x8.js → EnvironmentPage-gNvDKTtA.js} +1 -1
  3. package/dist/app/assets/{HomePage-B-7xHDxu.js → HomePage-lrIG8Qjk.js} +1 -1
  4. package/dist/app/assets/{MainPage-swHGcEfw.js → MainPage-CJf3Uuul.js} +1 -1
  5. package/dist/app/assets/{ModelPage-BP7XeFQu.js → ModelPage-t_Ln0qr1.js} +2 -2
  6. package/dist/app/assets/{PackagePage-CMIewiLY.js → PackagePage-Cxa0_alv.js} +1 -1
  7. package/dist/app/assets/{PackageSplatRoute-CfR6aEOF.js → PackageSplatRoute-FyScmoYw.js} +2 -2
  8. package/dist/app/assets/{RenderedResult-DqPvGZgL.es-Cga6-xj5.js → RenderedResult-DqPvGZgL.es-BNxk46Vn.js} +1 -1
  9. package/dist/app/assets/{RouteError-JKbL4qo3.js → RouteError-BZUUKmNE.js} +1 -1
  10. package/dist/app/assets/{ThemeEditorPage-DomLLlrf.js → ThemeEditorPage-vDnfPmZz.js} +1 -1
  11. package/dist/app/assets/{ToggleButtonGroup-D5xHfdFe.js → ToggleButtonGroup-DdUWm7cB.js} +1 -1
  12. package/dist/app/assets/{documentRoutes-BxF_zGoi.js → documentRoutes-DtWdqG6B.js} +1 -1
  13. package/dist/app/assets/{editPageMounted-C972ZdQO.js → editPageMounted-vEdUjhAX.js} +2 -2
  14. package/dist/app/assets/{index-Dc7yoJFF.js → index-D-htCO4q.js} +6 -6
  15. package/dist/app/assets/{index-p8cCzaE5.js → index-DYHeNKEh.js} +1 -1
  16. package/dist/app/assets/{index-NoukhIo4.js → index-dUom3Bdm.js} +1 -1
  17. package/dist/app/assets/{index-DhoAPSk5.js → index-diN_kmcj.js} +1 -1
  18. package/dist/app/assets/{index.es-COxgMbi1.js → index.es-DpNxHwgw.js} +1 -1
  19. package/dist/app/assets/usePackageLinkNavigate-D2TepxAX.js +1 -0
  20. package/dist/app/assets/{usePackageRoute-1hM9kuTm.js → usePackageRoute-CjGpnrTp.js} +1 -1
  21. package/dist/app/index.html +1 -1
  22. package/dist/instrumentation.mjs +95 -10
  23. package/dist/package_load_worker.mjs +127 -19
  24. package/dist/server.mjs +5605 -4156
  25. package/package.json +2 -1
  26. package/dist/app/assets/usePackageLinkNavigate-Do-ihosf.js +0 -1
@@ -3665,8 +3665,11 @@ function setting(entry) {
3665
3665
  type: entry.type,
3666
3666
  default: entry.default,
3667
3667
  description: entry.description,
3668
+ ...entry.notes !== undefined ? { notes: entry.notes } : {},
3669
+ ...entry.defaultText !== undefined ? { defaultText: entry.defaultText } : {},
3668
3670
  kind: entry.kind ?? "server",
3669
3671
  secret: entry.secret ?? false,
3672
+ ...entry.masked ? { masked: true } : {},
3670
3673
  aliases: entry.aliases ?? {}
3671
3674
  };
3672
3675
  }
@@ -3835,6 +3838,7 @@ var init_access = __esm(() => {
3835
3838
  type: boolean(),
3836
3839
  default: false,
3837
3840
  description: "Allow publisher connections, which make this server call a configured connectionUri.",
3841
+ notes: "Set to `true` to allow `publisher`-type proxy connections (Publisher-to-Publisher). See [connections.md](connections.md).",
3838
3842
  aliases: {
3839
3843
  env: ["PUBLISHER_ALLOW_PROXY_CONNECTIONS"],
3840
3844
  today: { reads: "exactly-true" }
@@ -3845,6 +3849,7 @@ var init_access = __esm(() => {
3845
3849
  type: boolean(),
3846
3850
  default: false,
3847
3851
  description: "Allow setupSQL on environment-authored DuckDB connections.",
3852
+ notes: "Set to `true` to let environment-level `duckdb` connections carry `setupSQL`. Unset, a connection with `setupSQL` is refused at config load, on create and update, and by the connection test. `setupSQL` runs arbitrary DuckDB statements on the server, including writing host files and loading extensions, so enable it only where the people who author connections are trusted with the host. Refused under `EXTENSION_FETCH_POLICY=local-only` either way. Same boolean spellings as `PUBLISHER_ALLOW_UNVERIFIED_SSH_HOST_KEY`; any other value fails config load.",
3848
3853
  aliases: { env: ["PUBLISHER_ALLOW_DUCKDB_SETUP_SQL"] }
3849
3854
  }),
3850
3855
  setting({
@@ -3852,6 +3857,7 @@ var init_access = __esm(() => {
3852
3857
  type: boolean(),
3853
3858
  default: false,
3854
3859
  description: "Accept a bastion host key no connection pins.",
3860
+ notes: "Set to `true` to let an SSH-proxy connection whose `ssh.hostKey` is not pinned connect anyway, logging a warning each time. Unset, such a tunnel is refused, because an unverified host key means a MITM on the publisher-to-bastion hop cannot be detected. Accepts the same spellings as every other boolean here -- `true`, `1`, `yes`, `on`, case-insensitive and trimmed. Any other value fails config load rather than opting in silently. See [connections.md](connections.md).",
3855
3861
  aliases: { env: ["PUBLISHER_ALLOW_UNVERIFIED_SSH_HOST_KEY"] }
3856
3862
  }),
3857
3863
  setting({
@@ -3859,6 +3865,7 @@ var init_access = __esm(() => {
3859
3865
  type: oneOf(["any", "destinations-only", "off"]),
3860
3866
  default: "any",
3861
3867
  description: "Where an s3 connection may use the host's credentials: any, destinations-only or off.",
3868
+ notes: "Where an S3 connection or attachment may use `provider: credential_chain`, which makes DuckDB resolve the **host's own** credentials (an EKS pod's IRSA role, an EC2 instance profile) instead of a configured key pair. `any`: allowed everywhere. `destinations-only`: allowed on a [storage destination](connections.md#storage-destinations) and on an admin-API catalog, and refused on an environment connection or attachment, which an author may supply. A destination is declared by whoever writes the environment (its config file, or `storageDestinations` on `POST`/`PATCH /environments`), so under this policy keep those writes to operators. `off`: refused everywhere. A refused config fails at load, on create and update, and by the connection test, with an error naming the policy. Any other value fails startup.",
3862
3869
  aliases: { env: ["S3_CREDENTIAL_CHAIN_POLICY"] }
3863
3870
  }),
3864
3871
  setting({
@@ -3866,6 +3873,7 @@ var init_access = __esm(() => {
3866
3873
  type: string(),
3867
3874
  secret: true,
3868
3875
  description: "Secret a request presents in x-publisher-bypass-authorize to skip #(authorize) gates.",
3876
+ notes: "A secret that, sent in the `x-publisher-bypass-authorize` header, skips `#(authorize)` gates for that request. Unset, the header does nothing. See [authorize-bypass-deployment.md](authorize-bypass-deployment.md).",
3869
3877
  aliases: { env: ["PUBLISHER_BYPASS_AUTHORIZE_SECRET"] }
3870
3878
  }),
3871
3879
  setting({
@@ -3873,6 +3881,7 @@ var init_access = __esm(() => {
3873
3881
  type: oneOf(["error", "warn", "info", "verbose", "debug", "silly"]),
3874
3882
  default: "debug",
3875
3883
  description: "Least severe level logged.",
3884
+ notes: "One of `error`, `warn`, `info`, `verbose`, `debug`, `silly`.",
3876
3885
  aliases: { env: ["LOG_LEVEL"], today: { invalid: "warn" } }
3877
3886
  }),
3878
3887
  setting({
@@ -3880,6 +3889,7 @@ var init_access = __esm(() => {
3880
3889
  type: boolean(),
3881
3890
  default: true,
3882
3891
  description: "Log response bodies.",
3892
+ notes: "Set to `true` or `1` to suppress response-body logging.",
3883
3893
  aliases: {
3884
3894
  env: ["DISABLE_RESPONSE_LOGGING"],
3885
3895
  negated: true,
@@ -3891,6 +3901,7 @@ var init_access = __esm(() => {
3891
3901
  type: integer({ min: 0 }),
3892
3902
  default: 0,
3893
3903
  description: "Seconds to report draining before closing the listeners on shutdown.",
3904
+ notes: "After SIGTERM, how long to keep serving in-flight and new requests (readiness reports not-ready immediately) before the server starts refusing new traffic.",
3894
3905
  aliases: {
3895
3906
  env: ["SHUTDOWN_DRAIN_DURATION_SECONDS"],
3896
3907
  flags: ["--shutdown_drain_duration_seconds"]
@@ -3901,6 +3912,7 @@ var init_access = __esm(() => {
3901
3912
  type: integer({ min: 0 }),
3902
3913
  default: 0,
3903
3914
  description: "Seconds to wait after closing the listeners before exiting.",
3915
+ notes: "Time to wait for in-flight requests to drain before forcing close.",
3904
3916
  aliases: {
3905
3917
  env: ["SHUTDOWN_GRACEFUL_CLOSE_TIMEOUT_SECONDS"],
3906
3918
  flags: ["--shutdown_graceful_close_timeout_seconds"]
@@ -3918,6 +3930,8 @@ var init_admin = __esm(() => {
3918
3930
  key: "admin.port",
3919
3931
  type: integer({ min: 0, max: 65535 }),
3920
3932
  description: "Port of the admin API; unset turns the listener off.",
3933
+ notes: "Port for the admin API (`admin-api-doc.yaml`): the operator's surface: the DuckLake catalogs in `PUBLISHER_ADMIN_CATALOG_DATABASE` as resources (create a catalog, load a file into a table, list and drop tables, reclaim old snapshots' storage), and watch mode as one resource, `GET`/`PUT`/`DELETE /watch-mode` (the main API's `/watch-mode/status`, `start` and `stop` are deprecated). Off unless set. Unauthenticated, like the main API. See [ducklake.md](ducklake.md#managing-ducklake-catalogs-the-admin-api).",
3934
+ defaultText: "_unset_ (off)",
3921
3935
  aliases: {
3922
3936
  env: ["PUBLISHER_ADMIN_PORT"],
3923
3937
  flags: ["--admin_port"]
@@ -3927,7 +3941,8 @@ var init_admin = __esm(() => {
3927
3941
  key: "admin.host",
3928
3942
  type: string(),
3929
3943
  default: "127.0.0.1",
3930
- description: "Host the admin API binds to; host does not move it.",
3944
+ description: "Host the admin API binds to; {host} does not move it.",
3945
+ notes: "Host binding for the admin API. Deliberately not moved by `PUBLISHER_HOST`: putting the main API on every interface does not expose the admin operations. Widen it only inside the network the orchestrator calls from, never behind a public ingress.",
3931
3946
  aliases: { env: ["PUBLISHER_ADMIN_HOST"], flags: ["--admin_host"] }
3932
3947
  }),
3933
3948
  setting({
@@ -3935,18 +3950,22 @@ var init_admin = __esm(() => {
3935
3950
  type: string(),
3936
3951
  secret: true,
3937
3952
  description: "libpq connection string of the database the admin API finds DuckLake catalogs in.",
3953
+ notes: "A libpq connection string (keyword or `postgres://` form) for the Postgres database holding the catalogs the admin API manages. Unset, the admin API's catalog routes answer `503 CATALOG_DATABASE_NOT_CONFIGURED`.",
3938
3954
  aliases: { env: ["PUBLISHER_ADMIN_CATALOG_DATABASE"] }
3939
3955
  }),
3940
3956
  setting({
3941
3957
  key: "admin.storage.provider",
3942
3958
  type: oneOf(["s3", "s3_credential_chain", "gcs"]),
3943
3959
  description: "Object store the catalogs' data paths are read and written with.",
3960
+ notes: "The credential the admin API reads and writes catalogs' data paths with: `s3` (with `PUBLISHER_ADMIN_STORAGE_KEY_ID`, `PUBLISHER_ADMIN_STORAGE_SECRET`, and optionally `PUBLISHER_ADMIN_STORAGE_REGION` and `PUBLISHER_ADMIN_STORAGE_ENDPOINT`), `s3_credential_chain` (the host's identity; optional region), or `gcs` (an HMAC key pair in the key id and secret variables). An unknown value or missing key fails startup.",
3961
+ defaultText: "_unset_ (local paths)",
3944
3962
  aliases: { env: ["PUBLISHER_ADMIN_STORAGE_PROVIDER"] }
3945
3963
  }),
3946
3964
  setting({
3947
3965
  key: "admin.storage.keyId",
3948
3966
  type: string(),
3949
3967
  description: "Access key id (s3) or HMAC key id (gcs).",
3968
+ masked: true,
3950
3969
  aliases: { env: ["PUBLISHER_ADMIN_STORAGE_KEY_ID"] }
3951
3970
  }),
3952
3971
  setting({
@@ -3982,13 +4001,16 @@ var init_launch = __esm(() => {
3982
4001
  default: ".",
3983
4002
  kind: "launch",
3984
4003
  description: "Directory served from, resolved against the working directory.",
4004
+ notes: "Where Publisher keeps its own storage (`publisher_data/`, `publisher.db`), and where it looks for `publisher.config.json` when `--config` is not passed.",
4005
+ defaultText: "`.` (cwd)",
3985
4006
  aliases: { env: ["SERVER_ROOT"], flags: ["--server_root"] }
3986
4007
  }),
3987
4008
  setting({
3988
4009
  key: "config",
3989
4010
  type: string(),
3990
4011
  kind: "launch",
3991
- description: "Path to publisher.config.json; default <root>/publisher.config.json.",
4012
+ description: "Path to publisher.config.json; default: the one in the server root.",
4013
+ notes: "Path to the `publisher.config.json` to read, instead of the one in the server root. A path that does not exist is reported at startup, and the server starts with no environments.",
3992
4014
  aliases: { env: ["PUBLISHER_CONFIG_PATH"], flags: ["--config"] }
3993
4015
  }),
3994
4016
  setting({
@@ -3996,7 +4018,9 @@ var init_launch = __esm(() => {
3996
4018
  type: boolean(),
3997
4019
  default: (resolving) => !resolving.isSet("root") && !resolving.isSet("config") && resolving.env("NODE_ENV") !== "test",
3998
4020
  kind: "launch",
3999
- description: "Serve the bundled sample config when the server root has none; on when neither root nor config is given.",
4021
+ description: "Serve the bundled sample config when the server root has none; on when neither {root} nor {config} is given.",
4022
+ notes: "Set to `true` to fall back to the sample config bundled inside the installed package when neither `--config` is passed nor a `publisher.config.json` exists at the server root. The server sets this itself on a zero-flag start (so a bare `npx @malloy-publisher/server` boots the samples); passing `--config` or `--server_root` leaves it unset. Because the bundled config lives inside the install, relative package locations resolve against the server root in this mode rather than the config's directory.",
4023
+ defaultText: "on unless a `--server_root` or `--config` flag is given; never in tests",
4000
4024
  aliases: {
4001
4025
  env: ["PUBLISHER_USE_BUNDLED_DEFAULT"],
4002
4026
  today: { reads: "exactly-true", defaultFromFlags: true }
@@ -4008,6 +4032,7 @@ var init_launch = __esm(() => {
4008
4032
  default: false,
4009
4033
  kind: "launch",
4010
4034
  description: "Wipe persisted storage and re-sync it from the config.",
4035
+ notes: "Set to `true` (or pass `--init`) to **wipe persisted storage** (`publisher_data/`) and re-sync it from the config on boot. A first boot with empty storage loads the config automatically, so you only need this to reset state or pick up config changes. Also exposed as the `start:init` / `start:dev:init` scripts.",
4011
4036
  aliases: {
4012
4037
  env: ["INITIALIZE_STORAGE"],
4013
4038
  flags: ["--init"],
@@ -4020,6 +4045,7 @@ var init_launch = __esm(() => {
4020
4045
  default: [],
4021
4046
  kind: "launch",
4022
4047
  description: "Environments whose local packages are mounted in place for live reload; only the first auto-reloads.",
4048
+ notes: "Dev only. Mount the named environment's local-dir packages in place (a symlink, not a copy) and watch them, so edits to your source recompile that package and live-reload any open pages. Repeat the flag or use a comma-separated list to mount several in place; only the first one auto-reloads. Leave unset in production, where packages are copied and stay decoupled from their source.",
4023
4049
  aliases: {
4024
4050
  env: ["PUBLISHER_WATCH"],
4025
4051
  flags: ["--watch-env"],
@@ -4039,6 +4065,7 @@ var init_mcp = __esm(() => {
4039
4065
  type: integer({ min: 0, max: 65535 }),
4040
4066
  default: 4040,
4041
4067
  description: "MCP HTTP port.",
4068
+ notes: "MCP HTTP port. Serves the ten MCP tools (`list_packages`, `get_context`, `execute_query`, `compile_model`, `reload_package`, `get_status`, `search_malloy_docs`, `search_database_schema`, `get_skill`, `get_agent`) and the agent skills as MCP prompts. `list_packages` is listed first because it is where an agent starts: `get_context` requires an environment and package in its `scopes`, and those names come from there.",
4042
4069
  aliases: {
4043
4070
  env: ["MCP_PORT"],
4044
4071
  flags: ["--mcp_port"]
@@ -4048,7 +4075,9 @@ var init_mcp = __esm(() => {
4048
4075
  key: "mcp.host",
4049
4076
  type: string(),
4050
4077
  default: (resolving) => resolving.isSet("host") ? resolving.get("host") : "127.0.0.1",
4051
- description: "Host MCP binds to; default host when that is given, else 127.0.0.1.",
4078
+ description: "Host the MCP server binds to.",
4079
+ notes: "Host binding for the MCP server. Takes precedence over `PUBLISHER_HOST`. Set `0.0.0.0` to expose MCP on the network, behind an authenticating gateway.",
4080
+ defaultText: "{host} when given, else `127.0.0.1`",
4052
4081
  aliases: { env: ["MCP_HOST"], flags: ["--mcp_host"] }
4053
4082
  }),
4054
4083
  setting({
@@ -4056,13 +4085,15 @@ var init_mcp = __esm(() => {
4056
4085
  type: list(),
4057
4086
  default: [],
4058
4087
  description: "Origins that may read MCP responses cross-origin; * allows any, none denies.",
4088
+ notes: "Comma-separated origins allowed to read a cross-origin response from the MCP endpoint; `*` allows any. Unset or empty sends no `Access-Control-Allow-Origin` at all.",
4059
4089
  aliases: { env: ["MCP_CORS_ORIGINS"] }
4060
4090
  }),
4061
4091
  setting({
4062
4092
  key: "mcp.configFileEnabled",
4063
4093
  type: boolean(),
4064
4094
  default: true,
4065
- description: "Write .mcp.json into the working directory, so an agent opened there finds this server.",
4095
+ description: "Do not write .mcp.json into the working directory. Without it the file is written, so an agent opened there finds this server, unless the directory already has one, is your home directory or the filesystem root, is inside a git working tree, or the MCP port bound is not the one requested.",
4096
+ notes: "Stops the server writing a `.mcp.json` into its working directory on startup. Accepts `1`/`true`/`yes`/`on` to disable and `0`/`false`/`no`/`off`/empty to leave on; anything else, including a value an env file left quotes around, is a startup error rather than a disable. See [The `.mcp.json` the server writes](#the-mcpjson-the-server-writes).",
4066
4097
  aliases: {
4067
4098
  env: ["PUBLISHER_NO_MCP_CONFIG"],
4068
4099
  flags: ["--no-mcp-config"],
@@ -4083,6 +4114,7 @@ var init_mcp = __esm(() => {
4083
4114
  key: "mcp.trace",
4084
4115
  type: oneOf(["retrieval"]),
4085
4116
  description: "retrieval writes a trace summary of each ranked get_context call to the log.",
4117
+ notes: "`retrieval` writes a one-line trace summary of each ranked `get_context` call to the server log, and adds nothing to any response. Any other value fails startup.",
4086
4118
  aliases: { env: ["PUBLISHER_MCP_TRACE"] }
4087
4119
  })
4088
4120
  ];
@@ -4099,6 +4131,7 @@ var init_query = __esm(() => {
4099
4131
  type: integer({ min: 0 }),
4100
4132
  default: DEFAULT_MAX_QUERY_ROWS,
4101
4133
  description: "Row cap on ad-hoc connection SQL; 0 leaves only the byte cap.",
4134
+ notes: "Maximum rows returned per query on every query surface (`/connections/.../sqlQuery`, model query, notebook cell, MCP `executeQuery`). Forwarded to the connector / Malloy `runnable.run` as the effective row limit; queries that exceed the cap fail with HTTP 413. Set to `0` to disable. A caller-supplied `rowLimit` smaller than the cap is preserved.",
4102
4135
  aliases: { env: ["PUBLISHER_MAX_QUERY_ROWS"] }
4103
4136
  }),
4104
4137
  setting({
@@ -4106,6 +4139,8 @@ var init_query = __esm(() => {
4106
4139
  type: integer({ min: 0 }),
4107
4140
  default: DEFAULT_MAX_RESPONSE_BYTES,
4108
4141
  description: "Byte cap on ad-hoc connection SQL responses; 0 leaves only the row cap.",
4142
+ notes: "Maximum JSON-serialized response size, for ad-hoc SQL, model queries and notebook cells. Streaming-capable connections (Postgres, DuckDB) enforce mid-stream and abort the driver immediately; non-streaming connections enforce post-buffer. Exceeding the cap fails with HTTP 413. Set to `0` to disable. See the note below the table.",
4143
+ defaultText: "`50000000` (50 MB)",
4109
4144
  aliases: { env: ["PUBLISHER_MAX_RESPONSE_BYTES"] }
4110
4145
  }),
4111
4146
  setting({
@@ -4113,6 +4148,7 @@ var init_query = __esm(() => {
4113
4148
  type: integer({ min: 1 }),
4114
4149
  default: DEFAULT_QUERY_ROW_LIMIT,
4115
4150
  description: "Row limit of a model query that sets none of its own.",
4151
+ notes: "Default `LIMIT` applied to model queries that don't include their own. Always ≤ `PUBLISHER_MAX_QUERY_ROWS`. `0` is rejected.",
4116
4152
  aliases: { env: ["PUBLISHER_DEFAULT_QUERY_ROW_LIMIT"] }
4117
4153
  }),
4118
4154
  setting({
@@ -4120,6 +4156,8 @@ var init_query = __esm(() => {
4120
4156
  type: integer({ min: 0 }),
4121
4157
  default: DEFAULT_QUERY_TIMEOUT_MS,
4122
4158
  description: "Per-query wall-clock timeout in ms; 0 turns it off.",
4159
+ notes: "Wall-clock timeout per query (all surfaces). Wired to the underlying SDK via `AbortSignal`; queries that exceed the budget are aborted and return HTTP 504. Set to `0` to disable.",
4160
+ defaultText: "`300000` (5 min)",
4123
4161
  aliases: { env: ["PUBLISHER_QUERY_TIMEOUT_MS"] }
4124
4162
  }),
4125
4163
  setting({
@@ -4127,6 +4165,7 @@ var init_query = __esm(() => {
4127
4165
  type: integer({ min: 0 }),
4128
4166
  default: DEFAULT_MAX_CONCURRENT_QUERIES,
4129
4167
  description: "Queries this process runs at once; 0 turns the cap off.",
4168
+ notes: "Per-pod cap on simultaneous in-flight work (HTTP + MCP share the same slot pool). Covers queries and the two authoring surfaces that also reach the database: `compile`, which resolves source schemas against the connection, and `sqlSource`, which runs a live introspection. When the cap is reached, new requests fail fast with HTTP 503 (or the MCP-error equivalent). Size it for authoring traffic as well as query traffic; set to `0` to disable.",
4130
4169
  aliases: { env: ["PUBLISHER_MAX_CONCURRENT_QUERIES"] }
4131
4170
  }),
4132
4171
  setting({
@@ -4134,6 +4173,7 @@ var init_query = __esm(() => {
4134
4173
  type: boolean(),
4135
4174
  default: false,
4136
4175
  description: "Attach per-query metadata to every statement.",
4176
+ notes: "`on` attaches per-query metadata to every statement, as a leading SQL comment where the connection has no native tag; `off` attaches none. Only `on` and `off` are read. See [query-metadata.md](query-metadata.md).",
4137
4177
  aliases: {
4138
4178
  env: ["PUBLISHER_QUERY_METADATA"],
4139
4179
  today: { reads: "on-off" }
@@ -4144,6 +4184,7 @@ var init_query = __esm(() => {
4144
4184
  type: integer({ min: 1 }),
4145
4185
  default: DEFAULT_POSTGRES_POOL_MAX,
4146
4186
  description: "Open sessions per plain Postgres connection.",
4187
+ notes: "Per-process cap on open database sessions for each Postgres connection, including one reached through an SSH proxy. Each query uses its own session and closes it; when all are busy a query waits up to 30 s for one, then fails with HTTP 502. Across a fleet the ceiling is roughly this value times the pods serving the environment, so size it against the role's `CONNECTION LIMIT`. Must be a positive integer.",
4147
4188
  aliases: { env: ["PUBLISHER_POSTGRES_POOL_MAX"] }
4148
4189
  }),
4149
4190
  setting({
@@ -4151,20 +4192,24 @@ var init_query = __esm(() => {
4151
4192
  type: integer({ min: 0 }),
4152
4193
  default: 0,
4153
4194
  description: "Process RSS ceiling for the memory governor, in bytes; 0 turns the governor off.",
4195
+ notes: "Enables the RSS-based memory governor. When set, the governor samples process RSS every `PUBLISHER_MEMORY_CHECK_INTERVAL_MS` ms and rejects new package loads and queries with HTTP 503 once RSS crosses `PUBLISHER_MEMORY_HIGH_WATER_FRACTION × PUBLISHER_MAX_MEMORY_BYTES`, until it drops below `PUBLISHER_MEMORY_LOW_WATER_FRACTION ×`. Unset or `0` disables.",
4196
+ defaultText: "`0` (the governor is off)",
4154
4197
  aliases: { env: ["PUBLISHER_MAX_MEMORY_BYTES"] }
4155
4198
  }),
4156
4199
  setting({
4157
4200
  key: "memory.highWaterFraction",
4158
4201
  type: number({ above: 0, below: 1 }),
4159
4202
  default: 0.8,
4160
- description: "Share of memory.maxBytes at which new package loads are refused.",
4203
+ description: "Share of {memory.maxBytes} at which new package loads are refused.",
4204
+ notes: "High-water mark (fraction of `PUBLISHER_MAX_MEMORY_BYTES`). Must be in `(0, 1)` and strictly above the low-water mark.",
4161
4205
  aliases: { env: ["PUBLISHER_MEMORY_HIGH_WATER_FRACTION"] }
4162
4206
  }),
4163
4207
  setting({
4164
4208
  key: "memory.lowWaterFraction",
4165
4209
  type: number({ above: 0, below: 1 }),
4166
4210
  default: 0.7,
4167
- description: "Share of memory.maxBytes at which loads are admitted again; below the high-water mark.",
4211
+ description: "Share of {memory.maxBytes} at which loads are admitted again; below the high-water mark.",
4212
+ notes: "Low-water mark (fraction of `PUBLISHER_MAX_MEMORY_BYTES`). Hysteresis: back-pressure clears when RSS dips below this value.",
4168
4213
  aliases: { env: ["PUBLISHER_MEMORY_LOW_WATER_FRACTION"] }
4169
4214
  }),
4170
4215
  setting({
@@ -4172,6 +4217,7 @@ var init_query = __esm(() => {
4172
4217
  type: integer({ min: 100 }),
4173
4218
  default: 5000,
4174
4219
  description: "How often the memory governor samples RSS, in ms.",
4220
+ notes: "RSS sampling interval (ms). Minimum 100.",
4175
4221
  aliases: { env: ["PUBLISHER_MEMORY_CHECK_INTERVAL_MS"] }
4176
4222
  }),
4177
4223
  setting({
@@ -4179,6 +4225,7 @@ var init_query = __esm(() => {
4179
4225
  type: boolean(),
4180
4226
  default: true,
4181
4227
  description: "Refuse loads above the high-water mark; off only samples and reports.",
4228
+ notes: "Set to `false` to disable the 503 behavior while keeping RSS monitoring — useful for a metrics-only rollout before enabling enforcement.",
4182
4229
  aliases: { env: ["PUBLISHER_MEMORY_BACKPRESSURE"] }
4183
4230
  }),
4184
4231
  setting({
@@ -4186,6 +4233,7 @@ var init_query = __esm(() => {
4186
4233
  type: integer({ min: 1 }),
4187
4234
  default: 1,
4188
4235
  description: "Package-load worker threads.",
4236
+ notes: "Worker processes for package compilation. Must be ≥ 1.",
4189
4237
  aliases: { env: ["PACKAGE_LOAD_WORKERS"] }
4190
4238
  }),
4191
4239
  setting({
@@ -4193,6 +4241,8 @@ var init_query = __esm(() => {
4193
4241
  type: integer({ min: 1 }),
4194
4242
  default: 120000,
4195
4243
  description: "Compile budget of one package load, in ms.",
4244
+ notes: "Bounds a package-load job's compile. A job may run to twice it before its worker is recycled, because the work it does for the main thread (render-tag results, pre-aggregation companions and the build plan) comes on top. The worker starts none of that work after three quarters of the timeout, and leaves what remains to the main thread.",
4245
+ defaultText: "`120000` (2 min)",
4196
4246
  aliases: { env: ["PACKAGE_LOAD_JOB_TIMEOUT_MS"] }
4197
4247
  }),
4198
4248
  setting({
@@ -4200,6 +4250,8 @@ var init_query = __esm(() => {
4200
4250
  type: integer({ min: 0 }),
4201
4251
  default: DEFAULT_PACKAGE_LOAD_SCHEMA_CACHE_BYTES,
4202
4252
  description: "Serialized schema each package-load worker caches across loads, in bytes; 0 turns it off.",
4253
+ notes: "Serialized size of the table and SQL schemas each package-load worker keeps across loads, so a model's repeated and later requests for the same table skip the round trip to the main thread. Least recently used entries go first. Scoped per environment and per connection instance, so editing a connection drops its entries; a request that asks to refresh a schema is fetched again, and the result replaces the entry. Heap use is a few times the serialized size. `0` disables it; empty takes the default, and a value that is not a byte count stops the server from starting.",
4254
+ defaultText: "`16777216` (16 MiB)",
4203
4255
  aliases: { env: ["PACKAGE_LOAD_SCHEMA_CACHE_BYTES"] }
4204
4256
  })
4205
4257
  ];
@@ -4223,12 +4275,15 @@ var init_retrieval = __esm(() => {
4223
4275
  type: string(),
4224
4276
  secret: true,
4225
4277
  description: "Key of the embedding provider; unset turns semantic search off, except for providers that need none.",
4278
+ notes: 'Turns on embedding closeness in `get_context`\'s search, and embedding ranking in `search_database_schema` (see below). Sent as a bearer token to the embedding endpoint. Unset: `get_context` ranks by keyword and stored values only. Must be set explicitly; an ambient `OPENAI_API_KEY` is deliberately not read. See "How get_context searches" below.',
4226
4279
  aliases: { env: ["EMBEDDING_API_KEY"] }
4227
4280
  }),
4228
4281
  setting({
4229
4282
  key: "retrieval.embedding.model",
4230
4283
  type: string(),
4231
4284
  description: "Embedding model; text-embedding-3-small for OpenAI.",
4285
+ notes: "Embedding model name sent to the endpoint. A `retrieval.embedding.model` in `publisher.config.json` wins over it.",
4286
+ defaultText: "`text-embedding-3-small` for OpenAI",
4232
4287
  aliases: {
4233
4288
  env: ["EMBEDDING_MODEL"],
4234
4289
  file: ["retrieval.embedding.model"],
@@ -4239,6 +4294,8 @@ var init_retrieval = __esm(() => {
4239
4294
  key: "retrieval.embedding.baseUrl",
4240
4295
  type: string(),
4241
4296
  description: "Base URL of the embedding API; default the provider's, else https://api.openai.com/v1.",
4297
+ notes: "Base URL of an OpenAI-compatible embeddings API (`POST <base>/embeddings`). Point at any compatible endpoint (e.g. a local Ollama or vLLM server). A `retrieval.embedding.baseUrl` in `publisher.config.json` wins over it.",
4298
+ defaultText: "the provider's, else `https://api.openai.com/v1`",
4242
4299
  aliases: {
4243
4300
  env: ["EMBEDDING_API_BASE"],
4244
4301
  file: ["retrieval.embedding.baseUrl"],
@@ -4249,6 +4306,7 @@ var init_retrieval = __esm(() => {
4249
4306
  key: "retrieval.embedding.dimensions",
4250
4307
  type: integer({ min: 1 }),
4251
4308
  description: "dimensions request parameter; unset takes the provider's vector length.",
4309
+ notes: "Optional `dimensions` request parameter (e.g. `512` to shrink `text-embedding-3-small` vectors). When unset the parameter is omitted, which suits providers that do not support it. A `retrieval.embedding.dimensions` in `publisher.config.json` wins over it.",
4252
4310
  aliases: {
4253
4311
  env: ["EMBEDDING_DIMENSIONS"],
4254
4312
  file: ["retrieval.embedding.dimensions"],
@@ -4259,7 +4317,8 @@ var init_retrieval = __esm(() => {
4259
4317
  key: "retrieval.embedding.minSimilarity",
4260
4318
  type: number({ min: 0, below: 1 }),
4261
4319
  default: DEFAULT_EMBEDDING_MIN_SIMILARITY,
4262
- description: "Cosine-similarity floor a semantic match must clear.",
4320
+ description: "Cosine-similarity floor a table must clear to be returned by search_database_schema.",
4321
+ notes: "Cosine-similarity floor a table must clear to be returned by `search_database_schema`. `get_context` has no floor. Tunable because cosine similarity is not calibrated across embedding models, so the right floor belongs to the endpoint you point at, not to Publisher. Must be in `[0, 1)`; `0` disables the floor, and an out-of-range or non-numeric value is a startup error rather than a silent clamp.",
4263
4322
  aliases: { env: ["EMBEDDING_MIN_SIMILARITY"] }
4264
4323
  }),
4265
4324
  setting({
@@ -4267,6 +4326,7 @@ var init_retrieval = __esm(() => {
4267
4326
  type: boolean(),
4268
4327
  default: false,
4269
4328
  description: "Let search_database_schema send a connection's table and column names to the embedding provider.",
4329
+ notes: "Allows `search_database_schema` to send a connection's schema name, table names, column names and column types, plus the agent's search text, to the embedding endpoint for semantic ranking. Never row values. A second switch on top of `EMBEDDING_API_KEY`, which alone covers only your own model text; unset, schema search still works and ranks lexically. Accepts `1`/`true`/`yes`/`on` and `0`/`false`/`no`/`off`. It is read when the tool is called, not at startup, so an unrecognised value does not stop the server: the tool logs a warning and ranks lexically for that call. See \"Semantic ranking for search_database_schema\" below.",
4270
4330
  aliases: { env: ["EMBEDDING_INDEX_CONNECTION_SCHEMA"] }
4271
4331
  }),
4272
4332
  setting({
@@ -4274,6 +4334,7 @@ var init_retrieval = __esm(() => {
4274
4334
  type: string(),
4275
4335
  secret: true,
4276
4336
  description: "Key of the retrieval LLM; unset turns every LLM feature off, except for providers that need none.",
4337
+ notes: 'API key for the chat model named by `retrieval.llm` in `publisher.config.json` (OpenAI, an OpenAI-compatible server, Anthropic or Google; not needed for `ollama` or `vertex`). Used for index-time keyphrases and source summaries. Unset with a keyed provider: every LLM feature is off and nothing errors. Never read from a file, never logged. See "Providers and the retrieval settings" below.',
4277
4338
  aliases: { env: ["LLM_API_KEY"] }
4278
4339
  })
4279
4340
  ];
@@ -4297,6 +4358,7 @@ var init_server = __esm(() => {
4297
4358
  type: boolean(),
4298
4359
  default: true,
4299
4360
  description: "Run the main API and MCP, and the environments they serve; off runs only the admin API.",
4361
+ notes: "The top-level `servingApiEnabled` setting ([below](#server-settings-top-level-of-publisherconfigjson)); overrides the config file.",
4300
4362
  aliases: {
4301
4363
  env: ["PUBLISHER_SERVING_API_ENABLED"],
4302
4364
  flags: ["--serving-api-enabled", "--no-serving-api-enabled"],
@@ -4309,6 +4371,7 @@ var init_server = __esm(() => {
4309
4371
  type: boolean(),
4310
4372
  default: true,
4311
4373
  description: "Allow the admin API; off refuses an admin setting.",
4374
+ notes: "The top-level `adminApiEnabled` setting ([below](#server-settings-top-level-of-publisherconfigjson)); overrides the config file.",
4312
4375
  aliases: {
4313
4376
  env: ["PUBLISHER_ADMIN_API_ENABLED"],
4314
4377
  flags: ["--admin-api-enabled", "--no-admin-api-enabled"],
@@ -4321,6 +4384,7 @@ var init_server = __esm(() => {
4321
4384
  type: integer({ min: 0, max: 65535 }),
4322
4385
  default: 4000,
4323
4386
  description: "Port of the REST API and the web app.",
4387
+ notes: "REST + static-app HTTP port.",
4324
4388
  aliases: {
4325
4389
  env: ["PUBLISHER_PORT"],
4326
4390
  flags: ["--port"]
@@ -4330,7 +4394,8 @@ var init_server = __esm(() => {
4330
4394
  key: "host",
4331
4395
  type: string(),
4332
4396
  default: "0.0.0.0",
4333
- description: "Host the REST API binds to, and MCP too unless mcp.host is given.",
4397
+ description: "Host the REST API binds to, and MCP too unless {mcp.host} is given.",
4398
+ notes: "Host binding for the REST server, and the fallback for the MCP server. Set `127.0.0.1` to keep both loopback-only.",
4334
4399
  aliases: { env: ["PUBLISHER_HOST"], flags: ["--host"] }
4335
4400
  }),
4336
4401
  setting({
@@ -4338,6 +4403,8 @@ var init_server = __esm(() => {
4338
4403
  type: integer({ min: 0 }),
4339
4404
  default: 0,
4340
4405
  description: "Requests per minute per client; 0 is unlimited.",
4406
+ notes: "Maximum requests per minute one client may make to the REST server; over it, requests get `429` with `RateLimit-*` headers until the minute rolls over. Unset or `0` means no limit; any other value must be a non-negative integer or startup fails. `/health*` and `/metrics` are never limited. Clients are told apart by the connection's peer address, so behind a reverse proxy every client shares one bucket: rate-limit at the proxy there, or leave this unset. The MCP port is not covered.",
4407
+ defaultText: "`0` (no limit)",
4341
4408
  aliases: { env: ["PUBLISHER_RATE_LIMIT"] }
4342
4409
  }),
4343
4410
  setting({
@@ -4345,6 +4412,7 @@ var init_server = __esm(() => {
4345
4412
  type: string(),
4346
4413
  default: "'self'",
4347
4414
  description: "The Content-Security-Policy frame-ancestors source list: who may embed the app.",
4415
+ notes: "`Content-Security-Policy: frame-ancestors` value sent on **every** document this server returns -- the Console and in-package `public/` files alike -- controlling which origins may embed a page in an iframe. Defaults to same-origin only; set it to the origins that embed you (`https://app.example.com`), or to `*` to restore the previous any-origin behaviour.",
4348
4416
  aliases: { env: ["PUBLISHER_FRAME_ANCESTORS"] }
4349
4417
  }),
4350
4418
  setting({
@@ -4352,6 +4420,7 @@ var init_server = __esm(() => {
4352
4420
  type: string(),
4353
4421
  default: DEFAULT_CALLER_HEADER,
4354
4422
  description: "Request header the access record copies as the caller: the identity the gateway in front of Publisher asserts.",
4423
+ notes: "The request header whose value the per-query access record copies as `caller`: the identity the gateway in front of Publisher asserts. Opaque to Publisher; see [access-record.md](access-record.md).",
4355
4424
  aliases: { env: ["PUBLISHER_CALLER_HEADER"] }
4356
4425
  }),
4357
4426
  setting({
@@ -4359,6 +4428,7 @@ var init_server = __esm(() => {
4359
4428
  type: oneOf(["off", "on"]),
4360
4429
  default: "off",
4361
4430
  description: "on publishes a package from a location as the version its publisher.json declares; off installs it in place. A transition setting #1381 removes.",
4431
+ notes: "`on` or `off`: whether a publish from a location publishes an immutable [package version](package-versions.md) numbered by its `publisher.json` `version` (a missing or non-semver `version` is then a 400), or installs the package in place as before versions. A transition setting: a future release removes it and requires a `version` ([#1381](https://github.com/malloydata/publisher/issues/1381)). Versions published while it was on keep serving when it is off. Any other value fails startup.",
4362
4432
  aliases: { env: ["PUBLISHER_PACKAGE_VERSIONING"] }
4363
4433
  }),
4364
4434
  setting({
@@ -4366,6 +4436,7 @@ var init_server = __esm(() => {
4366
4436
  type: oneOf(["on-publish", "explicit"]),
4367
4437
  default: "on-publish",
4368
4438
  description: "on-publish moves a package's latest to a newly published higher version; explicit leaves it to PUT …/latest.",
4439
+ notes: "`on-publish` or `explicit`: what publishing a package version does to its `latest`. `on-publish` moves `latest` to the new version unless a higher one already is; `explicit` never moves it, so only `PUT .../packages/{package}/latest` does, for an orchestrator that decides when a version is ready. Also settable as `versionPromotion` in `publisher.config.json`; the variable wins. Any other value fails startup. See [package-versions.md](package-versions.md).",
4369
4440
  aliases: {
4370
4441
  env: ["PUBLISHER_VERSION_PROMOTION"],
4371
4442
  file: ["versionPromotion"]
@@ -4376,6 +4447,7 @@ var init_server = __esm(() => {
4376
4447
  type: oneOf(["off", "on"]),
4377
4448
  default: "on",
4378
4449
  description: "on keeps the fields that moved off Package (buildPlan, agents, secureGivens, embeddingIndex, the manifest-binding and serving fields) inline in a package response, marked deprecated; off leaves each where it now lives. A transition setting a later release turns off, then removes.",
4450
+ notes: "`on` or `off`: whether a package response carries the deprecated fields `api-doc.yaml` marks on `Package`, and a `GET /status` entry the whole package response. Off, each is read only at its own route: the serving and manifest-binding fields (`status`, `loaded`, `archiveStatus`, `servedRevision`, `sourceContentSha`, `manifestBindingStatus`, `manifestEntryCount`, `boundManifestUri`, `storageServeBindings`) at `GET …/packages/{pkg}/status`, `buildPlan` at `…/build-plan`, `embeddingIndex` at `…/embedding-index`, `classification` at `…/classification`, `agents` at `…/agents`, and `secureGivens` as each model's `givens[].secure` at `…/entities`. `warnings` and `exploresWarnings` stay on the package either way. A transition flag: a later release turns it off by default and the one after removes it with the fields, so move readers to the new locations now. Any other value fails startup.",
4379
4451
  aliases: { env: ["PUBLISHER_PACKAGE_INLINE_FIELDS"] }
4380
4452
  }),
4381
4453
  setting({
@@ -4383,6 +4455,7 @@ var init_server = __esm(() => {
4383
4455
  type: oneOf(["explorer", "viewer"]),
4384
4456
  default: "explorer",
4385
4457
  description: "The page the Console shows for a model, reported on /status as modelPage: explorer, or viewer, which builds no query and takes the Explorer out of the legacy notebook too.",
4458
+ notes: "`explorer` or `viewer`: the page the Console shows for a model, reported on `/status` as `modelPage`. `explorer` is the [Explorer](explorer.md), which writes the queries it builds back to Malloy with string values unescaped (`escapeString` in `@malloydata/malloy-interfaces` is a TODO), so a drilled value holding a double quote rewrites its query; the server's restricted mode and `#(authorize)` still bound what that query can read. `viewer` shows the model viewer, which builds no query, and also takes the Explorer's \"Data sources\" dialog out of the legacy notebook; there a given's option list also quotes every name. The Console keeps both pages, and shows the viewer if `/status` cannot be read. Any other value fails startup.",
4386
4459
  aliases: { env: ["PUBLISHER_MODEL_PAGE"] }
4387
4460
  }),
4388
4461
  setting({
@@ -4412,18 +4485,21 @@ var init_storage = __esm(() => {
4412
4485
  type: oneOf(["on-demand", "local-only"]),
4413
4486
  default: "on-demand",
4414
4487
  description: "on-demand installs a missing DuckDB extension on first use; local-only never reaches the network.",
4488
+ notes: "Whether the server may fetch DuckDB extensions from the network at runtime. `on-demand`: a missing extension is installed on first use (unchanged prior behavior). `local-only`: never install, and disable DuckDB's implicit auto-install — a locally-present (e.g. image-baked) extension still loads, but a missing one fails with an actionable error naming the extension. Use `local-only` for air-gapped / pinned-image deployments. See [ducklake.md](ducklake.md#duckdb-extension-provisioning).",
4415
4489
  aliases: { env: ["EXTENSION_FETCH_POLICY"] }
4416
4490
  }),
4417
4491
  setting({
4418
4492
  key: "duckdb.memoryLimit",
4419
4493
  type: string(),
4420
4494
  description: "memory_limit of every DuckDB session, as a DuckDB size (1GB), or off; unset warns at boot.",
4495
+ notes: "DuckDB `memory_limit` applied to **every** DuckDB session and instance Publisher owns, as a flat value (`1GB`, `512MB`) passed to DuckDB verbatim. `off` or unset leaves DuckDB's own default, which is roughly 80% of the container's memory computed **per instance** — so N instances in one process commit N times that share, and the kernel kills the process while each of them still believes it is inside its budget. Measured in a 3 GiB container: three instances each reported a 2.3 GiB limit, 6.9 GiB of committed budget against 3 GiB of real memory. **Sizing:** the divisor is not a number of builds. Count 1 metadata store + 1 serve-shape gate session + 1 environment lookup funnel + one sandbox per loaded package × `PACKAGE_LOAD_WORKERS` (package loads run in `worker_threads`, so same address space and same cgroup) + one per in-flight materialization build, and nothing bounds concurrent builds. Budget roughly (container memory − resident baseline) ÷ that count. DuckDB does not reserve the limit up front, so an idle instance costs far less than its budget — the limit caps what it may reach, and it is the sum of the caps that has to fit. Too low fails a query with a DuckDB out-of-memory error and leaves the process up, which is the intended trade against losing the pod and every package on it. Validated at startup.",
4421
4496
  aliases: { env: ["PUBLISHER_DUCKDB_MEMORY_LIMIT"] }
4422
4497
  }),
4423
4498
  setting({
4424
4499
  key: "duckdb.tempDirectory",
4425
4500
  type: string(),
4426
4501
  description: "Directory DuckDB spills to.",
4502
+ notes: "Where DuckDB spills. A materialization build overrides this with its own disposable working directory (unique per build, removed with the build); every other session and instance uses this. Unset leaves DuckDB's default of `.tmp` relative to the process working directory, whose default `max_temp_directory_size` is 90% of whatever filesystem that lands on — on a container with no ephemeral-storage limit, the node's shared disk. Created at startup if missing, since `SET temp_directory` accepts a path that does not exist and only fails at the first spill. Unlike the memory limit there is no `off` sentinel, because a directory named `off` is a legal path. Note that setting `PUBLISHER_DUCKDB_MEMORY_LIMIT` creates spill on the `storage=` build path in one case: a `partition=` build sorts the whole passthrough result by its partition columns in DuckDB before writing it (see `PUBLISHER_PARTITIONED_WRITE_FLUSH_THRESHOLD`), and that sort runs out of core against the build's own working directory, so the entire result can land on local disk. Every other `storage=` build pushes its SQL to the source warehouse and streams the result into the destination with nothing to spill. Local compute, and so spill, is otherwise the chained-build and serve paths.",
4427
4503
  aliases: { env: ["PUBLISHER_DUCKDB_TEMP_DIRECTORY"] }
4428
4504
  }),
4429
4505
  setting({
@@ -4431,18 +4507,21 @@ var init_storage = __esm(() => {
4431
4507
  type: string(),
4432
4508
  default: "8192",
4433
4509
  description: "Rows a partitioned storage build buffers before flushing, or off.",
4510
+ notes: "Rows the appender buffers before a `#@ persist partition=` build flushes them to the partition files, set on the build session as DuckDB's `partitioned_write_flush_threshold`. `off` turns the whole treatment off — this threshold, the ordered insert and the single appender thread together — and leaves DuckDB's own behaviour (a 524,288-row threshold, an unordered parallel insert); it is the escape hatch for a source that built fine before, at the cost of the sort. A partitioned build is DuckDB's partitioned COPY, and that operator buffers rows per partition in a column-data collection **inside** the buffer manager — so unlike the two DuckLake bounds above, `PUBLISHER_DUCKDB_MEMORY_LIMIT` does see this term, and the failure reads `Out of Memory Error: failed to pin block` against the session's limit rather than a container kill. Two things drive it: every partition the appender meets costs it one vector per column up front, before a row of it is flushed, and nothing is flushed until it has appended this many rows across all its partitions. On a passthrough-sourced build (Postgres, BigQuery, Snowflake; a chained build is untouched) the publisher bounds the first by ordering the insert's SELECT by the partition columns at the top of the INSERT statement — the SELECT the build was handed is unchanged, so what the warehouse runs, its query tag or label, and how the source is addressed are untouched — and by running that insert on one thread, since a DuckDB-side sort is read in parallel and several appenders each meet every partition again; this variable bounds the second. Sorted by DuckDB rather than by the warehouse because a multi-stream read (BigQuery) re-interleaves a sorted result on the way in. Measured at a `768MB` limit on 122 columns, 616k rows, 308 partitions: from Postgres, interleaved rows fail in under 3 s at any threshold, ordered rows fail at DuckDB's default after ~0.5M rows, ordered rows on one thread complete at `8192` in 9.5 s (4 threads fail at 7 s); from BigQuery, interleaved fails at 54 s and ordered on one thread completes in 36 s (4 threads fail at 39 s). Snowflake is not measured; the write side is the same. The treatment has a running cost: the sort reads the whole result before the first partition file is written, spills it to the build's working directory when it exceeds the memory limit, and writes on one thread — so a wide, many-partition build trades memory for local disk and wall-clock, and no production-scale build has been measured yet. The disk is the one to watch: the working directory is created under the process temp directory, which in a container with no volume there is the node's overlay filesystem, and a spill of tens of GB there is an ephemeral-storage eviction — a killed pod, not a publisher error. Give the worker a volume for its temp directory, or an ephemeral-storage limit that makes the failure a caught one, before relying on this at that scale. The single thread costs little on a single-stream read (`postgres_query`, `snowflake_query`, `bigquery_query`) and real scan parallelism on the labelled BigQuery split, whose result table is read multi-stream. An incremental delta into a laid-out table runs on the same session and gets the threshold and the single thread; its read is not ordered. Smaller is not free: a flush touches every partition the appender holds, so a very high-cardinality layout (thousands of partitions) does more file work at a low value — that is the many-small-files layout `docs/materialization.md` already warns off. Validated at startup.",
4434
4511
  aliases: { env: ["PUBLISHER_PARTITIONED_WRITE_FLUSH_THRESHOLD"] }
4435
4512
  }),
4436
4513
  setting({
4437
4514
  key: "ducklake.rowGroupSizeBytes",
4438
4515
  type: string(),
4439
4516
  description: "Bytes DuckLake buffers per column before flushing a Parquet row group (16MB).",
4517
+ notes: "Bytes DuckLake buffers per Parquet row group before flushing, applied as a **catalog** option on each writable lake at attach. Unset issues nothing and leaves DuckLake's default of 122,880 ROWS. A DuckLake write buffers a whole row group per COLUMN, so its memory is driven by the table's width rather than its row count, and `PUBLISHER_DUCKDB_MEMORY_LIMIT` does not bound it — those buffers sit outside the buffer manager, so a low limit and a large row group OOM together. Measured on a 72-column, 5M-row write, sampling cgroup `memory.stat` anon: 2772 MiB at the default, 1530 MiB at `64MB`, 1006 MiB at `16MB`. Bytes rather than a row count because one row count cannot suit a 9-column and a 110-column table at once; the byte form derives rows-per-group from the data actually buffered, so it tracks width with nobody estimating it. Smaller is not free: more row groups cost Parquet metadata and read-side pruning quality, and the read cost has not been measured here. Requires `preserve_insertion_order=false`, which Publisher sets on the attaching session — DuckLake plans its copy parallel unconditionally and does not honour insertion order regardless (measured: 15 adjacent inversions per 1.5M rows with it on, 10 with it off), so the guarantee being waived is not one that was being provided. Written to `ducklake_metadata`, so it outlives the connection and is seen by every writer of that lake; skipped on a read-only attach. A catalog that refuses the option is logged and attaches anyway. Validated at startup.",
4440
4518
  aliases: { env: ["PUBLISHER_DUCKLAKE_ROW_GROUP_SIZE_BYTES"] }
4441
4519
  }),
4442
4520
  setting({
4443
4521
  key: "ducklake.targetFileSizeBytes",
4444
4522
  type: string(),
4445
4523
  description: "Size a DuckLake Parquet file grows to before rotating (256MB).",
4524
+ notes: "Bytes DuckLake writes into one Parquet file before rotating to the next, applied as a **catalog** option on each writable lake at attach. Unset issues nothing and leaves DuckLake's own default of roughly 512MB. A separate term from `PUBLISHER_DUCKLAKE_ROW_GROUP_SIZE_BYTES`, not a replacement: that bounds the per-column buffer _within_ a file, this bounds how much of the file stays resident. Writing to object storage, DuckDB copies each multipart part into a buffer it allocates itself and holds it until the file completes, so a file's bytes are resident however they are grouped inside it — and `PUBLISHER_DUCKDB_MEMORY_LIMIT` bounds neither, since both sit outside the buffer manager. The same write to a local path streams and shows none of this, so the cost is invisible to testing that does not target a cloud destination. Measured on a 72-column, 20M-row DuckLake write to GCS, all cells in one batch: 650 MiB at DuckLake's default, 550 MiB at `512MB`, 373 MiB at `256MB`, 262 MiB at `128MB`, 255 MiB at `64MB`. **Pick the largest value that clears your memory ceiling, not the smallest** — memory is the only axis where smaller wins and it stops improving below ~`128MB`, while write throughput, full-scan time and catalog size all get worse (a full scan measured 13.0s at `512MB` against 21.6s at `64MB`; the catalog holds one row per file per column, in a database every writer of that lake shares). Where sources carry a required equality filter, scan time is the least binding of the three: a selective lookup ran in 17–63 ms at every size tested. Unlike the row-group bound it does **not** require `preserve_insertion_order=false`, and the order the two are applied in does not matter. Written to `ducklake_metadata`, so it outlives the connection and is seen by every writer of that lake; skipped on a read-only attach. **Unsetting this variable does not revert it** — the last value written stays in the catalog; to change it back, run `CALL <lake>.set_option('target_file_size', '<value>')` against the catalog. A catalog that refuses the option is logged and attaches anyway. Validated at startup.",
4446
4525
  aliases: { env: ["PUBLISHER_DUCKLAKE_TARGET_FILE_SIZE_BYTES"] }
4447
4526
  }),
4448
4527
  setting({
@@ -4450,6 +4529,7 @@ var init_storage = __esm(() => {
4450
4529
  type: oneOf(["off", "write-only", "on"]),
4451
4530
  default: "off",
4452
4531
  description: "How #@ persist storage= is honored: off, write-only (build only) or on (build and serve).",
4532
+ notes: "Controls the `#@ persist storage=<name>` materialization tier (materialize a source into a registered [storage destination](connections.md#storage-destinations) and serve it from there — a destination is declared alongside `connections`, not in it, and is not nameable from a model). `off`: the `storage=` annotation is inert — sources build and serve from their own warehouse exactly as without it. `write-only`: materialize into the storage destination but still serve live (the measurement rung). `on`: build **and** serve from the storage table via the virtual-source transform. Read at startup. A kill switch: moving it **down** never fails a loaded package — a `storage=` source just reverts to serving live and surfaces as a package warning. See [persist-storage-tutorial.md](persist-storage-tutorial.md).",
4453
4533
  aliases: { env: ["PERSIST_STORAGE_MODE"] }
4454
4534
  }),
4455
4535
  setting({
@@ -4457,6 +4537,7 @@ var init_storage = __esm(() => {
4457
4537
  type: boolean(),
4458
4538
  default: false,
4459
4539
  description: "Refuse a publish where two persist sources resolve to the same table.",
4540
+ notes: "Set to `true` to refuse a publish in which two persist sources of one package resolve to the same table in the same destination. Off, a collision is a warning; loading a package only ever warns.",
4460
4541
  aliases: { env: ["PERSIST_COLLISION_ENFORCE"] }
4461
4542
  }),
4462
4543
  setting({
@@ -4464,6 +4545,7 @@ var init_storage = __esm(() => {
4464
4545
  type: boolean(),
4465
4546
  default: false,
4466
4547
  description: "Fire packages' materialization schedules from this process; never on an orchestrated worker.",
4548
+ notes: "Opt-in: enable the standalone materialization scheduler, which fires each loaded package's `materialization.schedule` cron, and each published package version's (see [package-versions.md](package-versions.md#materializations)), so a self-hosted Publisher rebuilds on a cadence with no control plane. **Never set this on a control-plane-driven (orchestrated) worker** — it is the primary guard against double-driving refresh. See [materialization.md](materialization.md).",
4467
4549
  aliases: { env: ["PUBLISHER_LOCAL_MATERIALIZATION_SCHEDULER"] }
4468
4550
  }),
4469
4551
  setting({
@@ -4471,6 +4553,8 @@ var init_storage = __esm(() => {
4471
4553
  type: integer({ min: 1000 }),
4472
4554
  default: 60000,
4473
4555
  description: "How often the scheduler looks for due schedules, in ms.",
4556
+ notes: "How often the scheduler sweeps for due schedules, in ms. Minimum `1000`. Only read when the scheduler is enabled.",
4557
+ defaultText: "`60000` (1 min)",
4474
4558
  aliases: { env: ["PUBLISHER_MATERIALIZATION_SCHEDULER_INTERVAL_MS"] }
4475
4559
  }),
4476
4560
  setting({
@@ -4478,6 +4562,7 @@ var init_storage = __esm(() => {
4478
4562
  type: integer({ min: 1 }),
4479
4563
  default: 10,
4480
4564
  description: "Packages the scheduler fires per look.",
4565
+ notes: "Stampede guard: max packages fired per sweep. A capped package fires on a later tick. Must be a positive integer.",
4481
4566
  aliases: {
4482
4567
  env: ["PUBLISHER_MATERIALIZATION_SCHEDULER_MAX_FIRES_PER_TICK"]
4483
4568
  }
@@ -14328,6 +14413,11 @@ function assertNoAuthorizeTagLike(callerText) {
14328
14413
  lastRefusalKind = "whole_text";
14329
14414
  refuseCallerAuthorizeAnnotation();
14330
14415
  }
14416
+ function assertNoCallerClassificationAnnotation(callerText) {
14417
+ if (!CLASSIFICATION_TAG_LIKE.test(callerText))
14418
+ return;
14419
+ throw new BadRequestError("A `classification` or `carries` annotation is not permitted in " + "caller-submitted Malloy text. Classes are declared by the model " + "author on the field or source; a query is checked against them.");
14420
+ }
14331
14421
  function refuseCallerAuthorizeAnnotation() {
14332
14422
  throw new BadRequestError("An `authorize` annotation is not permitted in caller-submitted Malloy " + "text. Access gates are declared by the model author on the source; a " + "request cannot introduce, replace, or relax one. To validate a gate " + "you are authoring, save it to the package's model file and reload the " + "package — model load validates every `#(authorize)` annotation it " + "declares.");
14333
14423
  }
@@ -14526,7 +14616,7 @@ ${rewrites}
14526
14616
  ` + `Test that the rewrite gates the same rows and check the row count ` + `matches what the string form served.`
14527
14617
  });
14528
14618
  }
14529
- var AUTHORIZE_TAG_LIKE, AUTHORIZE_ANNOTATION_ANYWHERE, REGEXP_SPECIAL, PROSE_ROUTES, makeMalloyParser, parserLoader, warnedNoParser = false, lastLexed, lastRefusalKind = "lexed", lexerMissing = false, GIVEN_REF_PATTERN, SINGLE_QUOTE_ESCAPE, DOUBLE_QUOTE_ESCAPE, STRING_LITERAL_PATTERN, everyMemberOf = () => (...members) => members, ROW_LEVEL_GATE_REJECTION_CAUSES, WHOLE_BODY_QUOTED_STRING, WHOLE_BODY_SINGLE_QUOTED_STRING;
14619
+ var AUTHORIZE_TAG_LIKE, AUTHORIZE_ANNOTATION_ANYWHERE, REGEXP_SPECIAL, PROSE_ROUTES, makeMalloyParser, parserLoader, warnedNoParser = false, lastLexed, lastRefusalKind = "lexed", lexerMissing = false, CLASSIFICATION_TAG_LIKE, GIVEN_REF_PATTERN, SINGLE_QUOTE_ESCAPE, DOUBLE_QUOTE_ESCAPE, STRING_LITERAL_PATTERN, everyMemberOf = () => (...members) => members, ROW_LEVEL_GATE_REJECTION_CAUSES, WHOLE_BODY_QUOTED_STRING, WHOLE_BODY_SINGLE_QUOTED_STRING;
14530
14620
  var init_authorize = __esm(() => {
14531
14621
  init_errors2();
14532
14622
  init_authorize_routes();
@@ -14539,6 +14629,7 @@ var init_authorize = __esm(() => {
14539
14629
  text: "",
14540
14630
  prose: []
14541
14631
  };
14632
+ CLASSIFICATION_TAG_LIKE = new RegExp(String.raw`##?\|?[ \t]*(?:[([{<][ \t]*)?(?:classification|carries)(?=[)\]}>]|[ \t]|$)`, "iu");
14542
14633
  GIVEN_REF_PATTERN = /\$([A-Za-z_][A-Za-z0-9_]*)/g;
14543
14634
  SINGLE_QUOTE_ESCAPE = /\\(['\\])/g;
14544
14635
  DOUBLE_QUOTE_ESCAPE = /\\(["\\])/g;
@@ -14731,6 +14822,7 @@ var init_translator_error = __esm(() => {
14731
14822
 
14732
14823
  // src/service/authorize_grammar.ts
14733
14824
  import { routeOf as routeOf3 } from "@malloydata/malloy";
14825
+ import { ParseUtil } from "@malloydata/malloy-tag";
14734
14826
  function noteRoute2(text) {
14735
14827
  return routeOf3({ value: text.trimStart() });
14736
14828
  }
@@ -14894,7 +14986,12 @@ function parseTerm(sourceName, body, term, givenDeclaredTypes) {
14894
14986
  }
14895
14987
  }
14896
14988
  if (leftIsLiteral) {
14897
- return { scope: "source_level", literal: left, given };
14989
+ return {
14990
+ scope: "source_level",
14991
+ literal: ParseUtil.parseString(left, left[0]),
14992
+ given,
14993
+ operator
14994
+ };
14898
14995
  }
14899
14996
  return {
14900
14997
  scope: "row_level",
@@ -15153,10 +15250,13 @@ function resolveDeclaredSource(struct, modelDef) {
15153
15250
  }
15154
15251
  return sawBrokenEntry ? { kind: "unresolvable" } : { kind: "none" };
15155
15252
  }
15253
+ function gateAtLevel(annotations, route) {
15254
+ return collectAuthorizeExprsForRoute(ownLevelNotes(annotations).map((note) => note.text), route);
15255
+ }
15156
15256
  function ancestorGateExprs(struct, modelDef, route, seen = new Set) {
15157
15257
  let inherited = struct.annotations?.inherits;
15158
15258
  for (let depth = 0;inherited && depth < ANCESTOR_WALK_MAX_DEPTH; depth++) {
15159
- const exprs2 = collectAuthorizeExprsForRoute(ownLevelNoteTexts(inherited), route);
15259
+ const exprs2 = gateAtLevel(inherited, route);
15160
15260
  if (exprs2.length > 0)
15161
15261
  return exprs2;
15162
15262
  inherited = inherited.inherits;
@@ -15173,7 +15273,7 @@ function ancestorGateExprs(struct, modelDef, route, seen = new Set) {
15173
15273
  }
15174
15274
  if (declared.kind === "none" || seen.has(declared.source))
15175
15275
  return [];
15176
- const exprs = collectAuthorizeExprsForRoute(ownLevelNoteTexts(declared.source.annotations), route);
15276
+ const exprs = gateAtLevel(declared.source.annotations, route);
15177
15277
  return exprs.length > 0 ? exprs : ancestorGateExprs(declared.source, modelDef, route, seen);
15178
15278
  }
15179
15279
  function resolveQuerySourceBase(struct, modelDef) {
@@ -15203,18 +15303,25 @@ function effectiveAncestorGateExprs(struct, modelDef, route, seen = new Set) {
15203
15303
  groups.push(["false"]);
15204
15304
  }
15205
15305
  } else if (!seen.has(base)) {
15206
- const ownExprs = collectAuthorizeExprsForRoute(ownLevelNoteTexts(base.annotations), route);
15306
+ const ownExprs = gateAtLevel(base.annotations, route);
15207
15307
  groups.push(...ownExprs.length > 0 ? [ownExprs] : effectiveAncestorGateExprs(base, modelDef, route, seen));
15208
15308
  }
15209
15309
  const composite = resolveCompositeResolvedBase(struct);
15210
15310
  if (composite && !seen.has(composite)) {
15211
15311
  const parentOwnNotes = base ? ownLevelNotes(base.annotations) : [];
15212
15312
  const compositeOwnNotes = ownLevelNotes(composite.annotations).filter((note) => !parentOwnNotes.includes(note));
15213
- const compositeOwn = collectAuthorizeExprsForRoute(compositeOwnNotes.map((note) => note.text), route);
15313
+ const compositeOwn = gateAtLevel({ notes: compositeOwnNotes }, route);
15214
15314
  groups.push(...compositeOwn.length > 0 ? [compositeOwn] : effectiveAncestorGateExprs(composite, modelDef, route, seen));
15215
15315
  }
15216
15316
  return groups;
15217
15317
  }
15318
+ function gateExprsForRoute(struct, modelDef, route) {
15319
+ const own = gateAtLevel(struct.annotations, route);
15320
+ if (own.length === 0) {
15321
+ return effectiveAncestorGateExprs(struct, modelDef, route, new Set);
15322
+ }
15323
+ return struct.type === "query_source" ? [own, ...effectiveAncestorGateExprs(struct, modelDef, route, new Set)] : [own];
15324
+ }
15218
15325
  function derivedStructsReachable(roots, modelDef) {
15219
15326
  const seen = new Set(roots);
15220
15327
  const found = [];
@@ -15512,8 +15619,11 @@ function assertAuthorizeGrammarValid(modelDef, authorizeMap, authorizeOwnNotes,
15512
15619
  const struct = modelDef.contents[sourceName];
15513
15620
  const ownGroupTerms = [];
15514
15621
  const declaredAdmitAllRoutes = [];
15622
+ const ownRoutesSeen = new Set;
15515
15623
  for (const { route, exprs } of groups) {
15516
- const isOwn = (authorizeOwnNotes.get(sourceName)?.get(route)?.length ?? 0) > 0;
15624
+ const isOwn = (authorizeOwnNotes.get(sourceName)?.get(route)?.length ?? 0) > 0 && !ownRoutesSeen.has(route);
15625
+ if (isOwn)
15626
+ ownRoutesSeen.add(route);
15517
15627
  const filteredExprs = exprs.filter((expr) => (isOwn || expr !== "false") && !isLegacyQuotedPayload(expr));
15518
15628
  const groupTerms = [];
15519
15629
  for (const expr of filteredExprs) {
@@ -16599,7 +16709,6 @@ function extractSourcesFromModelDef(modelDef, givens, onParseError) {
16599
16709
  onParseError?.(sourceName, err);
16600
16710
  }
16601
16711
  }
16602
- const ownNotes = ownLevelNoteTexts(struct.annotations);
16603
16712
  const ownAuthorizeNotes = ownLevelNotes(struct.annotations).filter((note) => containsAuthorizeAnnotationTag([note.text]));
16604
16713
  const ownNotesByRoute = new Map;
16605
16714
  const attributedOwnNotesByRoute = new Map;
@@ -16613,8 +16722,7 @@ function extractSourcesFromModelDef(modelDef, givens, onParseError) {
16613
16722
  const groupsForSource = [];
16614
16723
  const routeGroupsByRoute = new Map;
16615
16724
  for (const route of CANONICAL_AUTHORIZE_ROUTES) {
16616
- const ownExprsForRoute = collectAuthorizeExprsForRoute(ownNotes, route);
16617
- const groupsForRoute = ownExprsForRoute.length > 0 ? [ownExprsForRoute] : effectiveAncestorGateExprs(struct, modelDef, route);
16725
+ const groupsForRoute = gateExprsForRoute(struct, modelDef, route);
16618
16726
  for (const exprs of groupsForRoute) {
16619
16727
  groupsForSource.push({ route, exprs });
16620
16728
  }